SaleOtherCollectionMapper.xml 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.zkqy.business.mapper.SaleOtherCollectionMapper">
  6. <resultMap type="com.zkqy.business.domain.SaleOtherCollection" id="SaleOtherCollectionResult">
  7. <result property="id" column="id" />
  8. <result property="serialNumber" column="serial_number" />
  9. <result property="otherCollectionDate" column="other_collection_date" />
  10. <result property="customerId" column="customer_id" />
  11. <result property="personInChargeId" column="person_in_charge_id" />
  12. <result property="paymentMethod" column="payment_method" />
  13. <result property="travelCertificateNumber" column="travel_certificate_number" />
  14. <result property="deptId" column="dept_id" />
  15. <result property="collectionDetails" column="collection_details" />
  16. <result property="itemReceivable" column="item_receivable" />
  17. <result property="settlementUnitId" column="settlement_unit_id"/>
  18. <result property="amount" column="amount" />
  19. <result property="auditor" column="auditor"/>
  20. <result property="bookkeepingFlag" column="bookkeeping_flag" />
  21. <result property="status" column="status" />
  22. <result property="remark" column="remark" />
  23. <result property="createBy" column="create_by" />
  24. <result property="createById" column="create_by_id" />
  25. <result property="createTime" column="create_time" />
  26. <result property="updateBy" column="update_by" />
  27. <result property="updateById" column="update_by_id" />
  28. <result property="updateTime" column="update_time" />
  29. <result property="delFlag" column="del_flag" />
  30. <result property="settlementUnitName" column="customer_name"/>
  31. </resultMap>
  32. <sql id="selectSaleOtherCollectionVo">
  33. select id, serial_number, other_collection_date, customer_id, person_in_charge_id, payment_method, travel_certificate_number, dept_id, collection_details, item_receivable,settlement_unit_id, amount,auditor, bookkeeping_flag, status, remark, create_by, create_by_id, create_time, update_by, update_by_id, update_time, del_flag from {DBNAME}.sale_other_collection
  34. </sql>
  35. <select id="selectSaleOtherCollectionList" parameterType="com.zkqy.business.domain.SaleOtherCollection" resultMap="SaleOtherCollectionResult">
  36. SELECT
  37. soc.* ,
  38. csu.customer_name
  39. FROM
  40. {DBNAME}.sale_other_collection soc
  41. LEFT JOIN {DBNAME}.customer_settlement_unit csu ON soc.settlement_unit_id = csu.id
  42. where soc.del_flag = '0'
  43. <if test="serialNumber != null and serialNumber != ''"> and soc.serial_number = #{serialNumber}</if>
  44. <if test="otherCollectionDate != null "> and soc.other_collection_date = #{otherCollectionDate}</if>
  45. <if test="customerId != null "> and soc.customer_id = #{customerId}</if>
  46. <if test="personInChargeId != null "> and soc.person_in_charge_id = #{personInChargeId}</if>
  47. <if test="paymentMethod != null and paymentMethod != ''"> and soc.payment_method = #{paymentMethod}</if>
  48. <if test="travelCertificateNumber != null and travelCertificateNumber != ''"> and soc.travel_certificate_number = #{travelCertificateNumber}</if>
  49. <if test="deptId != null "> and soc.dept_id = #{deptId}</if>
  50. <if test="collectionDetails != null and collectionDetails != ''"> and soc.collection_details = #{collectionDetails}</if>
  51. <if test="itemReceivable != null and itemReceivable != ''"> and soc.item_receivable = #{itemReceivable}</if>
  52. <if test="settlementUnitId != null "> and soc.settlement_unit_id = #{settlementUnitId}</if>
  53. <if test="amount != null "> and soc.amount = #{amount}</if>
  54. <if test="bookkeepingFlag != null and bookkeepingFlag != ''"> and bookkeeping_flag = #{bookkeepingFlag}</if>
  55. <if test="status != null and status != ''"> and soc.status = #{status}</if>
  56. <if test="startTime != null and endTime != null">and soc.other_collection_date BETWEEN #{startTime} AND #{endTime}</if>
  57. order by soc.id desc
  58. </select>
  59. <select id="selectSaleOtherCollectionById" parameterType="Long" resultMap="SaleOtherCollectionResult">
  60. <include refid="selectSaleOtherCollectionVo"/>
  61. where id = #{id}
  62. </select>
  63. <insert id="insertSaleOtherCollection" parameterType="com.zkqy.business.domain.SaleOtherCollection" useGeneratedKeys="true" keyProperty="id">
  64. insert into {DBNAME}.sale_other_collection
  65. <trim prefix="(" suffix=")" suffixOverrides=",">
  66. <if test="serialNumber != null">serial_number,</if>
  67. <if test="otherCollectionDate != null">other_collection_date,</if>
  68. <if test="customerId != null">customer_id,</if>
  69. <if test="personInChargeId != null">person_in_charge_id,</if>
  70. <if test="paymentMethod != null">payment_method,</if>
  71. <if test="travelCertificateNumber != null">travel_certificate_number,</if>
  72. <if test="deptId != null">dept_id,</if>
  73. <if test="collectionDetails != null">collection_details,</if>
  74. <if test="itemReceivable != null">item_receivable,</if>
  75. <if test="settlementUnitId != null">settlement_unit_id,</if>
  76. <if test="amount != null">amount,</if>
  77. <if test="auditor != null">auditor,</if>
  78. <if test="bookkeepingFlag != null">bookkeeping_flag,</if>
  79. <if test="status != null">status,</if>
  80. <if test="remark != null">remark,</if>
  81. <if test="createBy != null">create_by,</if>
  82. <if test="createById != null">create_by_id,</if>
  83. <if test="createTime != null">create_time,</if>
  84. del_flag
  85. </trim>
  86. <trim prefix="values (" suffix=")" suffixOverrides=",">
  87. <if test="serialNumber != null">#{serialNumber},</if>
  88. <if test="otherCollectionDate != null">#{otherCollectionDate},</if>
  89. <if test="customerId != null">#{customerId},</if>
  90. <if test="personInChargeId != null">#{personInChargeId},</if>
  91. <if test="paymentMethod != null">#{paymentMethod},</if>
  92. <if test="travelCertificateNumber != null">#{travelCertificateNumber},</if>
  93. <if test="deptId != null">#{deptId},</if>
  94. <if test="collectionDetails != null">#{collectionDetails},</if>
  95. <if test="itemReceivable != null">#{itemReceivable},</if>
  96. <if test="settlementUnitId != null">#{settlementUnitId},</if>
  97. <if test="amount != null">#{amount},</if>
  98. <if test="auditor != null">#{auditor},</if>
  99. <if test="bookkeepingFlag != null">#{bookkeepingFlag},</if>
  100. <if test="status != null">#{status},</if>
  101. <if test="remark != null">#{remark},</if>
  102. <if test="createBy != null">#{createBy},</if>
  103. <if test="createById != null">#{createById},</if>
  104. <if test="createTime != null">#{createTime},</if>
  105. '0'
  106. </trim>
  107. </insert>
  108. <update id="updateSaleOtherCollection" parameterType="com.zkqy.business.domain.SaleOtherCollection">
  109. update {DBNAME}.sale_other_collection
  110. <trim prefix="SET" suffixOverrides=",">
  111. <if test="serialNumber != null">serial_number = #{serialNumber},</if>
  112. <if test="otherCollectionDate != null">other_collection_date = #{otherCollectionDate},</if>
  113. <if test="customerId != null">customer_id = #{customerId},</if>
  114. <if test="personInChargeId != null">person_in_charge_id = #{personInChargeId},</if>
  115. <if test="paymentMethod != null">payment_method = #{paymentMethod},</if>
  116. <if test="travelCertificateNumber != null">travel_certificate_number = #{travelCertificateNumber},</if>
  117. <if test="deptId != null">dept_id = #{deptId},</if>
  118. <if test="collectionDetails != null">collection_details = #{collectionDetails},</if>
  119. <if test="itemReceivable != null">item_receivable = #{itemReceivable},</if>
  120. <if test="settlementUnitId != null">settlement_unit_id = #{settlementUnitId},</if>
  121. <if test="amount != null">amount = #{amount},</if>
  122. <if test="auditor != null">auditor = #{auditor},</if>
  123. <if test="bookkeepingFlag != null">bookkeeping_flag = #{bookkeepingFlag},</if>
  124. <if test="status != null">status = #{status},</if>
  125. <if test="remark != null">remark = #{remark},</if>
  126. <if test="updateBy != null">update_by = #{updateBy},</if>
  127. <if test="updateById != null">update_by_id = #{updateById},</if>
  128. <if test="updateTime != null">update_time = #{updateTime},</if>
  129. </trim>
  130. where id = #{id}
  131. </update>
  132. <delete id="deleteSaleOtherCollectionById" parameterType="Long">
  133. delete from {DBNAME}.sale_other_collection where id = #{id}
  134. </delete>
  135. <delete id="deleteSaleOtherCollectionByIds" parameterType="String">
  136. update {DBNAME}.sale_other_collection set del_flag = '2' where id in
  137. <foreach item="id" collection="list" open="(" separator="," close=")">
  138. #{id}
  139. </foreach>
  140. </delete>
  141. </mapper>