AmstruckPurplanMaterialMapper.xml 29 KB

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