AmstruckSporadicMaterialMapper.xml 24 KB

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