PurchaseReportMapper.xml 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3. <mapper namespace="com.usoftchina.saas.purchase.mapper.PurchaseReportMapper" >
  4. <resultMap id="BaseResultMap" type="com.usoftchina.saas.purchase.po.report.PurchasePay" >
  5. <result column="pb_id" property="pb_id" jdbcType="INTEGER" />
  6. <result column="pb_code" property="pb_code" jdbcType="VARCHAR" />
  7. <result column="pu_vendcode" property="pu_vendcode" jdbcType="VARCHAR" />
  8. <result column="pu_vendname" property="pu_vendname" jdbcType="VARCHAR" />
  9. <result column="pbd_slcode" property="pbd_slcode" jdbcType="VARCHAR" />
  10. <result column="pbd_slkind" property="pbd_slkind" jdbcType="VARCHAR" />
  11. <result column="pbd_amount" property="pbd_amount" jdbcType="DOUBLE" />
  12. <result column="pbd_nowbalance" property="pbd_nowbalance" jdbcType="DOUBLE" />
  13. <result column="pb_pbdamount" property="pb_pbdamount" jdbcType="DOUBLE" />
  14. <result column="pb_payrate" property="pb_payrate" jdbcType="DOUBLE" />
  15. <result column="pd_remark" property="pd_remark" jdbcType="VARCHAR" />
  16. <result column="companyid" property="companyId" jdbcType="BIGINT" />
  17. <result column="creatorid" property="creatorId" jdbcType="INTEGER"/>
  18. <result column="createTime" property="createTime" jdbcType="TIMESTAMP" />
  19. <result column="creatorName" property="creatorName" jdbcType="VARCHAR" />
  20. </resultMap>
  21. <resultMap id="ListMap" type="com.usoftchina.saas.purchase.po.report.PurchaseReportDetail">
  22. <id column="pu_id" property="pu_id" jdbcType="INTEGER" />
  23. <result column="pu_code" property="pu_code" jdbcType="VARCHAR" />
  24. <result column="pu_date" property="pu_date" jdbcType="TIMESTAMP" />
  25. <result column="pu_vendid" property="pu_vendid" jdbcType="INTEGER" />
  26. <result column="PU_VENDCODE" property="pu_vendcode" jdbcType="VARCHAR" />
  27. <result column="PU_VENDNAME" property="pu_vendname" jdbcType="VARCHAR" />
  28. <result column="PU_BUYERID" property="pu_buyerid" jdbcType="INTEGER" />
  29. <result column="PU_BUYERCODE" property="pu_buyercode" jdbcType="VARCHAR" />
  30. <result column="PU_BUYERNAME" property="pu_buyername" jdbcType="VARCHAR" />
  31. <result column="PU_DELIVERY" property="pu_delivery" jdbcType="TIMESTAMP" />
  32. <result column="PU_TAXTOTAL" property="pu_taxtotal" jdbcType="DOUBLE" />
  33. <result column="PU_TOTAL" property="pu_total" jdbcType="DOUBLE" />
  34. <result column="PU_REMARK" property="pu_remark" jdbcType="VARCHAR" />
  35. <result column="PU_TOTALUPPER" property="pu_totalupper" jdbcType="VARCHAR" />
  36. <result column="PU_INDATE" property="createTime" jdbcType="TIMESTAMP" />
  37. <result column="PU_PRINTSTATUS" property="pu_printstatus" jdbcType="VARCHAR" />
  38. <result column="PU_PRINTSTATUSCODE" property="pu_printstatuscode" jdbcType="VARCHAR" />
  39. <result column="PU_ACCEPTSTATUSCODE" property="pu_acceptstatuscode" jdbcType="VARCHAR" />
  40. <result column="PU_ACCEPTSTATUS" property="pu_acceptstatus" jdbcType="VARCHAR" />
  41. <result column="PU_STATUSCODE" property="pu_statuscode" jdbcType="VARCHAR" />
  42. <result column="PU_STATUS" property="pu_status" jdbcType="VARCHAR" />
  43. <result column="companyid" property="companyId" jdbcType="BIGINT" />
  44. <result column="pu_text1" property="pu_text1" jdbcType="VARCHAR" />
  45. <result column="pu_text2" property="pu_text2" jdbcType="VARCHAR" />
  46. <result column="pu_text3" property="pu_text3" jdbcType="VARCHAR" />
  47. <result column="pu_text4" property="pu_text4" jdbcType="VARCHAR" />
  48. <result column="pu_text5" property="pu_text5" jdbcType="VARCHAR" />
  49. <result column="PD_ID" property="pd_id" jdbcType="INTEGER" />
  50. <result column="PD_PUID" property="pd_puid" jdbcType="INTEGER" />
  51. <result column="PD_CODE" property="pd_code" jdbcType="VARCHAR" />
  52. <result column="PD_DETNO" property="pd_detno" jdbcType="INTEGER" />
  53. <result column="PD_PRODID" property="pd_prodid" jdbcType="INTEGER" />
  54. <result column="PD_PRODCODE" property="pd_prodcode" jdbcType="VARCHAR" />
  55. <result column="PD_UNIT" property="pd_unit" jdbcType="VARCHAR" />
  56. <result column="PD_QTY" property="pd_qty" jdbcType="DOUBLE" />
  57. <result column="PD_PRICE" property="pd_price" jdbcType="DOUBLE" />
  58. <result column="PD_TAXPRICE" property="pd_taxprice" jdbcType="DOUBLE" />
  59. <result column="PD_TOTAL" property="pd_total" jdbcType="DOUBLE" />
  60. <result column="PD_TAXTOTAL" property="pd_taxtotal" jdbcType="DOUBLE" />
  61. <result column="PD_ACCEPTQTY" property="pd_acceptqty" jdbcType="DOUBLE" />
  62. <result column="PD_DELIVERY" property="pd_delivery" jdbcType="TIMESTAMP" />
  63. <result column="PD_SALECODE" property="pd_salecode" jdbcType="VARCHAR" />
  64. <result column="PD_SALEDETNO" property="pd_saledetno" jdbcType="INTEGER" />
  65. <result column="PD_SDID" property="pd_sdid" jdbcType="INTEGER" />
  66. <result column="pd_text1" property="pd_text1" jdbcType="VARCHAR" />
  67. <result column="pd_text2" property="pd_text2" jdbcType="VARCHAR" />
  68. <result column="pd_text3" property="pd_text3" jdbcType="VARCHAR" />
  69. <result column="pd_text4" property="pd_text4" jdbcType="VARCHAR" />
  70. <result column="pd_text5" property="pd_text5" jdbcType="VARCHAR" />
  71. <result column="pd_yqty" property="pd_yqty" jdbcType="DOUBLE" />
  72. <result column="pd_remark" property="pd_remark" jdbcType="VARCHAR" />
  73. <result column="pr_id" property="pr_id"/>
  74. <result column="pr_code" property="pr_code"/>
  75. <result column="pr_detail" property="pr_detail"/>
  76. <result column="pr_spec" property="pr_spec"/>
  77. <result column="pr_unit" property="pr_unit"/>
  78. <result column="pr_kind" property="pr_kind"/>
  79. <result column="pr_orispeccode" property="pr_orispeccode"/>
  80. <result column="pr_whid" property="pr_whid"/>
  81. <result column="pr_whcode" property="pr_whcode"/>
  82. <result column="pr_whname" property="pr_whname"/>
  83. <result column="pr_zxbzs" property="pr_zxbzs"/>
  84. <result column="pr_leadtime" property="pr_leadtime"/>
  85. <result column="pr_brand" property="pr_brand"/>
  86. <result column="pr_standardprice" property="pr_standardprice"/>
  87. <result column="pr_purcprice" property="pr_purcprice"/>
  88. <result column="pr_saleprice" property="pr_saleprice"/>
  89. <result column="pr_vendid" property="pr_vendid"/>
  90. <result column="pr_vendname" property="pr_vendname"/>
  91. <result column="pr_vendcode" property="pr_vendcode"/>
  92. <result column="pr_status" property="pr_status"/>
  93. <result column="pr_statuscode" property="pr_statuscode"/>
  94. <result column="pr_text1" property="pr_text1"/>
  95. <result column="pr_text2" property="pr_text2"/>
  96. <result column="pr_text3" property="pr_text3"/>
  97. <result column="pr_text4" property="pr_text4"/>
  98. <result column="pd_accepttotal" property="pd_accepttotal"/>
  99. </resultMap>
  100. <select id="selectPurchasePayByCondition" resultMap="BaseResultMap">
  101. select * from purchasepay_view
  102. <where>
  103. <if test="con != null">
  104. ${con}
  105. </if>
  106. <if test="companyId != null">
  107. and companyId = #{companyId}
  108. </if>
  109. </where>
  110. order by pb_id desc
  111. </select>
  112. <select id="selectDetailByCondition" resultMap="ListMap">
  113. select *,ifnull(purchasedetail.PD_ACCEPTQTY,0)*ifnull(purchasedetail.PD_PRICE,0) pd_accepttotal from purchase left join purchasedetail on pu_id=pd_puid
  114. left join product on pd_prodid=pr_id
  115. <where>
  116. <if test="con != null">
  117. ${con}
  118. </if>
  119. <if test="companyId != null">
  120. and purchase.companyId = #{companyId}
  121. </if>
  122. and pu_statuscode='AUDITED'
  123. </where> order by pu_date desc
  124. </select>
  125. <select id="selectPurchasePayCalculateFields" resultType="string">
  126. select ${fields} from purchasepay_view
  127. <where>
  128. <if test="con != null">
  129. ${con}
  130. </if>
  131. <if test="companyId != null">
  132. and companyId = #{companyId}
  133. </if>
  134. </where>
  135. order by pb_id desc
  136. </select>
  137. <select id="selectDetailCalculateFields" resultType="string">
  138. select ${fields} from purchase left join purchasedetail on pu_id=pd_puid
  139. left join product on pd_prodid=pr_id
  140. <where>
  141. <if test="con != null">
  142. ${con}
  143. </if>
  144. <if test="companyId != null">
  145. and purchase.companyId = #{companyId}
  146. </if>
  147. </where> order by pu_date desc
  148. </select>
  149. </mapper>