TSeapriceMapper.xml 11 KB

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