TSeapriceMapper.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  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.quotation.mapper.TSeapriceMapper">
  6. <resultMap type="TSeaprice" id="TSeapriceResult">
  7. <result property="fId" column="f_id"/>
  8. <result property="fBilltype" column="f_billtype"/>
  9. <result property="fCorpid" column="f_corpid"/>
  10. <result property="polId" column="pol_id"/>
  11. <result property="podId" column="pod_id"/>
  12. <result property="fValiddate" column="f_validdate"/>
  13. <result property="fDateChanged" column="f_date_changed"/>
  14. <result property="fBillstatus" column="f_billstatus"/>
  15. <result property="delFlag" column="del_flag"/>
  16. <result property="createBy" column="create_by"/>
  17. <result property="createTime" column="create_time"/>
  18. <result property="updateBy" column="update_by"/>
  19. <result property="updateTime" column="update_time"/>
  20. <result property="remarks" column="remarks"/>
  21. <result property="fLineid" column="f_lineid"/>
  22. <result property="fBookagentid" column="f_bookagentid"/>
  23. </resultMap>
  24. <sql id="selectTSeapriceVo">
  25. select f_id,
  26. f_billtype,
  27. f_corpid,
  28. pol_id,
  29. pod_id,
  30. f_validdate,
  31. f_date_changed,
  32. f_billstatus,
  33. del_flag,
  34. create_by,
  35. create_time,
  36. update_by,
  37. update_time,
  38. remarks,
  39. f_lineid,
  40. f_bookagentid
  41. from t_seaprice
  42. </sql>
  43. <select id="selectTSeapriceList" parameterType="TSeaprice" resultMap="TSeapriceResult">
  44. <include refid="selectTSeapriceVo"/>
  45. <where>
  46. <if test="fBilltype != null ">and f_billtype = #{fBilltype}</if>
  47. <if test="fCorpid != null ">and f_corpid = #{fCorpid}</if>
  48. <if test="polId != null ">and pol_id = #{polId}</if>
  49. <if test="podId != null ">and pod_id = #{podId}</if>
  50. <if test="fBillstatus != null ">and f_billstatus = #{fBillstatus}</if>
  51. <if test="remarks != null and remarks != ''">and remarks = #{remarks}</if>
  52. <if test='validdateList != null and validdateList[0] != null and validdateList[0]!= ""'>
  53. and f_validdate &gt;= #{validdateList[0]}
  54. </if>
  55. <if test='validdateList != null and validdateList[1] != null and validdateList[1]!= ""'>
  56. and f_validdate &lt;= #{validdateList[1]}
  57. </if>
  58. <if test="fLineid != null and fLineid != ''">and f_lineid = #{fLineid}</if>
  59. <if test="fBookagentid != null and fBookagentid != ''">and f_bookagentid = #{fBookagentid}</if>
  60. </where>
  61. </select>
  62. <select id="selectTSeapriceById" parameterType="Long" resultMap="TSeapriceResult">
  63. <include refid="selectTSeapriceVo"/>
  64. where f_id = #{fId}
  65. </select>
  66. <select id="selectTSeapriceMapList" parameterType="TSeaprice" resultType="Map">
  67. SELECT
  68. s.f_id fId,
  69. t.dict_label fBilltype,
  70. c.f_cname fCorpid,
  71. CASE
  72. WHEN s.f_billstatus = '0' THEN
  73. '正常'
  74. WHEN s.f_billstatus = '1' THEN
  75. '停用'
  76. END AS fBillstatus,
  77. pol.dict_label polId,
  78. pod.dict_label podId,
  79. s.create_by createBy,
  80. s.f_validdate fValiddate,
  81. s.remarks,
  82. s.f_lineid fLineid,
  83. s.f_bookagentid fBookagentid,
  84. j.f_name fLineName,
  85. q.f_name fBookagentName
  86. FROM
  87. t_seaprice s
  88. LEFT JOIN sys_dict_data t ON t.dict_value = s.f_billtype AND t.dict_type = 'data_billType'
  89. LEFT JOIN sys_dict_data pol ON pol.dict_value = s.pol_id AND pol.dict_type = 'port_start'
  90. LEFT JOIN sys_dict_data pod ON pod.dict_value = s.pod_id AND pod.dict_type = 'port_end'
  91. LEFT JOIN t_corps c ON c.f_id = s.f_corpid
  92. LEFT JOIN t_address j ON s.f_lineid = j.f_id
  93. LEFT JOIN t_corps q ON s.f_bookagentid = q.f_id
  94. <where>
  95. <if test="fBilltype != null ">and s.f_billtype = #{fBilltype}</if>
  96. <if test="fCorpid != null ">and s.f_corpid = #{fCorpid}</if>
  97. <if test="polId != null ">and s.pol_id = #{polId}</if>
  98. <if test="podId != null ">and s.pod_id = #{podId}</if>
  99. <if test="fValiddate != null ">and s.f_validdate = #{fValiddate}</if>
  100. <if test="fBillstatus != null ">and s.f_billstatus = #{fBillstatus}</if>
  101. <if test="remarks != null and remarks != ''">and remarks = #{remarks}</if>
  102. </where>
  103. ORDER BY s.f_id DESC
  104. </select>
  105. <select id="checkSeapriceByValiddate" parameterType="TSeaprice" resultType="int">
  106. SELECT COUNT(f_id)
  107. FROM t_seaprice
  108. WHERE f_id != #{fId}
  109. AND f_billtype = #{fBilltype}
  110. AND f_corpid = #{fCorpid}
  111. AND pol_id = #{polId}
  112. AND pod_id = #{podId}
  113. AND pod_id = #{podId}
  114. AND f_validdate &gt;= #{fValiddate}
  115. </select>
  116. <select id="selectSeapriceItemAmt" parameterType="TSeaprice" resultType="BigDecimal">
  117. SELECT IFNULL(SUM(IF(#{fType} = '0', s.${fSpecification}, s.f_unitprice)), 0)
  118. FROM t_seaprice t
  119. LEFT JOIN t_seapriceitem s ON s.f_pid = t.f_id
  120. WHERE t.f_billtype = #{fBilltype}
  121. AND t.f_corpid = #{fCorpid}
  122. AND t.f_validdate &gt;= #{fValiddate}
  123. AND t.f_billstatus = 0
  124. AND t.del_flag = '0'
  125. AND s.f_type = #{fType}
  126. </select>
  127. <select id="selectSeapriceItem" parameterType="TSeaprice" resultType="Map">
  128. SELECT f.f_name fFeeid,
  129. IF
  130. (s.f_type = '0', s.${fSpecification}, s.f_unitprice) fUnitprice
  131. FROM t_seaprice t
  132. LEFT JOIN t_seapriceitem s ON s.f_pid = t.f_id
  133. LEFT JOIN t_fees f ON f.f_id = s.f_feeid
  134. WHERE t.f_billtype = #{fBilltype}
  135. AND t.f_corpid = #{fCorpid}
  136. AND t.f_validdate &gt;= #{fValiddate}
  137. AND t.f_billstatus = 0
  138. AND t.del_flag = '0'
  139. AND f.f_name != '海运费'
  140. ORDER BY s.f_type, s.f_id asc
  141. </select>
  142. <select id="selectShippingFee" parameterType="TSeaprice" resultType="com.ruoyi.quotation.domain.TSeapriceitem">
  143. SELECT s.f_id fId,
  144. s.f_feeid fFeeid,
  145. IFNULL(s.${fSpecification}, 0) fUnitprice,
  146. IFNULL(s.f_exrate, 0) fExrate,
  147. IFNULL(IFNULL(s.${fSpecification}, 0) * IFNULL(s.f_exrate, 0), 0) rmb
  148. FROM t_seaprice t
  149. LEFT JOIN t_seapriceitem s ON s.f_pid = t.f_id
  150. LEFT JOIN t_fees f ON f.f_id = s.f_feeid
  151. WHERE t.f_billtype = #{fBilltype}
  152. AND t.f_corpid = #{fCorpid}
  153. AND t.f_validdate &gt;= #{fValiddate}
  154. AND t.f_billstatus = 0
  155. AND t.del_flag = '0'
  156. AND f.f_name = '海运费'
  157. ORDER BY s.f_id asc
  158. LIMIT 0, 1
  159. </select>
  160. <insert id="insertTSeaprice" parameterType="TSeaprice" useGeneratedKeys="true" keyProperty="fId">
  161. insert into t_seaprice
  162. <trim prefix="(" suffix=")" suffixOverrides=",">
  163. <if test="fBilltype != null">f_billtype,</if>
  164. <if test="fCorpid != null">f_corpid,</if>
  165. <if test="polId != null">pol_id,</if>
  166. <if test="podId != null">pod_id,</if>
  167. <if test="fValiddate != null">f_validdate,</if>
  168. <if test="fDateChanged != null">f_date_changed,</if>
  169. <if test="fBillstatus != null">f_billstatus,</if>
  170. <if test="delFlag != null">del_flag,</if>
  171. <if test="createBy != null">create_by,</if>
  172. <if test="createTime != null">create_time,</if>
  173. <if test="updateBy != null">update_by,</if>
  174. <if test="updateTime != null">update_time,</if>
  175. <if test="remarks != null">remarks,</if>
  176. <if test="fLineid != null">f_lineid,</if>
  177. <if test="fBookagentid != null">f_bookagentid,</if>
  178. </trim>
  179. <trim prefix="values (" suffix=")" suffixOverrides=",">
  180. <if test="fBilltype != null">#{fBilltype},</if>
  181. <if test="fCorpid != null">#{fCorpid},</if>
  182. <if test="polId != null">#{polId},</if>
  183. <if test="podId != null">#{podId},</if>
  184. <if test="fValiddate != null">#{fValiddate},</if>
  185. <if test="fDateChanged != null">#{fDateChanged},</if>
  186. <if test="fBillstatus != null">#{fBillstatus},</if>
  187. <if test="delFlag != null">#{delFlag},</if>
  188. <if test="createBy != null">#{createBy},</if>
  189. <if test="createTime != null">#{createTime},</if>
  190. <if test="updateBy != null">#{updateBy},</if>
  191. <if test="updateTime != null">#{updateTime},</if>
  192. <if test="remarks != null">#{remarks},</if>
  193. <if test="fLineid != null">#{fLineid},</if>
  194. <if test="fBookagentid != null">#{fBookagentid},</if>
  195. </trim>
  196. </insert>
  197. <update id="updateTSeaprice" parameterType="TSeaprice">
  198. update t_seaprice
  199. <trim prefix="SET" suffixOverrides=",">
  200. <if test="fBilltype != null">f_billtype = #{fBilltype},</if>
  201. <if test="fCorpid != null">f_corpid = #{fCorpid},</if>
  202. <if test="polId != null">pol_id = #{polId},</if>
  203. <if test="podId != null">pod_id = #{podId},</if>
  204. <if test="fValiddate != null">f_validdate = #{fValiddate},</if>
  205. <if test="fBillstatus != null">f_billstatus = #{fBillstatus},</if>
  206. <if test="fDateChanged != null">f_date_changed = #{fDateChanged},</if>
  207. <if test="delFlag != null">del_flag = #{delFlag},</if>
  208. <if test="createBy != null">create_by = #{createBy},</if>
  209. <if test="createTime != null">create_time = #{createTime},</if>
  210. <if test="updateBy != null">update_by = #{updateBy},</if>
  211. <if test="updateTime != null">update_time = #{updateTime},</if>
  212. <if test="remarks != null">remarks = #{remarks},</if>
  213. <if test="fLineid != null">f_lineid = #{fLineid},</if>
  214. <if test="fBookagentid != null">f_bookagentid = #{fBookagentid},</if>
  215. </trim>
  216. where f_id = #{fId}
  217. </update>
  218. <delete id="deleteTSeapriceById" parameterType="Long">
  219. delete
  220. from t_seaprice
  221. where f_id = #{fId}
  222. </delete>
  223. <delete id="deleteTSeapriceByIds" parameterType="String">
  224. delete from t_seaprice where f_id in
  225. <foreach item="fId" collection="array" open="(" separator="," close=")">
  226. #{fId}
  227. </foreach>
  228. </delete>
  229. </mapper>