TmstruckUnloadResultMapper.xml 49 KB

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