TCtnpriceItemsMapper.xml 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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.shipping.mapper.TCtnpriceItemsMapper">
  6. <resultMap type="TCtnpriceItems" id="TCtnpriceItemsResult">
  7. <result property="fId" column="f_id"/>
  8. <result property="fPid" column="f_pid"/>
  9. <result property="fCntrid" column="f_cntrid"/>
  10. <result property="fPrice" column="f_price"/>
  11. <result property="fStatus" column="f_status"/>
  12. <result property="createBy" column="create_by"/>
  13. <result property="createTime" column="create_time"/>
  14. <result property="updateBy" column="update_by"/>
  15. <result property="updateTime" column="update_time"/>
  16. <result property="remark" column="remark"/>
  17. </resultMap>
  18. <sql id="selectTCtnpriceItemsVo">
  19. select f_id,
  20. f_pid,
  21. f_cntrid,
  22. f_price,
  23. f_status,
  24. create_by,
  25. create_time,
  26. update_by,
  27. update_time,
  28. remark
  29. from t_ctnprice_items
  30. </sql>
  31. <select id="selectTCtnpriceItemsList" parameterType="TCtnpriceItems" resultMap="TCtnpriceItemsResult">
  32. SELECT
  33. ti.f_id,
  34. ti.f_pid,
  35. ti.f_cntrid,
  36. tc.f_no cntridName,
  37. ti.f_price,
  38. CASE
  39. WHEN ti.f_status = 'T' THEN
  40. '正常' ELSE '停用'
  41. END AS f_status,
  42. ti.create_by,
  43. ti.create_time,
  44. ti.update_by,
  45. ti.update_time,
  46. ti.remark
  47. FROM
  48. t_ctnprice_items ti
  49. LEFT JOIN t_cntr tc ON ti.f_cntrid = tc.f_id
  50. <where>
  51. <if test="fPid != null ">and ti.f_pid = #{fPid}</if>
  52. <if test="fCntrid != null ">and ti.f_cntrid = #{fCntrid}</if>
  53. <if test="fPrice != null ">and ti.f_price = #{fPrice}</if>
  54. <if test="fStatus != null and fStatus != ''">and ti.f_status = #{fStatus}</if>
  55. <if test='cLoadDate != null and cLoadDate[0] != null and cLoadDate[0]!= ""'>
  56. and ti.create_time &gt;= #{cLoadDate[0]}
  57. </if>
  58. <if test='cLoadDate != null and cLoadDate[1] != null and cLoadDate[1]!= ""'>
  59. and ti.create_time &lt;= #{cLoadDate[1]}
  60. </if>
  61. </where>
  62. </select>
  63. <select id="selectTCtnpriceItemsById" parameterType="Long" resultMap="TCtnpriceItemsResult">
  64. <include refid="selectTCtnpriceItemsVo"/>
  65. where f_id = #{fId}
  66. </select>
  67. <insert id="insertTCtnpriceItems" parameterType="TCtnpriceItems" useGeneratedKeys="true" keyProperty="fId">
  68. insert into t_ctnprice_items
  69. <trim prefix="(" suffix=")" suffixOverrides=",">
  70. <if test="fPid != null">f_pid,</if>
  71. <if test="fCntrid != null">f_cntrid,</if>
  72. <if test="fPrice != null">f_price,</if>
  73. <if test="fStatus != null">f_status,</if>
  74. <if test="createBy != null">create_by,</if>
  75. <if test="createTime != null">create_time,</if>
  76. <if test="updateBy != null">update_by,</if>
  77. <if test="updateTime != null">update_time,</if>
  78. <if test="remark != null">remark,</if>
  79. </trim>
  80. <trim prefix="values (" suffix=")" suffixOverrides=",">
  81. <if test="fPid != null">#{fPid},</if>
  82. <if test="fCntrid != null">#{fCntrid},</if>
  83. <if test="fPrice != null">#{fPrice},</if>
  84. <if test="fStatus != null">#{fStatus},</if>
  85. <if test="createBy != null">#{createBy},</if>
  86. <if test="createTime != null">#{createTime},</if>
  87. <if test="updateBy != null">#{updateBy},</if>
  88. <if test="updateTime != null">#{updateTime},</if>
  89. <if test="remark != null">#{remark},</if>
  90. </trim>
  91. </insert>
  92. <update id="updateTCtnpriceItems" parameterType="TCtnpriceItems">
  93. update t_ctnprice_items
  94. <trim prefix="SET" suffixOverrides=",">
  95. <if test="fPid != null">f_pid = #{fPid},</if>
  96. <if test="fCntrid != null">f_cntrid = #{fCntrid},</if>
  97. <if test="fPrice != null">f_price = #{fPrice},</if>
  98. <if test="fStatus != null">f_status = #{fStatus},</if>
  99. <if test="createBy != null">create_by = #{createBy},</if>
  100. <if test="createTime != null">create_time = #{createTime},</if>
  101. <if test="updateBy != null">update_by = #{updateBy},</if>
  102. <if test="updateTime != null">update_time = #{updateTime},</if>
  103. <if test="remark != null">remark = #{remark},</if>
  104. </trim>
  105. where f_id = #{fId}
  106. </update>
  107. <delete id="deleteTCtnpriceItemsById" parameterType="Long">
  108. delete
  109. from t_ctnprice_items
  110. where f_id = #{fId}
  111. </delete>
  112. <delete id="deleteTCtnpriceItemsByIds" parameterType="String">
  113. delete from t_ctnprice_items where f_id in
  114. <foreach item="fId" collection="array" open="(" separator="," close=")">
  115. #{fId}
  116. </foreach>
  117. </delete>
  118. <delete id="deleteTCtnpriceItemsByfPid" parameterType="Long">
  119. delete
  120. from t_ctnprice_items
  121. where f_pid = #{fPid}
  122. </delete>
  123. <delete id="deleteTCtnpriceItemsByfPids" parameterType="Long">
  124. delete from t_ctnprice_items where f_pid in
  125. <foreach item="fPid" collection="array" open="(" separator="," close=")">
  126. #{fPid}
  127. </foreach>
  128. </delete>
  129. <select id="selectMoney" resultType="string">
  130. SELECT IFNULL(min(ti.f_price), 0) price
  131. FROM t_ctnprice_items ti
  132. LEFT JOIN t_ctnprice tc ON ti.f_pid = tc.f_id
  133. LEFT JOIN t_cntr tr ON ti.f_cntrid = tr.f_id
  134. WHERE tc.f_portofloadid = #{fPortofloadid}
  135. AND tc.f_distinationid = #{fDistinationid}
  136. AND tr.f_no = #{fNo}
  137. AND tc.f_status = 'T'
  138. AND ti.f_status = 'T'
  139. </select>
  140. <select id="selectPriceMoney" resultType="string">
  141. SELECT CASE
  142. WHEN
  143. ti.f_price IS NULL THEN
  144. 0
  145. ELSE ti.f_price END AS pric
  146. FROM t_ctnprice_items ti
  147. LEFT JOIN t_ctnprice tc ON ti.f_pid = tc.f_id
  148. LEFT JOIN t_cntr tr ON ti.f_cntrid = tr.f_id
  149. WHERE tc.f_portofloadid = #{fPortofloadid}
  150. AND tc.f_distinationid = #{fDistinationid}
  151. AND tr.f_no = #{fNo}
  152. AND tc.f_status = 'T'
  153. AND ti.f_status = 'T'
  154. <if test="fPortoftransshipment != null "> and tc.f_portoftransshipment = #{fPortoftransshipment}</if>
  155. <if test="fPortoftransshipment == null "> and tc.f_portoftransshipment IS NULL</if>
  156. </select>
  157. <select id="containerPrice" parameterType="object" resultType="long">
  158. SELECT ti.f_price
  159. FROM t_ctnprice_items ti
  160. LEFT JOIN t_cntr tc
  161. ON ti.f_cntrid = tc.f_id
  162. LEFT JOIN t_ctnprice tp ON ti.f_pid = tp.f_id
  163. WHERE tc.f_no = #{cntridName}
  164. AND tp.f_portofloadid = #{fPortofloadid}
  165. AND tp.f_distinationid = #{fDistinationid}
  166. AND #{fEtd} BETWEEN tp.f_begindate AND tp.f_end
  167. AND tc.f_status = 'T'
  168. AND tp.f_status = 'T'
  169. <if test="fPortoftransshipment != null">AND tp.f_portoftransshipment = #{fPortoftransshipment}</if>
  170. </select>
  171. <select id="selectItemMeaasge" parameterType="TCtnpriceItems" resultMap="TCtnpriceItemsResult">
  172. select f_id,
  173. f_pid,
  174. f_cntrid,
  175. f_price,
  176. f_status,
  177. create_by,
  178. create_time,
  179. update_by,
  180. update_time,
  181. remark
  182. from t_ctnprice_items
  183. where f_pid = #{fPid}
  184. AND f_cntrid = #{fCntrid}
  185. </select>
  186. </mapper>