TSeapriceMapper.xml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  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="fBilltypeName" column="f_billtype_name"/>
  10. <result property="fCorpid" column="f_corpid"/>
  11. <result property="polId" column="pol_id"/>
  12. <result property="polName" column="pol_name"/>
  13. <result property="podId" column="pod_id"/>
  14. <result property="podName" column="pod_name"/>
  15. <result property="fValiddate" column="f_validdate"/>
  16. <result property="fDateChanged" column="f_date_changed"/>
  17. <result property="fBillstatus" column="f_billstatus"/>
  18. <result property="fBillstatusName" column="f_billstatus_name"/>
  19. <result property="delFlag" column="del_flag"/>
  20. <result property="createBy" column="create_by"/>
  21. <result property="createTime" column="create_time"/>
  22. <result property="updateBy" column="update_by"/>
  23. <result property="updateTime" column="update_time"/>
  24. <result property="remarks" column="remarks"/>
  25. <result property="fLineid" column="f_lineid"/>
  26. <result property="fBookagentid" column="f_bookagentid"/>
  27. <result property="fLineName" column="f_line_name"/>
  28. <result property="fBookagentName" column="f_bookagent_name"/>
  29. <result property="fTransitPortId" column="f_transit_port_id"/>
  30. <result property="fSailingSchedule" column="f_sailing_schedule"/>
  31. <result property="fVoyage" column="f_voyage"/>
  32. </resultMap>
  33. <sql id="selectTSeapriceVo">
  34. select s.f_id,
  35. s.f_billtype,
  36. dic.dict_label as f_billtype_name,
  37. s.f_corpid,
  38. s.pol_id,
  39. ltd.f_name as pol_name,
  40. s.pod_id,
  41. dtd.f_name as pod_name,
  42. s.f_validdate,
  43. s.f_date_changed,
  44. CASE
  45. WHEN s.f_billstatus=0 THEN '正常'
  46. WHEN s.f_billstatus=1 THEN '停用'
  47. END as f_billstatus_name,
  48. s.f_billstatus,
  49. s.del_flag,
  50. s.create_by,
  51. s.create_time,
  52. s.update_by,
  53. s.update_time,
  54. s.remarks,
  55. s.f_lineid,
  56. s.f_bookagentid,
  57. s.f_transit_port_id,
  58. s.f_sailing_schedule,
  59. s.f_voyage,
  60. j.f_name AS f_line_name,
  61. q.f_name AS f_bookagent_name,
  62. tc.f_name AS fNamec
  63. from t_seaprice s
  64. LEFT JOIN t_address j ON s.f_lineid = j.f_id
  65. LEFT JOIN t_corps q ON s.f_bookagentid = q.f_id
  66. LEFT JOIN t_corps tc ON s.f_corpid = tc.f_id
  67. LEFT JOIN (
  68. SELECT *
  69. FROM sys_dict_data dic
  70. WHERE dic.dict_label = IF(dic.dict_type = "data_billType", dic.dict_label, NULL)
  71. ) dic ON dic.dict_value = s.f_billtype
  72. LEFT JOIN t_address ltd ON s.pol_id = ltd.f_id
  73. LEFT JOIN t_address dtd ON s.pod_id = dtd.f_id
  74. </sql>
  75. <select id="selectTSeapriceList" parameterType="TSeaprice" resultMap="TSeapriceResult">
  76. <include refid="selectTSeapriceVo"/>
  77. <where>
  78. <if test="fBilltype != null ">and f_billtype = #{fBilltype}</if>
  79. <if test="fCorpid != null ">and f_corpid = #{fCorpid}</if>
  80. <if test="polId != null ">and pol_id = #{polId}</if>
  81. <if test="podId != null ">and pod_id = #{podId}</if>
  82. <if test="fBillstatus != null ">and f_billstatus = #{fBillstatus}</if>
  83. <if test="remarks != null and remarks != ''">and remarks = #{remarks}</if>
  84. <if test='validdateList != null and validdateList[0] != null and validdateList[0]!= ""'>
  85. and f_validdate &gt;= #{validdateList[0]}
  86. </if>
  87. <if test='validdateList != null and validdateList[1] != null and validdateList[1]!= ""'>
  88. and f_validdate &lt;= #{validdateList[1]}
  89. </if>
  90. <if test="fLineid != null and fLineid != ''">and f_lineid = #{fLineid}</if>
  91. <if test="fBookagentid != null and fBookagentid != ''">and f_bookagentid = #{fBookagentid}</if>
  92. <if test="fTransitPortId != null ">and f_transit_port_id = #{fTransitPortId}</if>
  93. <if test="fSailingSchedule != null and fSailingSchedule != ''">and f_sailing_schedule =
  94. #{fSailingSchedule}
  95. </if>
  96. <if test="fVoyage != null ">and f_voyage = #{fVoyage}</if>
  97. </where>
  98. </select>
  99. <select id="selectTSeapriceById" parameterType="Long" resultMap="TSeapriceResult">
  100. <include refid="selectTSeapriceVo"/>
  101. where s.f_id = #{fId}
  102. </select>
  103. <select id="selectTSeapriceMapList" parameterType="TSeaprice" resultType="Map">
  104. SELECT
  105. s.f_id fId,
  106. t.dict_label fBilltype,
  107. c.f_id fCorpid,
  108. c.f_cname fCorpName,
  109. CASE
  110. WHEN s.f_billstatus = '0' THEN
  111. '正常'
  112. WHEN s.f_billstatus = '1' THEN
  113. '停用'
  114. END AS fBillstatus,
  115. pol.f_name polName,
  116. pod.f_name podName,
  117. transit.f_name fTransitPortId,
  118. s.f_sailing_schedule fSailingSchedule,
  119. s.f_voyage fVoyage,
  120. s.create_by createBy,
  121. s.f_validdate fValiddate,
  122. s.remarks,
  123. s.f_lineid fLineid,
  124. s.f_bookagentid fBookagentid,
  125. j.f_name fLineName,
  126. q.f_name fBookagentName,
  127. s.pol_id polId,
  128. s.pod_id podId
  129. FROM
  130. t_seaprice s
  131. LEFT JOIN sys_dict_data t ON t.dict_value = s.f_billtype AND t.dict_type = 'data_billType'
  132. LEFT JOIN t_address pol ON s.pol_id = pol.f_id
  133. LEFT JOIN t_address pod ON s.pod_id = pod.f_id
  134. LEFT JOIN t_address transit ON s.f_transit_port_id = transit.f_id
  135. LEFT JOIN t_corps c ON c.f_id = s.f_corpid
  136. LEFT JOIN t_address j ON s.f_lineid = j.f_id
  137. LEFT JOIN t_corps q ON s.f_bookagentid = q.f_id
  138. <where>
  139. <if test="fBilltype != null ">and s.f_billtype = #{fBilltype}</if>
  140. <if test="fCorpid != null ">and s.f_corpid = #{fCorpid}</if>
  141. <if test="polId != null ">and s.pol_id = #{polId}</if>
  142. <if test="podId != null ">and s.pod_id = #{podId}</if>
  143. <if test="fValiddate != null ">and s.f_validdate = #{fValiddate}</if>
  144. <if test="fBillstatus != null ">and s.f_billstatus = #{fBillstatus}</if>
  145. <if test="remarks != null and remarks != ''">and remarks = #{remarks}</if>
  146. <if test="fLineid != null and fLineid != ''">and f_lineid = #{fLineid}</if>
  147. <if test="fBookagentid != null and fBookagentid != ''">and f_bookagentid = #{fBookagentid}</if>
  148. <if test="fTransitPortId != null ">and f_transit_port_id = #{fTransitPortId}</if>
  149. <if test="fSailingSchedule != null and fSailingSchedule != ''">and f_sailing_schedule =
  150. #{fSailingSchedule}
  151. </if>
  152. <if test="fVoyage != null ">and f_voyage = #{fVoyage}</if>
  153. <if test="fValiddateBegin != null and fValiddateBegin != '' and fValiddateEnd != null and fValiddateEnd!= ''">
  154. and s.f_validdate BETWEEN #{fValiddateBegin} AND #{fValiddateEnd}
  155. </if>
  156. </where>
  157. ORDER BY s.f_id DESC
  158. </select>
  159. <select id="checkSeapriceByValiddate" parameterType="TSeaprice" resultType="int">
  160. SELECT COUNT(f_id)
  161. FROM t_seaprice
  162. WHERE f_id != #{fId}
  163. AND f_billtype = #{fBilltype}
  164. AND f_corpid = #{fCorpid}
  165. AND pol_id = #{polId}
  166. AND pod_id = #{podId}
  167. AND pod_id = #{podId}
  168. AND f_validdate &gt;= #{fValiddate}
  169. </select>
  170. <select id="selectSeapriceItemAmt" parameterType="TSeaprice" resultType="BigDecimal">
  171. SELECT IFNULL(SUM(IF(#{fType} = '0', s.${fSpecification}, s.f_unitprice)), 0)
  172. FROM t_seaprice t
  173. LEFT JOIN t_seapriceitem s ON s.f_pid = t.f_id
  174. WHERE t.f_billtype = #{fBilltype}
  175. AND t.f_corpid = #{fCorpid}
  176. AND t.pol_id = #{polId}
  177. AND t.pod_id = #{podId}
  178. AND t.f_lineid = #{fLineid}
  179. AND t.f_bookagentid = #{fBookagentid}
  180. AND t.f_billstatus = 0
  181. AND t.del_flag = '0'
  182. AND s.f_type = #{fType}
  183. </select>
  184. <select id="selectSeapriceItem" parameterType="TSeaprice" resultType="Map">
  185. SELECT distinct f.f_name fFeeid, s.remark remark, IF(s.f_type = '0', s.${fSpecification}, s.f_unitprice) fUnitprice
  186. FROM t_seaprice t
  187. LEFT JOIN t_seapriceitem s ON s.f_pid = t.f_id
  188. LEFT JOIN t_fees f ON f.f_id = s.f_feeid
  189. WHERE t.f_billtype = #{fBilltype}
  190. AND t.f_corpid = #{fCorpid}
  191. AND t.f_validdate &gt;= #{fValiddate}
  192. AND t.pol_id = #{polId}
  193. AND t.pod_id = #{podId}
  194. AND t.f_lineid = #{fLineid}
  195. AND t.f_bookagentid = #{fBookagentid}
  196. AND t.f_billstatus = 0
  197. AND t.del_flag = '0'
  198. AND f.f_name != '海运费'
  199. ORDER BY s.f_type, s.f_id asc
  200. </select>
  201. <select id="selectShippingFee" parameterType="TSeaprice" resultType="com.ruoyi.quotation.domain.TSeapriceitem">
  202. SELECT s.f_id fId,
  203. s.f_feeid fFeeid,
  204. IFNULL(s.${fSpecification}, 0) fUnitprice,
  205. IFNULL(s.f_exrate, 0) fExrate,
  206. IFNULL(IFNULL(s.${fSpecification}, 0) * IFNULL(s.f_exrate, 0), 0) rmb
  207. FROM t_seaprice t
  208. LEFT JOIN t_seapriceitem s ON s.f_pid = t.f_id
  209. LEFT JOIN t_fees f ON f.f_id = s.f_feeid
  210. WHERE t.f_billtype = #{fBilltype}
  211. AND t.f_corpid = #{fCorpid}
  212. AND t.f_validdate &gt;= #{fValiddate}
  213. AND t.f_billstatus = 0
  214. AND t.del_flag = '0'
  215. AND f.f_name = '海运费'
  216. ORDER BY s.f_id asc LIMIT 0, 1
  217. </select>
  218. <insert id="insertTSeaprice" parameterType="TSeaprice" useGeneratedKeys="true" keyProperty="fId">
  219. insert into t_seaprice
  220. <trim prefix="(" suffix=")" suffixOverrides=",">
  221. <if test="fBilltype != null">f_billtype,</if>
  222. <if test="fCorpid != null">f_corpid,</if>
  223. <if test="polId != null">pol_id,</if>
  224. <if test="podId != null">pod_id,</if>
  225. <if test="fValiddate != null">f_validdate,</if>
  226. <if test="fDateChanged != null">f_date_changed,</if>
  227. <if test="fBillstatus != null">f_billstatus,</if>
  228. <if test="delFlag != null">del_flag,</if>
  229. <if test="createBy != null">create_by,</if>
  230. <if test="createTime != null">create_time,</if>
  231. <if test="updateBy != null">update_by,</if>
  232. <if test="updateTime != null">update_time,</if>
  233. <if test="remarks != null">remarks,</if>
  234. <if test="fLineid != null">f_lineid,</if>
  235. <if test="fBookagentid != null">f_bookagentid,</if>
  236. <if test="fTransitPortId != null">f_transit_port_id,</if>
  237. <if test="fSailingSchedule != null">f_sailing_schedule,</if>
  238. <if test="fVoyage != null">f_voyage,</if>
  239. </trim>
  240. <trim prefix="values (" suffix=")" suffixOverrides=",">
  241. <if test="fBilltype != null">#{fBilltype},</if>
  242. <if test="fCorpid != null">#{fCorpid},</if>
  243. <if test="polId != null">#{polId},</if>
  244. <if test="podId != null">#{podId},</if>
  245. <if test="fValiddate != null">#{fValiddate},</if>
  246. <if test="fDateChanged != null">#{fDateChanged},</if>
  247. <if test="fBillstatus != null">#{fBillstatus},</if>
  248. <if test="delFlag != null">#{delFlag},</if>
  249. <if test="createBy != null">#{createBy},</if>
  250. <if test="createTime != null">#{createTime},</if>
  251. <if test="updateBy != null">#{updateBy},</if>
  252. <if test="updateTime != null">#{updateTime},</if>
  253. <if test="remarks != null">#{remarks},</if>
  254. <if test="fLineid != null">#{fLineid},</if>
  255. <if test="fBookagentid != null">#{fBookagentid},</if>
  256. <if test="fTransitPortId != null">#{fTransitPortId},</if>
  257. <if test="fSailingSchedule != null">#{fSailingSchedule},</if>
  258. <if test="fVoyage != null">#{fVoyage},</if>
  259. </trim>
  260. </insert>
  261. <update id="updateTSeaprice" parameterType="TSeaprice">
  262. update t_seaprice
  263. <trim prefix="SET" suffixOverrides=",">
  264. <if test="fBilltype != null">f_billtype = #{fBilltype},</if>
  265. <if test="fCorpid != null">f_corpid = #{fCorpid},</if>
  266. <if test="polId != null">pol_id = #{polId},</if>
  267. <if test="podId != null">pod_id = #{podId},</if>
  268. <if test="fValiddate != null">f_validdate = #{fValiddate},</if>
  269. <if test="fBillstatus != null">f_billstatus = #{fBillstatus},</if>
  270. <if test="fDateChanged != null">f_date_changed = #{fDateChanged},</if>
  271. <if test="delFlag != null">del_flag = #{delFlag},</if>
  272. <if test="createBy != null">create_by = #{createBy},</if>
  273. <if test="createTime != null">create_time = #{createTime},</if>
  274. <if test="updateBy != null">update_by = #{updateBy},</if>
  275. <if test="updateTime != null">update_time = #{updateTime},</if>
  276. <if test="remarks != null">remarks = #{remarks},</if>
  277. <if test="fLineid != null">f_lineid = #{fLineid},</if>
  278. <if test="fBookagentid != null">f_bookagentid = #{fBookagentid},</if>
  279. <if test="fTransitPortId != null">f_transit_port_id = #{fTransitPortId},</if>
  280. <if test="fSailingSchedule != null">f_sailing_schedule = #{fSailingSchedule},</if>
  281. <if test="fVoyage != null">f_voyage = #{fVoyage},</if>
  282. </trim>
  283. where f_id = #{fId}
  284. </update>
  285. <delete id="deleteTSeapriceById" parameterType="Long">
  286. delete
  287. from t_seaprice
  288. where f_id = #{fId}
  289. </delete>
  290. <delete id="deleteTSeapriceByIds" parameterType="String">
  291. delete from t_seaprice where f_id in
  292. <foreach item="fId" collection="array" open="(" separator="," close=")">
  293. #{fId}
  294. </foreach>
  295. </delete>
  296. </mapper>