WalletPayableApplyMapper.xml 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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. <!-- 运费申请记录(wallet_payable_apply) -->
  4. <mapper namespace="com.sckw.payment.mapper.WalletPayableApplyMapper">
  5. <!-- This code was generated by TableGo tools, mark 1 begin. -->
  6. <!-- 字段映射 -->
  7. <resultMap id="walletPayableApplyMap" type="com.sckw.payment.entity.WalletPayableApply">
  8. <id column="id" property="id" />
  9. <result column="payable_id" property="payableId" />
  10. <result column="order_no" property="orderNo" />
  11. <result column="apply_amount" property="applyAmount" />
  12. <result column="paying_amount" property="payingAmount" />
  13. <result column="received_amount" property="receivedAmount" />
  14. <result column="status" property="status" />
  15. <result column="remark" property="remark" />
  16. <result column="del_flag" property="delFlag" />
  17. <result column="create_by" property="createBy" />
  18. <result column="create_time" property="createTime" />
  19. <result column="update_by" property="updateBy" />
  20. <result column="update_time" property="updateTime" />
  21. </resultMap>
  22. <!-- 表所有字段 -->
  23. <sql id="allColumns">
  24. wpa.id, wpa.payable_id, wpa.order_no, wpa.apply_amount, wpa.paying_amount,wpa.received_amount, wpa.status, wpa.remark, wpa.del_flag,
  25. wpa.create_by, wpa.create_time, wpa.update_by, wpa.update_time
  26. </sql>
  27. <!-- This code was generated by TableGo tools, mark 1 end. -->
  28. <!-- 分页查询运费申请记录列表 -->
  29. <select id="selectWalletPayableApplyList" resultMap="walletPayableApplyMap">
  30. SELECT
  31. <include refid="allColumns" />
  32. FROM wallet_payable_apply wpa WHERE wpa.DEL_FLAG = '0'
  33. <if test="payableId != null">
  34. AND wpa.payable_id = #{payableId}
  35. </if>
  36. <if test="orderNo != null">
  37. AND wpa.order_no = #{orderNo}
  38. </if>
  39. </select>
  40. <!-- 根据主键ID查询运费申请记录 -->
  41. <select id="selectWalletPayableApplyById" resultMap="walletPayableApplyMap">
  42. SELECT
  43. <include refid="allColumns" />
  44. FROM wallet_payable_apply wpa WHERE wpa.id = #{id}
  45. </select>
  46. <select id="selectWalletPayableApplyByOrderNo" resultMap="walletPayableApplyMap">
  47. SELECT
  48. <include refid="allColumns" />
  49. FROM wallet_payable_apply wpa WHERE wpa.order_no = #{orderNo}
  50. </select>
  51. <!-- 根据主键ID列表查询运费申请记录列表 -->
  52. <select id="selectWalletPayableApplyByIds" resultMap="walletPayableApplyMap">
  53. SELECT
  54. <include refid="allColumns" />
  55. FROM wallet_payable_apply wpa WHERE wpa.id IN
  56. <foreach collection="idList" index="index" item="id" open="(" separator="," close=")">
  57. #{id}
  58. </foreach>
  59. </select>
  60. <select id="selectPayableApplyByPayableId" resultMap="walletPayableApplyMap">
  61. SELECT
  62. <include refid="allColumns" />
  63. FROM wallet_payable_apply wpa
  64. WHERE wpa.payable_id = #{payableId}
  65. AND wpa.status = '0'
  66. AND wpa.apply_amount > (wpa.paying_amount+wpa.received_amount)
  67. AND wpa.DEL_FLAG = '0'
  68. order by wpa.create_time DESC
  69. </select>
  70. <!-- This code was generated by TableGo tools, mark 2 begin. -->
  71. <!-- 新增运费申请记录 -->
  72. <insert id="insertWalletPayableApply" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
  73. INSERT INTO wallet_payable_apply
  74. <trim prefix="(" suffix=")" suffixOverrides=",">
  75. <if test="id != null">id,</if>
  76. <if test="payableId != null">payable_id,</if>
  77. <if test="orderNo != null">order_no,</if>
  78. <if test="applyAmount != null">apply_amount,</if>
  79. <if test="payingAmount != null">paying_amount,</if>
  80. <if test="receivedAmount != null">received_amount,</if>
  81. <if test="status != null">status,</if>
  82. <if test="remark != null">remark,</if>
  83. <if test="delFlag != null">del_flag,</if>
  84. <if test="createBy != null">create_by,</if>
  85. <if test="createTime != null">create_time,</if>
  86. <if test="updateBy != null">update_by,</if>
  87. <if test="updateTime != null">update_time</if>
  88. </trim>
  89. <trim prefix="VALUES (" suffix=")" suffixOverrides=",">
  90. <if test="id != null">#{id},</if>
  91. <if test="payableId != null">#{payableId},</if>
  92. <if test="orderNo != null">#{orderNo},</if>
  93. <if test="applyAmount != null">#{applyAmount},</if>
  94. <if test="payingAmount != null">#{payingAmount},</if>
  95. <if test="receivedAmount != null">#{receivedAmount},</if>
  96. <if test="status != null">#{status},</if>
  97. <if test="remark != null">#{remark},</if>
  98. <if test="delFlag != null">#{delFlag},</if>
  99. <if test="createBy != null">#{createBy},</if>
  100. <if test="createTime != null">#{createTime},</if>
  101. <if test="updateBy != null">#{updateBy},</if>
  102. <if test="updateTime != null">#{updateTime}</if>
  103. </trim>
  104. </insert>
  105. <!-- 修改运费申请记录 -->
  106. <update id="updateWalletPayableApply">
  107. UPDATE wallet_payable_apply
  108. <set>
  109. <if test="payableId != null">payable_id = #{payableId},</if>
  110. <if test="orderNo != null">order_no = #{orderNo},</if>
  111. <if test="applyAmount != null">apply_amount = #{applyAmount},</if>
  112. <if test="payingAmount != null">paying_amount = #{payingAmount},</if>
  113. <if test="receivedAmount != null">received_amount = #{receivedAmount},</if>
  114. <if test="status != null">status = #{status},</if>
  115. <if test="remark != null">remark = #{remark},</if>
  116. <if test="delFlag != null">del_flag = #{delFlag},</if>
  117. <if test="createBy != null">create_by = #{createBy},</if>
  118. <if test="createTime != null">create_time = #{createTime},</if>
  119. <if test="updateBy != null">update_by = #{updateBy},</if>
  120. <if test="updateTime != null">update_time = #{updateTime}</if>
  121. </set>
  122. WHERE id = #{id}
  123. </update>
  124. <!-- This code was generated by TableGo tools, mark 2 end. -->
  125. <!-- 删除运费申请记录 -->
  126. <delete id="deleteWalletPayableApplyById">
  127. DELETE FROM wallet_payable_apply WHERE id = #{id}
  128. </delete>
  129. <!-- 批量删除运费申请记录 -->
  130. <delete id="deleteWalletPayableApplyByIds">
  131. DELETE FROM wallet_payable_apply WHERE id IN
  132. <foreach collection="idList" index="index" item="id" open="(" separator="," close=")">
  133. #{id}
  134. </foreach>
  135. </delete>
  136. <!-- 批量逻辑删除运费申请记录 -->
  137. <update id="deleteWalletPayableApplyLogicByIds">
  138. UPDATE wallet_payable_apply
  139. <set>
  140. DEL_FLAG = '2',
  141. UPDATE_TIME = NOW(),
  142. <if test="loginName != null and loginName != ''">UPDATE_BY = #{loginName}</if>
  143. </set>
  144. WHERE DEL_FLAG = '0' AND id IN
  145. <foreach collection="idList" index="index" item="id" open="(" separator="," close=")">
  146. #{id}
  147. </foreach>
  148. </update>
  149. </mapper>