AmstruckInwardPlanMapper.xml 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827
  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. <result column="PLAN_ISSUE_NAME" jdbcType="VARCHAR" property="planIssueName" />
  18. <result column="PLAN_EABLE_STATUS" jdbcType="DECIMAL" property="planEableStatus" />
  19. </resultMap>
  20. <sql id="columns">
  21. PLAN_ID, PLAN_NUMBER, CARRIER_ID, PLAN_TRUCK_NUMBER, PLAN_STATUS, PLAN_ISSUE_TIME,
  22. INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK,
  23. DELETED, PLAN_ISSUE_NAME, PLAN_EABLE_STATUS
  24. </sql>
  25. <sql id="columns_alias">
  26. t.PLAN_ID, t.PLAN_NUMBER, t.CARRIER_ID, t.PLAN_TRUCK_NUMBER, t.PLAN_STATUS, t.PLAN_ISSUE_TIME,
  27. t.INSERT_USERNAME, t.INSERT_TIME, t.UPDATE_USERNAME, t.UPDATE_TIME, t.INSERT_UPDATE_REMARK,
  28. t.DELETED, t.PLAN_ISSUE_NAME, t.PLAN_EABLE_STATUS
  29. </sql>
  30. <sql id="select">
  31. SELECT <include refid="columns" /> FROM AMSTRUCK_INWARD_PLAN
  32. </sql>
  33. <sql id="select_alias">
  34. SELECT <include refid="columns_alias" /> FROM AMSTRUCK_INWARD_PLAN t
  35. </sql>
  36. <sql id="where">
  37. <where>
  38. <if test="planId != null">
  39. and PLAN_ID = #{planId}
  40. </if>
  41. <if test="planNumber != null and planNumber != ''">
  42. and PLAN_NUMBER = #{planNumber}
  43. </if>
  44. <if test="carrierId != null">
  45. and CARRIER_ID = #{carrierId}
  46. </if>
  47. <if test="planTruckNumber != null">
  48. and PLAN_TRUCK_NUMBER = #{planTruckNumber}
  49. </if>
  50. <if test="planStatus != null">
  51. and PLAN_STATUS = #{planStatus}
  52. </if>
  53. <if test="planIssueTime != null">
  54. and TO_CHAR(PLAN_ISSUE_TIME,'yyyy-MM-dd') = #{planIssueTime}
  55. </if>
  56. <if test="insertUsername != null and insertUsername != ''">
  57. and INSERT_USERNAME = #{insertUsername}
  58. </if>
  59. <if test="insertTime != null">
  60. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  61. </if>
  62. <if test="updateUsername != null and updateUsername != ''">
  63. and UPDATE_USERNAME = #{updateUsername}
  64. </if>
  65. <if test="updateTime != null">
  66. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  67. </if>
  68. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  69. and INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  70. </if>
  71. <if test="deleted != null">
  72. and DELETED = #{deleted}
  73. </if>
  74. <if test="planIssueName != null and planIssueName != ''">
  75. and PLAN_ISSUE_NAME = #{planIssueName}
  76. </if>
  77. <if test="planEableStatus != null">
  78. and PLAN_EABLE_STATUS = #{planEableStatus}
  79. </if>
  80. </where>
  81. </sql>
  82. <sql id="whereLike">
  83. <where>
  84. <if test="planId != null">
  85. and PLAN_ID = #{planId}
  86. </if>
  87. <if test="planNumber != null and planNumber != ''">
  88. and PLAN_NUMBER LIKE '%${planNumber}%'
  89. </if>
  90. <if test="carrierId != null">
  91. and CARRIER_ID = #{carrierId}
  92. </if>
  93. <if test="planTruckNumber != null">
  94. and PLAN_TRUCK_NUMBER = #{planTruckNumber}
  95. </if>
  96. <if test="planStatus != null">
  97. and PLAN_STATUS = #{planStatus}
  98. </if>
  99. <if test="planIssueTime != null">
  100. and TO_CHAR(PLAN_ISSUE_TIME,'yyyy-MM-dd') = #{planIssueTime}
  101. </if>
  102. <if test="insertUsername != null and insertUsername != ''">
  103. and INSERT_USERNAME LIKE '%${insertUsername}%'
  104. </if>
  105. <if test="insertTime != null">
  106. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  107. </if>
  108. <if test="updateUsername != null and updateUsername != ''">
  109. and UPDATE_USERNAME LIKE '%${updateUsername}%'
  110. </if>
  111. <if test="updateTime != null">
  112. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  113. </if>
  114. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  115. and INSERT_UPDATE_REMARK LIKE '%${insertUpdateRemark}%'
  116. </if>
  117. <if test="deleted != null">
  118. and DELETED = #{deleted}
  119. </if>
  120. <if test="planIssueName != null and planIssueName != ''">
  121. and PLAN_ISSUE_NAME LIKE '%${planIssueName}%'
  122. </if>
  123. <if test="planEableStatus != null">
  124. and PLAN_EABLE_STATUS = #{planEableStatus}
  125. </if>
  126. </where>
  127. </sql>
  128. <delete id="deleteByPrimaryKey" parameterType="DECIMAL">
  129. delete from AMSTRUCK_INWARD_PLAN
  130. where PLAN_ID = #{planId,jdbcType=DECIMAL}
  131. </delete>
  132. <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
  133. delete from AMSTRUCK_INWARD_PLAN
  134. where 1!=1
  135. <if test="planNumber != null and planNumber != ''">
  136. or PLAN_NUMBER = #{planNumber}
  137. </if>
  138. <if test="carrierId != null">
  139. or CARRIER_ID = #{carrierId}
  140. </if>
  141. <if test="planTruckNumber != null">
  142. or PLAN_TRUCK_NUMBER = #{planTruckNumber}
  143. </if>
  144. <if test="planStatus != null">
  145. or PLAN_STATUS = #{planStatus}
  146. </if>
  147. <if test="planIssueTime != null">
  148. or TO_CHAR(PLAN_ISSUE_TIME,'yyyy-MM-dd') = '#{planIssueTime}'
  149. </if>
  150. <if test="insertUsername != null and insertUsername != ''">
  151. or INSERT_USERNAME = #{insertUsername}
  152. </if>
  153. <if test="insertTime != null">
  154. or TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = '#{insertTime}'
  155. </if>
  156. <if test="updateUsername != null and updateUsername != ''">
  157. or UPDATE_USERNAME = #{updateUsername}
  158. </if>
  159. <if test="updateTime != null">
  160. or TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = '#{updateTime}'
  161. </if>
  162. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  163. or INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  164. </if>
  165. <if test="deleted != null">
  166. or DELETED = #{deleted}
  167. </if>
  168. <if test="planIssueName != null and planIssueName != ''">
  169. or PLAN_ISSUE_NAME = #{planIssueName}
  170. </if>
  171. <if test="planEableStatus != null">
  172. or PLAN_EABLE_STATUS = #{planEableStatus}
  173. </if>
  174. </delete>
  175. <insert id="insert" parameterType="com.steerinfo.dil.model.AmstruckInwardPlan">
  176. insert into AMSTRUCK_INWARD_PLAN (PLAN_ID, PLAN_NUMBER, CARRIER_ID,
  177. PLAN_TRUCK_NUMBER, PLAN_STATUS, PLAN_ISSUE_TIME,
  178. INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME,
  179. UPDATE_TIME, INSERT_UPDATE_REMARK, DELETED,
  180. PLAN_ISSUE_NAME, PLAN_EABLE_STATUS)
  181. values (#{planId,jdbcType=DECIMAL}, #{planNumber,jdbcType=VARCHAR}, #{carrierId,jdbcType=DECIMAL},
  182. #{planTruckNumber,jdbcType=DECIMAL}, #{planStatus,jdbcType=DECIMAL}, #{planIssueTime,jdbcType=TIMESTAMP},
  183. #{insertUsername,jdbcType=VARCHAR}, #{insertTime,jdbcType=TIMESTAMP}, #{updateUsername,jdbcType=VARCHAR},
  184. #{updateTime,jdbcType=TIMESTAMP}, #{insertUpdateRemark,jdbcType=VARCHAR}, #{deleted,jdbcType=DECIMAL},
  185. #{planIssueName,jdbcType=VARCHAR}, #{planEableStatus,jdbcType=DECIMAL})
  186. </insert>
  187. <insert id="insertSelective" parameterType="com.steerinfo.dil.model.AmstruckInwardPlan">
  188. insert into AMSTRUCK_INWARD_PLAN
  189. <trim prefix="(" suffix=")" suffixOverrides=",">
  190. <if test="planId != null">
  191. PLAN_ID,
  192. </if>
  193. <if test="planNumber != null">
  194. PLAN_NUMBER,
  195. </if>
  196. <if test="carrierId != null">
  197. CARRIER_ID,
  198. </if>
  199. <if test="planTruckNumber != null">
  200. PLAN_TRUCK_NUMBER,
  201. </if>
  202. <if test="planStatus != null">
  203. PLAN_STATUS,
  204. </if>
  205. <if test="planIssueTime != null">
  206. PLAN_ISSUE_TIME,
  207. </if>
  208. <if test="insertUsername != null">
  209. INSERT_USERNAME,
  210. </if>
  211. <if test="insertTime != null">
  212. INSERT_TIME,
  213. </if>
  214. <if test="updateUsername != null">
  215. UPDATE_USERNAME,
  216. </if>
  217. <if test="updateTime != null">
  218. UPDATE_TIME,
  219. </if>
  220. <if test="insertUpdateRemark != null">
  221. INSERT_UPDATE_REMARK,
  222. </if>
  223. <if test="deleted != null">
  224. DELETED,
  225. </if>
  226. <if test="planIssueName != null">
  227. PLAN_ISSUE_NAME,
  228. </if>
  229. <if test="planEableStatus != null">
  230. PLAN_EABLE_STATUS,
  231. </if>
  232. </trim>
  233. <trim prefix="values (" suffix=")" suffixOverrides=",">
  234. <if test="planId != null">
  235. #{planId,jdbcType=DECIMAL},
  236. </if>
  237. <if test="planNumber != null">
  238. #{planNumber,jdbcType=VARCHAR},
  239. </if>
  240. <if test="carrierId != null">
  241. #{carrierId,jdbcType=DECIMAL},
  242. </if>
  243. <if test="planTruckNumber != null">
  244. #{planTruckNumber,jdbcType=DECIMAL},
  245. </if>
  246. <if test="planStatus != null">
  247. #{planStatus,jdbcType=DECIMAL},
  248. </if>
  249. <if test="planIssueTime != null">
  250. #{planIssueTime,jdbcType=TIMESTAMP},
  251. </if>
  252. <if test="insertUsername != null">
  253. #{insertUsername,jdbcType=VARCHAR},
  254. </if>
  255. <if test="insertTime != null">
  256. #{insertTime,jdbcType=TIMESTAMP},
  257. </if>
  258. <if test="updateUsername != null">
  259. #{updateUsername,jdbcType=VARCHAR},
  260. </if>
  261. <if test="updateTime != null">
  262. #{updateTime,jdbcType=TIMESTAMP},
  263. </if>
  264. <if test="insertUpdateRemark != null">
  265. #{insertUpdateRemark,jdbcType=VARCHAR},
  266. </if>
  267. <if test="deleted != null">
  268. #{deleted,jdbcType=DECIMAL},
  269. </if>
  270. <if test="planIssueName != null">
  271. #{planIssueName,jdbcType=VARCHAR},
  272. </if>
  273. <if test="planEableStatus != null">
  274. #{planEableStatus,jdbcType=DECIMAL},
  275. </if>
  276. </trim>
  277. </insert>
  278. <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.AmstruckInwardPlan">
  279. update AMSTRUCK_INWARD_PLAN
  280. set PLAN_NUMBER = #{planNumber,jdbcType=VARCHAR},
  281. CARRIER_ID = #{carrierId,jdbcType=DECIMAL},
  282. PLAN_TRUCK_NUMBER = #{planTruckNumber,jdbcType=DECIMAL},
  283. PLAN_STATUS = #{planStatus,jdbcType=DECIMAL},
  284. PLAN_ISSUE_TIME = #{planIssueTime,jdbcType=TIMESTAMP},
  285. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  286. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  287. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  288. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  289. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  290. DELETED = #{deleted,jdbcType=DECIMAL},
  291. PLAN_ISSUE_NAME = #{planIssueName,jdbcType=VARCHAR},
  292. PLAN_EABLE_STATUS = #{planEableStatus,jdbcType=DECIMAL}
  293. where PLAN_ID = #{planId,jdbcType=DECIMAL}
  294. </update>
  295. <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.AmstruckInwardPlan">
  296. update AMSTRUCK_INWARD_PLAN
  297. <set>
  298. <if test="planNumber != null">
  299. PLAN_NUMBER = #{planNumber,jdbcType=VARCHAR},
  300. </if>
  301. <if test="carrierId != null">
  302. CARRIER_ID = #{carrierId,jdbcType=DECIMAL},
  303. </if>
  304. <if test="planTruckNumber != null">
  305. PLAN_TRUCK_NUMBER = #{planTruckNumber,jdbcType=DECIMAL},
  306. </if>
  307. <if test="planStatus != null">
  308. PLAN_STATUS = #{planStatus,jdbcType=DECIMAL},
  309. </if>
  310. <if test="planIssueTime != null">
  311. PLAN_ISSUE_TIME = #{planIssueTime,jdbcType=TIMESTAMP},
  312. </if>
  313. <if test="insertUsername != null">
  314. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  315. </if>
  316. <if test="insertTime != null">
  317. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  318. </if>
  319. <if test="updateUsername != null">
  320. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  321. </if>
  322. <if test="updateTime != null">
  323. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  324. </if>
  325. <if test="insertUpdateRemark != null">
  326. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  327. </if>
  328. <if test="deleted != null">
  329. DELETED = #{deleted,jdbcType=DECIMAL},
  330. </if>
  331. <if test="planIssueName != null">
  332. PLAN_ISSUE_NAME = #{planIssueName,jdbcType=VARCHAR},
  333. </if>
  334. <if test="planEableStatus != null">
  335. PLAN_EABLE_STATUS = #{planEableStatus,jdbcType=DECIMAL},
  336. </if>
  337. </set>
  338. where PLAN_ID = #{planId,jdbcType=DECIMAL}
  339. </update>
  340. <select id="selectByPrimaryKey" parameterType="DECIMAL" resultMap="BaseResultMap">
  341. <include refid="select" />
  342. where PLAN_ID = #{planId,jdbcType=DECIMAL}
  343. </select>
  344. <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  345. <include refid="select" />
  346. <include refid="where" />
  347. </select>
  348. <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  349. <include refid="select" />
  350. <include refid="whereLike" />
  351. </select>
  352. <insert id="batchInsert" parameterType="java.util.List">
  353. insert into AMSTRUCK_INWARD_PLAN
  354. (PLAN_ID,
  355. PLAN_NUMBER, CARRIER_ID, PLAN_TRUCK_NUMBER,
  356. PLAN_STATUS, PLAN_ISSUE_TIME,
  357. INSERT_USERNAME, INSERT_TIME,
  358. UPDATE_USERNAME, UPDATE_TIME,
  359. INSERT_UPDATE_REMARK, DELETED,
  360. PLAN_ISSUE_NAME, PLAN_EABLE_STATUS
  361. )
  362. ( <foreach collection="list" item="item" separator="union all">
  363. select
  364. #{item.planId,jdbcType=DECIMAL},
  365. #{item.planNumber,jdbcType=VARCHAR}, #{item.carrierId,jdbcType=DECIMAL}, #{item.planTruckNumber,jdbcType=DECIMAL},
  366. #{item.planStatus,jdbcType=DECIMAL}, #{item.planIssueTime,jdbcType=TIMESTAMP},
  367. #{item.insertUsername,jdbcType=VARCHAR}, #{item.insertTime,jdbcType=TIMESTAMP},
  368. #{item.updateUsername,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP},
  369. #{item.insertUpdateRemark,jdbcType=VARCHAR}, #{item.deleted,jdbcType=DECIMAL},
  370. #{item.planIssueName,jdbcType=VARCHAR}, #{item.planEableStatus,jdbcType=DECIMAL}
  371. from dual
  372. </foreach> )
  373. </insert>
  374. <update id="batchUpdate" parameterType="java.util.List">
  375. update AMSTRUCK_INWARD_PLAN
  376. set
  377. PLAN_ID=
  378. <foreach close="end" collection="list" index="index" item="item" open="case PLAN_ID" separator=" ">
  379. when #{item.planId,jdbcType=DECIMAL} then #{item.planId,jdbcType=DECIMAL}
  380. </foreach>
  381. ,PLAN_NUMBER=
  382. <foreach close="end" collection="list" index="index" item="item" open="case PLAN_ID" separator=" ">
  383. when #{item.planId,jdbcType=DECIMAL} then #{item.planNumber,jdbcType=VARCHAR}
  384. </foreach>
  385. ,CARRIER_ID=
  386. <foreach close="end" collection="list" index="index" item="item" open="case PLAN_ID" separator=" ">
  387. when #{item.planId,jdbcType=DECIMAL} then #{item.carrierId,jdbcType=DECIMAL}
  388. </foreach>
  389. ,PLAN_TRUCK_NUMBER=
  390. <foreach close="end" collection="list" index="index" item="item" open="case PLAN_ID" separator=" ">
  391. when #{item.planId,jdbcType=DECIMAL} then #{item.planTruckNumber,jdbcType=DECIMAL}
  392. </foreach>
  393. ,PLAN_STATUS=
  394. <foreach close="end" collection="list" index="index" item="item" open="case PLAN_ID" separator=" ">
  395. when #{item.planId,jdbcType=DECIMAL} then #{item.planStatus,jdbcType=DECIMAL}
  396. </foreach>
  397. ,PLAN_ISSUE_TIME=
  398. <foreach close="end" collection="list" index="index" item="item" open="case PLAN_ID" separator=" ">
  399. when #{item.planId,jdbcType=DECIMAL} then #{item.planIssueTime,jdbcType=TIMESTAMP}
  400. </foreach>
  401. ,INSERT_USERNAME=
  402. <foreach close="end" collection="list" index="index" item="item" open="case PLAN_ID" separator=" ">
  403. when #{item.planId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
  404. </foreach>
  405. ,INSERT_TIME=
  406. <foreach close="end" collection="list" index="index" item="item" open="case PLAN_ID" separator=" ">
  407. when #{item.planId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
  408. </foreach>
  409. ,UPDATE_USERNAME=
  410. <foreach close="end" collection="list" index="index" item="item" open="case PLAN_ID" separator=" ">
  411. when #{item.planId,jdbcType=DECIMAL} then #{item.updateUsername,jdbcType=VARCHAR}
  412. </foreach>
  413. ,UPDATE_TIME=
  414. <foreach close="end" collection="list" index="index" item="item" open="case PLAN_ID" separator=" ">
  415. when #{item.planId,jdbcType=DECIMAL} then #{item.updateTime,jdbcType=TIMESTAMP}
  416. </foreach>
  417. ,INSERT_UPDATE_REMARK=
  418. <foreach close="end" collection="list" index="index" item="item" open="case PLAN_ID" separator=" ">
  419. when #{item.planId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
  420. </foreach>
  421. ,DELETED=
  422. <foreach close="end" collection="list" index="index" item="item" open="case PLAN_ID" separator=" ">
  423. when #{item.planId,jdbcType=DECIMAL} then #{item.deleted,jdbcType=DECIMAL}
  424. </foreach>
  425. ,PLAN_ISSUE_NAME=
  426. <foreach close="end" collection="list" index="index" item="item" open="case PLAN_ID" separator=" ">
  427. when #{item.planId,jdbcType=DECIMAL} then #{item.planIssueName,jdbcType=VARCHAR}
  428. </foreach>
  429. ,PLAN_EABLE_STATUS=
  430. <foreach close="end" collection="list" index="index" item="item" open="case PLAN_ID" separator=" ">
  431. when #{item.planId,jdbcType=DECIMAL} then #{item.planEableStatus,jdbcType=DECIMAL}
  432. </foreach>
  433. where PLAN_ID in
  434. <foreach close=")" collection="list" index="index" item="item" open="(" separator=",">
  435. #{item.planId,jdbcType=DECIMAL}
  436. </foreach>
  437. </update>
  438. <delete id="batchDelete" parameterType="java.util.List">
  439. delete from AMSTRUCK_INWARD_PLAN
  440. where PLAN_ID in
  441. <foreach close=")" collection="list" item="id" open="(" separator=",">
  442. #{id}
  443. </foreach>
  444. </delete>
  445. <!-- 友情提示!!!-->
  446. <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
  447. <select id="getTruckPlanList" resultType="java.util.Map" parameterType="java.util.Map">
  448. SELECT *
  449. FROM (SELECT AIP.PLAN_NUMBER AS "planNumber",
  450. RCA.CARRIER_NAME AS "carrierName",
  451. AIP.PLAN_TRUCK_NUMBER AS "planTruckNumber",
  452. AIR.REQUIREMENT_NUMBER AS "requirementNumber",
  453. AIR.REQUIREMENT_TYPE AS "requirementType",
  454. AIR.REQUIREMENT_TRUCK_TIME AS "requirementTruckTime",
  455. AIR.REQUIREMENT_ID AS "requirementId",
  456. AIR.REQUIREMENT_WORK_TYPE AS "requirementWorkType",
  457. AIR.REQUIREMENT_WORK_CONTENT AS "requirementWorkContent",
  458. AIR.REQUIREMENT_WORK_ENVIRONMENT AS "requirementWorkEnvironment",
  459. AIR.REQUIREMENT_ESTIMATED_DURATION AS "requirementEstimatedDuration",
  460. AIR.LOADING_REMARK AS "loadingRemark",
  461. RTR.TRANS_RANGE_VALUE AS "rangeValue",
  462. AIP.PLAN_ID AS "planId",
  463. AIP.INSERT_TIME AS "insertTime",
  464. RS.SHIPPER_NAME AS "shipperName"
  465. FROM AMSTRUCK_INWARD_PLAN AIP
  466. LEFT JOIN AMSTRUCK_REQUIREMENT_PLAN ARP
  467. ON ARP.PLAN_ID = AIP.PLAN_ID
  468. LEFT JOIN AMSTRUCK_INWARD_REQUIREMENT AIR
  469. ON AIR.REQUIREMENT_ID = ARP.REQUIREMENT_ID
  470. LEFT JOIN RMS_CARRIER RCA
  471. ON RCA.CARRIER_ID = AIP.CARRIER_ID
  472. LEFT JOIN RMS_SHIPPER RS
  473. ON RS.SHIPPER_ID = AIR.REQUIREMENT_SHIPPER_ID
  474. LEFT JOIN RMS_TRANS_RANGE RTR
  475. ON RTR.TRANS_RANGE_ID = AIR.LINE_ID
  476. WHERE AIP.PLAN_STATUS = #{planStatus}
  477. AND AIP.DELETED = 0
  478. AND AIR.PURCHASE_ORDER_ID IS NULL
  479. )
  480. <where>
  481. <if test="purchaseOrderNo != null">
  482. <foreach collection="purchaseOrderNo" item="item" open="(" separator="or" close=")">
  483. "purchaseOrderNo" like '%${item}%'
  484. </foreach>
  485. </if>
  486. <if test="materialName != null">
  487. and
  488. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  489. "materialName" like '%${item}%'
  490. </foreach>
  491. </if>
  492. <if test="materialNumber != null">
  493. and
  494. <foreach collection="materialNumber" item="item" open="(" separator="or" close=")">
  495. "materialNumber" like '%${item}%'
  496. </foreach>
  497. </if>
  498. <if test="resultForeignShipName != null">
  499. and
  500. <foreach collection="resultForeignShipName" item="item" open="(" separator="or" close=")">
  501. "resultForeignShipName" like '%${item}%'
  502. </foreach>
  503. </if>
  504. <if test="requirementNumber != null">
  505. and
  506. <foreach collection="requirementNumber" item="item" open="(" separator="or" close=")">
  507. "requirementNumber" like '%${item}%'
  508. </foreach>
  509. </if>
  510. <if test="requirementType != null">
  511. and
  512. <foreach collection="requirementType" item="item" open="(" separator="or" close=")">
  513. "requirementType" like '%${item}%'
  514. </foreach>
  515. </if>
  516. <if test="capacityTypeName != null">
  517. and
  518. <foreach collection="capacityTypeName" item="item" open="(" separator="or" close=")">
  519. "capacityTypeName" like '%${item}%'
  520. </foreach>
  521. </if>
  522. <if test="requirementTruckTime != null">
  523. and
  524. <foreach collection="requirementTruckTime" item="item" open="(" separator="or" close=")">
  525. "requirementTruckTime" like '%${item}%'
  526. </foreach>
  527. </if>
  528. <if test="requirementWorkType != null">
  529. and
  530. <foreach collection="requirementWorkType" item="item" open="(" separator="or" close=")">
  531. "requirementWorkType" like '%${item}%'
  532. </foreach>
  533. </if>
  534. <if test="requirementWorkContent != null">
  535. and
  536. <foreach collection="requirementWorkContent" item="item" open="(" separator="or" close=")">
  537. "requirementWorkContent" like '%${item}%'
  538. </foreach>
  539. </if>
  540. <if test="requirementWorkEnvironment != null">
  541. and
  542. <foreach collection="requirementWorkEnvironment" item="item" open="(" separator="or" close=")">
  543. "requirementWorkEnvironment" like '%${item}%'
  544. </foreach>
  545. </if>
  546. <if test="requirementEstimatedDuration != null">
  547. and
  548. <foreach collection="requirementEstimatedDuration" item="item" open="(" separator="or" close=")">
  549. "requirementEstimatedDuration" like '%${item}%'
  550. </foreach>
  551. </if>
  552. <if test="planNumber != null">
  553. and
  554. <foreach collection="planNumber" item="item" open="(" separator="or" close=")">
  555. "planNumber" like '%${item}%'
  556. </foreach>
  557. </if>
  558. <if test="carrierName != null">
  559. and
  560. <foreach collection="carrierName" item="item" open="(" separator="or" close=")">
  561. "carrierName" like '%${item}%'
  562. </foreach>
  563. </if>
  564. <if test="planTruckNumber != null">
  565. and
  566. <foreach collection="planTruckNumber" item="item" open="(" separator="or" close=")">
  567. "planTruckNumber" like '%${item}%'
  568. </foreach>
  569. </if>
  570. <if test="wareHouseName != null">
  571. and
  572. <foreach collection="wareHouseName" item="item" open="(" separator="or" close=")">
  573. "wareHouseName" like '%${item}%'
  574. </foreach>
  575. </if>
  576. </where>
  577. <include refid="orderBy"></include>
  578. </select>
  579. <!-- 展示运输计划 -->
  580. <select id="getIssuedPlanList" resultType="java.util.Map" parameterType="java.util.Map">
  581. select *
  582. from (SELECT AIP.PLAN_NUMBER AS "planNumber",
  583. RCA.CARRIER_NAME AS "carrierName",
  584. RTR.TRANS_RANGE_VALUE AS "rangeValue",
  585. AIP.PLAN_TRUCK_NUMBER AS "planTruckNumber",
  586. AIR.REQUIREMENT_NUMBER AS "requirementNumber",
  587. AIP.PLAN_ISSUE_TIME AS "planIssueTime",
  588. AIP.PLAN_ISSUE_NAME AS "planIssueName",
  589. AIR.REQUIREMENT_TYPE AS "requirementType",
  590. AIR.REQUIREMENT_TRUCK_TIME AS "requirementTruckTime",
  591. AIR.REQUIREMENT_WORK_TYPE AS "requirementWorkType",
  592. AIR.REQUIREMENT_WORK_CONTENT AS "requirementWorkContent",
  593. AIR.REQUIREMENT_WORK_ENVIRONMENT AS "requirementWorkEnvironment",
  594. AIR.REQUIREMENT_ESTIMATED_DURATION AS "requirementEstimatedDuration",
  595. AIR.REQUIREMENT_ID AS "requirementId",
  596. AIR.LOADING_REMARK AS "loadingRemark",
  597. AIP.PLAN_ID AS "planId",
  598. AIP.CARRIER_ID AS "carrierId",
  599. AIP.INSERT_TIME AS "insertTime",
  600. RS.SHIPPER_NAME AS "shipperName",
  601. AIR.DUE_DATE AS "dueDate",
  602. AIR.INSERT_USERNAME AS "insertUsername",
  603. rw1.warehouse_name "unloadName",
  604. rw1.WAREHOUSE_ID "unloadId",
  605. rw2.warehouse_name "loadName",
  606. rw2.WAREHOUSE_ID "loadId",
  607. arm.material_weight "materialWeight",
  608. arm.material_count "materialCount",
  609. arm.MATERIAL_ID "materialId",
  610. rm.material_name || rm.material_specification || '(' ||
  611. rm.material_model || ')' "materialName",
  612. AIR.INSERT_UPDATE_REMARK "Tel"
  613. FROM AMSTRUCK_INWARD_PLAN AIP
  614. LEFT JOIN AMSTRUCK_REQUIREMENT_PLAN ARP
  615. ON ARP.PLAN_ID = AIP.PLAN_ID
  616. LEFT JOIN AMSTRUCK_INWARD_REQUIREMENT AIR
  617. ON AIR.REQUIREMENT_ID = ARP.REQUIREMENT_ID
  618. LEFT JOIN RMS_SHIPPER RS
  619. ON RS.SHIPPER_ID = AIR.REQUIREMENT_SHIPPER_ID
  620. LEFT JOIN RMS_CARRIER RCA
  621. ON RCA.CARRIER_ID = AIP.CARRIER_ID
  622. LEFT JOIN amstruck_requirement_material arm
  623. ON air.requirement_id = arm.requirement_id
  624. LEFT JOIN rms_warehouse rw1
  625. ON rw1.warehouse_id = arm.requirement_unload_unit_id
  626. LEFT JOIN rms_warehouse rw2
  627. ON rw2.warehouse_id = arm.requirement_platform_id
  628. LEFT JOIN rms_material rm
  629. ON rm.material_id = arm.material_id
  630. LEFT JOIN RMS_TRANS_RANGE RTR
  631. ON RTR.TRANS_RANGE_ID = AIR.LINE_ID
  632. WHERE AIP.DELETED = 0
  633. AND AIR.PURCHASE_ORDER_ID IS NULL
  634. <if test="planId != null">
  635. and AIP.PLAN_ID = #{planId}
  636. </if>
  637. <if test="carrierId != null">
  638. and (select
  639. rc.carrier_sso_id from rms_carrier rc
  640. where rc.carrier_id = AIP.CARRIER_ID) = #{carrierId}
  641. </if>
  642. <if test="planStatus == 0">
  643. and AIP.PLAN_STATUS = 0
  644. </if>
  645. <if test="planStatus == 1">
  646. and AIP.PLAN_STATUS in (1,2)
  647. </if>
  648. <if test="planStatus == 4">
  649. and to_date(#{newTime}, 'yyyy-mm-dd hh24:mi:ss') >= AIR.DUE_DATE
  650. </if>
  651. <if test="planStatus == 2">
  652. and AIP.PLAN_STATUS = 2
  653. </if>
  654. <if test="planStatus == 3">
  655. and to_date(#{newTime}, 'yyyy-mm-dd hh24:mi:ss') &lt;= AIR.DUE_DATE
  656. </if>
  657. <if test="con != null">
  658. and rm.material_name like #{con}
  659. </if>
  660. )
  661. <where>
  662. <if test="planNumber != null">
  663. <foreach collection="planNumber" item="item" open="(" separator="or" close=")">
  664. "planNumber" like '%${item}%'
  665. </foreach>
  666. </if>
  667. <if test="materialName != null">
  668. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  669. "materialName" like '%${item}%'
  670. </foreach>
  671. </if>
  672. <if test="loadName != null">
  673. <foreach collection="loadName" item="item" open="(" separator="or" close=")">
  674. "loadName" like '%${item}%'
  675. </foreach>
  676. </if>
  677. <if test="unloadName != null">
  678. <foreach collection="unloadName" item="item" open="(" separator="or" close=")">
  679. "unloadName" like '%${item}%'
  680. </foreach>
  681. </if>
  682. <if test="carrierName != null">
  683. and
  684. <foreach collection="carrierName" item="item" open="(" separator="or" close=")">
  685. "carrierName" like '%${item}%'
  686. </foreach>
  687. </if>
  688. <if test="planTruckNumber != null">
  689. and
  690. <foreach collection="planTruckNumber" item="item" open="(" separator="or" close=")">
  691. "planTruckNumber" like '%${item}%'
  692. </foreach>
  693. </if>
  694. <if test="requirementNumber != null">
  695. and
  696. <foreach collection="requirementNumber" item="item" open="(" separator="or" close=")">
  697. "requirementNumber" like '%${item}%'
  698. </foreach>
  699. </if>
  700. <if test="planIssueTime != null">
  701. and
  702. <foreach collection="planIssueTime" item="item" open="(" separator="or" close=")">
  703. "planIssueTime" like '%${item}%'
  704. </foreach>
  705. </if>
  706. <if test="requirementType != null">
  707. and
  708. <foreach collection="requirementType" item="item" open="(" separator="or" close=")">
  709. "requirementType" like '%${item}%'
  710. </foreach>
  711. </if>
  712. <if test="requirementTruckTime != null">
  713. and
  714. <foreach collection="requirementTruckTime" item="item" open="(" separator="or" close=")">
  715. "requirementTruckTime" like '%${item}%'
  716. </foreach>
  717. </if>
  718. <if test="insertTime != null">
  719. and
  720. <foreach collection="insertTime" item="item" open="(" separator="or" close=")">
  721. "insertTime" like '%${item}%'
  722. </foreach>
  723. </if>
  724. <if test="shipperName != null">
  725. and
  726. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  727. "shipperName" like '%${item}%'
  728. </foreach>
  729. </if>
  730. </where>
  731. <include refid="orderBy"></include>
  732. </select>
  733. <select id="getIssuedPlanList2" resultType="java.util.Map" parameterType="java.util.Map">
  734. SELECT *
  735. FROM (SELECT AIP.PLAN_NUMBER AS "planNumber",
  736. RCA.CARRIER_NAME AS "carrierName",
  737. RTR.TRANS_RANGE_VALUE AS "rangeValue",
  738. AIP.PLAN_TRUCK_NUMBER AS "planTruckNumber",
  739. AIR.REQUIREMENT_NUMBER AS "requirementNumber",
  740. AIP.PLAN_ISSUE_TIME AS "planIssueTime",
  741. AIP.PLAN_ISSUE_NAME AS "planIssueName",
  742. AIR.REQUIREMENT_TYPE AS "requirementType",
  743. AIR.REQUIREMENT_TRUCK_TIME AS "requirementTruckTime",
  744. AIR.REQUIREMENT_WORK_TYPE AS "requirementWorkType",
  745. AIR.REQUIREMENT_WORK_CONTENT AS "requirementWorkContent",
  746. AIR.REQUIREMENT_WORK_ENVIRONMENT AS "requirementWorkEnvironment",
  747. AIR.REQUIREMENT_ESTIMATED_DURATION AS "requirementEstimatedDuration",
  748. AIR.REQUIREMENT_ID AS "requirementId",
  749. AIP.PLAN_ID AS "planId",
  750. AIP.CARRIER_ID AS "carrierId",
  751. AIP.INSERT_TIME AS "insertTime",
  752. RS.SHIPPER_NAME AS "shipperName"
  753. FROM AMSTRUCK_INWARD_PLAN AIP
  754. LEFT JOIN AMSTRUCK_REQUIREMENT_PLAN ARP
  755. ON ARP.PLAN_ID = AIP.PLAN_ID
  756. LEFT JOIN AMSTRUCK_INWARD_REQUIREMENT AIR
  757. ON AIR.REQUIREMENT_ID = ARP.REQUIREMENT_ID
  758. LEFT JOIN RMS_SHIPPER RS
  759. ON RS.SHIPPER_ID = AIR.REQUIREMENT_SHIPPER_ID
  760. LEFT JOIN RMS_CARRIER RCA
  761. ON RCA.CARRIER_ID = AIP.CARRIER_ID
  762. LEFT JOIN RMS_TRANS_RANGE RTR
  763. ON RTR.TRANS_RANGE_ID = AIR.LINE_ID
  764. WHERE AIP.DELETED = 0
  765. AND AIR.PURCHASE_ORDER_ID IS NULL
  766. <if test="planId != null">
  767. and AIP.PLAN_ID = #{planId}
  768. </if>
  769. )
  770. </select>
  771. <sql id="orderBy">
  772. <if test="orderField != null and orderField != ''">
  773. order by "${orderField}"
  774. <if test="orderType != null and orderType != ''">
  775. ${orderType}
  776. </if>
  777. </if>
  778. <if test="orderField == null ">
  779. order by "insertTime" desc
  780. </if>
  781. </sql>
  782. <select id="selectInwardPlanToUpdate" parameterType="DECIMAL" resultType="java.util.Map">
  783. SELECT AIP.CARRIER_ID AS "carrierId",
  784. AIP.PLAN_TRUCK_NUMBER AS "planTruckNumber",
  785. AIR.REQUIREMENT_NUMBER AS "requirementNumber",
  786. AIP.PLAN_NUMBER AS "planNumber"
  787. FROM AMSTRUCK_INWARD_PLAN AIP
  788. LEFT JOIN AMSTRUCK_REQUIREMENT_PLAN ARP
  789. ON AIP.PLAN_ID = ARP.PLAN_ID
  790. LEFT JOIN AMSTRUCK_INWARD_REQUIREMENT AIR
  791. ON AIR.REQUIREMENT_ID = ARP.REQUIREMENT_ID
  792. WHERE AIP.PLAN_ID = #{planId}
  793. </select>
  794. <select id="getCarrierList" resultType="java.util.Map">
  795. SELECT RC.CARRIER_ID AS "id",
  796. RC.CARRIER_ID AS "value",
  797. RC.CARRIER_NAME AS "label"
  798. FROM RMS_CARRIER RC
  799. </select>
  800. <select id="getPlanOrder" resultType="java.util.Map" parameterType="java.util.Map">
  801. select RC.CAPACITY_ID "capacityId",
  802. rc.capacity_number "capacityNumber",
  803. oo.order_number "orderNumber",
  804. oo.order_id "orderId"
  805. from OMSTRUCK_ORDER OO
  806. left join RMS_CAPACITY RC
  807. ON RC.CAPACITY_ID = OO.CAPACITY_ID
  808. left join amstruck_inward_plan aip
  809. on aip.plan_id = oo.order_plan_id
  810. left join amstruck_requirement_plan arp
  811. on arp.plan_id = aip.plan_id
  812. left join amstruck_inward_requirement air
  813. on air.requirement_id = arp.requirement_id
  814. where oo.order_status = #{orderStatus}
  815. <if test="planId != null ">
  816. and aip.plan_id = #{planId}
  817. </if>
  818. <if test="requirementId != null ">
  819. and air.requirement_id = #{requirementId}
  820. </if>
  821. </select>
  822. </mapper>