TmstruckUnloadResultMapper.xml 47 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072
  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.TmstruckUnloadResultMapper">
  4. <resultMap id="BaseResultMap" type="com.steerinfo.dil.model.TmstruckUnloadResult">
  5. <id column="RESULT_ID" jdbcType="DECIMAL" property="resultId" />
  6. <result column="RESULT_NUMBER" jdbcType="VARCHAR" property="resultNumber" />
  7. <result column="RESULT_TOTAL_ID" jdbcType="DECIMAL" property="resultTotalId" />
  8. <result column="RESULT_START_TIME" jdbcType="TIMESTAMP" property="resultStartTime" />
  9. <result column="RESULT_END_TIME" jdbcType="TIMESTAMP" property="resultEndTime" />
  10. <result column="RESULT_DURATION" jdbcType="DECIMAL" property="resultDuration" />
  11. <result column="UNLOAD_STATUS" jdbcType="VARCHAR" property="unloadStatus" />
  12. <result column="INSERT_USERNAME" jdbcType="VARCHAR" property="insertUsername" />
  13. <result column="INSERT_TIME" jdbcType="TIMESTAMP" property="insertTime" />
  14. <result column="UPDATE_USERNAME" jdbcType="VARCHAR" property="updateUsername" />
  15. <result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime" />
  16. <result column="INSERT_UPDATE_REMARK" jdbcType="VARCHAR" property="insertUpdateRemark" />
  17. <result column="DELETE_NAME" jdbcType="VARCHAR" property="deleteName" />
  18. <result column="DELETE_TIME" jdbcType="TIMESTAMP" property="deleteTime" />
  19. <result column="RESULT_UNLOAD_PLACE_ID" jdbcType="DECIMAL" property="resultUnloadPlaceId" />
  20. <result column="SEGMENT_SQE" jdbcType="DECIMAL" property="segmentSqe" />
  21. <result column="MATERIAL_ID" jdbcType="DECIMAL" property="materialId" />
  22. <result column="UNLOADER_ID" jdbcType="DECIMAL" property="unloaderId" />
  23. </resultMap>
  24. <sql id="columns">
  25. RESULT_ID, RESULT_NUMBER, RESULT_TOTAL_ID, RESULT_START_TIME, RESULT_END_TIME, RESULT_DURATION,
  26. UNLOAD_STATUS, INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK,
  27. DELETE_NAME, DELETE_TIME, RESULT_UNLOAD_PLACE_ID, SEGMENT_SQE, MATERIAL_ID, UNLOADER_ID
  28. </sql>
  29. <sql id="columns_alias">
  30. t.RESULT_ID, t.RESULT_NUMBER, t.RESULT_TOTAL_ID, t.RESULT_START_TIME, t.RESULT_END_TIME,
  31. t.RESULT_DURATION, t.UNLOAD_STATUS, t.INSERT_USERNAME, t.INSERT_TIME, t.UPDATE_USERNAME,
  32. t.UPDATE_TIME, t.INSERT_UPDATE_REMARK, t.DELETE_NAME, t.DELETE_TIME, t.RESULT_UNLOAD_PLACE_ID,
  33. t.SEGMENT_SQE, t.MATERIAL_ID, t.UNLOADER_ID
  34. </sql>
  35. <sql id="select">
  36. SELECT <include refid="columns" /> FROM TMSTRUCK_UNLOAD_RESULT
  37. </sql>
  38. <sql id="select_alias">
  39. SELECT <include refid="columns_alias" /> FROM TMSTRUCK_UNLOAD_RESULT t
  40. </sql>
  41. <sql id="where">
  42. <where>
  43. <if test="resultId != null">
  44. and RESULT_ID = #{resultId}
  45. </if>
  46. <if test="resultNumber != null and resultNumber != ''">
  47. and RESULT_NUMBER = #{resultNumber}
  48. </if>
  49. <if test="resultTotalId != null">
  50. and RESULT_TOTAL_ID = #{resultTotalId}
  51. </if>
  52. <if test="resultStartTime != null">
  53. and TO_CHAR(RESULT_START_TIME,'yyyy-MM-dd') = #{resultStartTime}
  54. </if>
  55. <if test="resultEndTime != null">
  56. and TO_CHAR(RESULT_END_TIME,'yyyy-MM-dd') = #{resultEndTime}
  57. </if>
  58. <if test="resultDuration != null">
  59. and RESULT_DURATION = #{resultDuration}
  60. </if>
  61. <if test="unloadStatus != null and unloadStatus != ''">
  62. and UNLOAD_STATUS = #{unloadStatus}
  63. </if>
  64. <if test="insertUsername != null and insertUsername != ''">
  65. and INSERT_USERNAME = #{insertUsername}
  66. </if>
  67. <if test="insertTime != null">
  68. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  69. </if>
  70. <if test="updateUsername != null and updateUsername != ''">
  71. and UPDATE_USERNAME = #{updateUsername}
  72. </if>
  73. <if test="updateTime != null">
  74. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  75. </if>
  76. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  77. and INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  78. </if>
  79. <if test="deleteName != null and deleteName != ''">
  80. and DELETE_NAME = #{deleteName}
  81. </if>
  82. <if test="deleteTime != null">
  83. and TO_CHAR(DELETE_TIME,'yyyy-MM-dd') = #{deleteTime}
  84. </if>
  85. <if test="resultUnloadPlaceId != null">
  86. and RESULT_UNLOAD_PLACE_ID = #{resultUnloadPlaceId}
  87. </if>
  88. <if test="segmentSqe != null">
  89. and SEGMENT_SQE = #{segmentSqe}
  90. </if>
  91. <if test="materialId != null">
  92. and MATERIAL_ID = #{materialId}
  93. </if>
  94. <if test="unloaderId != null">
  95. and UNLOADER_ID = #{unloaderId}
  96. </if>
  97. </where>
  98. </sql>
  99. <sql id="whereLike">
  100. <where>
  101. <if test="resultId != null">
  102. and RESULT_ID = #{resultId}
  103. </if>
  104. <if test="resultNumber != null and resultNumber != ''">
  105. and RESULT_NUMBER LIKE '%${resultNumber}%'
  106. </if>
  107. <if test="resultTotalId != null">
  108. and RESULT_TOTAL_ID = #{resultTotalId}
  109. </if>
  110. <if test="resultStartTime != null">
  111. and TO_CHAR(RESULT_START_TIME,'yyyy-MM-dd') = #{resultStartTime}
  112. </if>
  113. <if test="resultEndTime != null">
  114. and TO_CHAR(RESULT_END_TIME,'yyyy-MM-dd') = #{resultEndTime}
  115. </if>
  116. <if test="resultDuration != null">
  117. and RESULT_DURATION = #{resultDuration}
  118. </if>
  119. <if test="unloadStatus != null and unloadStatus != ''">
  120. and UNLOAD_STATUS LIKE '%${unloadStatus}%'
  121. </if>
  122. <if test="insertUsername != null and insertUsername != ''">
  123. and INSERT_USERNAME LIKE '%${insertUsername}%'
  124. </if>
  125. <if test="insertTime != null">
  126. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  127. </if>
  128. <if test="updateUsername != null and updateUsername != ''">
  129. and UPDATE_USERNAME LIKE '%${updateUsername}%'
  130. </if>
  131. <if test="updateTime != null">
  132. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  133. </if>
  134. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  135. and INSERT_UPDATE_REMARK LIKE '%${insertUpdateRemark}%'
  136. </if>
  137. <if test="deleteName != null and deleteName != ''">
  138. and DELETE_NAME LIKE '%${deleteName}%'
  139. </if>
  140. <if test="deleteTime != null">
  141. and TO_CHAR(DELETE_TIME,'yyyy-MM-dd') = #{deleteTime}
  142. </if>
  143. <if test="resultUnloadPlaceId != null">
  144. and RESULT_UNLOAD_PLACE_ID = #{resultUnloadPlaceId}
  145. </if>
  146. <if test="segmentSqe != null">
  147. and SEGMENT_SQE = #{segmentSqe}
  148. </if>
  149. <if test="materialId != null">
  150. and MATERIAL_ID = #{materialId}
  151. </if>
  152. <if test="unloaderId != null">
  153. and UNLOADER_ID = #{unloaderId}
  154. </if>
  155. </where>
  156. </sql>
  157. <delete id="deleteByPrimaryKey" parameterType="java.lang.Short">
  158. delete from TMSTRUCK_UNLOAD_RESULT
  159. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  160. </delete>
  161. <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
  162. delete from TMSTRUCK_UNLOAD_RESULT
  163. where 1!=1
  164. <if test="resultNumber != null and resultNumber != ''">
  165. or RESULT_NUMBER = #{resultNumber}
  166. </if>
  167. <if test="resultTotalId != null">
  168. or RESULT_TOTAL_ID = #{resultTotalId}
  169. </if>
  170. <if test="resultStartTime != null">
  171. or TO_CHAR(RESULT_START_TIME,'yyyy-MM-dd') = '#{resultStartTime}'
  172. </if>
  173. <if test="resultEndTime != null">
  174. or TO_CHAR(RESULT_END_TIME,'yyyy-MM-dd') = '#{resultEndTime}'
  175. </if>
  176. <if test="resultDuration != null">
  177. or RESULT_DURATION = #{resultDuration}
  178. </if>
  179. <if test="unloadStatus != null and unloadStatus != ''">
  180. or UNLOAD_STATUS = #{unloadStatus}
  181. </if>
  182. <if test="insertUsername != null and insertUsername != ''">
  183. or INSERT_USERNAME = #{insertUsername}
  184. </if>
  185. <if test="insertTime != null">
  186. or TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = '#{insertTime}'
  187. </if>
  188. <if test="updateUsername != null and updateUsername != ''">
  189. or UPDATE_USERNAME = #{updateUsername}
  190. </if>
  191. <if test="updateTime != null">
  192. or TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = '#{updateTime}'
  193. </if>
  194. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  195. or INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  196. </if>
  197. <if test="deleteName != null and deleteName != ''">
  198. or DELETE_NAME = #{deleteName}
  199. </if>
  200. <if test="deleteTime != null">
  201. or TO_CHAR(DELETE_TIME,'yyyy-MM-dd') = '#{deleteTime}'
  202. </if>
  203. <if test="resultUnloadPlaceId != null">
  204. or RESULT_UNLOAD_PLACE_ID = #{resultUnloadPlaceId}
  205. </if>
  206. <if test="segmentSqe != null">
  207. or SEGMENT_SQE = #{segmentSqe}
  208. </if>
  209. <if test="materialId != null">
  210. or MATERIAL_ID = #{materialId}
  211. </if>
  212. <if test="unloaderId != null">
  213. or UNLOADER_ID = #{unloaderId}
  214. </if>
  215. </delete>
  216. <insert id="insert" parameterType="com.steerinfo.dil.model.TmstruckUnloadResult">
  217. insert into TMSTRUCK_UNLOAD_RESULT (RESULT_ID, RESULT_NUMBER, RESULT_TOTAL_ID,
  218. RESULT_START_TIME, RESULT_END_TIME, RESULT_DURATION,
  219. UNLOAD_STATUS, INSERT_USERNAME, INSERT_TIME,
  220. UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK,
  221. DELETE_NAME, DELETE_TIME, RESULT_UNLOAD_PLACE_ID,
  222. SEGMENT_SQE, MATERIAL_ID, UNLOADER_ID
  223. )
  224. values (#{resultId,jdbcType=DECIMAL}, #{resultNumber,jdbcType=VARCHAR}, #{resultTotalId,jdbcType=DECIMAL},
  225. #{resultStartTime,jdbcType=TIMESTAMP}, #{resultEndTime,jdbcType=TIMESTAMP}, #{resultDuration,jdbcType=DECIMAL},
  226. #{unloadStatus,jdbcType=VARCHAR}, #{insertUsername,jdbcType=VARCHAR}, #{insertTime,jdbcType=TIMESTAMP},
  227. #{updateUsername,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{insertUpdateRemark,jdbcType=VARCHAR},
  228. #{deleteName,jdbcType=VARCHAR}, #{deleteTime,jdbcType=TIMESTAMP}, #{resultUnloadPlaceId,jdbcType=DECIMAL},
  229. #{segmentSqe,jdbcType=DECIMAL}, #{materialId,jdbcType=DECIMAL}, #{unloaderId,jdbcType=DECIMAL}
  230. )
  231. </insert>
  232. <insert id="insertSelective" parameterType="com.steerinfo.dil.model.TmstruckUnloadResult">
  233. insert into TMSTRUCK_UNLOAD_RESULT
  234. <trim prefix="(" suffix=")" suffixOverrides=",">
  235. <if test="resultId != null">
  236. RESULT_ID,
  237. </if>
  238. <if test="resultNumber != null">
  239. RESULT_NUMBER,
  240. </if>
  241. <if test="resultTotalId != null">
  242. RESULT_TOTAL_ID,
  243. </if>
  244. <if test="resultStartTime != null">
  245. RESULT_START_TIME,
  246. </if>
  247. <if test="resultEndTime != null">
  248. RESULT_END_TIME,
  249. </if>
  250. <if test="resultDuration != null">
  251. RESULT_DURATION,
  252. </if>
  253. <if test="unloadStatus != null">
  254. UNLOAD_STATUS,
  255. </if>
  256. <if test="insertUsername != null">
  257. INSERT_USERNAME,
  258. </if>
  259. <if test="insertTime != null">
  260. INSERT_TIME,
  261. </if>
  262. <if test="updateUsername != null">
  263. UPDATE_USERNAME,
  264. </if>
  265. <if test="updateTime != null">
  266. UPDATE_TIME,
  267. </if>
  268. <if test="insertUpdateRemark != null">
  269. INSERT_UPDATE_REMARK,
  270. </if>
  271. <if test="deleteName != null">
  272. DELETE_NAME,
  273. </if>
  274. <if test="deleteTime != null">
  275. DELETE_TIME,
  276. </if>
  277. <if test="resultUnloadPlaceId != null">
  278. RESULT_UNLOAD_PLACE_ID,
  279. </if>
  280. <if test="segmentSqe != null">
  281. SEGMENT_SQE,
  282. </if>
  283. <if test="materialId != null">
  284. MATERIAL_ID,
  285. </if>
  286. <if test="unloaderId != null">
  287. UNLOADER_ID,
  288. </if>
  289. </trim>
  290. <trim prefix="values (" suffix=")" suffixOverrides=",">
  291. <if test="resultId != null">
  292. #{resultId,jdbcType=DECIMAL},
  293. </if>
  294. <if test="resultNumber != null">
  295. #{resultNumber,jdbcType=VARCHAR},
  296. </if>
  297. <if test="resultTotalId != null">
  298. #{resultTotalId,jdbcType=DECIMAL},
  299. </if>
  300. <if test="resultStartTime != null">
  301. #{resultStartTime,jdbcType=TIMESTAMP},
  302. </if>
  303. <if test="resultEndTime != null">
  304. #{resultEndTime,jdbcType=TIMESTAMP},
  305. </if>
  306. <if test="resultDuration != null">
  307. #{resultDuration,jdbcType=DECIMAL},
  308. </if>
  309. <if test="unloadStatus != null">
  310. #{unloadStatus,jdbcType=VARCHAR},
  311. </if>
  312. <if test="insertUsername != null">
  313. #{insertUsername,jdbcType=VARCHAR},
  314. </if>
  315. <if test="insertTime != null">
  316. #{insertTime,jdbcType=TIMESTAMP},
  317. </if>
  318. <if test="updateUsername != null">
  319. #{updateUsername,jdbcType=VARCHAR},
  320. </if>
  321. <if test="updateTime != null">
  322. #{updateTime,jdbcType=TIMESTAMP},
  323. </if>
  324. <if test="insertUpdateRemark != null">
  325. #{insertUpdateRemark,jdbcType=VARCHAR},
  326. </if>
  327. <if test="deleteName != null">
  328. #{deleteName,jdbcType=VARCHAR},
  329. </if>
  330. <if test="deleteTime != null">
  331. #{deleteTime,jdbcType=TIMESTAMP},
  332. </if>
  333. <if test="resultUnloadPlaceId != null">
  334. #{resultUnloadPlaceId,jdbcType=DECIMAL},
  335. </if>
  336. <if test="segmentSqe != null">
  337. #{segmentSqe,jdbcType=DECIMAL},
  338. </if>
  339. <if test="materialId != null">
  340. #{materialId,jdbcType=DECIMAL},
  341. </if>
  342. <if test="unloaderId != null">
  343. #{unloaderId,jdbcType=DECIMAL},
  344. </if>
  345. </trim>
  346. </insert>
  347. <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.TmstruckUnloadResult">
  348. update TMSTRUCK_UNLOAD_RESULT
  349. set RESULT_NUMBER = #{resultNumber,jdbcType=VARCHAR},
  350. RESULT_TOTAL_ID = #{resultTotalId,jdbcType=DECIMAL},
  351. RESULT_START_TIME = #{resultStartTime,jdbcType=TIMESTAMP},
  352. RESULT_END_TIME = #{resultEndTime,jdbcType=TIMESTAMP},
  353. RESULT_DURATION = #{resultDuration,jdbcType=DECIMAL},
  354. UNLOAD_STATUS = #{unloadStatus,jdbcType=VARCHAR},
  355. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  356. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  357. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  358. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  359. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  360. DELETE_NAME = #{deleteName,jdbcType=VARCHAR},
  361. DELETE_TIME = #{deleteTime,jdbcType=TIMESTAMP},
  362. RESULT_UNLOAD_PLACE_ID = #{resultUnloadPlaceId,jdbcType=DECIMAL},
  363. SEGMENT_SQE = #{segmentSqe,jdbcType=DECIMAL},
  364. MATERIAL_ID = #{materialId,jdbcType=DECIMAL},
  365. UNLOADER_ID = #{unloaderId,jdbcType=DECIMAL}
  366. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  367. </update>
  368. <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.TmstruckUnloadResult">
  369. update TMSTRUCK_UNLOAD_RESULT
  370. <set>
  371. <if test="resultNumber != null">
  372. RESULT_NUMBER = #{resultNumber,jdbcType=VARCHAR},
  373. </if>
  374. <if test="resultTotalId != null">
  375. RESULT_TOTAL_ID = #{resultTotalId,jdbcType=DECIMAL},
  376. </if>
  377. <if test="resultStartTime != null">
  378. RESULT_START_TIME = #{resultStartTime,jdbcType=TIMESTAMP},
  379. </if>
  380. <if test="resultEndTime != null">
  381. RESULT_END_TIME = #{resultEndTime,jdbcType=TIMESTAMP},
  382. </if>
  383. <if test="resultDuration != null">
  384. RESULT_DURATION = #{resultDuration,jdbcType=DECIMAL},
  385. </if>
  386. <if test="unloadStatus != null">
  387. UNLOAD_STATUS = #{unloadStatus,jdbcType=VARCHAR},
  388. </if>
  389. <if test="insertUsername != null">
  390. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  391. </if>
  392. <if test="insertTime != null">
  393. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  394. </if>
  395. <if test="updateUsername != null">
  396. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  397. </if>
  398. <if test="updateTime != null">
  399. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  400. </if>
  401. <if test="insertUpdateRemark != null">
  402. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  403. </if>
  404. <if test="deleteName != null">
  405. DELETE_NAME = #{deleteName,jdbcType=VARCHAR},
  406. </if>
  407. <if test="deleteTime != null">
  408. DELETE_TIME = #{deleteTime,jdbcType=TIMESTAMP},
  409. </if>
  410. <if test="resultUnloadPlaceId != null">
  411. RESULT_UNLOAD_PLACE_ID = #{resultUnloadPlaceId,jdbcType=DECIMAL},
  412. </if>
  413. <if test="segmentSqe != null">
  414. SEGMENT_SQE = #{segmentSqe,jdbcType=DECIMAL},
  415. </if>
  416. <if test="materialId != null">
  417. MATERIAL_ID = #{materialId,jdbcType=DECIMAL},
  418. </if>
  419. <if test="unloaderId != null">
  420. UNLOADER_ID = #{unloaderId,jdbcType=DECIMAL},
  421. </if>
  422. </set>
  423. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  424. </update>
  425. <select id="selectByPrimaryKey" parameterType="java.lang.Short" resultMap="BaseResultMap">
  426. <include refid="select" />
  427. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  428. </select>
  429. <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  430. <include refid="select" />
  431. <include refid="where" />
  432. </select>
  433. <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  434. <include refid="select" />
  435. <include refid="whereLike" />
  436. </select>
  437. <insert id="batchInsert" parameterType="java.util.List">
  438. insert into TMSTRUCK_UNLOAD_RESULT
  439. (RESULT_ID,
  440. RESULT_NUMBER, RESULT_TOTAL_ID,
  441. RESULT_START_TIME, RESULT_END_TIME,
  442. RESULT_DURATION, UNLOAD_STATUS,
  443. INSERT_USERNAME, INSERT_TIME,
  444. UPDATE_USERNAME, UPDATE_TIME,
  445. INSERT_UPDATE_REMARK, DELETE_NAME,
  446. DELETE_TIME, RESULT_UNLOAD_PLACE_ID,
  447. SEGMENT_SQE, MATERIAL_ID, UNLOADER_ID
  448. )
  449. ( <foreach collection="list" item="item" separator="union all">
  450. select
  451. #{item.resultId,jdbcType=DECIMAL},
  452. #{item.resultNumber,jdbcType=VARCHAR}, #{item.resultTotalId,jdbcType=DECIMAL},
  453. #{item.resultStartTime,jdbcType=TIMESTAMP}, #{item.resultEndTime,jdbcType=TIMESTAMP},
  454. #{item.resultDuration,jdbcType=DECIMAL}, #{item.unloadStatus,jdbcType=VARCHAR},
  455. #{item.insertUsername,jdbcType=VARCHAR}, #{item.insertTime,jdbcType=TIMESTAMP},
  456. #{item.updateUsername,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP},
  457. #{item.insertUpdateRemark,jdbcType=VARCHAR}, #{item.deleteName,jdbcType=VARCHAR},
  458. #{item.deleteTime,jdbcType=TIMESTAMP}, #{item.resultUnloadPlaceId,jdbcType=DECIMAL},
  459. #{item.segmentSqe,jdbcType=DECIMAL}, #{item.materialId,jdbcType=DECIMAL}, #{item.unloaderId,jdbcType=DECIMAL}
  460. from dual
  461. </foreach> )
  462. </insert>
  463. <update id="batchUpdate" parameterType="java.util.List">
  464. update TMSTRUCK_UNLOAD_RESULT
  465. set
  466. RESULT_ID=
  467. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  468. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultId,jdbcType=DECIMAL}
  469. </foreach>
  470. ,RESULT_NUMBER=
  471. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  472. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultNumber,jdbcType=VARCHAR}
  473. </foreach>
  474. ,RESULT_TOTAL_ID=
  475. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  476. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultTotalId,jdbcType=DECIMAL}
  477. </foreach>
  478. ,RESULT_START_TIME=
  479. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  480. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultStartTime,jdbcType=TIMESTAMP}
  481. </foreach>
  482. ,RESULT_END_TIME=
  483. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  484. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultEndTime,jdbcType=TIMESTAMP}
  485. </foreach>
  486. ,RESULT_DURATION=
  487. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  488. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultDuration,jdbcType=DECIMAL}
  489. </foreach>
  490. ,UNLOAD_STATUS=
  491. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  492. when #{item.resultId,jdbcType=DECIMAL} then #{item.unloadStatus,jdbcType=VARCHAR}
  493. </foreach>
  494. ,INSERT_USERNAME=
  495. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  496. when #{item.resultId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
  497. </foreach>
  498. ,INSERT_TIME=
  499. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  500. when #{item.resultId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
  501. </foreach>
  502. ,UPDATE_USERNAME=
  503. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  504. when #{item.resultId,jdbcType=DECIMAL} then #{item.updateUsername,jdbcType=VARCHAR}
  505. </foreach>
  506. ,UPDATE_TIME=
  507. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  508. when #{item.resultId,jdbcType=DECIMAL} then #{item.updateTime,jdbcType=TIMESTAMP}
  509. </foreach>
  510. ,INSERT_UPDATE_REMARK=
  511. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  512. when #{item.resultId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
  513. </foreach>
  514. ,DELETE_NAME=
  515. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  516. when #{item.resultId,jdbcType=DECIMAL} then #{item.deleteName,jdbcType=VARCHAR}
  517. </foreach>
  518. ,DELETE_TIME=
  519. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  520. when #{item.resultId,jdbcType=DECIMAL} then #{item.deleteTime,jdbcType=TIMESTAMP}
  521. </foreach>
  522. ,RESULT_UNLOAD_PLACE_ID=
  523. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  524. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultUnloadPlaceId,jdbcType=DECIMAL}
  525. </foreach>
  526. ,SEGMENT_SQE=
  527. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  528. when #{item.resultId,jdbcType=DECIMAL} then #{item.segmentSqe,jdbcType=DECIMAL}
  529. </foreach>
  530. ,MATERIAL_ID=
  531. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  532. when #{item.resultId,jdbcType=DECIMAL} then #{item.materialId,jdbcType=DECIMAL}
  533. </foreach>
  534. ,UNLOADER_ID=
  535. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  536. when #{item.resultId,jdbcType=DECIMAL} then #{item.unloaderId,jdbcType=DECIMAL}
  537. </foreach>
  538. where RESULT_ID in
  539. <foreach close=")" collection="list" index="index" item="item" open="(" separator=",">
  540. #{item.resultId,jdbcType=DECIMAL}
  541. </foreach>
  542. </update>
  543. <delete id="batchDelete" parameterType="java.util.List">
  544. delete from TMSTRUCK_UNLOAD_RESULT
  545. where RESULT_ID in
  546. <foreach close=")" collection="list" item="id" open="(" separator=",">
  547. #{id}
  548. </foreach>
  549. </delete>
  550. <!-- 友情提示!!!-->
  551. <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
  552. <!-- 排序 -->
  553. <sql id="orderBy">
  554. <if test="orderField != null and orderField != ''">
  555. order by "${orderField}"
  556. <if test="orderType != null and orderType != ''">
  557. ${orderType}
  558. </if>
  559. </if>
  560. <if test="orderField == null ">
  561. order by "resultEndTime" desc
  562. </if>
  563. </sql>
  564. <!-- 获取采购卸货实绩 -->
  565. <select id="getCGUnloadResult" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
  566. select *
  567. from (
  568. select
  569. TUR.RESULT_ID "resultId",
  570. APO.PURCHASE_ORDER_NO "purchaseOrderNo",
  571. OO.ORDER_NUMBER "orderNumber",
  572. RC.CAPACITY_NUMBER "capacityNumber",
  573. RM.MATERIAL_NAME "materialName",
  574. TWR.RESULT_NET_WEIGHT "resultNetWeight",
  575. RW.WAREHOUSE_NAME "warehouseName",
  576. TUR.RESULT_END_TIME "resultEndTime",
  577. TUR.INSERT_TIME "insertTime"
  578. from TMSTRUCK_UNLOAD_RESULT TUR
  579. left join TMSTRUCK_TOTAL_RESULT TTR
  580. on TUR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  581. left join TMSTRUCK_WEIGHT_RESULT TWR
  582. on TWR.RESULT_TOTAL_ID = TUR.RESULT_TOTAL_ID
  583. left join OMSTRUCK_ORDER OO
  584. on OO.ORDER_ID = TTR.ORDER_ID
  585. left join AMS_PURCHASE_ORDER APO
  586. on APO.PURCHASE_ORDER_ID = OO.ORDER_PLAN_ID
  587. left join OMSTRUCK_ORDER_MATERIAL OOM
  588. on OOM.ORDER_ID = OO.ORDER_ID
  589. left join RMS_MATERIAL RM
  590. on OOM.MATERIAL_ID = RM.MATERIAL_ID
  591. left join RMS_CAPACITY RC
  592. on RC.CAPACITY_ID = OO.CAPACITY_ID
  593. left join RMS_WAREHOUSE RW
  594. on RW.WAREHOUSE_ID = TUR.RESULT_UNLOAD_PLACE_ID
  595. where RESULT_END_TIME is not null and OO.ORDER_TYPE = #{orderTypee}
  596. )
  597. <where>
  598. <if test="purchaseOrderNo != null">
  599. <foreach collection="purchaseOrderNo" item="item" open="(" separator="or" close=")">
  600. "purchaseOrderNo" like '%${item}%'
  601. </foreach>
  602. </if>
  603. <if test="materialName != null">
  604. and
  605. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  606. "materialName" like '%${item}%'
  607. </foreach>
  608. </if>
  609. <if test="orderNumber != null">
  610. and
  611. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  612. "orderNumber" like '%${item}%'
  613. </foreach>
  614. </if>
  615. <if test="capacityNumber != null">
  616. and
  617. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  618. "capacityNumber" like '%${item}%'
  619. </foreach>
  620. </if>
  621. <if test="warehouseName != null">
  622. and
  623. <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
  624. "warehouseName" like '%${item}%'
  625. </foreach>
  626. </if>
  627. <if test="resultNetWeight != null">
  628. and
  629. <foreach collection="resultNetWeight" item="item" open="(" separator="or" close=")">
  630. "resultNetWeight" like '%${item}%'
  631. </foreach>
  632. </if>
  633. <if test="orderMaterialWeight != null">
  634. and
  635. <foreach collection="orderMaterialWeight" item="item" open="(" separator="or" close=")">
  636. "orderMaterialWeight" like '%${item}%'
  637. </foreach>
  638. </if>
  639. <if test="resultStartTime != null">
  640. and
  641. <foreach collection="resultStartTime" item="item" open="(" separator="or" close=")">
  642. "resultStartTime" like '%${item}%'
  643. </foreach>
  644. </if>
  645. </where>
  646. <include refid="orderBy"></include>
  647. </select>
  648. <!-- 通过总实绩Id查询卸货实绩Id -->
  649. <select id="getResultIdByTotalId" parameterType="DECIMAL" resultType="DECIMAL">
  650. SELECT RESULT_ID
  651. FROM TMSTRUCK_UNLOAD_RESULT
  652. WHERE RESULT_TOTAL_ID = #{resultTotalId}
  653. </select>
  654. <!-- 通过运输订单号 查询实绩Id、总实绩ID -->
  655. <select id="selectUnloadMesByOrderNo" parameterType="java.util.Map" resultType="java.util.Map">
  656. select *
  657. from (
  658. select
  659. TUR.RESULT_ID "resultId",
  660. TUR.SEGMENT_SQE "segmentSqe",
  661. TUR.RESULT_TOTAL_ID "resultTotalId"
  662. from TMSTRUCK_UNLOAD_RESULT TUR
  663. where TUR.RESULT_TOTAL_ID = #{resultTotalId}
  664. <if test="updateLoadResult != null">
  665. and TUR.RESULT_END_TIME is null
  666. </if>
  667. order by TUR.SEGMENT_SQE
  668. )
  669. where rownum = 1
  670. </select>
  671. <!-- 通过卸货地点查询 仓库ID-->
  672. <select id="getWarehouseIdByWName" parameterType="string" resultType="java.math.BigDecimal">
  673. select WAREHOUSE_ID
  674. from RMS_WAREHOUSE
  675. where WAREHOUSE_NAME = #{warehouseName}
  676. </select>
  677. <!-- 通过总实绩ID查询订单中卸货实绩 -->
  678. <select id="getUnloadPointId" resultType="java.math.BigDecimal" parameterType="java.util.Map">
  679. select OO.UNLOAD_POINT_ID from OMSTRUCK_ORDER OO
  680. left join TMSTRUCK_TOTAL_RESULT TTR
  681. on OO.ORDER_ID = TTR.ORDER_ID
  682. where TTR.RESULT_TOTAL_ID = #{resultTotalId}
  683. </select>
  684. <!-- 查询内转采购进口矿国产矿实绩 -->
  685. <select id="getImportedDomesticNzUnloadResult" parameterType="java.util.Map" resultType="java.util.Map">
  686. select *
  687. from (
  688. select TUR.RESULT_ID "resultId",
  689. APO.PURCHASE_ORDER_NO "purchaseOrderNo",
  690. OO.ORDER_NUMBER "orderNumber",
  691. RC.CAPACITY_NUMBER "capacityNumber",
  692. RM.MATERIAL_NAME "materialName",
  693. DB.RESULT_FOREIGN_SHIP_NAME "resultForeignShipName",
  694. TWR.RESULT_NET_WEIGHT "resultNetWeight",
  695. RW.WAREHOUSE_NAME "warehouseName",
  696. TUR.RESULT_START_TIME "resultStartTime",
  697. TUR.INSERT_TIME "insertTime"
  698. from TMSTRUCK_UNLOAD_RESULT TUR
  699. left join TMSTRUCK_TOTAL_RESULT TTR
  700. on TUR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  701. left join TMSTRUCK_WEIGHT_RESULT TWR
  702. on TWR.RESULT_TOTAL_ID = TUR.RESULT_TOTAL_ID
  703. left join OMSTRUCK_ORDER OO
  704. on OO.ORDER_ID = TTR.ORDER_ID
  705. left join AMS_PURCHASE_ORDER APO
  706. on APO.PURCHASE_ORDER_ID = OO.ORDER_PLAN_ID
  707. left join DIL_BATCH DB
  708. on DB.BATCH_ID = APO.BATCH_ID
  709. left join OMSTRUCK_ORDER_MATERIAL OOM
  710. on OOM.ORDER_ID = OO.ORDER_ID
  711. left join RMS_MATERIAL RM
  712. on OOM.MATERIAL_ID = RM.MATERIAL_ID
  713. left join RMS_CAPACITY RC
  714. on RC.CAPACITY_ID = OO.CAPACITY_ID
  715. left join RMS_WAREHOUSE RW
  716. on RW.WAREHOUSE_ID = TUR.RESULT_UNLOAD_PLACE_ID
  717. where RESULT_START_TIME is not null
  718. and OO.ORDER_TYPE = 9
  719. )
  720. <where>
  721. <if test="purchaseOrderNo != null">
  722. <foreach collection="purchaseOrderNo" item="item" open="(" separator="or" close=")">
  723. "purchaseOrderNo" like '%${item}%'
  724. </foreach>
  725. </if>
  726. <if test="materialName != null">
  727. and
  728. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  729. "materialName" like '%${item}%'
  730. </foreach>
  731. </if>
  732. <if test="orderNumber != null">
  733. and
  734. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  735. "orderNumber" like '%${item}%'
  736. </foreach>
  737. </if>
  738. <if test="capacityNumber != null">
  739. and
  740. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  741. "capacityNumber" like '%${item}%'
  742. </foreach>
  743. </if>
  744. <if test="orderMaterialNumber != null">
  745. and
  746. <foreach collection="orderMaterialNumber" item="item" open="(" separator="or" close=")">
  747. "orderMaterialNumber" like '%${item}%'
  748. </foreach>
  749. </if>
  750. <if test="resultForeignShipName != null">
  751. and
  752. <foreach collection="resultForeignShipName" item="item" open="(" separator="or" close=")">
  753. "resultForeignShipName" like '%${item}%'
  754. </foreach>
  755. </if>
  756. <if test="orderMaterialWeight != null">
  757. and
  758. <foreach collection="orderMaterialWeight" item="item" open="(" separator="or" close=")">
  759. "orderMaterialWeight" like '%${item}%'
  760. </foreach>
  761. </if>
  762. <if test="resultNetWeight != null">
  763. and
  764. <foreach collection="resultNetWeight" item="item" open="(" separator="or" close=")">
  765. "resultNetWeight" like '%${item}%'
  766. </foreach>
  767. </if>
  768. <if test="warehouseName != null">
  769. and
  770. <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
  771. "warehouseName" like '%${item}%'
  772. </foreach>
  773. </if>
  774. <if test="resultStartTime != null">
  775. and
  776. <foreach collection="resultStartTime" item="item" open="(" separator="or" close=")">
  777. "resultStartTime" like '%${item}%'
  778. </foreach>
  779. </if>
  780. </where>
  781. <include refid="orderBy"></include>
  782. </select>
  783. <!-- 查询内转采购进口矿国产矿实绩(老区-厂内) -->
  784. <select id="getImportedDomesticNzUnload2Result" parameterType="java.util.Map" resultType="java.util.Map">
  785. SELECT *
  786. FROM ( SELECT TUR.RESULT_ID "resultId",
  787. APO.PURCHASE_ORDER_NO "purchaseOrderNo",
  788. OO.ORDER_NUMBER "orderNumber",
  789. RC.CAPACITY_NUMBER "capacityNumber",
  790. RM.MATERIAL_NAME "materialName",
  791. RW.WAREHOUSE_NAME "warehouseName",
  792. TUR.RESULT_END_TIME "resultEndTime"
  793. FROM TMSTRUCK_UNLOAD_RESULT TUR
  794. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  795. ON TTR.RESULT_TOTAL_ID = TUR.RESULT_TOTAL_ID
  796. LEFT JOIN OMSTRUCK_ORDER OO
  797. ON OO.ORDER_ID = TTR.ORDER_ID
  798. LEFT JOIN RMS_CAPACITY RC
  799. ON RC.CAPACITY_ID = OO.CAPACITY_ID
  800. LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM
  801. ON OOM.ORDER_ID = OO.ORDER_ID
  802. left join amstruck_inward_plan aip
  803. on aip.plan_id = oo.order_plan_id
  804. left join amstruck_requirement_plan arp
  805. on arp.plan_id = aip.plan_id
  806. left join amstruck_inward_requirement air
  807. on air.requirement_id = arp.requirement_id
  808. LEFT JOIN AMS_PURCHASE_ORDER APO
  809. ON APO.PURCHASE_ORDER_ID = air.PURCHASE_ORDER_ID
  810. LEFT JOIN RMS_MATERIAL RM
  811. ON RM.MATERIAL_ID = OOM.MATERIAL_ID
  812. LEFT JOIN RMS_WAREHOUSE RW
  813. ON RW.WAREHOUSE_ID = TUR.RESULT_UNLOAD_PLACE_ID
  814. WHERE TUR.RESULT_END_TIME IS NOT NULL
  815. AND OO.ORDER_TYPE in (10,20)
  816. <if test="userId !=null">
  817. AND AIR.INSERT_USERNAME = #{userId}
  818. </if>
  819. )
  820. <where>
  821. <if test="orderNumber != null">
  822. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  823. "orderNumber" like '%${item}%'
  824. </foreach>
  825. </if>
  826. <if test="purchaseOrderNo != null">
  827. <foreach collection="purchaseOrderNo" item="item" open="(" separator="or" close=")">
  828. "purchaseOrderNo" like '%${item}%'
  829. </foreach>
  830. </if>
  831. <if test="capacityNumber != null">
  832. and
  833. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  834. "capacityNumber" like '%${item}%'
  835. </foreach>
  836. </if>
  837. <if test="materialName != null">
  838. and
  839. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  840. "materialName" like '%${item}%'
  841. </foreach>
  842. </if>
  843. <if test="warehouseName != null">
  844. and
  845. <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
  846. "warehouseName" like '%${item}%'
  847. </foreach>
  848. </if>
  849. <if test="resultEndTime != null">
  850. and
  851. <foreach collection="resultEndTime" item="item" open="(" separator="or" close=")">
  852. "resultEndTime" like '%${item}%'
  853. </foreach>
  854. </if>
  855. </where>
  856. <include refid="orderBy"></include>
  857. </select>
  858. <!-- 查询内转厂内卸货实绩 -->
  859. <select id="getInFactoryUnloadResult" parameterType="java.util.Map" resultType="java.util.Map">
  860. SELECT *
  861. FROM (
  862. SELECT TUR.RESULT_ID "resultId",
  863. OO.ORDER_NUMBER "orderNumber",
  864. RC.CAPACITY_NUMBER "capacityNumber",
  865. RM.MATERIAL_NAME "materialName",
  866. OOM.ORDER_MATERIAL_NUMBER "orderMaterialNumber",
  867. TUR.RESULT_END_TIME "resultEndTime",
  868. RW.WAREHOUSE_NAME "warehouseName",
  869. TWR.RESULT_NET_WEIGHT "resultNetWeight"
  870. FROM TMSTRUCK_UNLOAD_RESULT TUR
  871. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  872. ON TTR.RESULT_TOTAL_ID = TUR.RESULT_TOTAL_ID
  873. LEFT JOIN OMSTRUCK_ORDER OO
  874. ON OO.ORDER_ID = TTR.ORDER_ID
  875. LEFT JOIN RMS_CAPACITY RC
  876. ON RC.CAPACITY_ID = OO.CAPACITY_ID
  877. LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM
  878. ON OOM.ORDER_ID = OO.ORDER_ID
  879. LEFT JOIN RMS_MATERIAL RM
  880. ON RM.MATERIAL_ID = OOM.MATERIAL_ID
  881. LEFT JOIN RMS_WAREHOUSE RW
  882. ON RW.WAREHOUSE_ID = TUR.RESULT_UNLOAD_PLACE_ID
  883. LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR
  884. ON TTR.RESULT_TOTAL_ID = TWR.RESULT_TOTAL_ID
  885. WHERE OO.ORDER_TYPE = #{orderTypee}
  886. ORDER BY TUR.RESULT_END_TIME desc
  887. )
  888. <where>
  889. <if test="orderNumber != null">
  890. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  891. "orderNumber" like '%${item}%'
  892. </foreach>
  893. </if>
  894. <if test="capacityNumber != null">
  895. and
  896. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  897. "capacityNumber" like '%${item}%'
  898. </foreach>
  899. </if>
  900. <if test="materialName != null">
  901. and
  902. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  903. "materialName" like '%${item}%'
  904. </foreach>
  905. </if>
  906. <if test="orderMaterialNumber != null">
  907. and
  908. <foreach collection="orderMaterialNumber" item="item" open="(" separator="or" close=")">
  909. "orderMaterialNumber" like '%${item}%'
  910. </foreach>
  911. </if>
  912. <if test="warehouseName != null">
  913. and
  914. <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
  915. "warehouseName" like '%${item}%'
  916. </foreach>
  917. </if>
  918. <if test="resultEndTime != null">
  919. and
  920. <foreach collection="resultEndTime" item="item" open="(" separator="or" close=")">
  921. to_char("resultEndTime",'yyyy-mm-dd hh24:mi:ss') like '%${item}%'
  922. </foreach>
  923. </if>
  924. <if test="resultNetWeight != null">
  925. and
  926. <foreach collection="resultNetWeight" item="item" open="(" separator="or" close=")">
  927. "resultNetWeight" like '%${item}%'
  928. </foreach>
  929. </if>
  930. </where>
  931. <include refid="orderBy"></include>
  932. </select>
  933. <!-- 根据总实绩ID查询卸货地点-->
  934. <select id="getSporadicSuppliesUnloadResult" resultType="java.util.Map">
  935. SELECT *
  936. FROM (
  937. SELECT distinct
  938. TUR.RESULT_ID "resultId",
  939. OO.ORDER_NUMBER "orderNumber",
  940. RC.CAPACITY_NUMBER "capacityNumber",
  941. TUR.RESULT_START_TIME "resultStartTime",
  942. TUR.RESULT_END_TIME "resultEndTime",
  943. TUR.RESULT_DURATION "resultDuration",
  944. RW.WAREHOUSE_NAME "warehouseName",
  945. RM.MATERIAL_NAME "materialName",
  946. OOM.ORDER_MATERIAL_WEIGHT "materialWeight",
  947. OOM.ORDER_MATERIAL_NUMBER "materialNumber",
  948. TWR.RESULT_NET_WEIGHT "orderMaterialNetWeight"
  949. FROM TMSTRUCK_UNLOAD_RESULT TUR
  950. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  951. ON TTR.RESULT_TOTAL_ID = TUR.RESULT_TOTAL_ID
  952. LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR
  953. ON TWR.RESULT_TOTAL_ID=TTR.RESULT_TOTAL_ID
  954. LEFT JOIN OMSTRUCK_ORDER OO
  955. ON OO.ORDER_ID = TTR.ORDER_ID
  956. LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM
  957. ON OOM.ORDER_ID=OO.ORDER_ID
  958. LEFT JOIN RMS_MATERIAL RM
  959. ON RM.MATERIAL_ID=OOM.MATERIAL_ID
  960. LEFT JOIN AMSTRUCK_SPORADIC_ORDER ASO
  961. ON OO.ORDER_PLAN_ID = ASO.SPORADIC_ORDER_ID
  962. LEFT JOIN RMS_CAPACITY RC
  963. ON RC.CAPACITY_ID = OO.CAPACITY_ID
  964. LEFT JOIN RMS_WAREHOUSE RW
  965. ON RW.WAREHOUSE_ID = TUR.RESULT_UNLOAD_PLACE_ID
  966. WHERE TUR.RESULT_END_TIME IS NOT NULL
  967. <if test="orderTypee != 100">
  968. AND OO.ORDER_TYPE = #{orderTypee}
  969. </if>
  970. <if test="orderTypee == 100">
  971. AND OO.ORDER_TYPE in (12, 13 ,14,19)
  972. </if>
  973. <if test="userId != null">
  974. and ASO.INSERT_USERNAME=#{userId}
  975. </if>
  976. <if test="userIds!=null">
  977. and ASO.UPDATE_USERNAME=#{userIds}
  978. </if>
  979. )
  980. <where>
  981. <if test="orderNumber != null">
  982. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  983. "orderNumber" like '%${item}%'
  984. </foreach>
  985. </if>
  986. <if test="capacityNumber != null">
  987. and
  988. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  989. "capacityNumber" like '%${item}%'
  990. </foreach>
  991. </if>
  992. <if test="warehouseName != null">
  993. and
  994. <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
  995. "warehouseName" like '%${item}%'
  996. </foreach>
  997. </if>
  998. <if test="resultStartTime != null">
  999. and
  1000. <foreach collection="resultStartTime" item="item" open="(" separator="or" close=")">
  1001. "resultStartTime" like '%${item}%'
  1002. </foreach>
  1003. </if>
  1004. <if test="resultEndTime != null">
  1005. and
  1006. <foreach collection="resultEndTime" item="item" open="(" separator="or" close=")">
  1007. "resultEndTime" like '%${item}%'
  1008. </foreach>
  1009. </if>
  1010. <if test="resultDuration != null">
  1011. and
  1012. <foreach collection="resultDuration" item="item" open="(" separator="or" close=")">
  1013. "resultDuration" like '%${item}%'
  1014. </foreach>
  1015. </if>
  1016. </where>
  1017. <include refid="orderBy"></include>
  1018. </select>
  1019. <!-- 根据优先级查询物资 -->
  1020. <select id="selectMaterialForUnload" resultType="java.util.Map">
  1021. select OOM.MATERIAL_ID "materialId",
  1022. OO.ORDER_ID "orderId"
  1023. from OMSTRUCK_ORDER_MATERIAL OOM
  1024. JOIN OMSTRUCK_ORDER OO
  1025. ON OO.ORDER_ID=OOM.ORDER_ID
  1026. where OO.ORDER_NUMBER=#{orderNumber}
  1027. ORDER BY OOM.MATERIAL_PRIORITY
  1028. </select>
  1029. <!-- 根据物资是否计量 -->
  1030. <select id="selectUnloadMaterialId" resultType="java.lang.Integer" parameterType="java.util.Map">
  1031. SELECT
  1032. COUNT( * )
  1033. FROM
  1034. OMSTRUCK_ORDER_MATERIAL OOM
  1035. JOIN OMSTRUCK_ORDER OO ON OO.ORDER_ID = OOM.ORDER_ID
  1036. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR ON TTR.ORDER_ID = OO.ORDER_ID
  1037. LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR ON TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  1038. WHERE OOM.MATERIAL_ID=#{materialId} AND OO.ORDER_ID=#{orderId}
  1039. </select>
  1040. <select id="selectOrderId" resultType="java.util.Map" parameterType="java.util.Map">
  1041. SELECT OO.ORDER_ID "orderId",
  1042. oo.ORDER_NUMBER "orderNumber",
  1043. TTR.RESULT_TOTAL_ID "totalId"
  1044. FROM OMSTRUCK_ORDER OO
  1045. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  1046. ON TTR.ORDER_ID = OO.ORDER_ID
  1047. WHERE OO.ORDER_NUMBER = #{orderNumber}
  1048. </select>
  1049. <select id="getNetWeightByTotalId" parameterType="java.math.BigDecimal" resultType="int">
  1050. select COUNT(TWR.RESULT_NET_WEIGHT) from TMSTRUCK_WEIGHT_RESULT TWR where TWR.RESULT_TOTAL_ID = #{totalId}
  1051. </select>
  1052. <select id="checkMaterialIdUnload" resultType="java.lang.Integer">
  1053. select TUR.RESULT_ID
  1054. from TMSTRUCK_UNLOAD_RESULT TUR
  1055. where TUR.RESULT_TOTAL_ID = #{resultTotalId}
  1056. and TUR.MATERIAL_ID = #{materialId}
  1057. </select>
  1058. </mapper>