TCtnpriceItemsMapper.xml 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  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. <result property="fDates" column="f_dates" />
  18. </resultMap>
  19. <sql id="selectTCtnpriceItemsVo">
  20. select f_id,
  21. f_pid,
  22. f_cntrid,
  23. f_price,
  24. f_status,
  25. create_by,
  26. create_time,
  27. update_by,
  28. update_time,
  29. remark,
  30. f_dates
  31. from t_ctnprice_items
  32. </sql>
  33. <select id="selectTCtnpriceItemsList" parameterType="TCtnpriceItems" resultMap="TCtnpriceItemsResult">
  34. SELECT
  35. ti.f_id,
  36. ti.f_pid,
  37. ti.f_cntrid,
  38. tc.f_no cntridName,
  39. ti.f_price,
  40. ti.f_status,
  41. ti.create_by,
  42. ti.create_time,
  43. ti.update_by,
  44. ti.update_time,
  45. ti.remark,
  46. ti.f_dates
  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. <if test="fDates != null">f_dates,</if>
  80. </trim>
  81. <trim prefix="values (" suffix=")" suffixOverrides=",">
  82. <if test="fPid != null">#{fPid},</if>
  83. <if test="fCntrid != null">#{fCntrid},</if>
  84. <if test="fPrice != null">#{fPrice},</if>
  85. <if test="fStatus != null">#{fStatus},</if>
  86. <if test="createBy != null">#{createBy},</if>
  87. <if test="createTime != null">#{createTime},</if>
  88. <if test="updateBy != null">#{updateBy},</if>
  89. <if test="updateTime != null">#{updateTime},</if>
  90. <if test="remark != null">#{remark},</if>
  91. <if test="fDates != null">#{fDates},</if>
  92. </trim>
  93. </insert>
  94. <update id="updateTCtnpriceItems" parameterType="TCtnpriceItems">
  95. update t_ctnprice_items
  96. <trim prefix="SET" suffixOverrides=",">
  97. <if test="fPid != null">f_pid = #{fPid},</if>
  98. <if test="fCntrid != null">f_cntrid = #{fCntrid},</if>
  99. <if test="fPrice != null">f_price = #{fPrice},</if>
  100. <if test="fStatus != null">f_status = #{fStatus},</if>
  101. <if test="createBy != null">create_by = #{createBy},</if>
  102. <if test="createTime != null">create_time = #{createTime},</if>
  103. <if test="updateBy != null">update_by = #{updateBy},</if>
  104. <if test="updateTime != null">update_time = #{updateTime},</if>
  105. <if test="remark != null">remark = #{remark},</if>
  106. <if test="fDates != null">f_dates = #{fDates},</if>
  107. </trim>
  108. where f_id = #{fId}
  109. </update>
  110. <delete id="deleteTCtnpriceItemsById" parameterType="Long">
  111. delete
  112. from t_ctnprice_items
  113. where f_id = #{fId}
  114. </delete>
  115. <delete id="deleteTCtnpriceItemsByIds" parameterType="String">
  116. delete from t_ctnprice_items where f_id in
  117. <foreach item="fId" collection="array" open="(" separator="," close=")">
  118. #{fId}
  119. </foreach>
  120. </delete>
  121. <delete id="deleteTCtnpriceItemsByfPid" parameterType="Long">
  122. delete
  123. from t_ctnprice_items
  124. where f_pid = #{fPid}
  125. </delete>
  126. <delete id="deleteTCtnpriceItemsByfPids" parameterType="Long">
  127. delete from t_ctnprice_items where f_pid in
  128. <foreach item="fPid" collection="array" open="(" separator="," close=")">
  129. #{fPid}
  130. </foreach>
  131. </delete>
  132. <select id="selectMoney" resultType="string">
  133. SELECT IFNULL(min(ti.f_price), 0) price
  134. FROM t_ctnprice_items ti
  135. LEFT JOIN t_ctnprice tc ON ti.f_pid = tc.f_id
  136. LEFT JOIN t_cntr tr ON ti.f_cntrid = tr.f_id
  137. WHERE tc.f_portofloadid = #{fPortofloadid}
  138. AND tc.f_distinationid = #{fDistinationid}
  139. AND tr.f_no = #{fNo}
  140. AND tc.f_status = 'T'
  141. AND ti.f_status = 'T'
  142. </select>
  143. <select id="selectPriceMoney" resultType="string">
  144. SELECT CASE
  145. WHEN
  146. ti.f_price IS NULL THEN
  147. 0
  148. ELSE ti.f_price END AS pric
  149. FROM t_ctnprice_items ti
  150. LEFT JOIN t_ctnprice tc ON ti.f_pid = tc.f_id
  151. LEFT JOIN t_cntr tr ON ti.f_cntrid = tr.f_id
  152. WHERE tc.f_portofloadid = #{fPortofloadid}
  153. AND tc.f_distinationid = #{fDistinationid}
  154. AND tr.f_no = #{fNo}
  155. AND tc.f_status = 'T'
  156. AND ti.f_status = 'T'
  157. <if test="fPortoftransshipment != null "> and tc.f_portoftransshipment = #{fPortoftransshipment}</if>
  158. <if test="fPortoftransshipment == null "> and tc.f_portoftransshipment IS NULL</if>
  159. </select>
  160. <select id="containerPrice" parameterType="object" resultType="long">
  161. SELECT ti.f_price
  162. FROM t_ctnprice_items ti
  163. LEFT JOIN t_cntr tc
  164. ON ti.f_cntrid = tc.f_id
  165. LEFT JOIN t_ctnprice tp ON ti.f_pid = tp.f_id
  166. WHERE tc.f_no = #{cntridName}
  167. AND tp.f_portofloadid = #{fPortofloadid}
  168. AND tp.f_distinationid = #{fDistinationid}
  169. AND #{fEtd} BETWEEN tp.f_begindate AND tp.f_end
  170. AND tc.f_status = 'T'
  171. AND tp.f_status = 'T'
  172. <if test="fPortoftransshipment != null">AND tp.f_portoftransshipment = #{fPortoftransshipment}</if>
  173. </select>
  174. <select id="selectItemMeaasge" parameterType="TCtnpriceItems" resultMap="TCtnpriceItemsResult">
  175. select f_id,
  176. f_pid,
  177. f_cntrid,
  178. f_price,
  179. f_status,
  180. create_by,
  181. create_time,
  182. update_by,
  183. update_time,
  184. remark,
  185. f_dates
  186. from t_ctnprice_items
  187. where f_pid = #{fPid}
  188. AND f_cntrid = #{fCntrid}
  189. AND f_status = 'T'
  190. </select>
  191. <select id="selectMinMoney" resultType="string">
  192. SELECT IFNULL(min(ti.f_price), 0) price
  193. FROM t_ctnprice_items ti
  194. LEFT JOIN t_cntr tr ON ti.f_cntrid = tr.f_id
  195. WHERE
  196. tr.f_no = #{fNo}
  197. AND ti.f_status = 'T'
  198. AND ti.f_pid in
  199. <foreach item="item" collection="fPid" open="(" separator="," close=")">
  200. #{item}
  201. </foreach>
  202. </select>
  203. </mapper>