TVoyageMapper.xml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  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.TVoyageMapper">
  6. <resultMap type="TVoyage" id="TVoyageResult">
  7. <result property="fId" column="f_id" />
  8. <result property="fPid" column="f_pid" />
  9. <result property="fNo" column="f_no" />
  10. <result property="fPortofloadid" column="f_portofloadid" />
  11. <result property="fPortofdischargeid" column="f_portofdischargeid" />
  12. <result property="fDistinationid" column="f_distinationid" />
  13. <result property="fPortoftransshipment" column="f_portoftransshipment" />
  14. <result property="fEtd" column="f_ETD" />
  15. <result property="fAtd" column="f_ATD" />
  16. <result property="fEta" column="f_ETA" />
  17. <result property="fAta" column="f_ATA" />
  18. <result property="fDays" column="f_days" />
  19. <result property="fDucomentrayoffdate" column="f_ducomentrayoffdate" />
  20. <result property="fCutoffdate" column="f_cutoffdate" />
  21. <result property="fTeu" column="f_teu" />
  22. <result property="fManageid" column="f_manageid" />
  23. <result property="fTel" column="f_tel" />
  24. <result property="fStatus" column="f_status" />
  25. <result property="createBy" column="create_by" />
  26. <result property="createTime" column="create_time" />
  27. <result property="updateBy" column="update_by" />
  28. <result property="updateTime" column="update_time" />
  29. <result property="remark" column="remark" />
  30. </resultMap>
  31. <sql id="selectTVoyageVo">
  32. select f_id, f_pid, f_no, f_portofloadid, f_portofdischargeid, f_distinationid, f_portoftransshipment, f_ETD, f_ATD, f_ETA, f_ATA, f_days, f_ducomentrayoffdate, f_cutoffdate, f_teu, f_manageid, f_tel, case when f_status = 'T' then '正常' else '停用' end as f_status, create_by, create_time, update_by, update_time, remark from t_voyage
  33. </sql>
  34. <select id="selectTVoyageList" parameterType="TVoyage" resultMap="TVoyageResult">
  35. SELECT
  36. tv.f_id,
  37. tv.f_pid,
  38. te.f_name pidName,
  39. tv.f_no,
  40. tv.f_portofloadid,
  41. ta.f_name portofloadidName,
  42. tv.f_portofdischargeid,
  43. td.f_name portofdischargeidName,
  44. tv.f_distinationid,
  45. tr.f_name distinationidName,
  46. tv.f_portoftransshipment,
  47. ts.f_name portoftransshipmentName,
  48. tv.f_ETD,
  49. tv.f_ATD,
  50. tv.f_ETA,
  51. tv.f_ATA,
  52. tv.f_days,
  53. tv.f_ducomentrayoffdate,
  54. tv.f_cutoffdate,
  55. tv.f_teu,
  56. tv.f_manageid,
  57. su.user_name manageidName,
  58. tv.f_tel,
  59. CASE
  60. WHEN tv.f_status = 'T' THEN
  61. '正常' ELSE '停用'
  62. END AS f_status,
  63. TIMESTAMPDIFF(DAY,tv.f_ETD,DATE_FORMAT(tv.f_ducomentrayoffdate, '%Y-%m-%d %H:%i:%S')) closing,
  64. tv.create_by,
  65. tv.create_time,
  66. tv.update_by,
  67. tv.update_time,
  68. tv.remark
  69. FROM
  70. t_voyage tv
  71. LEFT JOIN t_vessel te ON tv.f_pid = te.f_id
  72. LEFT JOIN t_address ta ON tv.f_portofloadid = ta.f_id
  73. LEFT JOIN t_address td ON tv.f_portofdischargeid = td.f_id
  74. LEFT JOIN t_address tr ON tv.f_distinationid = tr.f_id
  75. LEFT JOIN t_address ts ON tv.f_portoftransshipment = ts.f_id
  76. LEFT JOIN sys_user su ON tv.f_manageid = su.user_id
  77. <where>
  78. tv.f_status = 'T'
  79. <if test="fPid != null "> and tv.f_pid = #{fPid}</if>
  80. <if test="fNo != null and fNo != ''"> and tv.f_no = #{fNo}</if>
  81. <if test="fPortofloadid != null "> and tv.f_portofloadid = #{fPortofloadid}</if>
  82. <if test="fPortofdischargeid != null "> and tv.f_portofdischargeid = #{fPortofdischargeid}</if>
  83. <if test="fDistinationid != null "> and tv.f_distinationid = #{fDistinationid}</if>
  84. <if test="fPortoftransshipment != null "> and tv.f_portoftransshipment = #{fPortoftransshipment}</if>
  85. <if test="fPortoftransshipment == null and empty != null"> and tv.f_portoftransshipment IS NULL</if>
  86. <if test="fEtd != null "> and tv.f_ETD = #{fEtd}</if>
  87. <if test="fAtd != null "> and tv.f_ATD = #{fAtd}</if>
  88. <if test="fEta != null "> and tv.f_ETA = #{fEta}</if>
  89. <if test="fAta != null "> and tv.f_ATA = #{fAta}</if>
  90. <if test="fDays != null "> and tv.f_days = #{fDays}</if>
  91. <if test="fDucomentrayoffdate != null "> and tv.f_ducomentrayoffdate = #{fDucomentrayoffdate}</if>
  92. <if test="fCutoffdate != null "> and tv.f_cutoffdate = #{fCutoffdate}</if>
  93. <if test="fTeu != null and fTeu != ''"> and tv.f_teu = #{fTeu}</if>
  94. <if test="fManageid != null "> and tv.f_manageid = #{fManageid}</if>
  95. <if test="fTel != null and fTel != ''"> and tv.f_tel = #{fTel}</if>
  96. <if test="fStatus != null and fStatus != ''"> and tv.f_status = #{fStatus}</if>
  97. <if test="createBy != null and createBy != ''">and tv.create_by like concat('%', #{createBy}, '%')</if>
  98. <if test="remark != null and remark != ''">and tv.remark like concat('%', #{remark}, '%')</if>
  99. <if test="pidName != null and pidName != ''"> and te.f_name = #{pidName}</if>
  100. <if test="portofloadidName != null and portofloadidName != ''"> and ta.f_name = #{portofloadidName}</if>
  101. <if test="portofdischargeidName != null and portofdischargeidName != ''"> and td.f_name = #{portofdischargeidName}</if>
  102. <if test="distinationidName != null and distinationidName != ''"> and tr.f_name = #{distinationidName}</if>
  103. <if test="portoftransshipmentName != null and portoftransshipmentName != ''"> and ts.f_name = #{portoftransshipmentName}</if>
  104. <if test='cLoadDate != null and cLoadDate[0] != null and cLoadDate[0]!= ""'>
  105. and tv.create_time &gt;= #{cLoadDate[0]}
  106. </if>
  107. <if test='cLoadDate != null and cLoadDate[1] != null and cLoadDate[1]!= ""'>
  108. and tv.create_time &lt;= #{cLoadDate[1]}
  109. </if>
  110. </where>
  111. </select>
  112. <select id="selectTVoyageById" parameterType="Long" resultMap="TVoyageResult">
  113. SELECT
  114. tv.f_id,
  115. tv.f_pid,
  116. te.f_name pidName,
  117. tv.f_no,
  118. tv.f_portofloadid,
  119. ta.f_name portofloadidName,
  120. tv.f_portofdischargeid,
  121. td.f_name portofdischargeidName,
  122. tv.f_distinationid,
  123. tr.f_name distinationidName,
  124. tv.f_portoftransshipment,
  125. ts.f_name portoftransshipmentName,
  126. tv.f_ETD,
  127. tv.f_ATD,
  128. tv.f_ETA,
  129. tv.f_ATA,
  130. tv.f_days,
  131. tv.f_ducomentrayoffdate,
  132. tv.f_cutoffdate,
  133. tv.f_teu,
  134. tv.f_manageid,
  135. su.user_name manageidName,
  136. tv.f_tel,
  137. CASE
  138. WHEN tv.f_status = 'T' THEN
  139. '正常' ELSE '停用'
  140. END AS f_status,
  141. TIMESTAMPDIFF(
  142. DAY,
  143. tv.f_ETD,
  144. DATE_FORMAT( tv.f_cutoffdate, '%Y-%m-%d %H:%i:%S' )) closing,
  145. tv.create_by,
  146. tv.create_time,
  147. tv.update_by,
  148. tv.update_time,
  149. tv.remark
  150. FROM
  151. t_voyage tv
  152. LEFT JOIN t_vessel te ON tv.f_pid = te.f_id
  153. LEFT JOIN t_address ta ON tv.f_portofloadid = ta.f_id
  154. LEFT JOIN t_address td ON tv.f_portofdischargeid = td.f_id
  155. LEFT JOIN t_address tr ON tv.f_distinationid = tr.f_id
  156. LEFT JOIN t_address ts ON tv.f_portoftransshipment = ts.f_id
  157. LEFT JOIN sys_user su ON tv.f_manageid = su.user_id
  158. WHERE
  159. tv.f_id = #{fId}
  160. </select>
  161. <insert id="insertTVoyage" parameterType="TVoyage" useGeneratedKeys="true" keyProperty="fId">
  162. insert into t_voyage
  163. <trim prefix="(" suffix=")" suffixOverrides=",">
  164. <if test="fPid != null">f_pid,</if>
  165. <if test="fNo != null and fNo != ''">f_no,</if>
  166. <if test="fPortofloadid != null">f_portofloadid,</if>
  167. <if test="fPortofdischargeid != null">f_portofdischargeid,</if>
  168. <if test="fDistinationid != null">f_distinationid,</if>
  169. <if test="fPortoftransshipment != null">f_portoftransshipment,</if>
  170. <if test="fEtd != null">f_ETD,</if>
  171. <if test="fAtd != null">f_ATD,</if>
  172. <if test="fEta != null">f_ETA,</if>
  173. <if test="fAta != null">f_ATA,</if>
  174. <if test="fDays != null">f_days,</if>
  175. <if test="fDucomentrayoffdate != null">f_ducomentrayoffdate,</if>
  176. <if test="fCutoffdate != null">f_cutoffdate,</if>
  177. <if test="fTeu != null">f_teu,</if>
  178. <if test="fManageid != null">f_manageid,</if>
  179. <if test="fTel != null and fTel != ''">f_tel,</if>
  180. <if test="fStatus != null">f_status,</if>
  181. <if test="createBy != null">create_by,</if>
  182. <if test="createTime != null">create_time,</if>
  183. <if test="updateBy != null">update_by,</if>
  184. <if test="updateTime != null">update_time,</if>
  185. <if test="remark != null">remark,</if>
  186. </trim>
  187. <trim prefix="values (" suffix=")" suffixOverrides=",">
  188. <if test="fPid != null">#{fPid},</if>
  189. <if test="fNo != null and fNo != ''">#{fNo},</if>
  190. <if test="fPortofloadid != null">#{fPortofloadid},</if>
  191. <if test="fPortofdischargeid != null">#{fPortofdischargeid},</if>
  192. <if test="fDistinationid != null">#{fDistinationid},</if>
  193. <if test="fPortoftransshipment != null">#{fPortoftransshipment},</if>
  194. <if test="fEtd != null">#{fEtd},</if>
  195. <if test="fAtd != null">#{fAtd},</if>
  196. <if test="fEta != null">#{fEta},</if>
  197. <if test="fAta != null">#{fAta},</if>
  198. <if test="fDays != null">#{fDays},</if>
  199. <if test="fDucomentrayoffdate != null">#{fDucomentrayoffdate},</if>
  200. <if test="fCutoffdate != null">#{fCutoffdate},</if>
  201. <if test="fTeu != null">#{fTeu},</if>
  202. <if test="fManageid != null">#{fManageid},</if>
  203. <if test="fTel != null and fTel != ''">#{fTel},</if>
  204. <if test="fStatus != null">#{fStatus},</if>
  205. <if test="createBy != null">#{createBy},</if>
  206. <if test="createTime != null">#{createTime},</if>
  207. <if test="updateBy != null">#{updateBy},</if>
  208. <if test="updateTime != null">#{updateTime},</if>
  209. <if test="remark != null">#{remark},</if>
  210. </trim>
  211. </insert>
  212. <update id="updateTVoyage" parameterType="TVoyage">
  213. update t_voyage
  214. <trim prefix="SET" suffixOverrides=",">
  215. <if test="fPid != null">f_pid = #{fPid},</if>
  216. <if test="fNo != null and fNo != ''">f_no = #{fNo},</if>
  217. <if test="fPortofloadid != null">f_portofloadid = #{fPortofloadid},</if>
  218. <if test="fPortofdischargeid != null">f_portofdischargeid = #{fPortofdischargeid},</if>
  219. <if test="fPortofdischargeid == null">f_portofdischargeid = null,</if>
  220. <if test="fDistinationid != null">f_distinationid = #{fDistinationid},</if>
  221. <if test="fPortoftransshipment != null">f_portoftransshipment = #{fPortoftransshipment},</if>
  222. <if test="fPortoftransshipment == null">f_portoftransshipment = null,</if>
  223. <if test="fEtd != null">f_ETD = #{fEtd},</if>
  224. <if test="fAtd != null">f_ATD = #{fAtd},</if>
  225. <if test="fEta != null">f_ETA = #{fEta},</if>
  226. <if test="fAta != null">f_ATA = #{fAta},</if>
  227. <if test="fDays != null">f_days = #{fDays},</if>
  228. <if test="fDucomentrayoffdate != null">f_ducomentrayoffdate = #{fDucomentrayoffdate},</if>
  229. <if test="fCutoffdate != null">f_cutoffdate = #{fCutoffdate},</if>
  230. <if test="fTeu != null">f_teu = #{fTeu},</if>
  231. <if test="fManageid != null">f_manageid = #{fManageid},</if>
  232. <if test="fTel != null and fTel != ''">f_tel = #{fTel},</if>
  233. <if test="fStatus != null">f_status = #{fStatus},</if>
  234. <if test="createBy != null">create_by = #{createBy},</if>
  235. <if test="createTime != null">create_time = #{createTime},</if>
  236. <if test="updateBy != null">update_by = #{updateBy},</if>
  237. <if test="updateTime != null">update_time = #{updateTime},</if>
  238. <if test="remark != null">remark = #{remark},</if>
  239. </trim>
  240. where f_id = #{fId}
  241. </update>
  242. <delete id="deleteTVoyageById" parameterType="Long">
  243. delete from t_voyage where f_id = #{fId}
  244. </delete>
  245. <delete id="deleteTVoyageByIds" parameterType="String">
  246. delete from t_voyage where f_id in
  247. <foreach item="fId" collection="array" open="(" separator="," close=")">
  248. #{fId}
  249. </foreach>
  250. </delete>
  251. <select id="selectTVoyagefNo" parameterType="TVoyage" resultMap="TVoyageResult">
  252. SELECT
  253. f_id,
  254. f_no
  255. FROM
  256. t_voyage
  257. WHERE
  258. f_no = #{fNo}
  259. </select>
  260. <select id="selectTVoyagefNumber" resultType="map">
  261. SELECT
  262. f_id fId,
  263. f_no fNo
  264. FROM
  265. t_voyage
  266. WHERE
  267. f_status = 'T'
  268. <if test="fNo != null and fNo != ''">
  269. and f_no like concat('%', #{fNo}, '%')
  270. </if>
  271. </select>
  272. </mapper>