TmsshipTotalResultMapper.xml 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.steerinfo.dil.mapper.TmsshipTotalResultMapper">
  4. <resultMap id="BaseResultMap" type="com.steerinfo.dil.model.TmsshipTotalResult">
  5. <id column="RESULT_ID" jdbcType="DECIMAL" property="resultId" />
  6. <result column="ORDER_ID" jdbcType="DECIMAL" property="orderId" />
  7. <result column="RESULT_DURATION" jdbcType="DECIMAL" property="resultDuration" />
  8. <result column="STANDARD_DATA_ID" jdbcType="DECIMAL" property="standardDataId" />
  9. <result column="RESULT_OUTLIER" jdbcType="DECIMAL" property="resultOutlier" />
  10. <result column="INSERT_USERNAME" jdbcType="VARCHAR" property="insertUsername" />
  11. <result column="INSERT_TIME" jdbcType="TIMESTAMP" property="insertTime" />
  12. <result column="UPDATE_USERNAME" jdbcType="VARCHAR" property="updateUsername" />
  13. <result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime" />
  14. <result column="INSERT_UPDATE_REMARK" jdbcType="VARCHAR" property="insertUpdateRemark" />
  15. <result column="SHIP_STATUS" jdbcType="DECIMAL" property="shipStatus" />
  16. </resultMap>
  17. <sql id="columns">
  18. RESULT_ID, ORDER_ID, RESULT_DURATION, STANDARD_DATA_ID, RESULT_OUTLIER, INSERT_USERNAME,
  19. INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK, SHIP_STATUS
  20. </sql>
  21. <sql id="columns_alias">
  22. t.RESULT_ID, t.ORDER_ID, t.RESULT_DURATION, t.STANDARD_DATA_ID, t.RESULT_OUTLIER,
  23. t.INSERT_USERNAME, t.INSERT_TIME, t.UPDATE_USERNAME, t.UPDATE_TIME, t.INSERT_UPDATE_REMARK,
  24. t.SHIP_STATUS
  25. </sql>
  26. <sql id="select">
  27. SELECT <include refid="columns"/> FROM TMSSHIP_TOTAL_RESULT
  28. </sql>
  29. <sql id="select_alias">
  30. SELECT <include refid="columns_alias"/> FROM TMSSHIP_TOTAL_RESULT t
  31. </sql>
  32. <sql id="where">
  33. <where>
  34. <if test="resultId != null">
  35. and RESULT_ID = #{resultId}
  36. </if>
  37. <if test="orderId != null">
  38. and ORDER_ID = #{orderId}
  39. </if>
  40. <if test="resultDuration != null">
  41. and RESULT_DURATION = #{resultDuration}
  42. </if>
  43. <if test="standardDataId != null">
  44. and STANDARD_DATA_ID = #{standardDataId}
  45. </if>
  46. <if test="resultOutlier != null">
  47. and RESULT_OUTLIER = #{resultOutlier}
  48. </if>
  49. <if test="insertUsername != null and insertUsername != ''">
  50. and INSERT_USERNAME = #{insertUsername}
  51. </if>
  52. <if test="insertTime != null">
  53. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  54. </if>
  55. <if test="updateUsername != null and updateUsername != ''">
  56. and UPDATE_USERNAME = #{updateUsername}
  57. </if>
  58. <if test="updateTime != null">
  59. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  60. </if>
  61. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  62. and INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  63. </if>
  64. <if test="shipStatus != null">
  65. and SHIP_STATUS = #{shipStatus}
  66. </if>
  67. </where>
  68. </sql>
  69. <sql id="whereLike">
  70. <where>
  71. <if test="resultId != null">
  72. and RESULT_ID = #{resultId}
  73. </if>
  74. <if test="orderId != null">
  75. and ORDER_ID = #{orderId}
  76. </if>
  77. <if test="resultDuration != null">
  78. and RESULT_DURATION = #{resultDuration}
  79. </if>
  80. <if test="standardDataId != null">
  81. and STANDARD_DATA_ID = #{standardDataId}
  82. </if>
  83. <if test="resultOutlier != null">
  84. and RESULT_OUTLIER = #{resultOutlier}
  85. </if>
  86. <if test="insertUsername != null and insertUsername != ''">
  87. and INSERT_USERNAME LIKE '%${insertUsername}%'
  88. </if>
  89. <if test="insertTime != null">
  90. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  91. </if>
  92. <if test="updateUsername != null and updateUsername != ''">
  93. and UPDATE_USERNAME LIKE '%${updateUsername}%'
  94. </if>
  95. <if test="updateTime != null">
  96. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  97. </if>
  98. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  99. and INSERT_UPDATE_REMARK LIKE '%${insertUpdateRemark}%'
  100. </if>
  101. <if test="shipStatus != null">
  102. and SHIP_STATUS = #{shipStatus}
  103. </if>
  104. </where>
  105. </sql>
  106. <delete id="deleteByPrimaryKey" parameterType="java.lang.Short">
  107. delete from TMSSHIP_TOTAL_RESULT
  108. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  109. </delete>
  110. <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
  111. delete from TMSSHIP_TOTAL_RESULT
  112. where 1!=1
  113. <if test="orderId != null">
  114. or ORDER_ID = #{orderId}
  115. </if>
  116. <if test="resultDuration != null">
  117. or RESULT_DURATION = #{resultDuration}
  118. </if>
  119. <if test="standardDataId != null">
  120. or STANDARD_DATA_ID = #{standardDataId}
  121. </if>
  122. <if test="resultOutlier != null">
  123. or RESULT_OUTLIER = #{resultOutlier}
  124. </if>
  125. <if test="insertUsername != null and insertUsername != ''">
  126. or INSERT_USERNAME = #{insertUsername}
  127. </if>
  128. <if test="insertTime != null">
  129. or TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = '#{insertTime}'
  130. </if>
  131. <if test="updateUsername != null and updateUsername != ''">
  132. or UPDATE_USERNAME = #{updateUsername}
  133. </if>
  134. <if test="updateTime != null">
  135. or TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = '#{updateTime}'
  136. </if>
  137. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  138. or INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  139. </if>
  140. <if test="shipStatus != null">
  141. or SHIP_STATUS = #{shipStatus}
  142. </if>
  143. </delete>
  144. <insert id="insert" parameterType="com.steerinfo.dil.model.TmsshipTotalResult">
  145. insert into TMSSHIP_TOTAL_RESULT (RESULT_ID, ORDER_ID, RESULT_DURATION,
  146. STANDARD_DATA_ID, RESULT_OUTLIER, INSERT_USERNAME,
  147. INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME,
  148. INSERT_UPDATE_REMARK, SHIP_STATUS)
  149. values (#{resultId,jdbcType=DECIMAL}, #{orderId,jdbcType=DECIMAL}, #{resultDuration,jdbcType=DECIMAL},
  150. #{standardDataId,jdbcType=DECIMAL}, #{resultOutlier,jdbcType=DECIMAL}, #{insertUsername,jdbcType=VARCHAR},
  151. #{insertTime,jdbcType=TIMESTAMP}, #{updateUsername,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
  152. #{insertUpdateRemark,jdbcType=VARCHAR}, #{shipStatus,jdbcType=DECIMAL})
  153. </insert>
  154. <insert id="insertSelective" parameterType="com.steerinfo.dil.model.TmsshipTotalResult">
  155. insert into TMSSHIP_TOTAL_RESULT
  156. <trim prefix="(" suffix=")" suffixOverrides=",">
  157. <if test="resultId != null">
  158. RESULT_ID,
  159. </if>
  160. <if test="orderId != null">
  161. ORDER_ID,
  162. </if>
  163. <if test="resultDuration != null">
  164. RESULT_DURATION,
  165. </if>
  166. <if test="standardDataId != null">
  167. STANDARD_DATA_ID,
  168. </if>
  169. <if test="resultOutlier != null">
  170. RESULT_OUTLIER,
  171. </if>
  172. <if test="insertUsername != null">
  173. INSERT_USERNAME,
  174. </if>
  175. <if test="insertTime != null">
  176. INSERT_TIME,
  177. </if>
  178. <if test="updateUsername != null">
  179. UPDATE_USERNAME,
  180. </if>
  181. <if test="updateTime != null">
  182. UPDATE_TIME,
  183. </if>
  184. <if test="insertUpdateRemark != null">
  185. INSERT_UPDATE_REMARK,
  186. </if>
  187. <if test="shipStatus != null">
  188. SHIP_STATUS,
  189. </if>
  190. </trim>
  191. <trim prefix="values (" suffix=")" suffixOverrides=",">
  192. <if test="resultId != null">
  193. #{resultId,jdbcType=DECIMAL},
  194. </if>
  195. <if test="orderId != null">
  196. #{orderId,jdbcType=DECIMAL},
  197. </if>
  198. <if test="resultDuration != null">
  199. #{resultDuration,jdbcType=DECIMAL},
  200. </if>
  201. <if test="standardDataId != null">
  202. #{standardDataId,jdbcType=DECIMAL},
  203. </if>
  204. <if test="resultOutlier != null">
  205. #{resultOutlier,jdbcType=DECIMAL},
  206. </if>
  207. <if test="insertUsername != null">
  208. #{insertUsername,jdbcType=VARCHAR},
  209. </if>
  210. <if test="insertTime != null">
  211. #{insertTime,jdbcType=TIMESTAMP},
  212. </if>
  213. <if test="updateUsername != null">
  214. #{updateUsername,jdbcType=VARCHAR},
  215. </if>
  216. <if test="updateTime != null">
  217. #{updateTime,jdbcType=TIMESTAMP},
  218. </if>
  219. <if test="insertUpdateRemark != null">
  220. #{insertUpdateRemark,jdbcType=VARCHAR},
  221. </if>
  222. <if test="shipStatus != null">
  223. #{shipStatus,jdbcType=DECIMAL},
  224. </if>
  225. </trim>
  226. </insert>
  227. <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.TmsshipTotalResult">
  228. update TMSSHIP_TOTAL_RESULT
  229. set ORDER_ID = #{orderId,jdbcType=DECIMAL},
  230. RESULT_DURATION = #{resultDuration,jdbcType=DECIMAL},
  231. STANDARD_DATA_ID = #{standardDataId,jdbcType=DECIMAL},
  232. RESULT_OUTLIER = #{resultOutlier,jdbcType=DECIMAL},
  233. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  234. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  235. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  236. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  237. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  238. SHIP_STATUS = #{shipStatus,jdbcType=DECIMAL}
  239. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  240. </update>
  241. <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.TmsshipTotalResult">
  242. update TMSSHIP_TOTAL_RESULT
  243. <set>
  244. <if test="orderId != null">
  245. ORDER_ID = #{orderId,jdbcType=DECIMAL},
  246. </if>
  247. <if test="resultDuration != null">
  248. RESULT_DURATION = #{resultDuration,jdbcType=DECIMAL},
  249. </if>
  250. <if test="standardDataId != null">
  251. STANDARD_DATA_ID = #{standardDataId,jdbcType=DECIMAL},
  252. </if>
  253. <if test="resultOutlier != null">
  254. RESULT_OUTLIER = #{resultOutlier,jdbcType=DECIMAL},
  255. </if>
  256. <if test="insertUsername != null">
  257. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  258. </if>
  259. <if test="insertTime != null">
  260. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  261. </if>
  262. <if test="updateUsername != null">
  263. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  264. </if>
  265. <if test="updateTime != null">
  266. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  267. </if>
  268. <if test="insertUpdateRemark != null">
  269. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  270. </if>
  271. <if test="shipStatus != null">
  272. SHIP_STATUS = #{shipStatus,jdbcType=DECIMAL},
  273. </if>
  274. </set>
  275. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  276. </update>
  277. <select id="selectByPrimaryKey" parameterType="java.lang.Short" resultMap="BaseResultMap">
  278. <include refid="select"/>
  279. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  280. </select>
  281. <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  282. <include refid="select"/>
  283. <include refid="where"/>
  284. </select>
  285. <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  286. <include refid="select"/>
  287. <include refid="whereLike"/>
  288. </select>
  289. <insert id="batchInsert" parameterType="java.util.List">
  290. insert into TMSSHIP_TOTAL_RESULT
  291. (RESULT_ID,
  292. ORDER_ID, RESULT_DURATION, STANDARD_DATA_ID,
  293. RESULT_OUTLIER, INSERT_USERNAME,
  294. INSERT_TIME, UPDATE_USERNAME,
  295. UPDATE_TIME, INSERT_UPDATE_REMARK,
  296. SHIP_STATUS)
  297. ( <foreach collection="list" item="item" separator="union all">
  298. select
  299. #{item.resultId,jdbcType=DECIMAL},
  300. #{item.orderId,jdbcType=DECIMAL}, #{item.resultDuration,jdbcType=DECIMAL}, #{item.standardDataId,jdbcType=DECIMAL},
  301. #{item.resultOutlier,jdbcType=DECIMAL}, #{item.insertUsername,jdbcType=VARCHAR},
  302. #{item.insertTime,jdbcType=TIMESTAMP}, #{item.updateUsername,jdbcType=VARCHAR},
  303. #{item.updateTime,jdbcType=TIMESTAMP}, #{item.insertUpdateRemark,jdbcType=VARCHAR},
  304. #{item.shipStatus,jdbcType=DECIMAL} from dual
  305. </foreach> )
  306. </insert>
  307. <update id="batchUpdate" parameterType="java.util.List">
  308. update TMSSHIP_TOTAL_RESULT
  309. set
  310. RESULT_ID=
  311. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  312. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultId,jdbcType=DECIMAL}
  313. </foreach>
  314. ,ORDER_ID=
  315. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  316. when #{item.resultId,jdbcType=DECIMAL} then #{item.orderId,jdbcType=DECIMAL}
  317. </foreach>
  318. ,RESULT_DURATION=
  319. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  320. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultDuration,jdbcType=DECIMAL}
  321. </foreach>
  322. ,STANDARD_DATA_ID=
  323. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  324. when #{item.resultId,jdbcType=DECIMAL} then #{item.standardDataId,jdbcType=DECIMAL}
  325. </foreach>
  326. ,RESULT_OUTLIER=
  327. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  328. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultOutlier,jdbcType=DECIMAL}
  329. </foreach>
  330. ,INSERT_USERNAME=
  331. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  332. when #{item.resultId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
  333. </foreach>
  334. ,INSERT_TIME=
  335. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  336. when #{item.resultId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
  337. </foreach>
  338. ,UPDATE_USERNAME=
  339. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  340. when #{item.resultId,jdbcType=DECIMAL} then #{item.updateUsername,jdbcType=VARCHAR}
  341. </foreach>
  342. ,UPDATE_TIME=
  343. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  344. when #{item.resultId,jdbcType=DECIMAL} then #{item.updateTime,jdbcType=TIMESTAMP}
  345. </foreach>
  346. ,INSERT_UPDATE_REMARK=
  347. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  348. when #{item.resultId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
  349. </foreach>
  350. ,SHIP_STATUS=
  351. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  352. when #{item.resultId,jdbcType=DECIMAL} then #{item.shipStatus,jdbcType=DECIMAL}
  353. </foreach>
  354. where RESULT_ID in
  355. <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
  356. #{item.resultId,jdbcType=DECIMAL}
  357. </foreach>
  358. </update>
  359. <delete id="batchDelete" parameterType="java.util.List">
  360. delete from TMSSHIP_TOTAL_RESULT
  361. where RESULT_ID in
  362. <foreach collection="list" item="id" open="(" close=")" separator=",">
  363. #{id}
  364. </foreach>
  365. </delete>
  366. <!-- 友情提示!!!-->
  367. <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
  368. <select id="selectMaxId" resultType="DECIMAL">
  369. SELECT MAX(RESULT_ID) + 1
  370. FROM TMSSHIP_TOTAL_RESULT
  371. </select>
  372. <select id="selectResultTotalId" resultType="DECIMAL">
  373. SELECT RESULT_ID
  374. FROM TMSSHIP_TOTAL_RESULT
  375. WHERE ORDER_ID = #{orderId}
  376. </select>
  377. <sql id="orderByInsertTime">
  378. <if test="orderField != null and orderField != ''">
  379. order by "${orderField}"
  380. <if test="orderType != null and orderType != ''">
  381. ${orderType}
  382. </if>
  383. </if>
  384. <if test="orderField == null ">
  385. order by "insertTime" desc
  386. </if>
  387. </sql>
  388. <select id="selectOrderList" resultType="java.util.Map">
  389. select * from (
  390. SELECT DISTINCT
  391. ttr.ORDER_ID as "orderId",
  392. ttr.INSERT_TIME as "insertTime",
  393. rm.MATERIAL_NAME as "materialName",
  394. dbi.INFACTORY_SHIP_NAME as "infactoryShipName",--进厂船名
  395. db.RESULT_FOREIGN_SHIP_NAME as "foreignShipName",
  396. rc.CAPACITY_NUMBER as "capacityName",
  397. rp.PORT_NAME as "supplierAbbreviation",
  398. pier.PIER_NAME as "groupName",
  399. rps.PORT_NAME as "startPortName",
  400. rpe.PORT_NAME as "arrivePortName",
  401. oic.INSTRUCTION_PLANNED_LOADING as "planWeight",
  402. tlsr.RESULT_ARRIVAL_PORT_TIME as "arriveTime",
  403. tlsr.RESULT_OUT_PORT_TIME as "liveTime",
  404. tlsr.RESULT_LOAD_SHIP_DATE as "resultLoadShipDate",
  405. tlsr.RESULT_ACTUAL_INSTALLATIONS as "realWeight",
  406. tlsr.INSERT_UPDATE_REMARK as "resultMemo",
  407. tlsr.RESULT_DELIVERY_DATE as "deliveryTime",
  408. tlsr.RESULT_NUMBER as "resultNumber",
  409. tlsr.RESULT_ISCLEAR as "isClear", --是否清场
  410. adn.PURCHASE_CONTRACT_MOISTURE as "purchaseContactMoisture",--合同水分值
  411. towr.RESULT_OUT_WHARY_NAME as "outWharyName",--离港确认人
  412. twqr.RESULT_EMPTY_HEAVY_WATER_METER as "emptyHeavyWaterMeter",--空舱/重载水尺米
  413. twqr.RESULT_INSPECTION_FEES as "inspectionFees",--检测费
  414. twqr.RESULT_PLANNED_DATE as "plannedDate",--计划日期
  415. twqr.RESULT_ES_DELIVERY_DATE as "deliveryDate",--预计放货日期
  416. twqr.IS_NEED_ASSEMBLE as "isNeedAssemble",--是否拼装
  417. twqr.WATER_UNIT_PRICE as "waterUnitPrice",--单价
  418. twqr.RESULT_MOISTURE_CONTENT as "moistubeContent",--含水率
  419. twqr.RESULT_WATER_TONNAGE as "waterTonnage"--水分吨位
  420. FROM TMSSHIP_TOTAL_RESULT ttr
  421. LEFT JOIN OMSSHIP_INSTRUCTIONS_CAPACITY oic
  422. ON oic.INSTRUCTIONS_CAPACITY_ID = ttr.ORDER_ID
  423. LEFT JOIN OMSSHIP_SHIPMENT_INSTRUCTIONS osi
  424. ON osi.SHIPMENT_INSTRUCTIONS_ID = oic.INSTRUCTIONS_ID
  425. left join DIL_BATCH_INFACOTRY dbi --批次中间表
  426. on osi.BATCH_ID=dbi.BATCH_INFACOTRY_ID
  427. LEFT JOIN DIL_BATCH db
  428. ON dbi.BATCH_ID = db.BATCH_ID
  429. LEFT JOIN RMS_MATERIAL rm
  430. ON db.MATERIAL_ID = rm.MATERIAL_ID
  431. LEFT JOIN AMSSHIP_DELIVERY_ATTORNEY ada
  432. on osi.BATCH_ID = ada.BATCH_ID
  433. LEFT JOIN AMSSHIP_DELIVERY_NOTICE adn
  434. on adn.BATCH_ID = ada.BATCH_ID
  435. LEFT JOIN RMS_PORT rp
  436. ON ada.CARRIER_ID = rp.PORT_ID
  437. LEFT JOIN RMS_PIER pier
  438. ON pier.PIER_ID = adn.GROUP_ID
  439. LEFT JOIN TMSSHIP_LOAD_SHIP_RESULT tlsr
  440. ON ttr.RESULT_ID = tlsr.TOTAL_RESULT_ID
  441. LEFT JOIN RMS_PORT rps
  442. ON ada.DOWN_SWIM_PORT_ID = rps.PORT_ID
  443. LEFT JOIN RMS_PORT rpe
  444. ON ada.PORT_ID = rpe.PORT_ID
  445. LEFT JOIN RMS_CAPACITY rc
  446. ON rc.CAPACITY_ID = oic.CAPACITY_ID
  447. LEFT JOIN TMSSHIP_WATER_QUALITY_RESULT twqr
  448. ON ttr.RESULT_ID=twqr.TOTAL_RESULT_ID
  449. LEFT JOIN TMSSHIP_OUT_WHARY_RESULT towr
  450. ON ttr.RESULT_ID =towr.TOTAL_RESULT_ID
  451. where tlsr.DELETED=0 and adn.DELETED=0 and ada.DELETED=0
  452. and oic.DELETED=0 and osi.DELETED=0
  453. )
  454. <where>
  455. <if test="materialName != null">
  456. and
  457. <foreach collection="materialName" item="item" open="(" separator="," close=")">
  458. "materialName" in #{item}
  459. </foreach>
  460. </if>
  461. <if test="foreignShipName != null">
  462. and
  463. <foreach collection="foreignShipName" item="item" open="(" separator="," close=")">
  464. "foreignShipName" in #{item}
  465. </foreach>
  466. </if>
  467. <if test="capacityName != null">
  468. and
  469. <foreach collection="capacityName" item="item" open="(" separator="," close=")">
  470. "capacityName" in #{item}
  471. </foreach>
  472. </if>
  473. <if test="shipperAbbreviation != null">
  474. and
  475. <foreach collection="shipperAbbreviation" item="item" open="(" separator="," close=")">
  476. "shipperAbbreviation" in #{item}
  477. </foreach>
  478. </if>
  479. <if test="supplierAbbreviation != null">
  480. and
  481. <foreach collection="supplierAbbreviation" item="item" open="(" separator="," close=")">
  482. "supplierAbbreviation" in #{item}
  483. </foreach>
  484. </if>
  485. <if test="groupName != null">
  486. and
  487. <foreach collection="groupName" item="item" open="(" separator="," close=")">
  488. "groupName" in #{item}
  489. </foreach>
  490. </if>
  491. <if test="resultLoadShipDate != null">
  492. and
  493. <foreach collection="resultLoadShipDate" item="item" open="(" separator="," close=")">
  494. "resultLoadShipDate" in to_date('${item}','yyyy-mm-dd hh24:mi:ss')
  495. </foreach>
  496. </if>
  497. <if test="startPortName != null">
  498. and
  499. <foreach collection="startPortName" item="item" open="(" separator="," close=")">
  500. "startPortName" in #{item}
  501. </foreach>
  502. </if>
  503. <if test="arrivePortName != null">
  504. and
  505. <foreach collection="arrivePortName" item="item" open="(" separator="," close=")">
  506. "arrivePortName" in #{item}
  507. </foreach>
  508. </if>
  509. <if test="arriveTime != null">
  510. and
  511. <foreach collection="arriveTime" item="item" open="(" separator="," close=")">
  512. "arriveTime" in to_date('${item}','yyyy-mm-dd hh24:mi:ss')
  513. </foreach>
  514. </if>
  515. <if test="liveTime != null">
  516. and
  517. <foreach collection="liveTime" item="item" open="(" separator="," close=")">
  518. "liveTime" in to_date('${item}','yyyy-mm-dd hh24:mi:ss')
  519. </foreach>
  520. </if>
  521. <if test="planWeight != null">
  522. and
  523. <foreach collection="planWeight" item="item" open="(" separator="," close=")">
  524. "planWeight" in #{item}
  525. </foreach>
  526. </if>
  527. <if test="realWeight != null">
  528. and
  529. <foreach collection="realWeight" item="item" open="(" separator="," close=")">
  530. "realWeight" in #{item}
  531. </foreach>
  532. </if>
  533. <if test="resultMemo != null">
  534. and
  535. <foreach collection="resultMemo" item="item" open="(" separator="," close=")">
  536. "resultMemo" in #{item}
  537. </foreach>
  538. </if>
  539. </where>
  540. <include refid="orderByInsertTime"></include>
  541. </select>
  542. <select id="getCapacity" resultType="java.util.Map">
  543. SELECT DISTINCT
  544. DBI.INFACTORY_SHIP_NAME "infactoryShipName",
  545. db.RESULT_FOREIGN_SHIP_NAME AS "resultForeignShipName",
  546. rm.MATERIAL_NAME AS "materialName",
  547. rc.CAPACITY_NUMBER AS "capacityNumber",
  548. oic.INSTRUCTIONS_CAPACITY_ID AS "orderId",
  549. DBI.BATCH_INFACOTRY_ID AS "batchInfactoryId",
  550. ada.DOWN_SWIM_PORT_ID AS "downSwimPortId",
  551. rp1.PORT_NAME AS "portName1",
  552. ada.PORT_ID AS "portId",
  553. rp2.PORT_NAME AS "portName2",
  554. oic.INSTRUCTIONS_SHIP_POSITION "instructionsShipPosition"
  555. FROM
  556. OMSSHIP_INSTRUCTIONS_CAPACITY oic
  557. LEFT JOIN OMSSHIP_SHIPMENT_INSTRUCTIONS osi ON oic.INSTRUCTIONS_ID = osi.SHIPMENT_INSTRUCTIONS_ID
  558. LEFT JOIN DIL_BATCH_INFACOTRY DBI ON DBI.BATCH_INFACOTRY_ID = osi.BATCH_ID
  559. LEFT JOIN DIL_BATCH db ON db.BATCH_ID = DBI.BATCH_ID
  560. LEFT JOIN AMSSHIP_DELIVERY_ATTORNEY ada ON ada.BATCH_ID = DBI.BATCH_INFACOTRY_ID
  561. LEFT JOIN RMS_PORT rp1 ON ada.DOWN_SWIM_PORT_ID = rp1.PORT_ID
  562. LEFT JOIN RMS_PORT rp2 ON ada.PORT_ID = rp2.PORT_ID
  563. LEFT JOIN RMS_MATERIAL rm ON rm.MATERIAL_ID = db.MATERIAL_ID
  564. LEFT JOIN RMS_CAPACITY rc ON rc.CAPACITY_ID = oic.CAPACITY_ID
  565. WHERE OSI.DELETED = 0
  566. AND OIC.DELETED = 0
  567. AND ADA.DELETED = 0
  568. AND OSI.INSTRUCTION_ISSUE_STATUS='已下发'
  569. <if test="con!=null">
  570. AND (DB.RESULT_FOREIGN_SHIP_NAME like concat('%', concat(#{con},'%'))
  571. or RM.MATERIAL_NAME like concat('%', concat(#{con}, '%'))
  572. or DBI.BATCH_INFACOTRY_ID like concat('%', concat(#{con}, '%'))
  573. or rc.CAPACITY_NUMBER like concat('%', concat(#{con}, '%'))
  574. or DBI.INFACTORY_SHIP_NAME like concat('%', concat(#{con}, '%'))
  575. )
  576. </if>
  577. </select>
  578. </mapper>