BizWaybillCostDetailsMapper.xml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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.ruoyi.logistics.mapper.BizWaybillCostDetailsMapper">
  6. <resultMap type="com.ruoyi.logistics.domain.BizWaybillCostDetails" id="BizWaybillCostDetailsResult">
  7. <result property="waybillDetailId" column="waybill_detail_id" />
  8. <result property="waybillId" column="waybill_id" />
  9. <result property="externalWaybillNo" column="external_waybill_no" />
  10. <result property="feeItemCode" column="fee_item_code" />
  11. <result property="feeItemName" column="fee_item_name" />
  12. <result property="feeName" column="fee_name" />
  13. <result property="amount" column="amount" />
  14. <result property="rateAmount" column="rate_amount" />
  15. <result property="adjustAmount" column="adjust_amount" />
  16. <result property="remark" column="remark" />
  17. <result property="createTime" column="create_time" />
  18. <result property="updateTime" column="update_time" />
  19. <result property="deptId" column="dept_id" />
  20. <result property="userId" column="user_id" />
  21. <result property="delFlag" column="del_flag" />
  22. <result property="createBy" column="create_by" />
  23. <result property="updateBy" column="update_by" />
  24. <result property="orderType" column="order_type" />
  25. <result property="senderCity" column="sender_city" />
  26. <result property="receiverCity" column="receiver_city" />
  27. <result property="signTime" column="sign_time" />
  28. <result property="goodsWeight" column="goods_weight" />
  29. <result property="productCode" column="product_code" />
  30. <result property="userName" column="user_name" />
  31. </resultMap>
  32. <sql id="selectBizWaybillCostDetailsVo">
  33. SELECT
  34. a.waybill_detail_id,
  35. b.sign_time,
  36. b.external_waybill_no,
  37. b.sender_city,
  38. b.receiver_city,
  39. b.goods_weight,
  40. b.order_type,
  41. b.product_code,
  42. u.nick_name,
  43. a.waybill_id,
  44. a.external_waybill_no,
  45. a.fee_item_code,
  46. a.fee_item_name,
  47. ifnull( a.adjust_amount, a.rate_amount ) rate_amount,
  48. a.adjust_amount,
  49. a.remark,
  50. a.create_time,
  51. a.update_time,
  52. a.dept_id,
  53. a.del_flag,
  54. a.create_by,
  55. a.update_by
  56. FROM
  57. biz_waybill_cost_details a
  58. LEFT JOIN biz_waybill_order b ON a.waybill_id = b.waybill_id
  59. LEFT JOIN sys_user u ON b.user_id = u.user_id
  60. LEFT JOIN sys_dept d ON a.dept_id = d.dept_id
  61. </sql>
  62. <select id="selectBizWaybillCostDetailsList" parameterType="com.ruoyi.logistics.domain.BizWaybillCostDetails" resultMap="BizWaybillCostDetailsResult">
  63. <include refid="selectBizWaybillCostDetailsVo"/>
  64. <where>
  65. b.order_status = 6
  66. <if test="monthCode != null "> AND DATE_FORMAT( b.sign_time, '%Y.%m' ) = #{monthCode}</if>
  67. <if test="deptId != null "> AND a.dept_id = #{deptId}</if>
  68. <!-- 数据范围过滤 -->
  69. ${params.dataScope}
  70. <!-- <if test="waybillId != null "> and waybill_id = #{waybillId}</if>
  71. <if test="externalWaybillNo != null and externalWaybillNo != ''"> and external_waybill_no = #{externalWaybillNo}</if>
  72. <if test="feeItemCode != null and feeItemCode != ''"> and fee_item_code = #{feeItemCode}</if>
  73. <if test="feeItemName != null and feeItemName != ''"> and fee_item_name like concat('%', #{feeItemName}, '%')</if>
  74. <if test="feeName != null and feeName != ''"> and fee_name like concat('%', #{feeName}, '%')</if>
  75. <if test="amount != null "> and amount = #{amount}</if>
  76. <if test="rateAmount != null "> and rate_amount = #{rateAmount}</if>
  77. <if test="adjustAmount != null "> and adjust_amount = #{adjustAmount}</if>
  78. <if test="deptId != null "> and dept_id = #{deptId}</if>
  79. <if test="userId != null "> and user_id = #{userId}</if>-->
  80. </where>
  81. </select>
  82. <select id="selectBizWaybillCostDetailsListByWx" parameterType="com.ruoyi.logistics.domain.BizWaybillCostDetails" resultMap="BizWaybillCostDetailsResult">
  83. select waybill_detail_id, waybill_id, external_waybill_no, fee_item_code, fee_item_name, fee_name, amount, rate_amount, adjust_amount, remark, create_time, update_time, dept_id, user_id, del_flag, create_by, update_by from biz_waybill_cost_details
  84. <where>
  85. <if test="waybillId != null "> and waybill_id = #{waybillId}</if>
  86. <!-- <if test="externalWaybillNo != null and externalWaybillNo != ''"> and external_waybill_no = #{externalWaybillNo}</if>
  87. <if test="feeItemCode != null and feeItemCode != ''"> and fee_item_code = #{feeItemCode}</if>
  88. <if test="feeItemName != null and feeItemName != ''"> and fee_item_name like concat('%', #{feeItemName}, '%')</if>
  89. <if test="feeName != null and feeName != ''"> and fee_name like concat('%', #{feeName}, '%')</if>
  90. <if test="amount != null "> and amount = #{amount}</if>
  91. <if test="rateAmount != null "> and rate_amount = #{rateAmount}</if>
  92. <if test="adjustAmount != null "> and adjust_amount = #{adjustAmount}</if>
  93. <if test="deptId != null "> and dept_id = #{deptId}</if>
  94. <if test="userId != null "> and user_id = #{userId}</if>-->
  95. </where>
  96. </select>
  97. <select id="selectBizWaybillCostDetailsByWaybillDetailId" parameterType="Long" resultMap="BizWaybillCostDetailsResult">
  98. <include refid="selectBizWaybillCostDetailsVo"/>
  99. where a.waybill_detail_id = #{waybillDetailId}
  100. </select>
  101. <insert id="insertBizWaybillCostDetails" parameterType="com.ruoyi.logistics.domain.BizWaybillCostDetails" useGeneratedKeys="true" keyProperty="waybillDetailId">
  102. insert into biz_waybill_cost_details
  103. <trim prefix="(" suffix=")" suffixOverrides=",">
  104. <if test="waybillId != null">waybill_id,</if>
  105. <if test="externalWaybillNo != null">external_waybill_no,</if>
  106. <if test="feeItemCode != null">fee_item_code,</if>
  107. <if test="feeItemName != null">fee_item_name,</if>
  108. <if test="feeName != null">fee_name,</if>
  109. <if test="amount != null">amount,</if>
  110. <if test="rateAmount != null">rate_amount,</if>
  111. <if test="adjustAmount != null">adjust_amount,</if>
  112. <if test="remark != null">remark,</if>
  113. <if test="createTime != null">create_time,</if>
  114. <if test="updateTime != null">update_time,</if>
  115. <if test="deptId != null">dept_id,</if>
  116. <if test="userId != null">user_id,</if>
  117. <if test="delFlag != null">del_flag,</if>
  118. <if test="createBy != null">create_by,</if>
  119. <if test="updateBy != null">update_by,</if>
  120. </trim>
  121. <trim prefix="values (" suffix=")" suffixOverrides=",">
  122. <if test="waybillId != null">#{waybillId},</if>
  123. <if test="externalWaybillNo != null">#{externalWaybillNo},</if>
  124. <if test="feeItemCode != null">#{feeItemCode},</if>
  125. <if test="feeItemName != null">#{feeItemName},</if>
  126. <if test="feeName != null">#{feeName},</if>
  127. <if test="amount != null">#{amount},</if>
  128. <if test="rateAmount != null">#{rateAmount},</if>
  129. <if test="adjustAmount != null">#{adjustAmount},</if>
  130. <if test="remark != null">#{remark},</if>
  131. <if test="createTime != null">#{createTime},</if>
  132. <if test="updateTime != null">#{updateTime},</if>
  133. <if test="deptId != null">#{deptId},</if>
  134. <if test="userId != null">#{userId},</if>
  135. <if test="delFlag != null">#{delFlag},</if>
  136. <if test="createBy != null">#{createBy},</if>
  137. <if test="updateBy != null">#{updateBy},</if>
  138. </trim>
  139. </insert>
  140. <update id="updateBizWaybillCostDetails" parameterType="com.ruoyi.logistics.domain.BizWaybillCostDetails">
  141. update biz_waybill_cost_details
  142. <trim prefix="SET" suffixOverrides=",">
  143. <if test="waybillId != null">waybill_id = #{waybillId},</if>
  144. <if test="externalWaybillNo != null">external_waybill_no = #{externalWaybillNo},</if>
  145. <if test="feeItemCode != null">fee_item_code = #{feeItemCode},</if>
  146. <if test="feeItemName != null">fee_item_name = #{feeItemName},</if>
  147. <if test="feeName != null">fee_name = #{feeName},</if>
  148. <if test="amount != null">amount = #{amount},</if>
  149. <if test="rateAmount != null">rate_amount = #{rateAmount},</if>
  150. <if test="adjustAmount != null">adjust_amount = #{adjustAmount},</if>
  151. <if test="remark != null">remark = #{remark},</if>
  152. <if test="createTime != null">create_time = #{createTime},</if>
  153. <if test="updateTime != null">update_time = #{updateTime},</if>
  154. <if test="deptId != null">dept_id = #{deptId},</if>
  155. <if test="userId != null">user_id = #{userId},</if>
  156. <if test="delFlag != null">del_flag = #{delFlag},</if>
  157. <if test="createBy != null">create_by = #{createBy},</if>
  158. <if test="updateBy != null">update_by = #{updateBy},</if>
  159. </trim>
  160. where waybill_detail_id = #{waybillDetailId}
  161. </update>
  162. <delete id="deleteBizWaybillCostDetailsByWaybillDetailId" parameterType="Long">
  163. delete from biz_waybill_cost_details where waybill_detail_id = #{waybillDetailId}
  164. </delete>
  165. <delete id="deleteBizWaybillCostDetailsByWaybillDetailIds" parameterType="String">
  166. delete from biz_waybill_cost_details where waybill_detail_id in
  167. <foreach item="waybillDetailId" collection="array" open="(" separator="," close=")">
  168. #{waybillDetailId}
  169. </foreach>
  170. </delete>
  171. </mapper>