TmstruckArrivalResultMapper.xml 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544
  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.route.mapper.TmstruckArrivalResultMapper">
  4. <resultMap id="BaseResultMap" type="com.steerinfo.route.model.TmstruckArrivalResult">
  5. <id column="RESULT_ID" jdbcType="DECIMAL" property="resultId" />
  6. <result column="POINT_ID" jdbcType="DECIMAL" property="pointId" />
  7. <result column="RESULT_TOTAL_ID" jdbcType="DECIMAL" property="resultTotalId" />
  8. <result column="RESULT_ARRIVAL_ADDRESS" jdbcType="VARCHAR" property="resultArrivalAddress" />
  9. <result column="RESULT_FULL_CONTAINER_PHOTO" jdbcType="VARCHAR" property="resultFullContainerPhoto" />
  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. </resultMap>
  16. <sql id="columns">
  17. RESULT_ID, POINT_ID, RESULT_TOTAL_ID, RESULT_ARRIVAL_ADDRESS, RESULT_FULL_CONTAINER_PHOTO,
  18. INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK
  19. </sql>
  20. <sql id="columns_alias">
  21. t.RESULT_ID, t.POINT_ID, t.RESULT_TOTAL_ID, t.RESULT_ARRIVAL_ADDRESS, t.RESULT_FULL_CONTAINER_PHOTO,
  22. t.INSERT_USERNAME, t.INSERT_TIME, t.UPDATE_USERNAME, t.UPDATE_TIME, t.INSERT_UPDATE_REMARK
  23. </sql>
  24. <sql id="select">
  25. SELECT <include refid="columns"/> FROM TMSTRUCK_ARRIVAL_RESULT
  26. </sql>
  27. <sql id="select_alias">
  28. SELECT <include refid="columns_alias"/> FROM TMSTRUCK_ARRIVAL_RESULT t
  29. </sql>
  30. <sql id="where">
  31. <where>
  32. <if test="resultId != null">
  33. and RESULT_ID = #{resultId}
  34. </if>
  35. <if test="pointId != null">
  36. and POINT_ID = #{pointId}
  37. </if>
  38. <if test="resultTotalId != null">
  39. and RESULT_TOTAL_ID = #{resultTotalId}
  40. </if>
  41. <if test="resultArrivalAddress != null and resultArrivalAddress != ''">
  42. and RESULT_ARRIVAL_ADDRESS = #{resultArrivalAddress}
  43. </if>
  44. <if test="resultFullContainerPhoto != null and resultFullContainerPhoto != ''">
  45. and RESULT_FULL_CONTAINER_PHOTO = #{resultFullContainerPhoto}
  46. </if>
  47. <if test="insertUsername != null and insertUsername != ''">
  48. and INSERT_USERNAME = #{insertUsername}
  49. </if>
  50. <if test="insertTime != null">
  51. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  52. </if>
  53. <if test="updateUsername != null and updateUsername != ''">
  54. and UPDATE_USERNAME = #{updateUsername}
  55. </if>
  56. <if test="updateTime != null">
  57. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  58. </if>
  59. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  60. and INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  61. </if>
  62. </where>
  63. </sql>
  64. <sql id="whereLike">
  65. <where>
  66. <if test="resultId != null">
  67. and RESULT_ID = #{resultId}
  68. </if>
  69. <if test="pointId != null">
  70. and POINT_ID = #{pointId}
  71. </if>
  72. <if test="resultTotalId != null">
  73. and RESULT_TOTAL_ID = #{resultTotalId}
  74. </if>
  75. <if test="resultArrivalAddress != null and resultArrivalAddress != ''">
  76. and RESULT_ARRIVAL_ADDRESS LIKE '%${resultArrivalAddress}%'
  77. </if>
  78. <if test="resultFullContainerPhoto != null and resultFullContainerPhoto != ''">
  79. and RESULT_FULL_CONTAINER_PHOTO LIKE '%${resultFullContainerPhoto}%'
  80. </if>
  81. <if test="insertUsername != null and insertUsername != ''">
  82. and INSERT_USERNAME LIKE '%${insertUsername}%'
  83. </if>
  84. <if test="insertTime != null">
  85. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  86. </if>
  87. <if test="updateUsername != null and updateUsername != ''">
  88. and UPDATE_USERNAME LIKE '%${updateUsername}%'
  89. </if>
  90. <if test="updateTime != null">
  91. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  92. </if>
  93. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  94. and INSERT_UPDATE_REMARK LIKE '%${insertUpdateRemark}%'
  95. </if>
  96. </where>
  97. </sql>
  98. <delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal">
  99. delete from TMSTRUCK_ARRIVAL_RESULT
  100. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  101. </delete>
  102. <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
  103. delete from TMSTRUCK_ARRIVAL_RESULT
  104. where 1!=1
  105. <if test="pointId != null">
  106. or POINT_ID = #{pointId}
  107. </if>
  108. <if test="resultTotalId != null">
  109. or RESULT_TOTAL_ID = #{resultTotalId}
  110. </if>
  111. <if test="resultArrivalAddress != null and resultArrivalAddress != ''">
  112. or RESULT_ARRIVAL_ADDRESS = #{resultArrivalAddress}
  113. </if>
  114. <if test="resultFullContainerPhoto != null and resultFullContainerPhoto != ''">
  115. or RESULT_FULL_CONTAINER_PHOTO = #{resultFullContainerPhoto}
  116. </if>
  117. <if test="insertUsername != null and insertUsername != ''">
  118. or INSERT_USERNAME = #{insertUsername}
  119. </if>
  120. <if test="insertTime != null">
  121. or TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = '#{insertTime}'
  122. </if>
  123. <if test="updateUsername != null and updateUsername != ''">
  124. or UPDATE_USERNAME = #{updateUsername}
  125. </if>
  126. <if test="updateTime != null">
  127. or TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = '#{updateTime}'
  128. </if>
  129. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  130. or INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  131. </if>
  132. </delete>
  133. <insert id="insert" parameterType="com.steerinfo.route.model.TmstruckArrivalResult">
  134. insert into TMSTRUCK_ARRIVAL_RESULT (RESULT_ID, POINT_ID, RESULT_TOTAL_ID,
  135. RESULT_ARRIVAL_ADDRESS, RESULT_FULL_CONTAINER_PHOTO,
  136. INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME,
  137. UPDATE_TIME, INSERT_UPDATE_REMARK)
  138. values (#{resultId,jdbcType=DECIMAL}, #{pointId,jdbcType=DECIMAL}, #{resultTotalId,jdbcType=DECIMAL},
  139. #{resultArrivalAddress,jdbcType=VARCHAR}, #{resultFullContainerPhoto,jdbcType=VARCHAR},
  140. #{insertUsername,jdbcType=VARCHAR}, #{insertTime,jdbcType=TIMESTAMP}, #{updateUsername,jdbcType=VARCHAR},
  141. #{updateTime,jdbcType=TIMESTAMP}, #{insertUpdateRemark,jdbcType=VARCHAR})
  142. </insert>
  143. <insert id="insertSelective" parameterType="com.steerinfo.route.model.TmstruckArrivalResult">
  144. insert into TMSTRUCK_ARRIVAL_RESULT
  145. <trim prefix="(" suffix=")" suffixOverrides=",">
  146. <if test="resultId != null">
  147. RESULT_ID,
  148. </if>
  149. <if test="pointId != null">
  150. POINT_ID,
  151. </if>
  152. <if test="resultTotalId != null">
  153. RESULT_TOTAL_ID,
  154. </if>
  155. <if test="resultArrivalAddress != null">
  156. RESULT_ARRIVAL_ADDRESS,
  157. </if>
  158. <if test="resultFullContainerPhoto != null">
  159. RESULT_FULL_CONTAINER_PHOTO,
  160. </if>
  161. <if test="insertUsername != null">
  162. INSERT_USERNAME,
  163. </if>
  164. <if test="insertTime != null">
  165. INSERT_TIME,
  166. </if>
  167. <if test="updateUsername != null">
  168. UPDATE_USERNAME,
  169. </if>
  170. <if test="updateTime != null">
  171. UPDATE_TIME,
  172. </if>
  173. <if test="insertUpdateRemark != null">
  174. INSERT_UPDATE_REMARK,
  175. </if>
  176. </trim>
  177. <trim prefix="values (" suffix=")" suffixOverrides=",">
  178. <if test="resultId != null">
  179. #{resultId,jdbcType=DECIMAL},
  180. </if>
  181. <if test="pointId != null">
  182. #{pointId,jdbcType=DECIMAL},
  183. </if>
  184. <if test="resultTotalId != null">
  185. #{resultTotalId,jdbcType=DECIMAL},
  186. </if>
  187. <if test="resultArrivalAddress != null">
  188. #{resultArrivalAddress,jdbcType=VARCHAR},
  189. </if>
  190. <if test="resultFullContainerPhoto != null">
  191. #{resultFullContainerPhoto,jdbcType=VARCHAR},
  192. </if>
  193. <if test="insertUsername != null">
  194. #{insertUsername,jdbcType=VARCHAR},
  195. </if>
  196. <if test="insertTime != null">
  197. #{insertTime,jdbcType=TIMESTAMP},
  198. </if>
  199. <if test="updateUsername != null">
  200. #{updateUsername,jdbcType=VARCHAR},
  201. </if>
  202. <if test="updateTime != null">
  203. #{updateTime,jdbcType=TIMESTAMP},
  204. </if>
  205. <if test="insertUpdateRemark != null">
  206. #{insertUpdateRemark,jdbcType=VARCHAR},
  207. </if>
  208. </trim>
  209. </insert>
  210. <update id="updateByPrimaryKey" parameterType="com.steerinfo.route.model.TmstruckArrivalResult">
  211. update TMSTRUCK_ARRIVAL_RESULT
  212. set POINT_ID = #{pointId,jdbcType=DECIMAL},
  213. RESULT_TOTAL_ID = #{resultTotalId,jdbcType=DECIMAL},
  214. RESULT_ARRIVAL_ADDRESS = #{resultArrivalAddress,jdbcType=VARCHAR},
  215. RESULT_FULL_CONTAINER_PHOTO = #{resultFullContainerPhoto,jdbcType=VARCHAR},
  216. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  217. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  218. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  219. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  220. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR}
  221. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  222. </update>
  223. <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.route.model.TmstruckArrivalResult">
  224. update TMSTRUCK_ARRIVAL_RESULT
  225. <set>
  226. <if test="pointId != null">
  227. POINT_ID = #{pointId,jdbcType=DECIMAL},
  228. </if>
  229. <if test="resultTotalId != null">
  230. RESULT_TOTAL_ID = #{resultTotalId,jdbcType=DECIMAL},
  231. </if>
  232. <if test="resultArrivalAddress != null">
  233. RESULT_ARRIVAL_ADDRESS = #{resultArrivalAddress,jdbcType=VARCHAR},
  234. </if>
  235. <if test="resultFullContainerPhoto != null">
  236. RESULT_FULL_CONTAINER_PHOTO = #{resultFullContainerPhoto,jdbcType=VARCHAR},
  237. </if>
  238. <if test="insertUsername != null">
  239. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  240. </if>
  241. <if test="insertTime != null">
  242. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  243. </if>
  244. <if test="updateUsername != null">
  245. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  246. </if>
  247. <if test="updateTime != null">
  248. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  249. </if>
  250. <if test="insertUpdateRemark != null">
  251. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  252. </if>
  253. </set>
  254. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  255. </update>
  256. <select id="selectByPrimaryKey" parameterType="java.math.BigDecimal" resultMap="BaseResultMap">
  257. <include refid="select"/>
  258. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  259. </select>
  260. <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  261. <include refid="select"/>
  262. <include refid="where"/>
  263. </select>
  264. <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  265. <include refid="select"/>
  266. <include refid="whereLike"/>
  267. </select>
  268. <insert id="batchInsert" parameterType="java.util.List">
  269. insert into TMSTRUCK_ARRIVAL_RESULT
  270. (RESULT_ID,
  271. POINT_ID, RESULT_TOTAL_ID, RESULT_ARRIVAL_ADDRESS,
  272. RESULT_FULL_CONTAINER_PHOTO, INSERT_USERNAME,
  273. INSERT_TIME, UPDATE_USERNAME,
  274. UPDATE_TIME, INSERT_UPDATE_REMARK
  275. )
  276. ( <foreach collection="list" item="item" separator="union all">
  277. select
  278. #{item.resultId,jdbcType=DECIMAL},
  279. #{item.pointId,jdbcType=DECIMAL}, #{item.resultTotalId,jdbcType=DECIMAL}, #{item.resultArrivalAddress,jdbcType=VARCHAR},
  280. #{item.resultFullContainerPhoto,jdbcType=VARCHAR}, #{item.insertUsername,jdbcType=VARCHAR},
  281. #{item.insertTime,jdbcType=TIMESTAMP}, #{item.updateUsername,jdbcType=VARCHAR},
  282. #{item.updateTime,jdbcType=TIMESTAMP}, #{item.insertUpdateRemark,jdbcType=VARCHAR}
  283. from dual
  284. </foreach> )
  285. </insert>
  286. <update id="batchUpdate" parameterType="java.util.List">
  287. update TMSTRUCK_ARRIVAL_RESULT
  288. set
  289. RESULT_ID=
  290. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  291. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultId,jdbcType=DECIMAL}
  292. </foreach>
  293. ,POINT_ID=
  294. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  295. when #{item.resultId,jdbcType=DECIMAL} then #{item.pointId,jdbcType=DECIMAL}
  296. </foreach>
  297. ,RESULT_TOTAL_ID=
  298. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  299. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultTotalId,jdbcType=DECIMAL}
  300. </foreach>
  301. ,RESULT_ARRIVAL_ADDRESS=
  302. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  303. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultArrivalAddress,jdbcType=VARCHAR}
  304. </foreach>
  305. ,RESULT_FULL_CONTAINER_PHOTO=
  306. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  307. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultFullContainerPhoto,jdbcType=VARCHAR}
  308. </foreach>
  309. ,INSERT_USERNAME=
  310. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  311. when #{item.resultId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
  312. </foreach>
  313. ,INSERT_TIME=
  314. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  315. when #{item.resultId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
  316. </foreach>
  317. ,UPDATE_USERNAME=
  318. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  319. when #{item.resultId,jdbcType=DECIMAL} then #{item.updateUsername,jdbcType=VARCHAR}
  320. </foreach>
  321. ,UPDATE_TIME=
  322. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  323. when #{item.resultId,jdbcType=DECIMAL} then #{item.updateTime,jdbcType=TIMESTAMP}
  324. </foreach>
  325. ,INSERT_UPDATE_REMARK=
  326. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  327. when #{item.resultId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
  328. </foreach>
  329. where RESULT_ID in
  330. <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
  331. #{item.resultId,jdbcType=DECIMAL}
  332. </foreach>
  333. </update>
  334. <update id="updateTown" parameterType="string">
  335. update RMS_RECEIVE_ADDRESS set ADDRESS_TOWN='${city}' where ADDRESS_DISTRICT ='${item}'
  336. </update>
  337. <delete id="batchDelete" parameterType="java.util.List">
  338. delete from TMSTRUCK_ARRIVAL_RESULT
  339. where RESULT_ID in
  340. <foreach collection="list" item="id" open="(" close=")" separator=",">
  341. #{id}
  342. </foreach>
  343. </delete>
  344. <!-- 友情提示!!!-->
  345. <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
  346. <select id="selectMaxId" resultType="java.math.BigDecimal">
  347. select max(RESULT_ID) from TMSTRUCK_ARRIVAL_RESULT
  348. </select>
  349. <select id="getArrivalResultInfo" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
  350. select * from(
  351. select distinct a_s_order.SALE_NUMBER "saleNumber",
  352. o_torder.ORDER_NUMBER "orderNumber",
  353. r_material.MATERIAL_NAME "materialName",
  354. r_material.MATERIAL_MODEL "materialModel",
  355. r_capacity.CAPACITY_NUMBER "capacityNumber",
  356. r_shipper.SHIPPER_NAME "shipperName",
  357. r_consignee.CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
  358. t_arrival.RESULT_ARRIVAL_ADDRESS "resultArrivalAddress",
  359. receive_address.ADDRESS_DELIVERY_ADDRESS "addressDeliveryAddress",
  360. t_arrival.RESULT_FULL_CONTAINER_PHOTO "resultFullContainerPhoto",
  361. t_arrival.INSERT_TIME "arrivalTime",
  362. r_carrier.CARRIER_NAME "carrierName",
  363. r_gatepost.GATEPOST_NAME "gatepostName"
  364. from TMSTRUCK_ARRIVAL_RESULT t_arrival
  365. left join TMSTRUCK_TOTAL_RESULT t_total
  366. on t_arrival.RESULT_TOTAL_ID=t_total.RESULT_TOTAL_ID
  367. left join OMSTRUCK_ORDER o_torder
  368. on t_total.ORDER_ID=o_torder.ORDER_ID
  369. left join RMS_CAPACITY r_capacity
  370. on o_torder.CAPACITY_ID=r_capacity.CAPACITY_ID
  371. left join RMS_DRIVER_CAPACITY r_d_capacity
  372. on r_capacity.CAPACITY_ID=r_d_capacity.CAPACITY_ID
  373. left join RMS_CARRIER r_carrier
  374. on o_torder.CARRIER_ID=r_carrier.CARRIER_ID
  375. left join RMS_CAR_DRIVER r_driver
  376. on r_d_capacity.DRIVER_ID=r_driver.DRIVER_ID
  377. left join AMS_SALE_ORDER_MATERIAL sale_material
  378. on o_torder.ORDER_PLAN_ID=sale_material.SALE_ORDER_MATERIAL_ID
  379. left join RMS_RECEIVE_ADDRESS receive_address
  380. on sale_material.SALE_SHIPPING_ADDRESS_ID=receive_address.ADDRESS_ID
  381. left join RMS_MATERIAL r_material
  382. on sale_material.MATERIAL_ID=r_material.MATERIAL_ID
  383. left join AMS_SALE_ORDER a_s_order
  384. on sale_material.SALE_ORDER_ID=a_s_order.SALE_ORDER_ID
  385. left join RMS_SHIPPER r_shipper
  386. on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
  387. left join RMS_CONSIGNEE r_consignee
  388. on a_s_order.CONSIGNEE_ID=r_consignee.CONSIGNEE_ID
  389. left join TMSTRUCK_LEAVE_FACTORY_RESULT t_leave
  390. on t_total.RESULT_TOTAL_ID=t_leave.RESULT_TOTAL_ID
  391. LEFT JOIN RMS_GATEPOST r_gatepost
  392. ON t_leave.GATEPOST_ID = r_gatepost.GATEPOST_ID
  393. order by t_arrival.INSERT_TIME desc)
  394. <where>
  395. <if test="productClassification != null and productClassification != '其他' and productClassification != '螺纹钢'">
  396. and "materialName" like '%${productClassification}%'
  397. </if>
  398. <if test="productClassification != null and '螺纹钢' == productClassification">
  399. and ("materialName" like '%螺纹钢%' or "materialName" like '%盘螺%'
  400. or "materialName" like '%盘圆%' or "materialName" like '%非定尺材%')
  401. </if>
  402. <if test="productClassification != null and '其他' == productClassification">
  403. and "materialName" not like '%带钢%' and "materialName" not like '%微粉%'
  404. and "materialName" not like '%螺纹钢%' and "materialName" not like '%非定尺材%' and "materialName" not like '%钢坯%'
  405. and "materialName" not like '%盘螺%' and "materialName" not like '%盘圆%'
  406. </if>
  407. <if test="carrierName1 != null">
  408. and "carrierName" like '%${carrierName1}%'
  409. </if>
  410. <if test="gatepostName1 !=null">
  411. and "gatepostName" like '%${gatepostName1}%'
  412. </if>
  413. <if test="capacityNumber1 != null">
  414. and "capacityNumber" like '%${capacityNumber1}%'
  415. </if>
  416. <if test="consigneeCompanyName1 != null">
  417. and "consigneeCompanyName" like '%${consigneeCompanyName1}%'
  418. </if>
  419. <if test="startTime != null">
  420. and "arrivalTime" &gt;= to_date('${startTime}','yyyy-mm-dd')
  421. </if>
  422. <if test="endTime != null">
  423. and "arrivalTime" &lt;= to_date('${endTime}','yyyy-mm-dd')
  424. </if>
  425. <if test="saleNumber != null">
  426. and
  427. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  428. "saleNumber" like '%${item}%'
  429. </foreach>
  430. </if>
  431. <if test="orderNumber != null">
  432. and
  433. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  434. "orderNumber" like '%${item}%'
  435. </foreach>
  436. </if>
  437. <if test="materialName != null">
  438. and
  439. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  440. "materialName" like '%${item}%'
  441. </foreach>
  442. </if>
  443. <if test="materialModel != null">
  444. and
  445. <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
  446. "materialModel" like '%${item}%'
  447. </foreach>
  448. </if>
  449. <if test="capacityNumber != null">
  450. and
  451. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  452. "capacityNumber" like '%${item}%'
  453. </foreach>
  454. </if>
  455. <if test="shipperName != null">
  456. and
  457. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  458. "shipperName" like '%${item}%'
  459. </foreach>
  460. </if>
  461. <if test="consigneeCompanyName != null">
  462. and
  463. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  464. "consigneeCompanyName" like '%${item}%'
  465. </foreach>
  466. </if>
  467. <if test="resultArrivalAddress != null">
  468. and
  469. <foreach collection="resultArrivalAddress" item="item" open="(" separator="or" close=")">
  470. "resultArrivalAddress" like '%${item}%'
  471. </foreach>
  472. </if>
  473. <if test="addressDeliveryAddress != null">
  474. and
  475. <foreach collection="addressDeliveryAddress" item="item" open="(" separator="or" close=")">
  476. "addressDeliveryAddress" like '%${item}%'
  477. </foreach>
  478. </if>
  479. <if test="arrivalTime != null">
  480. and
  481. <foreach collection="arrivalTime" item="item" open="(" separator="or" close=")">
  482. "arrivalTime" like '%${item}%'
  483. </foreach>
  484. </if>
  485. <if test="carrierName != null">
  486. and
  487. <foreach collection="carrierName" item="item" open="(" separator="or" close=")">
  488. "carrierName" like '%${item}%'
  489. </foreach>
  490. </if>
  491. <if test="gatepostName != null">
  492. and
  493. <foreach collection="gatepostName" item="item" open="(" separator="or" close=")">
  494. "gatepostName" like '%${item}%'
  495. </foreach>
  496. </if>
  497. </where>
  498. <include refid="orderBy"></include>
  499. </select>
  500. <select id="alreadyExistsArrivalResult" parameterType="String" resultType="java.math.BigDecimal">
  501. select max(RESULT_ID)
  502. from TMSTRUCK_ARRIVAL_RESULT t_arrival
  503. left join TMSTRUCK_TOTAL_RESULT t_total
  504. on t_arrival.RESULT_TOTAL_ID=t_total.RESULT_TOTAL_ID
  505. left join OMSTRUCK_ORDER o_torder
  506. on t_total.ORDER_ID=o_torder.ORDER_ID
  507. where o_torder.ORDER_NUMBER = #{orderNumber}
  508. </select>
  509. <select id="getAddressDistrict" resultType="java.lang.String">
  510. select receive_address.ADDRESS_TOWN "addressDistrict"
  511. FROM
  512. OMSTRUCK_ORDER o_torder
  513. LEFT JOIN AMS_SALE_ORDER_MATERIAL sale_material ON o_torder.ORDER_PLAN_ID = sale_material.SALE_ORDER_MATERIAL_ID
  514. LEFT JOIN RMS_RECEIVE_ADDRESS receive_address ON sale_material.SALE_SHIPPING_ADDRESS_ID = receive_address.ADDRESS_ID
  515. WHERE
  516. o_torder.ORDER_NUMBER = #{orderNumber}
  517. </select>
  518. <select id="getAdjustment" resultType="java.lang.String">
  519. SELECT distinct ADDRESS_DISTRICT FROM RMS_RECEIVE_ADDRESS where ADDRESS_TOWN is null
  520. </select>
  521. <select id="getTotalIdByOrderNumber" resultType="java.math.BigDecimal">
  522. select RESULT_TOTAL_ID "totalId"
  523. from TMSTRUCK_TOTAL_RESULT t_total
  524. left join OMSTRUCK_ORDER o_order
  525. on t_total.ORDER_ID=o_order.ORDER_ID
  526. where o_order.ORDER_NUMBER = #{orderNumber}
  527. </select>
  528. <sql id="orderBy">
  529. <if test="orderField != null and orderField != ''">
  530. order by "${orderField}"
  531. <if test="orderType != null and orderType != ''">
  532. ${orderType}
  533. </if>
  534. </if>
  535. </sql>
  536. </mapper>