TCntrnoMapper.xml 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701
  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.TCntrnoMapper">
  6. <resultMap type="TCntrno" id="TCntrnoResult">
  7. <result property="fId" column="f_id"/>
  8. <result property="fNo" column="f_no"/>
  9. <result property="fTypeid" column="f_typeid"/>
  10. <result property="fOwner" column="f_owner"/>
  11. <result property="fSource" column="f_source"/>
  12. <result property="fRent" column="f_rent"/>
  13. <result property="fUpdatetime" column="f_updatetime"/>
  14. <result property="fUpdateaddress" column="f_updateaddress"/>
  15. <result property="fUpdateef" column="f_updateEF"/>
  16. <result property="fCntrstatus" column="f_cntrstatus"/>
  17. <result property="fStatus" column="f_status"/>
  18. <result property="createBy" column="create_by"/>
  19. <result property="createTime" column="create_time"/>
  20. <result property="updateBy" column="update_by"/>
  21. <result property="updateTime" column="update_time"/>
  22. <result property="remark" column="remark"/>
  23. <result property="fOpctnstatus" column="f_opctnstatus"/>
  24. <result property="fSealno" column="f_sealno"/>
  25. <result property="fBuildBoxTime" column="f_build_box_time" />
  26. <result property="fBoxTurtleYear" column="f_box_turtle_year" />
  27. <result property="fBoxTurtleMonth" column="f_box_turtle_month" />
  28. <result property="fBoxLord" column="f_box_lord" />
  29. <result property="fPactDealHorn" column="f_pact_deal_horn" />
  30. <result property="fMblno" column="f_mblno" />
  31. <result property="fBoxWeight" column="f_box_weight" />
  32. </resultMap>
  33. <sql id="selectTCntrnoVo">
  34. select f_id, f_no, f_typeid, f_owner, f_source, f_rent, f_updatetime, f_updateaddress, f_updateEF, f_cntrstatus, case when f_status = 'T' then '正常' else '停用' end as f_status,f_opctnstatus,f_sealno,create_by, create_time, update_by, update_time, remark,
  35. f_build_box_time,f_box_turtle_year,f_box_turtle_month,f_box_lord,f_pact_deal_horn,f_mblno,f_box_weight from t_cntrno
  36. </sql>
  37. <select id="selectTCntrnoList" parameterType="TCntrno" resultMap="TCntrnoResult">
  38. <include refid="selectTCntrnoVo"/>
  39. <where>
  40. <if test="fNo != null and fNo != ''">and f_no = #{fNo}</if>
  41. <if test="fTypeid != null ">and f_typeid = #{fTypeid}</if>
  42. <if test="fOwner != null and fOwner != ''">and f_owner = #{fOwner}</if>
  43. <if test="fSource != null and fSource != ''">and f_source = #{fSource}</if>
  44. <if test="fRent != null and fRent != ''">and f_rent = #{fRent}</if>
  45. <if test="fUpdatetime != null ">and f_updatetime = #{fUpdatetime}</if>
  46. <if test="fUpdateaddress != null and fUpdateaddress != ''">and f_updateaddress = #{fUpdateaddress}</if>
  47. <if test="fUpdateef != null and fUpdateef != ''">and f_updateEF = #{fUpdateef}</if>
  48. <if test="fCntrstatus != null and fCntrstatus != ''">and f_cntrstatus = #{fCntrstatus}</if>
  49. <if test="fStatus != null and fStatus != ''">and f_status = #{fStatus}</if>
  50. <if test="fOpctnstatus != null and fOpctnstatus != ''">and f_opctnstatus = #{fOpctnstatus}</if>
  51. <if test="fSealno != null and fSealno != ''">and f_sealno = #{fSealno}</if>
  52. <if test='cLoadDate != null and cLoadDate[0] != null and cLoadDate[0]!= ""'>
  53. and create_time &gt;= #{cLoadDate[0]}
  54. </if>
  55. <if test='cLoadDate != null and cLoadDate[1] != null and cLoadDate[1]!= ""'>
  56. and create_time &lt;= #{cLoadDate[1]}
  57. </if>
  58. <if test="fBuildBoxTime != null "> and f_build_box_time = #{fBuildBoxTime}</if>
  59. <if test="fBoxTurtleYear != null and fBoxTurtleYear != ''"> and f_box_turtle_year = #{fBoxTurtleYear}</if>
  60. <if test="fBoxTurtleMonth != null and fBoxTurtleMonth != ''"> and f_box_turtle_month = #{fBoxTurtleMonth}</if>
  61. <if test="fBoxLord != null and fBoxLord != ''"> and f_box_lord = #{fBoxLord}</if>
  62. <if test="fPactDealHorn != null and fPactDealHorn != ''"> and f_pact_deal_horn = #{fPactDealHorn}</if>
  63. <if test="fMblno != null and fMblno != ''"> and f_mblno = #{fMblno}</if>
  64. <if test="fBoxWeight != null "> and f_box_weight = #{fBoxWeight}</if>
  65. </where>
  66. </select>
  67. <select id="selectTcntrnoMessage" parameterType="TCntrno" resultMap="TCntrnoResult">
  68. SELECT
  69. tc.f_id,
  70. tc.f_no,
  71. tc.f_typeid,
  72. t.f_no typeidName,
  73. t.f_cntrsize cntrsize,
  74. prs.dict_label cntrsizeName,
  75. tc.f_owner,
  76. pro.dict_label ownerName,
  77. tc.f_source,
  78. sd.dict_label sourceName,
  79. tc.f_rent,
  80. sdd.dict_label rentName,
  81. tc.f_updatetime,
  82. tc.f_updateaddress,
  83. address.f_name addressName,
  84. tc.f_updateEF,
  85. sdda.dict_label updateEFName,
  86. tc.f_cntrstatus,
  87. pr.dict_label cntrstatusName,
  88. case when tc.f_status = 'T' then '正常' else '停用' end as f_status,
  89. prd.dict_label opctnstatusName,
  90. tc.create_by,
  91. tc.create_time,
  92. tc.update_by,
  93. tc.update_time,
  94. tc.remark,
  95. tc.f_build_box_time,
  96. tc.f_box_turtle_year,
  97. tc.f_box_turtle_month,
  98. tc.f_box_lord,
  99. tc.f_pact_deal_horn
  100. FROM
  101. t_cntrno tc
  102. LEFT JOIN sys_dict_data pro ON pro.dict_value = tc.f_owner
  103. AND pro.dict_type = 'f_owner'
  104. LEFT JOIN sys_dict_data sd ON sd.dict_value = tc.f_source
  105. AND sd.dict_type = 'f_source'
  106. LEFT JOIN sys_dict_data sdd ON sdd.dict_value = tc.f_rent
  107. AND sdd.dict_type = 'f_rent'
  108. LEFT JOIN sys_dict_data sdda ON sdda.dict_value = tc.f_updateEF
  109. AND sdda.dict_type = 'f_updateEF'
  110. LEFT JOIN sys_dict_data pr ON pr.dict_value = tc.f_cntrstatus
  111. AND pr.dict_type = 'f_cntrstatus'
  112. LEFT JOIN t_cntr t ON tc.f_typeid = t.f_id
  113. LEFT JOIN sys_dict_data prs ON prs.dict_value = t.f_cntrsize
  114. AND prs.dict_type = 'f_cntrsize'
  115. LEFT JOIN sys_dict_data prd ON prd.dict_value = tc.f_opctnstatus
  116. AND prd.dict_type = 'f_opctnstatus'
  117. LEFT JOIN t_address address ON address.f_id = tc.f_updateaddress
  118. <where>
  119. tc.f_status = 'T'
  120. <if test="tc.fNo != null and tc.fNo != ''">and tc.f_no like concat('%', #{tc.fNo}, '%') </if>
  121. <if test="tc.fTypeid != null ">and tc.f_typeid = #{tc.fTypeid}</if>
  122. <if test="tc.fOwner != null and tc.fOwner != ''">and tc.f_owner = #{tc.fOwner}</if>
  123. <if test="tc.fSource != null and tc.fSource != ''">and tc.f_source = #{tc.fSource}</if>
  124. <if test="tc.fRent != null and tc.fRent != ''">and tc.f_rent = #{tc.fRent}</if>
  125. <if test="tc.fUpdatetime != null ">and tc.f_updatetime = #{tc.fUpdatetime}</if>
  126. <if test="tc.fUpdateaddress != null and tc.fUpdateaddress != ''">and tc.f_updateaddress = #{tc.fUpdateaddress}</if>
  127. <if test="tc.fUpdateef != null and tc.fUpdateef != ''">and tc.f_updateEF = #{tc.fUpdateef}</if>
  128. <if test="tc.fCntrstatus != null and tc.fCntrstatus != ''">and tc.f_cntrstatus = #{tc.fCntrstatus}</if>
  129. <if test="tc.fStatus != null and tc.fStatus != ''">and tc.f_status = #{tc.fStatus}</if>
  130. <if test="tc.fOpctnstatus != null and tc.fOpctnstatus != ''">and tc.f_opctnstatus = #{tc.fOpctnstatus}</if>
  131. <if test="tc.fSealno != null and tc.fSealno != ''">and tc.f_sealno = #{tc.fSealno}</if>
  132. <if test='tc.cLoadDate != null and tc.cLoadDate[0] != null and tc.cLoadDate[0]!= ""'>
  133. and tc.create_time &gt;= #{tc.cLoadDate[0]}
  134. </if>
  135. <if test='tc.cLoadDate != null and tc.cLoadDate[1] != null and tc.cLoadDate[1]!= ""'>
  136. and tc.create_time &lt;= #{tc.cLoadDate[1]}
  137. </if>
  138. <if test="address != null and address != ''">and address.f_name = #{address}</if>
  139. <if test="typeidName != null and typeidName != ''">and t.f_no = #{typeidName}</if>
  140. <if test="cntrstatusName != null and cntrstatusName != ''">and pr.dict_label = #{cntrstatusName}</if>
  141. <if test="updateEFName != null and updateEFName != ''">and sdda.dict_label = #{updateEFName}</if>
  142. <if test="cntrsize != null ">and t.f_cntrsize = #{cntrsize}</if>
  143. <if test="tc.fBuildBoxTime != null "> and tc.f_build_box_time = #{fBuildBoxTime}</if>
  144. <if test="tc.fBoxTurtleYear != null and tc.fBoxTurtleYear != ''"> and tc.f_box_turtle_year = #{fBoxTurtleYear}</if>
  145. <if test="tc.fBoxTurtleMonth != null and tc.fBoxTurtleMonth != ''"> and tc.f_box_turtle_month = #{fBoxTurtleMonth}</if>
  146. <if test="tc.fBoxLord != null and tc.fBoxLord != ''"> and tc.f_box_lord = #{tc.fBoxLord}</if>
  147. <if test="tc.fPactDealHorn != null and tc.fPactDealHorn != ''"> and tc.f_pact_deal_horn = #{tc.fPactDealHorn}</if>
  148. <if test="tc.fMblno != null and tc.fMblno != ''"> and tc.f_mblno = #{tc.fMblno}</if>
  149. <if test="tc.fBoxWeight != null "> and tc.f_box_weight = #{tc.fBoxWeight}</if>
  150. </where>
  151. ORDER BY tc.f_no,CONVERT(tc.f_updateaddress USING gbk),CONVERT(t.f_no USING gbk),
  152. tc.f_updateEF,tc.f_cntrstatus,tc.f_owner
  153. </select>
  154. <select id="selectTCntrnoById" parameterType="Long" resultMap="TCntrnoResult">
  155. SELECT
  156. tc.f_id,
  157. tc.f_no,
  158. tc.f_typeid,
  159. tc.f_sealno,
  160. t.f_name typeidName,
  161. t.f_cntrsize cntrsize,
  162. prs.dict_label cntrsizeName,
  163. tc.f_owner,
  164. pro.dict_label ownerName,
  165. tc.f_source,
  166. sd.dict_label sourceName,
  167. tc.f_rent,
  168. sdd.dict_label rentName,
  169. tc.f_updatetime,
  170. tc.f_updateaddress,
  171. address.f_name addressName,
  172. tc.f_updateEF,
  173. sdda.dict_label updateEFName,
  174. tc.f_cntrstatus,
  175. pr.dict_label cntrstatusName,
  176. case when tc.f_status = 'T' then '正常' else '停用' end as f_status,
  177. tc.f_opctnstatus,
  178. tc.create_by,
  179. tc.create_time,
  180. tc.update_by,
  181. tc.update_time,
  182. tc.remark,
  183. tc.f_build_box_time,
  184. tc.f_box_turtle_year,
  185. tc.f_box_turtle_month,
  186. tc.f_box_lord,
  187. tc.f_pact_deal_horn
  188. FROM
  189. t_cntrno tc
  190. LEFT JOIN sys_dict_data pro ON pro.dict_value = tc.f_owner
  191. AND pro.dict_type = 'f_owner'
  192. LEFT JOIN sys_dict_data sd ON sd.dict_value = tc.f_source
  193. AND sd.dict_type = 'f_source'
  194. LEFT JOIN sys_dict_data sdd ON sdd.dict_value = tc.f_rent
  195. AND sdd.dict_type = 'f_rent'
  196. LEFT JOIN sys_dict_data sdda ON sdda.dict_value = tc.f_updateEF
  197. AND sdda.dict_type = 'f_updateEF'
  198. LEFT JOIN sys_dict_data pr ON pr.dict_value = tc.f_cntrstatus
  199. AND pr.dict_type = 'f_cntrstatus'
  200. LEFT JOIN t_cntr t ON tc.f_typeid = t.f_id
  201. LEFT JOIN sys_dict_data prs ON prs.dict_value = t.f_cntrsize
  202. AND prs.dict_type = 'f_cntrsize'
  203. LEFT JOIN t_address address ON address.f_id = tc.f_updateaddress
  204. where tc.f_id = #{fId}
  205. </select>
  206. <select id="selectTCnTrNoByfNo" parameterType="string" resultMap="TCntrnoResult">
  207. SELECT
  208. tc.f_id,
  209. tc.f_no,
  210. tc.f_typeid,
  211. tc.f_sealno,
  212. t.f_no typeidName,
  213. t.f_cntrsize cntrsize,
  214. prs.dict_label cntrsizeName,
  215. tc.f_owner,
  216. pro.dict_label ownerName,
  217. tc.f_source,
  218. sd.dict_label sourceName,
  219. tc.f_rent,
  220. sdd.dict_label rentName,
  221. tc.f_updatetime,
  222. tc.f_updateaddress,
  223. address.f_name addressName,
  224. tc.f_updateEF,
  225. sdda.dict_label updateEFName,
  226. tc.f_cntrstatus,
  227. pr.dict_label cntrstatusName,
  228. case when tc.f_status = 'T' then '正常' else '停用' end as f_status,
  229. tc.f_opctnstatus,
  230. tc.create_by,
  231. tc.create_time,
  232. tc.update_by,
  233. tc.update_time,
  234. tc.remark,
  235. tc.f_build_box_time,
  236. tc.f_box_turtle_year,
  237. tc.f_box_turtle_month,
  238. tc.f_box_lord,
  239. tc.f_pact_deal_horn
  240. FROM
  241. t_cntrno tc
  242. LEFT JOIN sys_dict_data pro ON pro.dict_value = tc.f_owner
  243. AND pro.dict_type = 'f_owner'
  244. LEFT JOIN sys_dict_data sd ON sd.dict_value = tc.f_source
  245. AND sd.dict_type = 'f_source'
  246. LEFT JOIN sys_dict_data sdd ON sdd.dict_value = tc.f_rent
  247. AND sdd.dict_type = 'f_rent'
  248. LEFT JOIN sys_dict_data sdda ON sdda.dict_value = tc.f_updateEF
  249. AND sdda.dict_type = 'f_updateEF'
  250. LEFT JOIN sys_dict_data pr ON pr.dict_value = tc.f_cntrstatus
  251. AND pr.dict_type = 'f_cntrstatus'
  252. LEFT JOIN t_cntr t ON tc.f_typeid = t.f_id
  253. LEFT JOIN sys_dict_data prs ON prs.dict_value = t.f_cntrsize
  254. AND prs.dict_type = 'f_cntrsize'
  255. LEFT JOIN t_address address ON address.f_id = tc.f_updateaddress
  256. where tc.f_no = #{fNo}
  257. </select>
  258. <insert id="insertTCntrno" parameterType="TCntrno">
  259. insert into t_cntrno
  260. <trim prefix="(" suffix=")" suffixOverrides=",">
  261. <if test="fId != null">f_id,</if>
  262. <if test="fNo != null and fNo != ''">f_no,</if>
  263. <if test="fTypeid != null">f_typeid,</if>
  264. <if test="fOwner != null and fOwner != ''">f_owner,</if>
  265. <if test="fSource != null">f_source,</if>
  266. <if test="fRent != null">f_rent,</if>
  267. <if test="fUpdatetime != null">f_updatetime,</if>
  268. <if test="fUpdateaddress != null and fUpdateaddress != ''">f_updateaddress,</if>
  269. <if test="fUpdateef != null and fUpdateef != ''">f_updateEF,</if>
  270. <if test="fCntrstatus != null and fCntrstatus != ''">f_cntrstatus,</if>
  271. <if test="fStatus != null">f_status,</if>
  272. <if test="fOpctnstatus != null and fOpctnstatus != ''">f_opctnstatus,</if>
  273. <if test="fSealno != null and fSealno != ''">f_sealno,</if>
  274. <if test="createBy != null">create_by,</if>
  275. <if test="createTime != null">create_time,</if>
  276. <if test="updateBy != null">update_by,</if>
  277. <if test="updateTime != null">update_time,</if>
  278. <if test="remark != null">remark,</if>
  279. <if test="fBuildBoxTime != null">f_build_box_time,</if>
  280. <if test="fBoxTurtleYear != null">f_box_turtle_year,</if>
  281. <if test="fBoxTurtleMonth != null">f_box_turtle_month,</if>
  282. <if test="fBoxLord != null">f_box_lord,</if>
  283. <if test="fPactDealHorn != null">f_pact_deal_horn,</if>
  284. </trim>
  285. <trim prefix="values (" suffix=")" suffixOverrides=",">
  286. <if test="fId != null">#{fId},</if>
  287. <if test="fNo != null and fNo != ''">#{fNo},</if>
  288. <if test="fTypeid != null">#{fTypeid},</if>
  289. <if test="fOwner != null and fOwner != ''">#{fOwner},</if>
  290. <if test="fSource != null">#{fSource},</if>
  291. <if test="fRent != null">#{fRent},</if>
  292. <if test="fUpdatetime != null">#{fUpdatetime},</if>
  293. <if test="fUpdateaddress != null and fUpdateaddress != ''">#{fUpdateaddress},</if>
  294. <if test="fUpdateef != null and fUpdateef != ''">#{fUpdateef},</if>
  295. <if test="fCntrstatus != null and fCntrstatus != ''">#{fCntrstatus},</if>
  296. <if test="fStatus != null">#{fStatus},</if>
  297. <if test="fOpctnstatus != null and fOpctnstatus != ''">#{fOpctnstatus},</if>
  298. <if test="fSealno != null and fSealno != ''">#{fSealno},</if>
  299. <if test="createBy != null">#{createBy},</if>
  300. <if test="createTime != null">#{createTime},</if>
  301. <if test="updateBy != null">#{updateBy},</if>
  302. <if test="updateTime != null">#{updateTime},</if>
  303. <if test="remark != null">#{remark},</if>
  304. <if test="fBuildBoxTime != null">#{fBuildBoxTime},</if>
  305. <if test="fBoxTurtleYear != null">#{fBoxTurtleYear},</if>
  306. <if test="fBoxTurtleMonth != null">#{fBoxTurtleMonth},</if>
  307. <if test="fBoxLord != null">#{fBoxLord},</if>
  308. <if test="fPactDealHorn != null">#{fPactDealHorn},</if>
  309. </trim>
  310. </insert>
  311. <update id="updateTCntrno" parameterType="TCntrno">
  312. update t_cntrno
  313. <trim prefix="SET" suffixOverrides=",">
  314. <if test="fNo != null and fNo != ''">f_no = #{fNo},</if>
  315. <if test="fTypeid != null">f_typeid = #{fTypeid},</if>
  316. <if test="fOwner != null and fOwner != ''">f_owner = #{fOwner},</if>
  317. <if test="fSource != null">f_source = #{fSource},</if>
  318. <if test="fRent != null">f_rent = #{fRent},</if>
  319. <if test="fUpdatetime != null">f_updatetime = #{fUpdatetime},</if>
  320. <if test="fUpdateaddress != null and fUpdateaddress != ''">f_updateaddress = #{fUpdateaddress},</if>
  321. <if test="fUpdateef != null and fUpdateef != ''">f_updateEF = #{fUpdateef},</if>
  322. <if test="fCntrstatus != null and fCntrstatus != ''">f_cntrstatus = #{fCntrstatus},</if>
  323. <if test="fStatus != null">f_status = #{fStatus},</if>
  324. <if test="fOpctnstatus != null and fOpctnstatus != ''">f_opctnstatus = #{fOpctnstatus},</if>
  325. <if test="fSealno != null and fSealno != ''">f_sealno = #{fSealno},</if>
  326. <if test="createBy != null">create_by = #{createBy},</if>
  327. <if test="createTime != null">create_time = #{createTime},</if>
  328. <if test="updateBy != null">update_by = #{updateBy},</if>
  329. <if test="updateTime != null">update_time = #{updateTime},</if>
  330. <if test="remark != null">remark = #{remark},</if>
  331. <if test="fBuildBoxTime != null">f_build_box_time = #{fBuildBoxTime},</if>
  332. <if test="fBoxTurtleYear != null">f_box_turtle_year = #{fBoxTurtleYear},</if>
  333. <if test="fBoxTurtleMonth != null">f_box_turtle_month = #{fBoxTurtleMonth},</if>
  334. <if test="fBoxLord != null">f_box_lord = #{fBoxLord},</if>
  335. <if test="fPactDealHorn != null">f_pact_deal_horn = #{fPactDealHorn},</if>
  336. </trim>
  337. where f_id = #{fId}
  338. </update>
  339. <update id="updateTCntrnoByfNo" parameterType="TCntrno">
  340. update t_cntrno
  341. <trim prefix="SET" suffixOverrides=",">
  342. <if test="fNo != null and fNo != ''">f_no = #{fNo},</if>
  343. <if test="fTypeid != null">f_typeid = #{fTypeid},</if>
  344. <if test="fOwner != null and fOwner != ''">f_owner = #{fOwner},</if>
  345. <if test="fSource != null">f_source = #{fSource},</if>
  346. <if test="fRent != null">f_rent = #{fRent},</if>
  347. <if test="fUpdatetime != null">f_updatetime = #{fUpdatetime},</if>
  348. <if test="fUpdateaddress != null and fUpdateaddress != ''">f_updateaddress = #{fUpdateaddress},</if>
  349. <if test="fUpdateef != null and fUpdateef != ''">f_updateEF = #{fUpdateef},</if>
  350. <if test="fCntrstatus != null and fCntrstatus != ''">f_cntrstatus = #{fCntrstatus},</if>
  351. <if test="fStatus != null">f_status = #{fStatus},</if>
  352. <if test="fOpctnstatus != null and fOpctnstatus != ''">f_opctnstatus = #{fOpctnstatus},</if>
  353. <if test="fSealno != null and fSealno != ''">f_sealno = #{fSealno},</if>
  354. <if test="createBy != null">create_by = #{createBy},</if>
  355. <if test="createTime != null">create_time = #{createTime},</if>
  356. <if test="updateBy != null">update_by = #{updateBy},</if>
  357. <if test="updateTime != null">update_time = #{updateTime},</if>
  358. <if test="remark != null">remark = #{remark},</if>
  359. <if test="remark == null">remark = null,</if>
  360. <if test="fBuildBoxTime != null">f_build_box_time = #{fBuildBoxTime},</if>
  361. <if test="fBoxTurtleYear != null">f_box_turtle_year = #{fBoxTurtleYear},</if>
  362. <if test="fBoxTurtleMonth != null">f_box_turtle_month = #{fBoxTurtleMonth},</if>
  363. <if test="fBoxLord != null">f_box_lord = #{fBoxLord},</if>
  364. <if test="fPactDealHorn != null">f_pact_deal_horn = #{fPactDealHorn},</if>
  365. </trim>
  366. where f_no = #{fNo}
  367. </update>
  368. <delete id="deleteTCntrnoById" parameterType="Long">
  369. delete from t_cntrno where f_id = #{fId}
  370. </delete>
  371. <delete id="deleteTCntrnoByIds" parameterType="String">
  372. delete from t_cntrno where f_id in
  373. <foreach item="fId" collection="array" open="(" separator="," close=")">
  374. #{fId}
  375. </foreach>
  376. </delete>
  377. <!--批量更新数据状态-->
  378. <update id="updateTcntrnoStatus" parameterType="string">
  379. update t_cntrno
  380. set f_status = 'F'
  381. where f_id in
  382. <foreach item="fId" collection="array" open="(" separator="," close=")">
  383. #{fId}
  384. </foreach>
  385. </update>
  386. <!--获取集装动态分布信息 -->
  387. <select id="getTCntrnoMessage" parameterType="string" resultType="map">
  388. SELECT
  389. container.*,
  390. box.`空`,
  391. box.`重`,
  392. car.`好`,
  393. car.`坏`
  394. FROM
  395. (
  396. SELECT
  397. tt.f_updateaddress AS 地点
  398. <if test=" sql != null and sql != ''">
  399. ,${sql}
  400. </if>
  401. FROM
  402. (
  403. SELECT
  404. tc.f_updateaddress f_updateaddress,
  405. tc.typeidCount typeidCount,
  406. t.f_no f_no
  407. FROM
  408. (
  409. SELECT
  410. ta.f_name f_updateaddress,
  411. tcn.f_typeid,
  412. COUNT( tcn.f_updateaddress ) typeidCount
  413. FROM
  414. t_cntrno tcn
  415. LEFT JOIN t_address ta ON tcn.f_updateaddress = ta.f_id
  416. WHERE
  417. tcn.f_status = 'T'
  418. GROUP BY
  419. tcn.f_updateaddress,
  420. tcn.f_typeid
  421. ) tc
  422. LEFT JOIN t_cntr t ON tc.f_typeid = t.f_id
  423. ) tt
  424. GROUP BY
  425. tt.f_updateaddress
  426. ) container
  427. LEFT JOIN (
  428. SELECT
  429. a.f_updateaddress,
  430. MAX( CASE WHEN a.dict_label = '空' THEN a.efCount ELSE 0 END ) AS 空,
  431. MAX( CASE WHEN a.dict_label = '重' THEN a.efCount ELSE 0 END ) AS 重
  432. FROM
  433. (
  434. SELECT
  435. tc.f_updateaddress f_updateaddress,
  436. tc.f_updateEF f_updateEF,
  437. tc.efCount efCount,
  438. sdda.dict_label dict_label
  439. FROM
  440. (
  441. SELECT
  442. ta.f_name f_updateaddress,
  443. tct.f_updateEF,
  444. COUNT( tct.f_updateaddress ) efCount
  445. FROM
  446. t_cntrno tct
  447. LEFT JOIN t_address ta ON tct.f_updateaddress = ta.f_id
  448. WHERE
  449. tct.f_status = 'T'
  450. GROUP BY
  451. tct.f_updateaddress,
  452. tct.f_updateEF
  453. ) tc
  454. LEFT JOIN sys_dict_data sdda ON sdda.dict_value = tc.f_updateEF
  455. AND sdda.dict_type = 'f_updateEF'
  456. ) a
  457. GROUP BY
  458. a.f_updateaddress
  459. ) box ON container.地点 = box.f_updateaddress
  460. LEFT JOIN (
  461. SELECT
  462. b.f_updateaddress,
  463. MAX( CASE WHEN b.dict_label = '好' THEN b.statusCount ELSE 0 END ) AS 好,
  464. MAX( CASE WHEN b.dict_label = '坏' THEN b.statusCount ELSE 0 END ) AS 坏
  465. FROM
  466. (
  467. SELECT
  468. tc.f_updateaddress f_updateaddress,
  469. tc.f_cntrstatus f_cntrstatus,
  470. tc.statusCount statusCount,
  471. sdda.dict_label dict_label
  472. FROM
  473. (
  474. SELECT
  475. ta.f_name f_updateaddress,
  476. tct.f_cntrstatus,
  477. COUNT( tct.f_updateaddress ) statusCount
  478. FROM
  479. t_cntrno tct
  480. LEFT JOIN t_address ta ON tct.f_updateaddress = ta.f_id
  481. WHERE
  482. tct.f_status = 'T'
  483. GROUP BY
  484. tct.f_updateaddress,
  485. tct.f_cntrstatus
  486. ) tc
  487. LEFT JOIN sys_dict_data sdda ON sdda.dict_value = tc.f_cntrstatus
  488. AND sdda.dict_type = 'f_cntrstatus'
  489. ) b
  490. GROUP BY
  491. b.f_updateaddress
  492. ) car ON container.地点 = car.f_updateaddress
  493. <where>
  494. <if test="tCntrno.fUpdateaddress != null and tCntrno.fUpdateaddress != ''">
  495. container.地点 like concat('%', #{tCntrno.fUpdateaddress}, '%')</if>
  496. </where>
  497. </select>
  498. <select id="selectTCntrnoFNo" parameterType="TCntrno" resultMap="TCntrnoResult">
  499. SELECT
  500. f_id,
  501. f_no
  502. FROM
  503. t_cntrno
  504. WHERE
  505. f_no = #{fNo}
  506. </select>
  507. <insert id="insertTCntrnoList" parameterType="list">
  508. insert into t_cntrno
  509. <trim prefix="(" suffix=")" suffixOverrides=",">
  510. <if test="fId != null">f_id,</if>
  511. <if test="fNo != null and fNo != ''">f_no,</if>
  512. <if test="fTypeid != null">f_typeid,</if>
  513. <if test="fOwner != null and fOwner != ''">f_owner,</if>
  514. <if test="fSource != null">f_source,</if>
  515. <if test="fRent != null">f_rent,</if>
  516. <if test="fUpdatetime != null">f_updatetime,</if>
  517. <if test="fUpdateaddress != null and fUpdateaddress != ''">f_updateaddress,</if>
  518. <if test="fUpdateef != null and fUpdateef != ''">f_updateEF,</if>
  519. <if test="fCntrstatus != null and fCntrstatus != ''">f_cntrstatus,</if>
  520. <if test="fStatus != null">f_status,</if>
  521. <if test="fOpctnstatus != null and fOpctnstatus != ''">f_opctnstatus,</if>
  522. <if test="fSealno != null and fSealno != ''">f_sealno,</if>
  523. <if test="createBy != null">create_by,</if>
  524. <if test="createTime != null">create_time,</if>
  525. <if test="updateBy != null">update_by,</if>
  526. <if test="updateTime != null">update_time,</if>
  527. <if test="remark != null">remark,</if>
  528. </trim>
  529. <foreach collection="list" item="item" separator=",">
  530. <trim prefix="values (" suffix=")" suffixOverrides=",">
  531. <if test="fId != null">#{fId},</if>
  532. <if test="fNo != null and fNo != ''">#{fNo},</if>
  533. <if test="fTypeid != null">#{fTypeid},</if>
  534. <if test="fOwner != null and fOwner != ''">#{fOwner},</if>
  535. <if test="fSource != null">#{fSource},</if>
  536. <if test="fRent != null">#{fRent},</if>
  537. <if test="fUpdatetime != null">#{fUpdatetime},</if>
  538. <if test="fUpdateaddress != null and fUpdateaddress != ''">#{fUpdateaddress},</if>
  539. <if test="fUpdateef != null and fUpdateef != ''">#{fUpdateef},</if>
  540. <if test="fCntrstatus != null and fCntrstatus != ''">#{fCntrstatus},</if>
  541. <if test="fStatus != null">#{fStatus},</if>
  542. <if test="fOpctnstatus != null and fOpctnstatus != ''">#{fOpctnstatus},</if>
  543. <if test="fSealno != null and fSealno != ''">#{fSealno},</if>
  544. <if test="createBy != null">#{createBy},</if>
  545. <if test="createTime != null">#{createTime},</if>
  546. <if test="updateBy != null">#{updateBy},</if>
  547. <if test="updateTime != null">#{updateTime},</if>
  548. <if test="remark != null">#{remark},</if>
  549. </trim>
  550. </foreach>
  551. </insert>
  552. <select id="getTcntrnoFno" parameterType="TCntrno" resultType="map">
  553. SELECT
  554. tc.f_no,
  555. address.f_name addressName,
  556. sdda.dict_label updateEFName
  557. FROM
  558. t_cntrno tc
  559. LEFT JOIN sys_dict_data sdda ON sdda.dict_value = tc.f_updateEF
  560. AND sdda.dict_type = 'f_updateEF'
  561. LEFT JOIN t_address address ON address.f_id = tc.f_updateaddress
  562. <where>
  563. tc.f_status = 'T'
  564. <if test="fNo != null and fNo != ''">and tc.f_no like concat('%', #{fNo}, '%') </if>
  565. <if test="fUpdateaddress != null and fUpdateaddress != ''">and tc.f_updateaddress = #{fUpdateaddress}</if>
  566. <if test="fUpdateef != null and fUpdateef != ''">and tc.f_updateEF = #{fUpdateef}</if>
  567. </where>
  568. ORDER BY tc.f_no
  569. </select>
  570. <!--获取箱分布情况-->
  571. <select id="boxDistributionStatistics" parameterType="TCntrno" resultType="com.ruoyi.shipping.excel.BoxMessage">
  572. SELECT
  573. MAX(case when tc.fNo = '20GP' then tc.boxNumber ELSE 0 end) AS 'TWENTYGP',
  574. MAX(case when tc.fNo = '20RF' then tc.boxNumber ELSE 0 end) AS 'TWENTYRF',
  575. MAX(case when tc.fNo = '20OT' then tc.boxNumber ELSE 0 end) AS 'TWENTYOT',
  576. MAX(case when tc.fNo = '20FR' then tc.boxNumber ELSE 0 end) AS 'TWENTYFR',
  577. MAX(case when tc.fNo = '20TK' then tc.boxNumber ELSE 0 end) AS 'TWENTYTK',
  578. MAX(case when tc.fNo = '40GP' then tc.boxNumber ELSE 0 end) AS 'FORTYGP',
  579. MAX(case when tc.fNo = '40HC' then tc.boxNumber ELSE 0 end) AS 'FORTYHC',
  580. MAX(case when tc.fNo = '40HR' then tc.boxNumber ELSE 0 end) AS 'FORTYHR',
  581. MAX(case when tc.fNo = '40FR' then tc.boxNumber ELSE 0 end) AS 'FORTYFR',
  582. MAX(case when tc.fNo = '40TK' then tc.boxNumber ELSE 0 end) AS 'FORTYTK',
  583. MAX(case when tc.fNo = '40OT' then tc.boxNumber ELSE 0 end) AS 'FORTYOT'
  584. FROM
  585. (
  586. SELECT
  587. IFNULL( COUNT( 1 ), 0 ) boxNumber,
  588. tr.f_no fNo,
  589. sd.dict_label opCTnStatusName
  590. FROM
  591. t_cntrno tc
  592. LEFT JOIN t_cntr tr ON tc.f_typeid = tr.f_id
  593. LEFT JOIN t_address ta ON tc.f_updateaddress = ta.f_id
  594. LEFT JOIN sys_dict_data sd ON tc.f_opctnstatus = sd.dict_value
  595. AND sd.dict_type = 'f_opctnstatus'
  596. <where>
  597. tc.f_status = 'T'
  598. <if test="fUpdateaddress != null and fUpdateaddress != ''">and tc.f_updateaddress = #{fUpdateaddress}</if>
  599. <if test="fOpctnstatus != null and fOpctnstatus != ''">and tc.f_opctnstatus = #{fOpctnstatus}</if>
  600. <if test="remark != null">and tc.remark = #{remark}</if>
  601. </where>
  602. GROUP BY
  603. LEFT ( tr.f_no, 2 ),
  604. RIGHT ( tr.f_no, 2 )
  605. )tc
  606. </select>
  607. <!--获取箱地点为港口信息情况-->
  608. <select id="getBoxPortMessage" parameterType="TCntrno" resultMap="TCntrnoResult">
  609. SELECT
  610. DISTINCT
  611. IFNULL(ta.f_portid, 0) fUpdateaddress,
  612. IFNULL(tr.f_name,'无') addressName
  613. FROM
  614. t_cntrno tc
  615. LEFT JOIN
  616. t_address ta ON ta.f_id = tc.f_updateaddress
  617. LEFT JOIN t_address tr ON ta.f_portid = tr.f_id
  618. LEFT JOIN sys_dict_data sd ON ta.f_types = sd.dict_value AND sd.dict_type = 'f_types'
  619. WHERE sd.dict_label != '港口'
  620. UNION
  621. SELECT
  622. DISTINCT
  623. IFNULL(tc.f_updateaddress,0) fUpdateaddress,
  624. IFNULL(ta.f_name ,'无') addressName
  625. FROM
  626. t_cntrno tc
  627. LEFT JOIN
  628. t_address ta ON ta.f_id = tc.f_updateaddress
  629. LEFT JOIN sys_dict_data sd ON ta.f_types = sd.dict_value AND sd.dict_type = 'f_types'
  630. WHERE sd.dict_label = '港口'
  631. </select>
  632. <!--获取箱地点不为港口信息情况-->
  633. <select id="getBoxAddressMessage" parameterType="TCntrno" resultMap="TCntrnoResult">
  634. SELECT
  635. DISTINCT
  636. tc.f_updateaddress,
  637. ta.f_name addressName,
  638. ta.f_name portName
  639. FROM
  640. t_cntrno tc
  641. LEFT JOIN
  642. t_address ta ON ta.f_id = tc.f_updateaddress
  643. LEFT JOIN sys_dict_data sd ON ta.f_types = sd.dict_value AND sd.dict_type = 'f_types'
  644. WHERE sd.dict_label = '港口'
  645. UNION
  646. SELECT
  647. DISTINCT
  648. tc.f_updateaddress,
  649. ta.f_name addressName,
  650. IFNULL(tr.f_name,'无')portName
  651. FROM
  652. t_cntrno tc
  653. LEFT JOIN
  654. t_address ta ON ta.f_id = tc.f_updateaddress
  655. LEFT JOIN t_address tr ON ta.f_portid = tr.f_id
  656. LEFT JOIN sys_dict_data sd ON ta.f_types = sd.dict_value AND sd.dict_type = 'f_types'
  657. WHERE sd.dict_label != '港口'
  658. </select>
  659. <!--获取地点为在船的备注-->
  660. <select id="getBoxRemark" parameterType="TCntrno" resultMap="TCntrnoResult">
  661. SELECT
  662. DISTINCT
  663. remark
  664. FROM
  665. t_cntrno
  666. WHERE
  667. f_updateaddress = #{fUpdateaddress}
  668. AND remark IS NOT NULL
  669. </select>
  670. <select id="homeBox" resultType="map">
  671. SELECT
  672. ta.f_name addressName,
  673. IFNULL(COUNT(1),0) boxNumber
  674. FROM
  675. t_cntrno tc
  676. LEFT JOIN t_address ta ON tc.f_updateaddress = ta.f_id
  677. WHERE
  678. ta.f_name != '在船'
  679. GROUP BY tc.f_updateaddress
  680. UNION
  681. SELECT
  682. tc.remark addressName,
  683. IFNULL(COUNT(1),0) boxNumber
  684. FROM
  685. t_cntrno tc
  686. LEFT JOIN t_address ta ON tc.f_updateaddress = ta.f_id
  687. WHERE
  688. ta.f_name = '在船'
  689. GROUP BY tc.remark
  690. </select>
  691. </mapper>