TCtnpriceMapper.xml 8.7 KB

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