TmstruckLeaveFactoryResultMapper.xml 54 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195
  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.TmstruckLeaveFactoryResultMapper">
  4. <resultMap id="BaseResultMap" type="com.steerinfo.dil.model.TmstruckLeaveFactoryResult">
  5. <id column="RESULT_ID" jdbcType="DECIMAL" property="resultId" />
  6. <result column="RESULT_TOTAL_ID" jdbcType="DECIMAL" property="resultTotalId" />
  7. <result column="GATEPOST_ID" jdbcType="DECIMAL" property="gatepostId" />
  8. <result column="RESULT_OUT_MODE" jdbcType="VARCHAR" property="resultOutMode" />
  9. <result column="RESULT_OUT_GATE_TIME" jdbcType="TIMESTAMP" property="resultOutGateTime" />
  10. <result column="INSERT_USERNAME" jdbcType="VARCHAR" property="insertUsername" />
  11. <result column="INSERT_TIME" jdbcType="TIMESTAMP" property="insertTime" />
  12. <result column="UPDATE_USERNAME" jdbcType="VARCHAR" property="updateUsername" />
  13. <result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime" />
  14. <result column="INSERT_UPDATE_REMARK" jdbcType="VARCHAR" property="insertUpdateRemark" />
  15. <result column="DELETE_USERNAME" jdbcType="VARCHAR" property="deleteUsername" />
  16. <result column="DELETE_TIME" jdbcType="TIMESTAMP" property="deleteTime" />
  17. <result column="SEGMENT_SQE" jdbcType="DECIMAL" property="segmentSqe" />
  18. <result column="RESULT_TRUCK_SNAPSHOT_PICTURE" jdbcType="BLOB" property="resultTruckSnapshotPicture" />
  19. </resultMap>
  20. <sql id="columns">
  21. RESULT_ID, RESULT_TOTAL_ID, GATEPOST_ID, RESULT_OUT_MODE, RESULT_OUT_GATE_TIME, INSERT_USERNAME,
  22. INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK, DELETE_USERNAME,
  23. DELETE_TIME, SEGMENT_SQE, RESULT_TRUCK_SNAPSHOT_PICTURE
  24. </sql>
  25. <sql id="columns_alias">
  26. t.RESULT_ID, t.RESULT_TOTAL_ID, t.GATEPOST_ID, t.RESULT_OUT_MODE, t.RESULT_OUT_GATE_TIME,
  27. t.INSERT_USERNAME, t.INSERT_TIME, t.UPDATE_USERNAME, t.UPDATE_TIME, t.INSERT_UPDATE_REMARK,
  28. t.DELETE_USERNAME, t.DELETE_TIME, t.SEGMENT_SQE, t.RESULT_TRUCK_SNAPSHOT_PICTURE
  29. </sql>
  30. <sql id="select">
  31. SELECT <include refid="columns"/> FROM TMSTRUCK_LEAVE_FACTORY_RESULT
  32. </sql>
  33. <sql id="select_alias">
  34. SELECT <include refid="columns_alias"/> FROM TMSTRUCK_LEAVE_FACTORY_RESULT t
  35. </sql>
  36. <sql id="where">
  37. <where>
  38. <if test="resultId != null">
  39. and RESULT_ID = #{resultId}
  40. </if>
  41. <if test="resultTotalId != null">
  42. and RESULT_TOTAL_ID = #{resultTotalId}
  43. </if>
  44. <if test="gatepostId != null">
  45. and GATEPOST_ID = #{gatepostId}
  46. </if>
  47. <if test="resultOutMode != null and resultOutMode != ''">
  48. and RESULT_OUT_MODE = #{resultOutMode}
  49. </if>
  50. <if test="resultOutGateTime != null">
  51. and TO_CHAR(RESULT_OUT_GATE_TIME,'yyyy-MM-dd') = #{resultOutGateTime}
  52. </if>
  53. <if test="insertUsername != null and insertUsername != ''">
  54. and INSERT_USERNAME = #{insertUsername}
  55. </if>
  56. <if test="insertTime != null">
  57. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  58. </if>
  59. <if test="updateUsername != null and updateUsername != ''">
  60. and UPDATE_USERNAME = #{updateUsername}
  61. </if>
  62. <if test="updateTime != null">
  63. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  64. </if>
  65. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  66. and INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  67. </if>
  68. <if test="deleteUsername != null and deleteUsername != ''">
  69. and DELETE_USERNAME = #{deleteUsername}
  70. </if>
  71. <if test="deleteTime != null">
  72. and TO_CHAR(DELETE_TIME,'yyyy-MM-dd') = #{deleteTime}
  73. </if>
  74. <if test="segmentSqe != null">
  75. and SEGMENT_SQE = #{segmentSqe}
  76. </if>
  77. <if test="resultTruckSnapshotPicture != null">
  78. and RESULT_TRUCK_SNAPSHOT_PICTURE = #{resultTruckSnapshotPicture}
  79. </if>
  80. </where>
  81. </sql>
  82. <sql id="whereLike">
  83. <where>
  84. <if test="resultId != null">
  85. and RESULT_ID = #{resultId}
  86. </if>
  87. <if test="resultTotalId != null">
  88. and RESULT_TOTAL_ID = #{resultTotalId}
  89. </if>
  90. <if test="gatepostId != null">
  91. and GATEPOST_ID = #{gatepostId}
  92. </if>
  93. <if test="resultOutMode != null and resultOutMode != ''">
  94. and RESULT_OUT_MODE LIKE '%${resultOutMode}%'
  95. </if>
  96. <if test="resultOutGateTime != null">
  97. and TO_CHAR(RESULT_OUT_GATE_TIME,'yyyy-MM-dd') = #{resultOutGateTime}
  98. </if>
  99. <if test="insertUsername != null and insertUsername != ''">
  100. and INSERT_USERNAME LIKE '%${insertUsername}%'
  101. </if>
  102. <if test="insertTime != null">
  103. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  104. </if>
  105. <if test="updateUsername != null and updateUsername != ''">
  106. and UPDATE_USERNAME LIKE '%${updateUsername}%'
  107. </if>
  108. <if test="updateTime != null">
  109. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  110. </if>
  111. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  112. and INSERT_UPDATE_REMARK LIKE '%${insertUpdateRemark}%'
  113. </if>
  114. <if test="deleteUsername != null and deleteUsername != ''">
  115. and DELETE_USERNAME LIKE '%${deleteUsername}%'
  116. </if>
  117. <if test="deleteTime != null">
  118. and TO_CHAR(DELETE_TIME,'yyyy-MM-dd') = #{deleteTime}
  119. </if>
  120. <if test="segmentSqe != null">
  121. and SEGMENT_SQE = #{segmentSqe}
  122. </if>
  123. <if test="resultTruckSnapshotPicture != null">
  124. and RESULT_TRUCK_SNAPSHOT_PICTURE = #{resultTruckSnapshotPicture}
  125. </if>
  126. </where>
  127. </sql>
  128. <delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal">
  129. delete from TMSTRUCK_LEAVE_FACTORY_RESULT
  130. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  131. </delete>
  132. <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
  133. delete from TMSTRUCK_LEAVE_FACTORY_RESULT
  134. where 1!=1
  135. <if test="resultTotalId != null">
  136. or RESULT_TOTAL_ID = #{resultTotalId}
  137. </if>
  138. <if test="gatepostId != null">
  139. or GATEPOST_ID = #{gatepostId}
  140. </if>
  141. <if test="resultOutMode != null and resultOutMode != ''">
  142. or RESULT_OUT_MODE = #{resultOutMode}
  143. </if>
  144. <if test="resultOutGateTime != null">
  145. or TO_CHAR(RESULT_OUT_GATE_TIME,'yyyy-MM-dd') = '#{resultOutGateTime}'
  146. </if>
  147. <if test="insertUsername != null and insertUsername != ''">
  148. or INSERT_USERNAME = #{insertUsername}
  149. </if>
  150. <if test="insertTime != null">
  151. or TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = '#{insertTime}'
  152. </if>
  153. <if test="updateUsername != null and updateUsername != ''">
  154. or UPDATE_USERNAME = #{updateUsername}
  155. </if>
  156. <if test="updateTime != null">
  157. or TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = '#{updateTime}'
  158. </if>
  159. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  160. or INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  161. </if>
  162. <if test="deleteUsername != null and deleteUsername != ''">
  163. or DELETE_USERNAME = #{deleteUsername}
  164. </if>
  165. <if test="deleteTime != null">
  166. or TO_CHAR(DELETE_TIME,'yyyy-MM-dd') = '#{deleteTime}'
  167. </if>
  168. <if test="segmentSqe != null">
  169. or SEGMENT_SQE = #{segmentSqe}
  170. </if>
  171. <if test="resultTruckSnapshotPicture != null">
  172. or RESULT_TRUCK_SNAPSHOT_PICTURE = #{resultTruckSnapshotPicture}
  173. </if>
  174. </delete>
  175. <insert id="insert" parameterType="com.steerinfo.dil.model.TmstruckLeaveFactoryResult">
  176. insert into TMSTRUCK_LEAVE_FACTORY_RESULT (RESULT_ID, RESULT_TOTAL_ID, GATEPOST_ID,
  177. RESULT_OUT_MODE, RESULT_OUT_GATE_TIME, INSERT_USERNAME,
  178. INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME,
  179. INSERT_UPDATE_REMARK, DELETE_USERNAME, DELETE_TIME,
  180. SEGMENT_SQE, RESULT_TRUCK_SNAPSHOT_PICTURE)
  181. values (#{resultId,jdbcType=DECIMAL}, #{resultTotalId,jdbcType=DECIMAL}, #{gatepostId,jdbcType=DECIMAL},
  182. #{resultOutMode,jdbcType=VARCHAR}, #{resultOutGateTime,jdbcType=TIMESTAMP}, #{insertUsername,jdbcType=VARCHAR},
  183. #{insertTime,jdbcType=TIMESTAMP}, #{updateUsername,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
  184. #{insertUpdateRemark,jdbcType=VARCHAR}, #{deleteUsername,jdbcType=VARCHAR}, #{deleteTime,jdbcType=TIMESTAMP},
  185. #{segmentSqe,jdbcType=DECIMAL}, #{resultTruckSnapshotPicture,jdbcType=BLOB})
  186. </insert>
  187. <insert id="insertSelective" parameterType="com.steerinfo.dil.model.TmstruckLeaveFactoryResult">
  188. insert into TMSTRUCK_LEAVE_FACTORY_RESULT
  189. <trim prefix="(" suffix=")" suffixOverrides=",">
  190. <if test="resultId != null">
  191. RESULT_ID,
  192. </if>
  193. <if test="resultTotalId != null">
  194. RESULT_TOTAL_ID,
  195. </if>
  196. <if test="gatepostId != null">
  197. GATEPOST_ID,
  198. </if>
  199. <if test="resultOutMode != null">
  200. RESULT_OUT_MODE,
  201. </if>
  202. <if test="resultOutGateTime != null">
  203. RESULT_OUT_GATE_TIME,
  204. </if>
  205. <if test="insertUsername != null">
  206. INSERT_USERNAME,
  207. </if>
  208. <if test="insertTime != null">
  209. INSERT_TIME,
  210. </if>
  211. <if test="updateUsername != null">
  212. UPDATE_USERNAME,
  213. </if>
  214. <if test="updateTime != null">
  215. UPDATE_TIME,
  216. </if>
  217. <if test="insertUpdateRemark != null">
  218. INSERT_UPDATE_REMARK,
  219. </if>
  220. <if test="deleteUsername != null">
  221. DELETE_USERNAME,
  222. </if>
  223. <if test="deleteTime != null">
  224. DELETE_TIME,
  225. </if>
  226. <if test="segmentSqe != null">
  227. SEGMENT_SQE,
  228. </if>
  229. <if test="resultTruckSnapshotPicture != null">
  230. RESULT_TRUCK_SNAPSHOT_PICTURE,
  231. </if>
  232. </trim>
  233. <trim prefix="values (" suffix=")" suffixOverrides=",">
  234. <if test="resultId != null">
  235. #{resultId,jdbcType=DECIMAL},
  236. </if>
  237. <if test="resultTotalId != null">
  238. #{resultTotalId,jdbcType=DECIMAL},
  239. </if>
  240. <if test="gatepostId != null">
  241. #{gatepostId,jdbcType=DECIMAL},
  242. </if>
  243. <if test="resultOutMode != null">
  244. #{resultOutMode,jdbcType=VARCHAR},
  245. </if>
  246. <if test="resultOutGateTime != null">
  247. #{resultOutGateTime,jdbcType=TIMESTAMP},
  248. </if>
  249. <if test="insertUsername != null">
  250. #{insertUsername,jdbcType=VARCHAR},
  251. </if>
  252. <if test="insertTime != null">
  253. #{insertTime,jdbcType=TIMESTAMP},
  254. </if>
  255. <if test="updateUsername != null">
  256. #{updateUsername,jdbcType=VARCHAR},
  257. </if>
  258. <if test="updateTime != null">
  259. #{updateTime,jdbcType=TIMESTAMP},
  260. </if>
  261. <if test="insertUpdateRemark != null">
  262. #{insertUpdateRemark,jdbcType=VARCHAR},
  263. </if>
  264. <if test="deleteUsername != null">
  265. #{deleteUsername,jdbcType=VARCHAR},
  266. </if>
  267. <if test="deleteTime != null">
  268. #{deleteTime,jdbcType=TIMESTAMP},
  269. </if>
  270. <if test="segmentSqe != null">
  271. #{segmentSqe,jdbcType=DECIMAL},
  272. </if>
  273. <if test="resultTruckSnapshotPicture != null">
  274. #{resultTruckSnapshotPicture,jdbcType=BLOB},
  275. </if>
  276. </trim>
  277. </insert>
  278. <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.TmstruckLeaveFactoryResult">
  279. update TMSTRUCK_LEAVE_FACTORY_RESULT
  280. set RESULT_TOTAL_ID = #{resultTotalId,jdbcType=DECIMAL},
  281. GATEPOST_ID = #{gatepostId,jdbcType=DECIMAL},
  282. RESULT_OUT_MODE = #{resultOutMode,jdbcType=VARCHAR},
  283. RESULT_OUT_GATE_TIME = #{resultOutGateTime,jdbcType=TIMESTAMP},
  284. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  285. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  286. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  287. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  288. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  289. DELETE_USERNAME = #{deleteUsername,jdbcType=VARCHAR},
  290. DELETE_TIME = #{deleteTime,jdbcType=TIMESTAMP},
  291. SEGMENT_SQE = #{segmentSqe,jdbcType=DECIMAL},
  292. RESULT_TRUCK_SNAPSHOT_PICTURE = #{resultTruckSnapshotPicture,jdbcType=BLOB}
  293. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  294. </update>
  295. <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.TmstruckLeaveFactoryResult">
  296. update TMSTRUCK_LEAVE_FACTORY_RESULT
  297. <set>
  298. <if test="resultTotalId != null">
  299. RESULT_TOTAL_ID = #{resultTotalId,jdbcType=DECIMAL},
  300. </if>
  301. <if test="gatepostId != null">
  302. GATEPOST_ID = #{gatepostId,jdbcType=DECIMAL},
  303. </if>
  304. <if test="resultOutMode != null">
  305. RESULT_OUT_MODE = #{resultOutMode,jdbcType=VARCHAR},
  306. </if>
  307. <if test="resultOutGateTime != null">
  308. RESULT_OUT_GATE_TIME = #{resultOutGateTime,jdbcType=TIMESTAMP},
  309. </if>
  310. <if test="insertUsername != null">
  311. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  312. </if>
  313. <if test="insertTime != null">
  314. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  315. </if>
  316. <if test="updateUsername != null">
  317. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  318. </if>
  319. <if test="updateTime != null">
  320. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  321. </if>
  322. <if test="insertUpdateRemark != null">
  323. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  324. </if>
  325. <if test="deleteUsername != null">
  326. DELETE_USERNAME = #{deleteUsername,jdbcType=VARCHAR},
  327. </if>
  328. <if test="deleteTime != null">
  329. DELETE_TIME = #{deleteTime,jdbcType=TIMESTAMP},
  330. </if>
  331. <if test="segmentSqe != null">
  332. SEGMENT_SQE = #{segmentSqe,jdbcType=DECIMAL},
  333. </if>
  334. <if test="resultTruckSnapshotPicture != null">
  335. RESULT_TRUCK_SNAPSHOT_PICTURE = #{resultTruckSnapshotPicture,jdbcType=BLOB},
  336. </if>
  337. </set>
  338. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  339. </update>
  340. <select id="selectByPrimaryKey" parameterType="java.math.BigDecimal" resultMap="BaseResultMap">
  341. <include refid="select"/>
  342. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  343. </select>
  344. <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  345. <include refid="select"/>
  346. <include refid="where"/>
  347. </select>
  348. <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  349. <include refid="select"/>
  350. <include refid="whereLike"/>
  351. </select>
  352. <insert id="batchInsert" parameterType="java.util.List">
  353. insert into TMSTRUCK_LEAVE_FACTORY_RESULT
  354. (RESULT_ID,
  355. RESULT_TOTAL_ID, GATEPOST_ID, RESULT_OUT_MODE,
  356. RESULT_OUT_GATE_TIME, INSERT_USERNAME,
  357. INSERT_TIME, UPDATE_USERNAME,
  358. UPDATE_TIME, INSERT_UPDATE_REMARK,
  359. DELETE_USERNAME, DELETE_TIME,
  360. SEGMENT_SQE, RESULT_TRUCK_SNAPSHOT_PICTURE
  361. )
  362. ( <foreach collection="list" item="item" separator="union all">
  363. select
  364. #{item.resultId,jdbcType=DECIMAL},
  365. #{item.resultTotalId,jdbcType=DECIMAL}, #{item.gatepostId,jdbcType=DECIMAL}, #{item.resultOutMode,jdbcType=VARCHAR},
  366. #{item.resultOutGateTime,jdbcType=TIMESTAMP}, #{item.insertUsername,jdbcType=VARCHAR},
  367. #{item.insertTime,jdbcType=TIMESTAMP}, #{item.updateUsername,jdbcType=VARCHAR},
  368. #{item.updateTime,jdbcType=TIMESTAMP}, #{item.insertUpdateRemark,jdbcType=VARCHAR},
  369. #{item.deleteUsername,jdbcType=VARCHAR}, #{item.deleteTime,jdbcType=TIMESTAMP},
  370. #{item.segmentSqe,jdbcType=DECIMAL}, #{item.resultTruckSnapshotPicture,jdbcType=BLOB}
  371. from dual
  372. </foreach> )
  373. </insert>
  374. <update id="batchUpdate" parameterType="java.util.List">
  375. update TMSTRUCK_LEAVE_FACTORY_RESULT
  376. set
  377. RESULT_ID=
  378. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  379. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultId,jdbcType=DECIMAL}
  380. </foreach>
  381. ,RESULT_TOTAL_ID=
  382. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  383. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultTotalId,jdbcType=DECIMAL}
  384. </foreach>
  385. ,GATEPOST_ID=
  386. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  387. when #{item.resultId,jdbcType=DECIMAL} then #{item.gatepostId,jdbcType=DECIMAL}
  388. </foreach>
  389. ,RESULT_OUT_MODE=
  390. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  391. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultOutMode,jdbcType=VARCHAR}
  392. </foreach>
  393. ,RESULT_OUT_GATE_TIME=
  394. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  395. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultOutGateTime,jdbcType=TIMESTAMP}
  396. </foreach>
  397. ,INSERT_USERNAME=
  398. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  399. when #{item.resultId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
  400. </foreach>
  401. ,INSERT_TIME=
  402. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  403. when #{item.resultId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
  404. </foreach>
  405. ,UPDATE_USERNAME=
  406. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  407. when #{item.resultId,jdbcType=DECIMAL} then #{item.updateUsername,jdbcType=VARCHAR}
  408. </foreach>
  409. ,UPDATE_TIME=
  410. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  411. when #{item.resultId,jdbcType=DECIMAL} then #{item.updateTime,jdbcType=TIMESTAMP}
  412. </foreach>
  413. ,INSERT_UPDATE_REMARK=
  414. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  415. when #{item.resultId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
  416. </foreach>
  417. ,DELETE_USERNAME=
  418. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  419. when #{item.resultId,jdbcType=DECIMAL} then #{item.deleteUsername,jdbcType=VARCHAR}
  420. </foreach>
  421. ,DELETE_TIME=
  422. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  423. when #{item.resultId,jdbcType=DECIMAL} then #{item.deleteTime,jdbcType=TIMESTAMP}
  424. </foreach>
  425. ,SEGMENT_SQE=
  426. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  427. when #{item.resultId,jdbcType=DECIMAL} then #{item.segmentSqe,jdbcType=DECIMAL}
  428. </foreach>
  429. ,RESULT_TRUCK_SNAPSHOT_PICTURE=
  430. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  431. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultTruckSnapshotPicture,jdbcType=BLOB}
  432. </foreach>
  433. where RESULT_ID in
  434. <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
  435. #{item.resultId,jdbcType=DECIMAL}
  436. </foreach>
  437. </update>
  438. <delete id="batchDelete" parameterType="java.util.List">
  439. delete from TMSTRUCK_LEAVE_FACTORY_RESULT
  440. where RESULT_ID in
  441. <foreach collection="list" item="id" open="(" close=")" separator=",">
  442. #{id}
  443. </foreach>
  444. </delete>
  445. <!-- 友情提示!!!-->
  446. <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
  447. <sql id="orderByOutTime">
  448. <if test="orderField != null and orderField != ''">
  449. order by "${orderField}"
  450. <if test="orderType != null and orderType != ''">
  451. ${orderType}
  452. </if>
  453. </if>
  454. <if test="orderField == null ">
  455. order by "resultOutGateTime" desc
  456. </if>
  457. </sql>
  458. <!-- 查询采购所有的出厂实绩 -->
  459. <select id="getCGLeaveFactoryResult" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
  460. select *
  461. from (
  462. select
  463. TLFR.RESULT_ID "resultId",
  464. APO.PURCHASE_ORDER_NO "purchaseOrderNo",
  465. RM.MATERIAL_NAME "materialName",
  466. TWR.RESULT_NET_WEIGHT "netWeight",
  467. DB.RESULT_FOREIGN_SHIP_NAME "resultForeignShipName",
  468. OO.ORDER_NUMBER "orderNumber",
  469. RC.CAPACITY_NUMBER "capacityNumber",
  470. RG.GATEPOST_NAME "gatepostName",
  471. TLFR.RESULT_OUT_MODE "resultOutMode",
  472. TLFR.RESULT_OUT_GATE_TIME "resultOutGateTime",
  473. TLFR.RESULT_TRUCK_SNAPSHOT_PICTURE "resultTruckSnapshotPicture"
  474. from TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
  475. left join TMSTRUCK_TOTAL_RESULT TTR
  476. on TTR.RESULT_TOTAL_ID = TLFR.RESULT_TOTAL_ID
  477. left join TMSTRUCK_WEIGHT_RESULT TWR
  478. on TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  479. left join OMSTRUCK_ORDER OO
  480. on OO.ORDER_ID = TTR.ORDER_ID
  481. left join AMS_PURCHASE_ORDER APO
  482. on APO.PURCHASE_ORDER_ID = OO.ORDER_PLAN_ID
  483. left join DIL_BATCH DB
  484. on DB.BATCH_ID = APO.BATCH_ID
  485. left join OMSTRUCK_ORDER_MATERIAL OOM
  486. on OOM.ORDER_ID = OO.ORDER_ID
  487. left join RMS_MATERIAL RM
  488. on RM.MATERIAL_ID = OOM.MATERIAL_ID
  489. left join RMS_CAPACITY RC
  490. on RC.CAPACITY_ID = OO.CAPACITY_ID
  491. <if test="carrierSsoId != null">
  492. left join RMS_CARRIER RCA
  493. on RCA.CARRIER_ID = RC.CARRIER_ID
  494. </if>
  495. left join RMS_GATEPOST RG
  496. on RG.GATEPOST_ID = TLFR.GATEPOST_ID
  497. where RESULT_OUT_GATE_TIME is not null and OO.ORDER_TYPE = #{orderTypee}
  498. <if test="carrierSsoId != null">
  499. and RCA.CARRIER_SSO_ID = #{carrierSsoId}
  500. </if>
  501. )
  502. <where>
  503. <if test="purchaseOrderNo != null">
  504. <foreach collection="purchaseOrderNo" item="item" open="(" separator="or" close=")">
  505. "purchaseOrderNo" like '%${item}%'
  506. </foreach>
  507. </if>
  508. <if test="materialName != null">
  509. and
  510. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  511. "materialName" like '%${item}%'
  512. </foreach>
  513. </if>
  514. <if test="netWeight != null">
  515. and
  516. <foreach collection="netWeight" item="item" open="(" separator="or" close=")">
  517. "netWeight" like '%${item}%'
  518. </foreach>
  519. </if>
  520. <if test="resultForeignShipName != null">
  521. and
  522. <foreach collection="resultForeignShipName" item="item" open="(" separator="or" close=")">
  523. "resultForeignShipName" like '%${item}%'
  524. </foreach>
  525. </if>
  526. <if test="orderNumber != null">
  527. and
  528. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  529. "orderNumber" like '%${item}%'
  530. </foreach>
  531. </if>
  532. <if test="capacityNumber != null">
  533. and
  534. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  535. "capacityNumber" like '%${item}%'
  536. </foreach>
  537. </if>
  538. <if test="gatepostName != null">
  539. and
  540. <foreach collection="gatepostName" item="item" open="(" separator="or" close=")">
  541. "gatepostName" like '%${item}%'
  542. </foreach>
  543. </if>
  544. <if test="resultOutMode != null">
  545. and
  546. <foreach collection="resultOutMode" item="item" open="(" separator="or" close=")">
  547. "resultOutMode" like '%${item}%'
  548. </foreach>
  549. </if>
  550. <if test="resultOutGateTime != null">
  551. and
  552. <foreach collection="resultOutGateTime" item="item" open="(" separator="or" close=")">
  553. "resultOutGateTime" like '%${item}%'
  554. </foreach>
  555. </if>
  556. <if test="resultTruckSnapshotPicture != null">
  557. and
  558. <foreach collection="resultTruckSnapshotPicture" item="item" open="(" separator="or" close=")">
  559. "resultTruckSnapshotPicture" like '%${item}%'
  560. </foreach>
  561. </if>
  562. </where>
  563. <include refid="orderByOutTime"></include>
  564. </select>
  565. <!-- 通过运输订单号查询 路段顺序号是否为 4 :已计皮-->
  566. <select id="selectTransportRoute" parameterType="string" resultType="int">
  567. select ORDER_LINE_SEQUENCE
  568. from OMSTRUCK_ORDER
  569. where ORDER_NUMBER = #{orderNumber}
  570. </select>
  571. <!-- 通过运输订单号查询 出厂门岗ID 和 实绩ID -->
  572. <select id="selectCnAndGnByOrderNumber" parameterType="string" resultType="java.util.Map">
  573. select RL.LINE_END_NODE_ID "lineEndNodeId",
  574. TTR.RESULT_TOTAL_ID "resultTotalId"
  575. from OMSTRUCK_ORDER OO
  576. left join TMSTRUCK_TOTAL_RESULT TTR
  577. on TTR.ORDER_ID = OO.ORDER_ID
  578. left join RMS_LINE RL
  579. on RL.LINE_ID = OO.LINE_ID
  580. where OO.ORDER_NUMBER = #{orderNumber}
  581. </select>
  582. <!-- 通过运输订单号获取实绩ID -->
  583. <select id="selectResultId" parameterType="string" resultType="java.util.Map">
  584. select *
  585. from (
  586. select TLFR.RESULT_ID "resultId",
  587. OO.ORDER_ID "orderId",
  588. OO.ORDER_TYPE "orderTypee",
  589. TTR.RESULT_TOTAL_ID "resultTotalId",
  590. OO.CAPACITY_ID "capacityId",
  591. TLFR.SEGMENT_SQE "segmentSqe",
  592. OO.ORDER_LINE_SEQUENCE "orderSegmentSqe",
  593. OO.PRICE_ID "priceId"
  594. from OMSTRUCK_ORDER OO
  595. left join TMSTRUCK_TOTAL_RESULT TTR
  596. on OO.ORDER_ID = TTR.ORDER_ID
  597. left join TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
  598. on TLFR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  599. where OO.ORDER_NUMBER = #{orderNumber} and TLFR.RESULT_OUT_GATE_TIME is null
  600. order by TLFR.SEGMENT_SQE
  601. )
  602. where rownum = 1
  603. </select>
  604. <!--销售物流查询所有的出厂实绩-->
  605. <select id="selectAllLeaveFacatoryForSale" resultType="java.util.Map">
  606. select *
  607. from (
  608. select
  609. TLFR.RESULT_OUT_GATE_TIME "resultOutGateTime",
  610. TLFR.RESULT_OUT_MODE "resultOutMode",
  611. RG.GATEPOST_NAME "gatepostName",
  612. OO.ORDER_NUMBER "orderNumber",
  613. RC.CAPACITY_NUMBER "capacityNumber",
  614. OO.ORDER_ID "orderId",
  615. ASO.SALE_NUMBER "saleNum",
  616. RS.SUPPLIER_NAME "shipperName",
  617. RCON.CONSIGNEE_COMPANY_NAME "supplierName"
  618. FROM TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
  619. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  620. ON TTR.RESULT_TOTAL_ID = TLFR.RESULT_TOTAL_ID
  621. LEFT JOIN OMSTRUCK_ORDER OO
  622. ON OO.ORDER_ID = TTR.ORDER_ID
  623. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
  624. ON ASOM.SALE_ORDER_MATERIAL_ID = OO.ORDER_PLAN_ID
  625. LEFT JOIN AMS_SALE_ORDER ASO
  626. ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  627. LEFT JOIN RMS_GATEPOST RG
  628. ON RG.GATEPOST_ID = TLFR.GATEPOST_ID
  629. LEFT JOIN RMS_CAPACITY RC
  630. ON RC.CAPACITY_ID = OO.CAPACITY_ID
  631. LEFT JOIN RMS_SUPPLIER RS
  632. ON RS.SUPPLIER_ID = ASO.SHIPPER_ID
  633. LEFT JOIN RMS_CONSIGNEE RCON
  634. ON RCON.CONSIGNEE_ID = ASO.RECEIVE_ID
  635. WHERE TLFR.RESULT_OUT_GATE_TIME IS NOT NULL
  636. AND OO.ORDER_TYPE IN (1, 2, 3)
  637. )
  638. <where>
  639. <if test="saleNum != null">
  640. <foreach collection="saleNum" item="item" open="(" separator="or" close=")">
  641. "saleNum" like '%${item}%'
  642. </foreach>
  643. </if>
  644. <if test="gatepostName != null">
  645. and
  646. <foreach collection="gatepostName" item="item" open="(" separator="or" close=")">
  647. "gatepostName" like '%${item}%'
  648. </foreach>
  649. </if>
  650. <if test="orderNumber != null">
  651. and
  652. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  653. "orderNumber" like '%${item}%'
  654. </foreach>
  655. </if>
  656. <if test="capacityNumber != null">
  657. and
  658. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  659. "capacityNumber" like '%${item}%'
  660. </foreach>
  661. </if>
  662. <if test="shipperName != null">
  663. and
  664. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  665. "shipperName" like '%${item}%'
  666. </foreach>
  667. </if>
  668. <if test="resultEntryMode != null">
  669. and
  670. <foreach collection="resultEntryMode" item="item" open="(" separator="or" close=")">
  671. "resultEntryMode" like '%${item}%'
  672. </foreach>
  673. </if>
  674. <if test="resultEntryGateTime != null">
  675. and
  676. <foreach collection="resultEntryGateTime" item="item" open="(" separator="or" close=")">
  677. "resultEntryGateTime" like '%${item}%'
  678. </foreach>
  679. </if>
  680. <if test="supplierName != null">
  681. and
  682. <foreach collection="supplierName" item="item" open="(" separator="or" close=")">
  683. "supplierName" like '%${item}%'
  684. </foreach>
  685. </if>
  686. </where>
  687. <include refid="orderByOutTime"></include>
  688. </select>
  689. <!-- 通过总实绩Id 查询出厂实绩ID -->
  690. <select id="getResultIdByTotalId" parameterType="int" resultType="java.math.BigDecimal">
  691. select *
  692. from (
  693. select TLFR.RESULT_ID
  694. from TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
  695. where TLFR.RESULT_TOTAL_ID = #{resultTotalId}
  696. and TLFR.RESULT_OUT_GATE_TIME is null
  697. order by TLFR.SEGMENT_SQE
  698. )
  699. where rownum = 1
  700. </select>
  701. <select id="getTruckFactoryResult" resultType="java.util.Map">
  702. SELECT * from(
  703. SELECT
  704. -- 出厂时间
  705. to_char(TLFR.RESULT_OUT_GATE_TIME,'yyyy-mm-dd hh24:mi:ss') "resultOutGateTime",
  706. --出厂抓拍图片
  707. TLFR.RESULT_TRUCK_SNAPSHOT_PICTURE "resultTruckSnapshotPicture",
  708. --出厂方式
  709. TLFR.RESULT_OUT_MODE "resultOutMode",
  710. --门岗名称
  711. RG.GATEPOST_NAME "gatepostName",
  712. -- 运输订单号
  713. OO.ORDER_NUMBER "orderNumber",
  714. -- 车牌号
  715. RC.CAPACITY_NUMBER "capacityNumber",
  716. -- 运输订单id
  717. OO.ORDER_ID "orderId",
  718. -- 订单类型
  719. OO.ORDER_TYPE "orderType",
  720. -- 销售订单号
  721. ASO.SALE_NUMBER "saleNum",
  722. -- 收货地址
  723. RRA.ADDRESS_DELIVERY_ADDRESS "receiveAddress",
  724. -- 收货单位
  725. RS.SUPPLIER_NAME "supplierName" ,
  726. -- 发货单位
  727. RS2.SHIPPER_NAME "shipperName"
  728. FROM
  729. -- 出厂实绩
  730. TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
  731. -- 总实绩
  732. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR ON TLFR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  733. -- 运输订单
  734. LEFT JOIN OMSTRUCK_ORDER OO ON TTR.ORDER_ID = OO.ORDER_ID
  735. -- 销售订单信息
  736. LEFT JOIN AMS_SALE_ORDER ASO ON OO.ORDER_PLAN_ID = ASO.SALE_ORDER_ID
  737. -- 托运人
  738. LEFT JOIN RMS_SUPPLIER RS ON ASO.SHIPPER_ID = RS.SUPPLIER_ID
  739. -- 门岗
  740. LEFT JOIN RMS_GATEPOST RG ON TLFR.GATEPOST_ID = RG.GATEPOST_ID
  741. -- 运力信息
  742. LEFT JOIN RMS_CAPACITY RC ON OO.CAPACITY_ID = RC.CAPACITY_ID
  743. -- 销售订单中间表
  744. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM ON ASOM.SALE_ORDER_MATERIAL_ID =OO.ORDER_PLAN_ID
  745. -- 收货地址
  746. LEFT JOIN RMS_RECEIVE_ADDRESS RRA ON ASOM.SALE_SHIPPING_ADDRESS_ID =RRA.ADDRESS_ID
  747. -- 收货单位
  748. LEFT JOIN RMS_SHIPPER RS2 ON ASO.SHIPPER_ID = RS2.SHIPPER_ID
  749. WHERE
  750. -- 判断出厂实绩的出厂时间不为空
  751. TLFR.RESULT_OUT_GATE_TIME IS NOT NULL
  752. -- 并且订单类型等于1(销售订单),2(焦炭发运计划),3(水渣发运计划)
  753. AND OO.ORDER_TYPE =1 AND OO.ORDER_NUMBER=#{orderNumber}
  754. )
  755. </select>
  756. <!-- 查询内转钢材到异地库出厂实绩 -->
  757. <select id="selectSteelNzLeaveFactory" parameterType="java.util.Map" resultType="java.util.Map">
  758. SELECT
  759. *
  760. FROM (
  761. SELECT
  762. OO.ORDER_ID "orderId",
  763. TLFR.RESULT_ID "resultId",
  764. AROD.DAYPLAN_NO "dayplanNo",
  765. OO.ORDER_NUMBER "orderNumber",
  766. RG.GATEPOST_NAME "gatepostName",
  767. TLFR.RESULT_OUT_MODE "resultOutMode",
  768. RC.CAPACITY_NUMBER "capacityNumber",
  769. TLFR.RESULT_OUT_GATE_TIME "resultOutGateTime",
  770. TLFR.RESULT_TRUCK_SNAPSHOT_PICTURE "resultTruckSnapshotPicture"
  771. FROM TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
  772. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  773. ON TTR.RESULT_TOTAL_ID = TLFR.RESULT_TOTAL_ID
  774. LEFT JOIN OMSTRUCK_ORDER OO
  775. ON OO.ORDER_ID = TTR.ORDER_ID
  776. LEFT JOIN AMS_RAIL_OFFSET_DAYPLAN AROD
  777. ON AROD.DAYPLAN_ID = OO.ORDER_PLAN_ID
  778. LEFT JOIN RMS_CAPACITY RC
  779. ON RC.CAPACITY_ID = OO.CAPACITY_ID
  780. LEFT JOIN RMS_GATEPOST RG
  781. ON RG.GATEPOST_ID = TLFR.GATEPOST_ID
  782. WHERE OO.ORDER_TYPE = 4
  783. AND TLFR.RESULT_OUT_GATE_TIME IS NOT NULL
  784. )
  785. <where>
  786. <if test="dayplanNo != null">
  787. <foreach collection="dayplanNo" item="item" open="(" separator="or" close=")">
  788. "dayplanNo" like '%${item}%'
  789. </foreach>
  790. </if>
  791. <if test="orderNumber != null">
  792. and
  793. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  794. "orderNumber" like '%${item}%'
  795. </foreach>
  796. </if>
  797. <if test="gatepostName != null">
  798. and
  799. <foreach collection="gatepostName" item="item" open="(" separator="or" close=")">
  800. "gatepostName" like '%${item}%'
  801. </foreach>
  802. </if>
  803. <if test="resultOutMode != null">
  804. and
  805. <foreach collection="resultOutMode" item="item" open="(" separator="or" close=")">
  806. "resultOutMode" like '%${item}%'
  807. </foreach>
  808. </if>
  809. <if test="capacityNumber != null">
  810. and
  811. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  812. "dayplanNo" like '%${item}%'
  813. </foreach>
  814. </if>
  815. <if test="resultOutGateTime != null">
  816. and
  817. <foreach collection="resultOutGateTime" item="item" open="(" separator="or" close=")">
  818. "resultOutGateTime" like '%${item}%'
  819. </foreach>
  820. </if>
  821. <if test="resultTruckSnapshotPicture != null">
  822. and
  823. <foreach collection="resultTruckSnapshotPicture" item="item" open="(" separator="or" close=")">
  824. "resultTruckSnapshotPicture" like '%${item}%'
  825. </foreach>
  826. </if>
  827. </where>
  828. <include refid="orderByOutTime"></include>
  829. </select>
  830. <!-- 查询内转国产矿进口矿 -->
  831. <select id="getImportedDomesticNzEnFactoryResult" resultType="java.util.Map">
  832. select *
  833. from (
  834. select TLFR.RESULT_ID "resultId",
  835. APO.PURCHASE_ORDER_NO "purchaseOrderNo",
  836. RM.MATERIAL_NAME "materialName",
  837. DB.RESULT_FOREIGN_SHIP_NAME "resultForeignShipName",
  838. OO.ORDER_NUMBER "orderNumber",
  839. RC.CAPACITY_NUMBER "capacityNumber",
  840. RG.GATEPOST_NAME "gatepostName",
  841. TLFR.RESULT_OUT_MODE "resultOutMode",
  842. TLFR.RESULT_OUT_GATE_TIME "resultOutGateTime",
  843. TLFR.RESULT_TRUCK_SNAPSHOT_PICTURE "resultTruckSnapshotPicture"
  844. from TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
  845. left join TMSTRUCK_TOTAL_RESULT TTR
  846. on TTR.RESULT_TOTAL_ID = TLFR.RESULT_TOTAL_ID
  847. left join OMSTRUCK_ORDER OO
  848. on OO.ORDER_ID = TTR.ORDER_ID
  849. left join AMS_PURCHASE_ORDER APO
  850. on APO.PURCHASE_ORDER_ID = OO.ORDER_PLAN_ID
  851. left join DIL_BATCH DB
  852. on DB.BATCH_ID = APO.BATCH_ID
  853. left join OMSTRUCK_ORDER_MATERIAL OOM
  854. on OOM.ORDER_ID = OO.ORDER_ID
  855. left join RMS_MATERIAL RM
  856. on RM.MATERIAL_ID = OOM.MATERIAL_ID
  857. left join RMS_CAPACITY RC
  858. on RC.CAPACITY_ID = OO.CAPACITY_ID
  859. left join RMS_GATEPOST RG
  860. on RG.GATEPOST_ID = TLFR.GATEPOST_ID
  861. where RESULT_OUT_GATE_TIME is not null
  862. and OO.ORDER_TYPE = 9
  863. )
  864. <where>
  865. <if test="purchaseOrderNo != null">
  866. <foreach collection="purchaseOrderNo" item="item" open="(" separator="or" close=")">
  867. "purchaseOrderNo" like '%${item}%'
  868. </foreach>
  869. </if>
  870. <if test="materialName != null">
  871. and
  872. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  873. "materialName" like '%${item}%'
  874. </foreach>
  875. </if>
  876. <if test="resultForeignShipName != null">
  877. and
  878. <foreach collection="resultForeignShipName" item="item" open="(" separator="or" close=")">
  879. "resultForeignShipName" like '%${item}%'
  880. </foreach>
  881. </if>
  882. <if test="orderNumber != null">
  883. and
  884. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  885. "orderNumber" like '%${item}%'
  886. </foreach>
  887. </if>
  888. <if test="capacityNumber != null">
  889. and
  890. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  891. "capacityNumber" like '%${item}%'
  892. </foreach>
  893. </if>
  894. <if test="gatepostName != null">
  895. and
  896. <foreach collection="gatepostName" item="item" open="(" separator="or" close=")">
  897. "gatepostName" like '%${item}%'
  898. </foreach>
  899. </if>
  900. <if test="resultOutMode != null">
  901. and
  902. <foreach collection="resultOutMode" item="item" open="(" separator="or" close=")">
  903. "resultOutMode" like '%${item}%'
  904. </foreach>
  905. </if>
  906. <if test="resultOutGateTime != null">
  907. and
  908. <foreach collection="resultOutGateTime" item="item" open="(" separator="or" close=")">
  909. "resultOutGateTime" like '%${item}%'
  910. </foreach>
  911. </if>
  912. <if test="resultTruckSnapshotPicture != null">
  913. and
  914. <foreach collection="resultTruckSnapshotPicture" item="item" open="(" separator="or" close=")">
  915. "resultTruckSnapshotPicture" like '%${item}%'
  916. </foreach>
  917. </if>
  918. </where>
  919. <include refid="orderByOutTime"></include>
  920. </select>
  921. <!-- 查询内转厂内物资出厂实绩 -->
  922. <select id="getInFactoryOutFactoryResult" parameterType="java.util.Map" resultType="java.util.Map">
  923. select *
  924. from (
  925. select TLFR.RESULT_ID "resultId",
  926. OO.ORDER_NUMBER "orderNumber",
  927. RC.CAPACITY_NUMBER "capacityNumber",
  928. RG.GATEPOST_NAME "gatepostName",
  929. TLFR.RESULT_OUT_MODE "resultOutMode",
  930. TLFR.RESULT_OUT_GATE_TIME "resultOutGateTime",
  931. TLFR.RESULT_TRUCK_SNAPSHOT_PICTURE "resultTruckSnapshotPicture"
  932. from TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
  933. left join TMSTRUCK_TOTAL_RESULT TTR
  934. on TTR.RESULT_TOTAL_ID = TLFR.RESULT_TOTAL_ID
  935. left join OMSTRUCK_ORDER OO
  936. on OO.ORDER_ID = TTR.ORDER_ID
  937. left join RMS_CAPACITY RC
  938. on RC.CAPACITY_ID = OO.CAPACITY_ID
  939. left join RMS_GATEPOST RG
  940. on RG.GATEPOST_ID = TLFR.GATEPOST_ID
  941. where RESULT_OUT_GATE_TIME is not null
  942. and OO.ORDER_TYPE = 11
  943. )
  944. <where>
  945. <if test="orderNumber != null">
  946. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  947. "orderNumber" like '%${item}%'
  948. </foreach>
  949. </if>
  950. <if test="capacityNumber != null">
  951. and
  952. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  953. "capacityNumber" like '%${item}%'
  954. </foreach>
  955. </if>
  956. <if test="gatepostName != null">
  957. and
  958. <foreach collection="gatepostName" item="item" open="(" separator="or" close=")">
  959. "gatepostName" like '%${item}%'
  960. </foreach>
  961. </if>
  962. <if test="resultOutMode != null">
  963. and
  964. <foreach collection="resultOutMode" item="item" open="(" separator="or" close=")">
  965. "resultOutMode" like '%${item}%'
  966. </foreach>
  967. </if>
  968. <if test="resultOutGateTime != null">
  969. and
  970. <foreach collection="resultOutGateTime" item="item" open="(" separator="or" close=")">
  971. "resultOutGateTime" like '%${item}%'
  972. </foreach>
  973. </if>
  974. <if test="resultTruckSnapshotPicture != null">
  975. and
  976. <foreach collection="resultTruckSnapshotPicture" item="item" open="(" separator="or" close=")">
  977. "resultTruckSnapshotPicture" like '%${item}%'
  978. </foreach>
  979. </if>
  980. </where>
  981. <include refid="orderByOutTime"></include>
  982. </select>
  983. <select id="getDeliveryOrder" parameterType="java.lang.String" resultType="java.util.Map">
  984. select
  985. aso.sale_number "saleNo" ,
  986. oo.order_number "orderNumber",
  987. rc.capacity_number "capacityNumber",
  988. rce.consignee_company_name "consigeeName",
  989. rcr.carrier_name "carrierName",
  990. rca.address_province "province",
  991. rca.address_district "district",
  992. rca.address_town "town",
  993. rca.address_delivery_address "deliveryAddress",
  994. asom.sale_order_consignee "consignee",
  995. asom.sale_order_consignee_tel "consigneeTel",
  996. asom.sale_date_of_receipt "receiptDate",
  997. rsh.SHIPPER_NAME "shippername",
  998. sysdate "sendDate"
  999. from omstruck_order oo
  1000. left join
  1001. rms_capacity rc
  1002. on
  1003. rc.capacity_id = oo.capacity_id
  1004. left join
  1005. ams_sale_order_material asom
  1006. on
  1007. asom.sale_order_material_id = oo.order_plan_id
  1008. left join
  1009. ams_sale_order aso
  1010. on
  1011. aso.sale_order_id = asom.sale_order_id
  1012. left join
  1013. rms_consignee rce
  1014. on
  1015. rce.consignee_id = aso.receive_id
  1016. left join
  1017. ams_dispatch_sale_order adso
  1018. on
  1019. adso.sale_order_material_id = asom.sale_order_material_id
  1020. left join
  1021. rms_carrier rcr
  1022. on
  1023. rcr.carrier_id = adso.carrier_id
  1024. left join
  1025. rms_receive_address rca
  1026. on
  1027. rca.address_id = asom.sale_shipping_address_id
  1028. left join RMS_SHIPPER rsh
  1029. on rsh.SHIPPER_ID = aso.SHIPPER_ID
  1030. where oo.order_number =#{orderNumber}
  1031. </select>
  1032. <select id="getDeliveryOrderMaterial" parameterType="java.lang.String" resultType="java.util.LinkedHashMap">
  1033. select
  1034. rm.material_name "materialName",
  1035. rm.material_specification "materialSpe",
  1036. rm.material_model "materialModel",
  1037. oom.order_material_number "materialNumber",
  1038. oom.order_material_weight "materialWeight",
  1039. ruom.unit_of_measure_name "measureName",
  1040. twr.RESULT_NET_WEIGHT "resultWeight"
  1041. from omstruck_order oo
  1042. left join
  1043. omstruck_order_material oom
  1044. on
  1045. oom.order_id = oo.order_id
  1046. left join
  1047. rms_material rm
  1048. on
  1049. rm.material_id = oom.order_material_id
  1050. left join
  1051. rms_unit_of_measure ruom
  1052. on
  1053. ruom.unit_of_measure_id = rm.unit_of_measure_id
  1054. left join
  1055. TMSTRUCK_TOTAL_RESULT ttr
  1056. on ttr.ORDER_ID = oo.ORDER_ID
  1057. left join
  1058. TMSTRUCK_WEIGHT_RESULT twr
  1059. on
  1060. twr.RESULT_TOTAL_ID = ttr.ORDER_ID
  1061. and twr.MATERIAL_ID = oom.MATERIAL_ID
  1062. where oo.order_number = #{orderNumber}
  1063. </select>
  1064. <!--零星物资出厂实绩列表 -->
  1065. <select id="getSporadicLeaveFactory" parameterType="java.util.Map" resultType="java.util.Map">
  1066. select *
  1067. from (
  1068. select distinct TLFR.RESULT_ID "resultId",
  1069. OO.ORDER_NUMBER "orderNumber",
  1070. RC.CAPACITY_NUMBER "capacityNumber",
  1071. RG.GATEPOST_NAME "gatepostName",
  1072. TLFR.RESULT_OUT_MODE "resultOutMode",
  1073. TLFR.RESULT_OUT_GATE_TIME "resultOutGateTime",
  1074. TLFR.RESULT_TRUCK_SNAPSHOT_PICTURE "resultTruckSnapshotPicture",
  1075. RM.MATERIAL_NAME "materialName",
  1076. OOM.ORDER_MATERIAL_WEIGHT "materialWeight",
  1077. OOM.ORDER_MATERIAL_NUMBER "materialNumber",
  1078. TWR.RESULT_NET_WEIGHT "netWeight"
  1079. from TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
  1080. left join TMSTRUCK_TOTAL_RESULT TTR
  1081. on TTR.RESULT_TOTAL_ID = TLFR.RESULT_TOTAL_ID
  1082. left join TMSTRUCK_WEIGHT_RESULT TWR
  1083. on TWR.RESULT_TOTAL_ID=TTR.RESULT_TOTAL_ID
  1084. left join OMSTRUCK_ORDER OO
  1085. on OO.ORDER_ID = TTR.ORDER_ID
  1086. left join OMSTRUCK_ORDER_MATERIAL OOM
  1087. on OO.ORDER_ID=OOM.ORDER_ID
  1088. left join RMS_MATERIAL RM
  1089. on RM.MATERIAL_ID=OOM.MATERIAL_ID
  1090. left join AMSTRUCK_SPORADIC_ORDER ASO
  1091. on ASO.SPORADIC_ORDER_ID = OO.ORDER_PLAN_ID
  1092. left join RMS_CAPACITY RC
  1093. on RC.CAPACITY_ID = OO.CAPACITY_ID
  1094. left join RMS_GATEPOST RG
  1095. on RG.GATEPOST_ID = TLFR.GATEPOST_ID
  1096. where RESULT_OUT_GATE_TIME is not null
  1097. and OO.ORDER_TYPE = #{orderTypee}
  1098. <if test="userId!=null">
  1099. AND ASO.INSERT_USERNAME=#{userId}
  1100. </if>
  1101. <if test="userIds!=null">
  1102. AND ASO.UPDATE_USERNAME=#{userIds}
  1103. </if>
  1104. <if test="con!=null">
  1105. where "orderNumber" like #{con} or "capacityNumber" like #{con}
  1106. or "gatepostName" like #{con} or "materialName" like #{con}
  1107. </if>
  1108. )
  1109. <where>
  1110. <if test="orderNumber != null">
  1111. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  1112. "orderNumber" like '%${item}%'
  1113. </foreach>
  1114. </if>
  1115. <if test="capacityNumber != null">
  1116. and
  1117. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  1118. "capacityNumber" like '%${item}%'
  1119. </foreach>
  1120. </if>
  1121. <if test="gatepostName != null">
  1122. and
  1123. <foreach collection="gatepostName" item="item" open="(" separator="or" close=")">
  1124. "gatepostName" like '%${item}%'
  1125. </foreach>
  1126. </if>
  1127. <if test="resultOutMode != null">
  1128. and
  1129. <foreach collection="resultOutMode" item="item" open="(" separator="or" close=")">
  1130. "resultOutMode" like '%${item}%'
  1131. </foreach>
  1132. </if>
  1133. <if test="resultOutGateTime != null">
  1134. and
  1135. <foreach collection="resultOutGateTime" item="item" open="(" separator="or" close=")">
  1136. "resultOutGateTime" like '%${item}%'
  1137. </foreach>
  1138. </if>
  1139. <if test="resultTruckSnapshotPicture != null">
  1140. and
  1141. <foreach collection="resultTruckSnapshotPicture" item="item" open="(" separator="or" close=")">
  1142. "resultTruckSnapshotPicture" like '%${item}%'
  1143. </foreach>
  1144. </if>
  1145. </where>
  1146. <include refid="orderByOutTime"></include>
  1147. </select>
  1148. <!-- 根据采购订单ID查询是否为一车多趟 -->
  1149. <select id="getIsMoreTripsStatus" parameterType="java.math.BigDecimal" resultType="java.lang.Integer">
  1150. select APO.IS_MORE_TRIPS
  1151. from OMSTRUCK_ORDER OO
  1152. left join AMS_PURCHASE_ORDER APO
  1153. on APO.PURCHASE_ORDER_ID = OO.ORDER_PLAN_ID
  1154. where OO.ORDER_ID = #{orderId}
  1155. </select>
  1156. <select id="getPlanEnable" resultType="java.lang.Integer">
  1157. select aip.plan_eable_status
  1158. from omstruck_order oo
  1159. left join amstruck_inward_plan aip
  1160. on aip.plan_id = oo.order_plan_id
  1161. where oo.order_id = #{orderId}
  1162. </select>
  1163. <select id="getSeq" resultType="java.lang.Integer">
  1164. select oo.order_line_sequence from omstruck_order oo
  1165. where oo.order_id =#{orderId}
  1166. </select>
  1167. </mapper>