TmstruckTotalResultMapper.xml 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704
  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.TmstruckTotalResultMapper">
  4. <resultMap id="BaseResultMap" type="com.steerinfo.dil.model.TmstruckTotalResult">
  5. <id column="RESULT_TOTAL_ID" jdbcType="DECIMAL" property="resultTotalId" />
  6. <result column="ORDER_ID" jdbcType="DECIMAL" property="orderId" />
  7. <result column="RESULT_DURATION" jdbcType="DECIMAL" property="resultDuration" />
  8. <result column="STANDARD_DATA_ID" jdbcType="DECIMAL" property="standardDataId" />
  9. <result column="RESULT_OUTLIER" jdbcType="DECIMAL" property="resultOutlier" />
  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_TOTAL_ID, ORDER_ID, RESULT_DURATION, STANDARD_DATA_ID, RESULT_OUTLIER, INSERT_USERNAME,
  18. INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK
  19. </sql>
  20. <sql id="columns_alias">
  21. t.RESULT_TOTAL_ID, t.ORDER_ID, t.RESULT_DURATION, t.STANDARD_DATA_ID, t.RESULT_OUTLIER,
  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_TOTAL_RESULT
  26. </sql>
  27. <sql id="select_alias">
  28. SELECT <include refid="columns_alias" /> FROM TMSTRUCK_TOTAL_RESULT t
  29. </sql>
  30. <sql id="where">
  31. <where>
  32. <if test="resultTotalId != null">
  33. and RESULT_TOTAL_ID = #{resultTotalId}
  34. </if>
  35. <if test="orderId != null">
  36. and ORDER_ID = #{orderId}
  37. </if>
  38. <if test="resultDuration != null">
  39. and RESULT_DURATION = #{resultDuration}
  40. </if>
  41. <if test="standardDataId != null">
  42. and STANDARD_DATA_ID = #{standardDataId}
  43. </if>
  44. <if test="resultOutlier != null">
  45. and RESULT_OUTLIER = #{resultOutlier}
  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="resultTotalId != null">
  67. and RESULT_TOTAL_ID = #{resultTotalId}
  68. </if>
  69. <if test="orderId != null">
  70. and ORDER_ID = #{orderId}
  71. </if>
  72. <if test="resultDuration != null">
  73. and RESULT_DURATION = #{resultDuration}
  74. </if>
  75. <if test="standardDataId != null">
  76. and STANDARD_DATA_ID = #{standardDataId}
  77. </if>
  78. <if test="resultOutlier != null">
  79. and RESULT_OUTLIER = #{resultOutlier}
  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_TOTAL_RESULT
  100. where RESULT_TOTAL_ID = #{resultTotalId,jdbcType=DECIMAL}
  101. </delete>
  102. <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
  103. delete from TMSTRUCK_TOTAL_RESULT
  104. where 1!=1
  105. <if test="orderId != null">
  106. or ORDER_ID = #{orderId}
  107. </if>
  108. <if test="resultDuration != null">
  109. or RESULT_DURATION = #{resultDuration}
  110. </if>
  111. <if test="standardDataId != null">
  112. or STANDARD_DATA_ID = #{standardDataId}
  113. </if>
  114. <if test="resultOutlier != null">
  115. or RESULT_OUTLIER = #{resultOutlier}
  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.dil.model.TmstruckTotalResult">
  134. insert into TMSTRUCK_TOTAL_RESULT (RESULT_TOTAL_ID, ORDER_ID, RESULT_DURATION,
  135. STANDARD_DATA_ID, RESULT_OUTLIER, INSERT_USERNAME,
  136. INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME,
  137. INSERT_UPDATE_REMARK)
  138. values (#{resultTotalId,jdbcType=DECIMAL}, #{orderId,jdbcType=DECIMAL}, #{resultDuration,jdbcType=DECIMAL},
  139. #{standardDataId,jdbcType=DECIMAL}, #{resultOutlier,jdbcType=DECIMAL}, #{insertUsername,jdbcType=VARCHAR},
  140. #{insertTime,jdbcType=TIMESTAMP}, #{updateUsername,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
  141. #{insertUpdateRemark,jdbcType=VARCHAR})
  142. </insert>
  143. <insert id="insertSelective" parameterType="com.steerinfo.dil.model.TmstruckTotalResult">
  144. insert into TMSTRUCK_TOTAL_RESULT
  145. <trim prefix="(" suffix=")" suffixOverrides=",">
  146. <if test="resultTotalId != null">
  147. RESULT_TOTAL_ID,
  148. </if>
  149. <if test="orderId != null">
  150. ORDER_ID,
  151. </if>
  152. <if test="resultDuration != null">
  153. RESULT_DURATION,
  154. </if>
  155. <if test="standardDataId != null">
  156. STANDARD_DATA_ID,
  157. </if>
  158. <if test="resultOutlier != null">
  159. RESULT_OUTLIER,
  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="resultTotalId != null">
  179. #{resultTotalId,jdbcType=DECIMAL},
  180. </if>
  181. <if test="orderId != null">
  182. #{orderId,jdbcType=DECIMAL},
  183. </if>
  184. <if test="resultDuration != null">
  185. #{resultDuration,jdbcType=DECIMAL},
  186. </if>
  187. <if test="standardDataId != null">
  188. #{standardDataId,jdbcType=DECIMAL},
  189. </if>
  190. <if test="resultOutlier != null">
  191. #{resultOutlier,jdbcType=DECIMAL},
  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.dil.model.TmstruckTotalResult">
  211. update TMSTRUCK_TOTAL_RESULT
  212. set ORDER_ID = #{orderId,jdbcType=DECIMAL},
  213. RESULT_DURATION = #{resultDuration,jdbcType=DECIMAL},
  214. STANDARD_DATA_ID = #{standardDataId,jdbcType=DECIMAL},
  215. RESULT_OUTLIER = #{resultOutlier,jdbcType=DECIMAL},
  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_TOTAL_ID = #{resultTotalId,jdbcType=DECIMAL}
  222. </update>
  223. <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.TmstruckTotalResult">
  224. update TMSTRUCK_TOTAL_RESULT
  225. <set>
  226. <if test="orderId != null">
  227. ORDER_ID = #{orderId,jdbcType=DECIMAL},
  228. </if>
  229. <if test="resultDuration != null">
  230. RESULT_DURATION = #{resultDuration,jdbcType=DECIMAL},
  231. </if>
  232. <if test="standardDataId != null">
  233. STANDARD_DATA_ID = #{standardDataId,jdbcType=DECIMAL},
  234. </if>
  235. <if test="resultOutlier != null">
  236. RESULT_OUTLIER = #{resultOutlier,jdbcType=DECIMAL},
  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_TOTAL_ID = #{resultTotalId,jdbcType=DECIMAL}
  255. </update>
  256. <select id="selectByPrimaryKey" parameterType="java.math.BigDecimal" resultMap="BaseResultMap">
  257. <include refid="select" />
  258. where RESULT_TOTAL_ID = #{resultTotalId,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_TOTAL_RESULT
  270. (RESULT_TOTAL_ID,
  271. ORDER_ID, RESULT_DURATION, STANDARD_DATA_ID,
  272. RESULT_OUTLIER, 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.resultTotalId,jdbcType=DECIMAL},
  279. #{item.orderId,jdbcType=DECIMAL}, #{item.resultDuration,jdbcType=DECIMAL}, #{item.standardDataId,jdbcType=DECIMAL},
  280. #{item.resultOutlier,jdbcType=DECIMAL}, #{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_TOTAL_RESULT
  288. set
  289. RESULT_TOTAL_ID=
  290. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_TOTAL_ID" separator=" ">
  291. when #{item.resultTotalId,jdbcType=DECIMAL} then #{item.resultTotalId,jdbcType=DECIMAL}
  292. </foreach>
  293. ,ORDER_ID=
  294. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_TOTAL_ID" separator=" ">
  295. when #{item.resultTotalId,jdbcType=DECIMAL} then #{item.orderId,jdbcType=DECIMAL}
  296. </foreach>
  297. ,RESULT_DURATION=
  298. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_TOTAL_ID" separator=" ">
  299. when #{item.resultTotalId,jdbcType=DECIMAL} then #{item.resultDuration,jdbcType=DECIMAL}
  300. </foreach>
  301. ,STANDARD_DATA_ID=
  302. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_TOTAL_ID" separator=" ">
  303. when #{item.resultTotalId,jdbcType=DECIMAL} then #{item.standardDataId,jdbcType=DECIMAL}
  304. </foreach>
  305. ,RESULT_OUTLIER=
  306. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_TOTAL_ID" separator=" ">
  307. when #{item.resultTotalId,jdbcType=DECIMAL} then #{item.resultOutlier,jdbcType=DECIMAL}
  308. </foreach>
  309. ,INSERT_USERNAME=
  310. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_TOTAL_ID" separator=" ">
  311. when #{item.resultTotalId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
  312. </foreach>
  313. ,INSERT_TIME=
  314. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_TOTAL_ID" separator=" ">
  315. when #{item.resultTotalId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
  316. </foreach>
  317. ,UPDATE_USERNAME=
  318. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_TOTAL_ID" separator=" ">
  319. when #{item.resultTotalId,jdbcType=DECIMAL} then #{item.updateUsername,jdbcType=VARCHAR}
  320. </foreach>
  321. ,UPDATE_TIME=
  322. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_TOTAL_ID" separator=" ">
  323. when #{item.resultTotalId,jdbcType=DECIMAL} then #{item.updateTime,jdbcType=TIMESTAMP}
  324. </foreach>
  325. ,INSERT_UPDATE_REMARK=
  326. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_TOTAL_ID" separator=" ">
  327. when #{item.resultTotalId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
  328. </foreach>
  329. where RESULT_TOTAL_ID in
  330. <foreach close=")" collection="list" index="index" item="item" open="(" separator=",">
  331. #{item.resultTotalId,jdbcType=DECIMAL}
  332. </foreach>
  333. </update>
  334. <delete id="batchDelete" parameterType="java.util.List">
  335. delete from TMSTRUCK_TOTAL_RESULT
  336. where RESULT_TOTAL_ID in
  337. <foreach close=")" collection="list" item="id" open="(" separator=",">
  338. #{id}
  339. </foreach>
  340. </delete>
  341. <!-- 友情提示!!!-->
  342. <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
  343. <!-- 查询计数实绩 -->
  344. <select id="selectCountList" resultType="java.util.Map" parameterType="java.lang.String">
  345. SELECT *
  346. FROM (
  347. SELECT RM.MATERIAL_NAME "materialName",
  348. OO.ORDER_NUMBER "orderNumber",
  349. RC.CAPACITY_NUMBER "capacityNumber",
  350. RW1.WAREHOUSE_NAME "warehouseName1",
  351. RW2.WAREHOUSE_NAME "warehouseName2",
  352. RCT.CAPACITY_TYPE_NAME "capacityTypeName",
  353. RS.SHIPPER_NAME "shipperName",
  354. AIR.REQUIREMENT_WORK_CONTENT "requirmentWorkContent",
  355. AIR.INSERT_TIME "insertTime",
  356. (
  357. select TWR.RESULT_NET_WEIGHT
  358. from TMSTRUCK_WEIGHT_RESULT TWR
  359. where TWR.RESULT_TOTAL_ID=TWR2.RESULT_TOTAL_ID
  360. and TWR.RESULT_NET_WEIGHT is not null
  361. )
  362. "netweight"
  363. FROM AMSTRUCK_INWARD_PLAN AIP
  364. LEFT JOIN OMSTRUCK_ORDER OO
  365. ON OO.ORDER_PLAN_ID = AIP.PLAN_ID
  366. LEFT JOIN AMSTRUCK_REQUIREMENT_PLAN ARP
  367. ON ARP.PLAN_ID=AIP.PLAN_ID
  368. LEFT JOIN AMSTRUCK_INWARD_REQUIREMENT AIR
  369. ON AIR.REQUIREMENT_ID=ARP.REQUIREMENT_ID
  370. LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM
  371. ON OO.ORDER_ID = OOM.ORDER_ID
  372. LEFT JOIN AMSTRUCK_REQUIREMENT_MATERIAL ARM
  373. ON ARM.REQUIREMENT_ID=AIR.REQUIREMENT_ID
  374. LEFT JOIN RMS_MATERIAL RM
  375. ON RM.MATERIAL_ID = OOM.MATERIAL_ID
  376. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  377. ON TTR.ORDER_ID = OO.ORDER_ID
  378. LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR2
  379. ON TTR.RESULT_TOTAL_ID = TWR2.RESULT_TOTAL_ID
  380. LEFT JOIN RMS_WAREHOUSE RW1
  381. ON ARM.REQUIREMENT_PLATFORM_ID = RW1.WAREHOUSE_ID
  382. LEFT JOIN RMS_WAREHOUSE RW2
  383. ON ARM.REQUIREMENT_UNLOAD_UNIT_ID = RW2.WAREHOUSE_ID
  384. LEFT JOIN RMS_CAPACITY RC
  385. ON OO.CAPACITY_ID = RC.CAPACITY_ID
  386. LEFT JOIN RMS_CAPACITY_TYPE RCT
  387. ON RCT.CAPACITY_TYPE_ID = RC.CAPACITY_TYPE_ID
  388. LEFT JOIN RMS_SHIPPER RS
  389. ON AIR.REQUIREMENT_SHIPPER_ID = RS.SHIPPER_ID
  390. WHERE AIR.REQUIREMENT_TYPE = '计次' and OO.ORDER_STATUS = 2
  391. )
  392. <where>
  393. <if test="materialName != null">
  394. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  395. "materialName" like '%${item}%'
  396. </foreach>
  397. </if>
  398. <if test="orderNumber != null">
  399. and
  400. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  401. "orderNumber" like '%${item}%'
  402. </foreach>
  403. </if>
  404. <if test="capacityNumber != null">
  405. and
  406. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  407. "capacityNumber" like '%${item}%'
  408. </foreach>
  409. </if>
  410. <if test="warehouseName1 != null">
  411. and
  412. <foreach collection="warehouseName1" item="item" open="(" separator="or" close=")">
  413. "warehouseName1" like '%${item}%'
  414. </foreach>
  415. </if>
  416. <if test="warehouseName2 != null">
  417. and
  418. <foreach collection="warehouseName2" item="item" open="(" separator="or" close=")">
  419. "warehouseName2" like '%${item}%'
  420. </foreach>
  421. </if>
  422. <if test="driverName != null">
  423. and
  424. <foreach collection="driverName" item="item" open="(" separator="or" close=")">
  425. "driverName" like '%${item}%'
  426. </foreach>
  427. </if>
  428. <if test="capacityTypeName != null">
  429. and
  430. <foreach collection="capacityTypeName" item="item" open="(" separator="or" close=")">
  431. "capacityTypeName" like '%${item}%'
  432. </foreach>
  433. </if>
  434. <if test="shipperName != null">
  435. and
  436. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  437. "shipperName" like '%${item}%'
  438. </foreach>
  439. </if>
  440. <if test="requirmentWorkContent != null">
  441. and
  442. <foreach collection="requirmentWorkContent" item="item" open="(" separator="or" close=")">
  443. "requirmentWorkContent" like '%${item}%'
  444. </foreach>
  445. </if>
  446. </where>
  447. <include refid="orderBy"></include>
  448. <if test="orderField == null ">
  449. order by "insertTime" desc
  450. </if>
  451. </select>
  452. <!-- 查询所有的包月作业实绩 -->
  453. <select id="getTmstruckMonthResult" parameterType="java.util.Map" resultType="java.util.Map">
  454. select * from tmstruck_total_result ttr
  455. left join omstruck_order oo on ttr.order_id = oo.order_id
  456. left join amstruck_inward_plan aip on oo.order_plan_id = aip.plan_id
  457. left join amstruck_requirement_plan arp on aip.plan_id = arp.plan_id
  458. left join amstruck_inward_requirement air on arp.requirement_plan_id = air.requirement_id
  459. where oo.order_type = 11 and air.requirement_type = '包月'
  460. </select>
  461. <select id="getAllReverseResult" resultType="java.util.Map">
  462. SELECT * FROM (
  463. SELECT
  464. OO.ORDER_NUMBER "orderNumber",
  465. RC.CAPACITY_NUMBER "capacityNumber",
  466. RM.MATERIAL_NAME "materialName",
  467. CONCAT(CONCAT(RM.MATERIAL_MODEL, '('), CONCAT(MATERIAL_SPECIFICATION, ')')) "materialMC",
  468. OOM.ORDER_MATERIAL_NUMBER "materialNumber",
  469. SUM(RMS.MATERIAL_THEORETICAL_WEIGHT)/1000 || '吨' "weight",
  470. RS.SHIPPER_NAME "shipperName",
  471. RW1.WAREHOUSE_NAME "loadName",
  472. RW.WAREHOUSE_NAME "unloadName",
  473. TLR.RESULT_LOAD_START_TIME "loadStartTime",
  474. TLR.RESULT_LOAD_END_TIME "loadEndTime",
  475. TUR.RESULT_START_TIME "unloadStartTime",
  476. TUR.RESULT_END_TIME"unloadEndTime"
  477. from OMSTRUCK_ORDER OO
  478. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR ON OO.ORDER_ID=TTR.ORDER_ID
  479. LEFT JOIN TMSTRUCK_LOAD_RESULT TLR ON TLR.RESULT_TOTAL_ID=TTR.RESULT_TOTAL_ID
  480. LEFT JOIN TMSTRUCK_UNLOAD_RESULT TUR ON TUR.RESULT_TOTAL_ID=TTR.RESULT_TOTAL_ID
  481. LEFT JOIN WMSP_OUTBOUND_RESULT WOR ON WOR.BILL_LADING_ID=OO.ORDER_ID
  482. LEFT JOIN WMSP_OUTBOUND_SCAN_RESULT WOSR ON WOSR.OUTBOUND_RESULT_ID=WOR.RESULT_ID
  483. LEFT JOIN WMSP_INBOUND_SCAN_RESULT WISR ON WOSR.INBOUND_RESULT_ID=WISR.INBOUND_RESULT_ID
  484. LEFT JOIN RMS_MATERIAL_STEEL RMS ON RMS.MATERIAL_STEEL_ID=WISR.MATERIAL_ID
  485. LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM ON OOM.ORDER_ID=OO.ORDER_ID
  486. LEFT JOIN RMS_MATERIAL RM ON RM.MATERIAL_ID=RMS.MATERIAL_ID
  487. LEFT JOIN RMS_CAPACITY RC ON RC.CAPACITY_ID=OO.CAPACITY_ID
  488. LEFT JOIN AMSTRUCK_INWARD_PLAN AIP ON OO.ORDER_PLAN_ID = AIP.PLAN_ID
  489. LEFT JOIN AMSTRUCK_REQUIREMENT_PLAN ARP ON ARP.PLAN_ID = AIP.PLAN_ID
  490. LEFT JOIN AMSTRUCK_INWARD_REQUIREMENT AIR ON AIR.REQUIREMENT_ID = ARP.REQUIREMENT_ID
  491. LEFT JOIN RMS_SHIPPER RS ON RS.SHIPPER_ID = AIR.REQUIREMENT_SHIPPER_ID
  492. LEFT JOIN AMSTRUCK_REQUIREMENT_MATERIAL ARM ON ARM.REQUIREMENT_ID = AIR.REQUIREMENT_ID
  493. LEFT JOIN RMS_WAREHOUSE RW ON RW.WAREHOUSE_ID = ARM.REQUIREMENT_UNLOAD_UNIT_ID
  494. LEFT JOIN RMS_WAREHOUSE RW1 ON RW1.WAREHOUSE_ID = ARM.REQUIREMENT_PLATFORM_ID
  495. WHERE OO.ORDER_TYPE=25 AND OO.ORDER_STATUS=2
  496. <if test="oneDate != null">
  497. and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TUR.RESULT_END_TIME
  498. </if>
  499. <if test="startDate != null">
  500. and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TUR.RESULT_END_TIME
  501. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TUR.RESULT_END_TIME
  502. </if>
  503. GROUP BY OO.ORDER_NUMBER,RC.CAPACITY_NUMBER,OOM.ORDER_MATERIAL_NUMBER,RM.MATERIAL_NAME,RM.MATERIAL_MODEL,MATERIAL_SPECIFICATION,RW1.WAREHOUSE_NAME,RW.WAREHOUSE_NAME,RS.SHIPPER_NAME,TLR.RESULT_LOAD_START_TIME,
  504. TLR.RESULT_LOAD_END_TIME,TUR.RESULT_START_TIME,TUR.RESULT_END_TIME
  505. ORDER BY TUR.RESULT_END_TIME DESC
  506. )
  507. <where>
  508. <if test="orderNumber != null">
  509. and
  510. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  511. "orderNumber" like '%${item}%'
  512. </foreach>
  513. </if>
  514. <if test="capacityNumber != null">
  515. and
  516. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  517. "capacityNumber" like '%${item}%'
  518. </foreach>
  519. </if>
  520. <if test="shipperName != null">
  521. and
  522. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  523. "shipperName" like '%${item}%'
  524. </foreach>
  525. </if>
  526. <if test="materialName != null">
  527. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  528. "materialName" like '%${item}%'
  529. </foreach>
  530. </if>
  531. <if test="materialMC != null">
  532. <foreach collection="materialMC" item="item" open="(" separator="or" close=")">
  533. "materialMC" like '%${item}%'
  534. </foreach>
  535. </if>
  536. <if test="materialNumber != null">
  537. <foreach collection="materialNumber" item="item" open="(" separator="or" close=")">
  538. "materialNumber" = #{item}
  539. </foreach>
  540. </if>
  541. <if test="weight != null">
  542. <foreach collection="weight" item="item" open="(" separator="or" close=")">
  543. "weight" = #{item}
  544. </foreach>
  545. </if>
  546. <if test="shipperName != null">
  547. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  548. "shipperName" like '%${item}%'
  549. </foreach>
  550. </if>
  551. <if test="loadName != null">
  552. <foreach collection="loadName" item="item" open="(" separator="or" close=")">
  553. "loadName" like '%${item}%'
  554. </foreach>
  555. </if>
  556. <if test="unloadName != null">
  557. <foreach collection="unloadName" item="item" open="(" separator="or" close=")">
  558. "unloadName" like '%${item}%'
  559. </foreach>
  560. </if>
  561. <if test="loadStartTime != null">
  562. <foreach collection="loadStartTime" item="item" open="(" separator="or" close=")">
  563. "loadStartTime" = #{item}
  564. </foreach>
  565. </if>
  566. <if test="unloadStartTime != null">
  567. <foreach collection="unloadStartTime" item="item" open="(" separator="or" close=")">
  568. "unloadStartTime" = #{item}
  569. </foreach>
  570. </if>
  571. <if test="loadEndTime != null">
  572. <foreach collection="loadEndTime" item="item" open="(" separator="or" close=")">
  573. "loadEndTime" = #{item}
  574. </foreach>
  575. </if>
  576. <if test="unloadEndTime != null">
  577. <foreach collection="unloadEndTime" item="item" open="(" separator="or" close=")">
  578. "unloadEndTime" = #{item}
  579. </foreach>
  580. </if>
  581. </where>
  582. <include refid="orderBy"></include>
  583. </select>
  584. <sql id="orderBy">
  585. <if test="orderField != null and orderField != ''">
  586. order by "${orderField}"
  587. <if test="orderType != null and orderType != ''">
  588. ${orderType}
  589. </if>
  590. </if>
  591. </sql>
  592. <select id="getOrderForBulu" resultType="java.math.BigDecimal">
  593. SELECT OO .ORDER_ID FROM OMSTRUCK_ORDER OO
  594. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR ON TTR .ORDER_ID = OO .ORDER_ID
  595. WHERE TTR .RESULT_TOTAL_ID IS NULL and ORDER_STATUS=5
  596. </select>
  597. <select id="getLineId" resultType="java.util.Map">
  598. SELECT
  599. TTR.RESULT_TOTAL_ID "resultTotalId",
  600. OO.LINE_ID "lineId",
  601. OO.ORDER_STATUS "orderStatus"
  602. FROM OMSTRUCK_ORDER OO
  603. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR ON TTR .ORDER_ID = OO .ORDER_ID
  604. WHERE OO.ORDER_ID = #{orderId} AND OO.ORDER_STATUS IN (4,5) AND OO.ORDER_TYPE=5
  605. </select>
  606. <select id="getLineMesByOrderId" resultType="java.util.Map">
  607. select RLS.SEGMENT_SQE "segmentSqe",
  608. RLS.SEGMENT_START_NODE_ID "type",
  609. RL.LINK_NAME "linkName",
  610. RLI.LINE_TYPE "lineType"
  611. from RMS_LINE_SEGEMNT RLS
  612. left join RMS_LINK RL
  613. on RL.LINK_ID = RLS.SEGMENT_START_NODE_ID
  614. left join RMS_LINE RLI
  615. ON RLI.LINE_ID = RLS.LINE_ID
  616. where RLS.LINE_ID = #{lineId}
  617. AND RLS.DELETED = 0
  618. order by "segmentSqe"
  619. </select>
  620. <update id="updateLineId">
  621. UPDATE OMSTRUCK_ORDER
  622. SET LINE_ID=#{lineId}
  623. <if test="orderStatus!=null">
  624. ,ORDER_STATUS=#{orderStatus}
  625. </if>
  626. WHERE ORDER_ID=#{orderId}
  627. </update>
  628. <select id="selectAllEnfactory" resultType="com.steerinfo.dil.model.TmstruckEnfactoryResult">
  629. SELECT RESULT_ID "resultId",
  630. RESULT_TOTAL_ID "resultTotalId",
  631. TMSTRUCK_ENFACTORY_RESULT.GATEPOST_ID "gatepostId",
  632. RESULT_ENTRY_MODE "resultEntryMode",
  633. RESULT_ENTRY_GATE_TIME "resultEntryGateTime"
  634. FROM TMSTRUCK_ENFACTORY_RESULT
  635. WHERE RESULT_TOTAL_ID=#{resultTotalId}
  636. <if test="flag==null || flag==1">
  637. AND RESULT_ENTRY_GATE_TIME IS NOT NULL
  638. </if>
  639. </select>
  640. <select id="selectAllWeight" resultType="com.steerinfo.dil.model.TmstruckWeightResult">
  641. SELECT TMSTRUCK_WEIGHT_RESULT.WEIGHT_TASK_RESULT_ID "weightTaskResultId",
  642. TMSTRUCK_WEIGHT_RESULT.RESULT_TOTAL_ID "resultTotalId",
  643. TMSTRUCK_WEIGHT_RESULT.RESULT_POUND_NO "resultPoundNo",
  644. TMSTRUCK_WEIGHT_RESULT.RESULT_GROSS_WEIGHT "resultGrossWeight",
  645. TMSTRUCK_WEIGHT_RESULT.RESULT_GROSS_WEIGHT_TIME "resultGrossWeightTime",
  646. TMSTRUCK_WEIGHT_RESULT.RESULT_TARE_WEIGHT "resultTareWeight",
  647. TMSTRUCK_WEIGHT_RESULT.RESULT_TARE_WEIGHT_TIME "resultTareWeightTime",
  648. TMSTRUCK_WEIGHT_RESULT.RESULT_NET_WEIGHT "resultNetWeight",
  649. TMSTRUCK_WEIGHT_RESULT.RESULT_GROSS_PLACE_ID "resultGrossPlaceId",
  650. TMSTRUCK_WEIGHT_RESULT.RESULT_TARE_PLACE_ID "resultTarePlaceId",
  651. TMSTRUCK_WEIGHT_RESULT.MATERIAL_ID "materialId"
  652. FROM TMSTRUCK_WEIGHT_RESULT
  653. WHERE RESULT_TOTAL_ID=#{resultTotalId}
  654. <if test="flag==null || flag==1">
  655. AND (RESULT_TARE_WEIGHT_TIME IS NOT NULL OR RESULT_GROSS_WEIGHT_TIME IS NOT NULL)
  656. </if>
  657. </select>
  658. <select id="selectAllLoad" resultType="com.steerinfo.dil.model.TmstruckLoadResult">
  659. SELECT *
  660. FROM TMSTRUCK_LOAD_RESULT
  661. WHERE RESULT_TOTAL_ID=#{resultTotalId}
  662. <if test="flag==null || flag==1">
  663. AND RESULT_LOAD_END_TIME IS NOT NULL
  664. </if>
  665. </select>
  666. <select id="selectAllUnload" resultType="com.steerinfo.dil.model.TmstruckUnloadResult">
  667. SELECT
  668. TMSTRUCK_UNLOAD_RESULT.RESULT_ID "resultId",
  669. TMSTRUCK_UNLOAD_RESULT.RESULT_TOTAL_ID "resultTotalId",
  670. TMSTRUCK_UNLOAD_RESULT.RESULT_START_TIME "resultStartTime",
  671. TMSTRUCK_UNLOAD_RESULT.RESULT_END_TIME "resultEndTime"
  672. FROM TMSTRUCK_UNLOAD_RESULT
  673. WHERE RESULT_TOTAL_ID=#{resultTotalId}
  674. <if test="flag==null || flag==1">
  675. AND RESULT_END_TIME IS NOT NULL
  676. </if>
  677. </select>
  678. <select id="selectAllLeavefactory" resultType="com.steerinfo.dil.model.TmstruckLeaveFactoryResult">
  679. SELECT
  680. TMSTRUCK_LEAVE_FACTORY_RESULT.RESULT_ID "resultId",
  681. TMSTRUCK_LEAVE_FACTORY_RESULT.RESULT_TOTAL_ID "resultTotalId",
  682. TMSTRUCK_LEAVE_FACTORY_RESULT.GATEPOST_ID "gatepostId",
  683. TMSTRUCK_LEAVE_FACTORY_RESULT.RESULT_OUT_MODE "resultOutMode",
  684. TMSTRUCK_LEAVE_FACTORY_RESULT.RESULT_OUT_GATE_TIME "resultOutGateTime"
  685. FROM TMSTRUCK_LEAVE_FACTORY_RESULT
  686. WHERE RESULT_TOTAL_ID=#{resultTotalId}
  687. <if test="flag==null || flag==1">
  688. AND RESULT_OUT_GATE_TIME IS NOT NULL
  689. </if>
  690. </select>
  691. <delete id="deleteEnByEnTotal">
  692. DELETE FROM TMSTRUCK_ENFACTORY_RESULT WHERE RESULT_TOTAL_ID=#{resultTotalId}
  693. </delete>
  694. <delete id="deleteWeightByEnTotal">
  695. DELETE FROM TMSTRUCK_WEIGHT_RESULT WHERE RESULT_TOTAL_ID=#{resultTotalId}
  696. </delete>
  697. <delete id="deleteUnloadByEnTotal">
  698. DELETE FROM TMSTRUCK_UNLOAD_RESULT WHERE RESULT_TOTAL_ID=#{resultTotalId}
  699. </delete>
  700. <delete id="deleteLeaveByEnTotal">
  701. DELETE FROM TMSTRUCK_LEAVE_FACTORY_RESULT WHERE RESULT_TOTAL_ID=#{resultTotalId}
  702. </delete>
  703. </mapper>