AmstruckInwardPlanMapper.xml 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562
  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.AmstruckInwardPlanMapper">
  4. <resultMap id="BaseResultMap" type="com.steerinfo.dil.model.AmstruckInwardPlan">
  5. <id column="PLAN_ID" jdbcType="DECIMAL" property="planId"/>
  6. <result column="PLAN_NUMBER" jdbcType="VARCHAR" property="planNumber"/>
  7. <result column="CARRIER_ID" jdbcType="DECIMAL" property="carrierId"/>
  8. <result column="PLAN_TRUCK_NUMBER" jdbcType="DECIMAL" property="planTruckNumber"/>
  9. <result column="PLAN_STATUS" jdbcType="DECIMAL" property="planStatus"/>
  10. <result column="PLAN_ISSUE_TIME" jdbcType="TIMESTAMP" property="planIssueTime"/>
  11. <result column="INSERT_USERNAME" jdbcType="VARCHAR" property="insertUsername"/>
  12. <result column="INSERT_TIME" jdbcType="TIMESTAMP" property="insertTime"/>
  13. <result column="UPDATE_USERNAME" jdbcType="VARCHAR" property="updateUsername"/>
  14. <result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime"/>
  15. <result column="INSERT_UPDATE_REMARK" jdbcType="VARCHAR" property="insertUpdateRemark"/>
  16. <result column="DELETED" jdbcType="DECIMAL" property="deleted"/>
  17. </resultMap>
  18. <sql id="columns">
  19. PLAN_ID, PLAN_NUMBER, CARRIER_ID, PLAN_TRUCK_NUMBER, PLAN_STATUS, PLAN_ISSUE_TIME,
  20. INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK,
  21. DELETED
  22. </sql>
  23. <sql id="columns_alias">
  24. t.PLAN_ID, t.PLAN_NUMBER, t.CARRIER_ID, t.PLAN_TRUCK_NUMBER, t.PLAN_STATUS, t.PLAN_ISSUE_TIME,
  25. t.INSERT_USERNAME, t.INSERT_TIME, t.UPDATE_USERNAME, t.UPDATE_TIME, t.INSERT_UPDATE_REMARK,
  26. t.DELETED
  27. </sql>
  28. <sql id="select">
  29. SELECT
  30. <include refid="columns"/>
  31. FROM AMSTRUCK_INWARD_PLAN
  32. </sql>
  33. <sql id="select_alias">
  34. SELECT
  35. <include refid="columns_alias"/>
  36. FROM AMSTRUCK_INWARD_PLAN t
  37. </sql>
  38. <sql id="where">
  39. <where>
  40. <if test="planId != null">
  41. and PLAN_ID = #{planId}
  42. </if>
  43. <if test="planNumber != null and planNumber != ''">
  44. and PLAN_NUMBER = #{planNumber}
  45. </if>
  46. <if test="carrierId != null">
  47. and CARRIER_ID = #{carrierId}
  48. </if>
  49. <if test="planTruckNumber != null">
  50. and PLAN_TRUCK_NUMBER = #{planTruckNumber}
  51. </if>
  52. <if test="planStatus != null">
  53. and PLAN_STATUS = #{planStatus}
  54. </if>
  55. <if test="planIssueTime != null">
  56. and TO_CHAR(PLAN_ISSUE_TIME,'yyyy-MM-dd') = #{planIssueTime}
  57. </if>
  58. <if test="insertUsername != null and insertUsername != ''">
  59. and INSERT_USERNAME = #{insertUsername}
  60. </if>
  61. <if test="insertTime != null">
  62. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  63. </if>
  64. <if test="updateUsername != null and updateUsername != ''">
  65. and UPDATE_USERNAME = #{updateUsername}
  66. </if>
  67. <if test="updateTime != null">
  68. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  69. </if>
  70. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  71. and INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  72. </if>
  73. <if test="deleted != null">
  74. and DELETED = #{deleted}
  75. </if>
  76. </where>
  77. </sql>
  78. <sql id="whereLike">
  79. <where>
  80. <if test="planId != null">
  81. and PLAN_ID = #{planId}
  82. </if>
  83. <if test="planNumber != null and planNumber != ''">
  84. and PLAN_NUMBER LIKE '%${planNumber}%'
  85. </if>
  86. <if test="carrierId != null">
  87. and CARRIER_ID = #{carrierId}
  88. </if>
  89. <if test="planTruckNumber != null">
  90. and PLAN_TRUCK_NUMBER = #{planTruckNumber}
  91. </if>
  92. <if test="planStatus != null">
  93. and PLAN_STATUS = #{planStatus}
  94. </if>
  95. <if test="planIssueTime != null">
  96. and TO_CHAR(PLAN_ISSUE_TIME,'yyyy-MM-dd') = #{planIssueTime}
  97. </if>
  98. <if test="insertUsername != null and insertUsername != ''">
  99. and INSERT_USERNAME LIKE '%${insertUsername}%'
  100. </if>
  101. <if test="insertTime != null">
  102. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  103. </if>
  104. <if test="updateUsername != null and updateUsername != ''">
  105. and UPDATE_USERNAME LIKE '%${updateUsername}%'
  106. </if>
  107. <if test="updateTime != null">
  108. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  109. </if>
  110. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  111. and INSERT_UPDATE_REMARK LIKE '%${insertUpdateRemark}%'
  112. </if>
  113. <if test="deleted != null">
  114. and DELETED = #{deleted}
  115. </if>
  116. </where>
  117. </sql>
  118. <delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal">
  119. delete
  120. from AMSTRUCK_INWARD_PLAN
  121. where PLAN_ID = #{planId,jdbcType=DECIMAL}
  122. </delete>
  123. <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
  124. delete from AMSTRUCK_INWARD_PLAN
  125. where 1!=1
  126. <if test="planNumber != null and planNumber != ''">
  127. or PLAN_NUMBER = #{planNumber}
  128. </if>
  129. <if test="carrierId != null">
  130. or CARRIER_ID = #{carrierId}
  131. </if>
  132. <if test="planTruckNumber != null">
  133. or PLAN_TRUCK_NUMBER = #{planTruckNumber}
  134. </if>
  135. <if test="planStatus != null">
  136. or PLAN_STATUS = #{planStatus}
  137. </if>
  138. <if test="planIssueTime != null">
  139. or TO_CHAR(PLAN_ISSUE_TIME,'yyyy-MM-dd') = '#{planIssueTime}'
  140. </if>
  141. <if test="insertUsername != null and insertUsername != ''">
  142. or INSERT_USERNAME = #{insertUsername}
  143. </if>
  144. <if test="insertTime != null">
  145. or TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = '#{insertTime}'
  146. </if>
  147. <if test="updateUsername != null and updateUsername != ''">
  148. or UPDATE_USERNAME = #{updateUsername}
  149. </if>
  150. <if test="updateTime != null">
  151. or TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = '#{updateTime}'
  152. </if>
  153. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  154. or INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  155. </if>
  156. <if test="deleted != null">
  157. or DELETED = #{deleted}
  158. </if>
  159. </delete>
  160. <insert id="insert" parameterType="com.steerinfo.dil.model.AmstruckInwardPlan">
  161. insert into AMSTRUCK_INWARD_PLAN (PLAN_ID, PLAN_NUMBER, CARRIER_ID,
  162. PLAN_TRUCK_NUMBER, PLAN_STATUS, PLAN_ISSUE_TIME,
  163. INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME,
  164. UPDATE_TIME, INSERT_UPDATE_REMARK, DELETED)
  165. values (#{planId,jdbcType=DECIMAL}, #{planNumber,jdbcType=VARCHAR}, #{carrierId,jdbcType=DECIMAL},
  166. #{planTruckNumber,jdbcType=DECIMAL}, #{planStatus,jdbcType=DECIMAL},
  167. #{planIssueTime,jdbcType=TIMESTAMP},
  168. #{insertUsername,jdbcType=VARCHAR}, #{insertTime,jdbcType=TIMESTAMP},
  169. #{updateUsername,jdbcType=VARCHAR},
  170. #{updateTime,jdbcType=TIMESTAMP}, #{insertUpdateRemark,jdbcType=VARCHAR}, #{deleted,jdbcType=DECIMAL})
  171. </insert>
  172. <insert id="insertSelective" parameterType="com.steerinfo.dil.model.AmstruckInwardPlan">
  173. insert into AMSTRUCK_INWARD_PLAN
  174. <trim prefix="(" suffix=")" suffixOverrides=",">
  175. <if test="planId != null">
  176. PLAN_ID,
  177. </if>
  178. <if test="planNumber != null">
  179. PLAN_NUMBER,
  180. </if>
  181. <if test="carrierId != null">
  182. CARRIER_ID,
  183. </if>
  184. <if test="planTruckNumber != null">
  185. PLAN_TRUCK_NUMBER,
  186. </if>
  187. <if test="planStatus != null">
  188. PLAN_STATUS,
  189. </if>
  190. <if test="planIssueTime != null">
  191. PLAN_ISSUE_TIME,
  192. </if>
  193. <if test="insertUsername != null">
  194. INSERT_USERNAME,
  195. </if>
  196. <if test="insertTime != null">
  197. INSERT_TIME,
  198. </if>
  199. <if test="updateUsername != null">
  200. UPDATE_USERNAME,
  201. </if>
  202. <if test="updateTime != null">
  203. UPDATE_TIME,
  204. </if>
  205. <if test="insertUpdateRemark != null">
  206. INSERT_UPDATE_REMARK,
  207. </if>
  208. <if test="deleted != null">
  209. DELETED,
  210. </if>
  211. </trim>
  212. <trim prefix="values (" suffix=")" suffixOverrides=",">
  213. <if test="planId != null">
  214. #{planId,jdbcType=DECIMAL},
  215. </if>
  216. <if test="planNumber != null">
  217. #{planNumber,jdbcType=VARCHAR},
  218. </if>
  219. <if test="carrierId != null">
  220. #{carrierId,jdbcType=DECIMAL},
  221. </if>
  222. <if test="planTruckNumber != null">
  223. #{planTruckNumber,jdbcType=DECIMAL},
  224. </if>
  225. <if test="planStatus != null">
  226. #{planStatus,jdbcType=DECIMAL},
  227. </if>
  228. <if test="planIssueTime != null">
  229. #{planIssueTime,jdbcType=TIMESTAMP},
  230. </if>
  231. <if test="insertUsername != null">
  232. #{insertUsername,jdbcType=VARCHAR},
  233. </if>
  234. <if test="insertTime != null">
  235. #{insertTime,jdbcType=TIMESTAMP},
  236. </if>
  237. <if test="updateUsername != null">
  238. #{updateUsername,jdbcType=VARCHAR},
  239. </if>
  240. <if test="updateTime != null">
  241. #{updateTime,jdbcType=TIMESTAMP},
  242. </if>
  243. <if test="insertUpdateRemark != null">
  244. #{insertUpdateRemark,jdbcType=VARCHAR},
  245. </if>
  246. <if test="deleted != null">
  247. #{deleted,jdbcType=DECIMAL},
  248. </if>
  249. </trim>
  250. </insert>
  251. <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.AmstruckInwardPlan">
  252. update AMSTRUCK_INWARD_PLAN
  253. set PLAN_NUMBER = #{planNumber,jdbcType=VARCHAR},
  254. CARRIER_ID = #{carrierId,jdbcType=DECIMAL},
  255. PLAN_TRUCK_NUMBER = #{planTruckNumber,jdbcType=DECIMAL},
  256. PLAN_STATUS = #{planStatus,jdbcType=DECIMAL},
  257. PLAN_ISSUE_TIME = #{planIssueTime,jdbcType=TIMESTAMP},
  258. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  259. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  260. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  261. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  262. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  263. DELETED = #{deleted,jdbcType=DECIMAL}
  264. where PLAN_ID = #{planId,jdbcType=DECIMAL}
  265. </update>
  266. <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.AmstruckInwardPlan">
  267. update AMSTRUCK_INWARD_PLAN
  268. <set>
  269. <if test="planNumber != null">
  270. PLAN_NUMBER = #{planNumber,jdbcType=VARCHAR},
  271. </if>
  272. <if test="carrierId != null">
  273. CARRIER_ID = #{carrierId,jdbcType=DECIMAL},
  274. </if>
  275. <if test="planTruckNumber != null">
  276. PLAN_TRUCK_NUMBER = #{planTruckNumber,jdbcType=DECIMAL},
  277. </if>
  278. <if test="planStatus != null">
  279. PLAN_STATUS = #{planStatus,jdbcType=DECIMAL},
  280. </if>
  281. <if test="planIssueTime != null">
  282. PLAN_ISSUE_TIME = #{planIssueTime,jdbcType=TIMESTAMP},
  283. </if>
  284. <if test="insertUsername != null">
  285. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  286. </if>
  287. <if test="insertTime != null">
  288. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  289. </if>
  290. <if test="updateUsername != null">
  291. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  292. </if>
  293. <if test="updateTime != null">
  294. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  295. </if>
  296. <if test="insertUpdateRemark != null">
  297. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  298. </if>
  299. <if test="deleted != null">
  300. DELETED = #{deleted,jdbcType=DECIMAL},
  301. </if>
  302. </set>
  303. where PLAN_ID = #{planId,jdbcType=DECIMAL}
  304. </update>
  305. <select id="selectByPrimaryKey" parameterType="java.math.BigDecimal" resultMap="BaseResultMap">
  306. <include refid="select"/>
  307. where PLAN_ID = #{planId,jdbcType=DECIMAL}
  308. </select>
  309. <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  310. <include refid="select"/>
  311. <include refid="where"/>
  312. </select>
  313. <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  314. <include refid="select"/>
  315. <include refid="whereLike"/>
  316. </select>
  317. <insert id="batchInsert" parameterType="java.util.List">
  318. insert into AMSTRUCK_INWARD_PLAN
  319. (PLAN_ID,
  320. PLAN_NUMBER, CARRIER_ID, PLAN_TRUCK_NUMBER,
  321. PLAN_STATUS, PLAN_ISSUE_TIME,
  322. INSERT_USERNAME, INSERT_TIME,
  323. UPDATE_USERNAME, UPDATE_TIME,
  324. INSERT_UPDATE_REMARK, DELETED)
  325. ( <foreach collection="list" item="item" separator="union all">
  326. select
  327. #{item.planId,jdbcType=DECIMAL},
  328. #{item.planNumber,jdbcType=VARCHAR}, #{item.carrierId,jdbcType=DECIMAL},
  329. #{item.planTruckNumber,jdbcType=DECIMAL},
  330. #{item.planStatus,jdbcType=DECIMAL}, #{item.planIssueTime,jdbcType=TIMESTAMP},
  331. #{item.insertUsername,jdbcType=VARCHAR}, #{item.insertTime,jdbcType=TIMESTAMP},
  332. #{item.updateUsername,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP},
  333. #{item.insertUpdateRemark,jdbcType=VARCHAR}, #{item.deleted,jdbcType=DECIMAL} from dual
  334. </foreach> )
  335. </insert>
  336. <update id="batchUpdate" parameterType="java.util.List">
  337. update AMSTRUCK_INWARD_PLAN
  338. set
  339. PLAN_ID=
  340. <foreach collection="list" item="item" index="index" separator=" " open="case PLAN_ID" close="end">
  341. when #{item.planId,jdbcType=DECIMAL} then #{item.planId,jdbcType=DECIMAL}
  342. </foreach>
  343. ,PLAN_NUMBER=
  344. <foreach collection="list" item="item" index="index" separator=" " open="case PLAN_ID" close="end">
  345. when #{item.planId,jdbcType=DECIMAL} then #{item.planNumber,jdbcType=VARCHAR}
  346. </foreach>
  347. ,CARRIER_ID=
  348. <foreach collection="list" item="item" index="index" separator=" " open="case PLAN_ID" close="end">
  349. when #{item.planId,jdbcType=DECIMAL} then #{item.carrierId,jdbcType=DECIMAL}
  350. </foreach>
  351. ,PLAN_TRUCK_NUMBER=
  352. <foreach collection="list" item="item" index="index" separator=" " open="case PLAN_ID" close="end">
  353. when #{item.planId,jdbcType=DECIMAL} then #{item.planTruckNumber,jdbcType=DECIMAL}
  354. </foreach>
  355. ,PLAN_STATUS=
  356. <foreach collection="list" item="item" index="index" separator=" " open="case PLAN_ID" close="end">
  357. when #{item.planId,jdbcType=DECIMAL} then #{item.planStatus,jdbcType=DECIMAL}
  358. </foreach>
  359. ,PLAN_ISSUE_TIME=
  360. <foreach collection="list" item="item" index="index" separator=" " open="case PLAN_ID" close="end">
  361. when #{item.planId,jdbcType=DECIMAL} then #{item.planIssueTime,jdbcType=TIMESTAMP}
  362. </foreach>
  363. ,INSERT_USERNAME=
  364. <foreach collection="list" item="item" index="index" separator=" " open="case PLAN_ID" close="end">
  365. when #{item.planId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
  366. </foreach>
  367. ,INSERT_TIME=
  368. <foreach collection="list" item="item" index="index" separator=" " open="case PLAN_ID" close="end">
  369. when #{item.planId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
  370. </foreach>
  371. ,UPDATE_USERNAME=
  372. <foreach collection="list" item="item" index="index" separator=" " open="case PLAN_ID" close="end">
  373. when #{item.planId,jdbcType=DECIMAL} then #{item.updateUsername,jdbcType=VARCHAR}
  374. </foreach>
  375. ,UPDATE_TIME=
  376. <foreach collection="list" item="item" index="index" separator=" " open="case PLAN_ID" close="end">
  377. when #{item.planId,jdbcType=DECIMAL} then #{item.updateTime,jdbcType=TIMESTAMP}
  378. </foreach>
  379. ,INSERT_UPDATE_REMARK=
  380. <foreach collection="list" item="item" index="index" separator=" " open="case PLAN_ID" close="end">
  381. when #{item.planId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
  382. </foreach>
  383. ,DELETED=
  384. <foreach collection="list" item="item" index="index" separator=" " open="case PLAN_ID" close="end">
  385. when #{item.planId,jdbcType=DECIMAL} then #{item.deleted,jdbcType=DECIMAL}
  386. </foreach>
  387. where PLAN_ID in
  388. <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
  389. #{item.planId,jdbcType=DECIMAL}
  390. </foreach>
  391. </update>
  392. <delete id="batchDelete" parameterType="java.util.List">
  393. delete from AMSTRUCK_INWARD_PLAN
  394. where PLAN_ID in
  395. <foreach collection="list" item="id" open="(" close=")" separator=",">
  396. #{id}
  397. </foreach>
  398. </delete>
  399. <!-- 友情提示!!!-->
  400. <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
  401. <!-- 展示运输计划 -->
  402. <select id="getTruckPlanList" resultType="java.util.Map" parameterType="java.util.Map">
  403. SELECT *
  404. FROM (SELECT APO.PURCHASE_ORDER_NO AS "purchaseOrderNo",
  405. RM.MATERIAL_NAME AS "materialName",
  406. DB.RESULT_FOREIGN_SHIP_NAME AS "resultForeignShipName",
  407. AIP.PLAN_NUMBER AS "planNumber",
  408. RCA.CARRIER_NAME AS "carrierName",
  409. AIP.PLAN_TRUCK_NUMBER AS "planTruckNumber",
  410. AIR.REQUIREMENT_NUMBER AS "requirementNumber",
  411. AIR.REQUIREMENT_TYPE AS "requirementType",
  412. RCT.CAPACITY_TYPE_NAME AS "capacityTypeName",
  413. ARM.MATERIAL_COUNT AS "materialNumber",
  414. AIR.REQUIREMENT_TRUCK_TIME AS "requirementTruckTime",
  415. RW.WAREHOUSE_NAME AS "wareHouseName",
  416. AIR.REQUIREMENT_WORK_TYPE AS "requirementWorkType",
  417. AIR.REQUIREMENT_WORK_CONTENT AS "requirementWorkContent",
  418. AIR.REQUIREMENT_WORK_ENVIRONMENT AS "requirementWorkEnvironment",
  419. AIR.REQUIREMENT_ESTIMATED_DURATION AS "requirementEstimatedDuration",
  420. AIP.PLAN_ID AS "planId",
  421. AIP.INSERT_TIME AS "insertTime"
  422. FROM AMSTRUCK_INWARD_PLAN AIP
  423. LEFT JOIN AMSTRUCK_REQUIREMENT_PLAN ARP
  424. ON ARP.PLAN_ID = AIP.PLAN_ID
  425. LEFT JOIN AMSTRUCK_INWARD_REQUIREMENT AIR
  426. ON AIR.REQUIREMENT_ID = ARP.REQUIREMENT_ID
  427. LEFT JOIN AMSTRUCK_REQUIREMENT_MATERIAL ARM
  428. ON ARM.REQUIREMENT_ID = AIR.REQUIREMENT_ID
  429. LEFT JOIN AMS_PURCHASE_ORDER APO
  430. ON APO.PURCHASE_ORDER_ID = AIR.PURCHASE_ORDER_ID
  431. LEFT JOIN DIL_BATCH DB
  432. ON APO.BATCH_ID = DB.BATCH_ID
  433. LEFT JOIN RMS_MATERIAL RM
  434. ON RM.MATERIAL_ID = DB.MATERIAL_ID
  435. LEFT JOIN RMS_WAREHOUSE RW
  436. ON RW.WAREHOUSE_ID = AIR.REQUIREMNT_UNIT_ID
  437. LEFT JOIN RMS_CARRIER RCA
  438. ON RCA.CARRIER_ID = AIP.CARRIER_ID
  439. LEFT JOIN RMS_CAPACITY_TYPE RCT
  440. ON RCT.CAPACITY_TYPE_ID = AIR.CAPACITY_TYPE_ID)
  441. <where>
  442. <if test="purchaseOrderNo != null">
  443. and
  444. <foreach collection="purchaseOrderNo" item="item" open="(" separator="or" close=")">
  445. "purchaseOrderNo" like '%${item}%'
  446. </foreach>
  447. </if>
  448. <if test="materialName != null">
  449. and
  450. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  451. "materialName" like '%${item}%'
  452. </foreach>
  453. </if>
  454. <if test="materialNumber != null">
  455. and
  456. <foreach collection="materialNumber" item="item" open="(" separator="or" close=")">
  457. "materialNumber" like '%${item}%'
  458. </foreach>
  459. </if>
  460. <if test="resultForeignShipName != null">
  461. and
  462. <foreach collection="resultForeignShipName" item="item" open="(" separator="or" close=")">
  463. "resultForeignShipName" like '%${item}%'
  464. </foreach>
  465. </if>
  466. <if test="requirementNumber != null">
  467. and
  468. <foreach collection="requirementNumber" item="item" open="(" separator="or" close=")">
  469. "requirementNumber" like '%${item}%'
  470. </foreach>
  471. </if>
  472. <if test="requirementType != null">
  473. and
  474. <foreach collection="requirementType" item="item" open="(" separator="or" close=")">
  475. "requirementType" like '%${item}%'
  476. </foreach>
  477. </if>
  478. <if test="capacityTypeName != null">
  479. and
  480. <foreach collection="capacityTypeName" item="item" open="(" separator="or" close=")">
  481. "capacityTypeName" like '%${item}%'
  482. </foreach>
  483. </if>
  484. <if test="requirementTruckTime != null">
  485. and
  486. <foreach collection="requirementTruckTime" item="item" open="(" separator="or" close=")">
  487. "requirementTruckTime" like '%${item}%'
  488. </foreach>
  489. </if>
  490. <if test="requirementWorkType != null">
  491. and
  492. <foreach collection="requirementWorkType" item="item" open="(" separator="or" close=")">
  493. "requirementWorkType" like '%${item}%'
  494. </foreach>
  495. </if>
  496. <if test="requirementWorkContent != null">
  497. and
  498. <foreach collection="requirementWorkContent" item="item" open="(" separator="or" close=")">
  499. "requirementWorkContent" like '%${item}%'
  500. </foreach>
  501. </if>
  502. <if test="requirementWorkEnvironment != null">
  503. and
  504. <foreach collection="requirementWorkEnvironment" item="item" open="(" separator="or" close=")">
  505. "requirementWorkEnvironment" like '%${item}%'
  506. </foreach>
  507. </if>
  508. <if test="requirementEstimatedDuration != null">
  509. and
  510. <foreach collection="requirementEstimatedDuration" item="item" open="(" separator="or" close=")">
  511. "requirementEstimatedDuration" like '%${item}%'
  512. </foreach>
  513. </if>
  514. <if test="planNumber != null">
  515. and
  516. <foreach collection="planNumber" item="item" open="(" separator="or" close=")">
  517. "planNumber" like '%${item}%'
  518. </foreach>
  519. </if>
  520. <if test="carrierName != null">
  521. and
  522. <foreach collection="carrierName" item="item" open="(" separator="or" close=")">
  523. "carrierName" like '%${item}%'
  524. </foreach>
  525. </if>
  526. <if test="planTruckNumber != null">
  527. and
  528. <foreach collection="planTruckNumber" item="item" open="(" separator="or" close=")">
  529. "planTruckNumber" like '%${item}%'
  530. </foreach>
  531. </if>
  532. <if test="wareHouseName != null">
  533. and
  534. <foreach collection="wareHouseName" item="item" open="(" separator="or" close=")">
  535. "wareHouseName" like '%${item}%'
  536. </foreach>
  537. </if>
  538. </where>
  539. <include refid="orderBy"></include>
  540. </select>
  541. <sql id="orderBy">
  542. <if test="orderField != null and orderField != ''">
  543. order by "${orderField}"
  544. <if test="orderType != null and orderType != ''">
  545. ${orderType}
  546. </if>
  547. </if>
  548. <if test="orderField == null ">
  549. order by "insertTime" desc
  550. </if>
  551. </sql>
  552. <select id="selectInwardPlanToUpdate" parameterType="DECIMAL" resultType="java.util.Map">
  553. SELECT AIP.PLAN_NUMBER AS "planNumber",
  554. AIP.CARRIER_ID AS "carrierId",
  555. AIP.PLAN_TRUCK_NUMBER AS "planTruckNumber",
  556. AIP.PLAN_STATUS AS "planStatus"
  557. FROM AMSTRUCK_INWARD_PLAN AIP
  558. WHERE AIP.PLAN_ID = #{planId}
  559. </select>
  560. </mapper>