AmstruckPurplanMapper.xml 26 KB

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