TmstruckLeaveFactoryResultMapper.xml 53 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172
  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. DB.RESULT_FOREIGN_SHIP_NAME "resultForeignShipName",
  467. OO.ORDER_NUMBER "orderNumber",
  468. RC.CAPACITY_NUMBER "capacityNumber",
  469. RG.GATEPOST_NAME "gatepostName",
  470. TLFR.RESULT_OUT_MODE "resultOutMode",
  471. TLFR.RESULT_OUT_GATE_TIME "resultOutGateTime",
  472. TLFR.RESULT_TRUCK_SNAPSHOT_PICTURE "resultTruckSnapshotPicture"
  473. from TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
  474. left join TMSTRUCK_TOTAL_RESULT TTR
  475. on TTR.RESULT_TOTAL_ID = TLFR.RESULT_TOTAL_ID
  476. left join OMSTRUCK_ORDER OO
  477. on OO.ORDER_ID = TTR.ORDER_ID
  478. left join AMS_PURCHASE_ORDER APO
  479. on APO.PURCHASE_ORDER_ID = OO.ORDER_PLAN_ID
  480. left join DIL_BATCH DB
  481. on DB.BATCH_ID = APO.BATCH_ID
  482. left join OMSTRUCK_ORDER_MATERIAL OOM
  483. on OOM.ORDER_ID = OO.ORDER_ID
  484. left join RMS_MATERIAL RM
  485. on RM.MATERIAL_ID = OOM.MATERIAL_ID
  486. left join RMS_CAPACITY RC
  487. on RC.CAPACITY_ID = OO.CAPACITY_ID
  488. <if test="carrierSsoId != null">
  489. left join RMS_CARRIER RCA
  490. on RCA.CARRIER_ID = RC.CARRIER_ID
  491. </if>
  492. left join RMS_GATEPOST RG
  493. on RG.GATEPOST_ID = TLFR.GATEPOST_ID
  494. where RESULT_OUT_GATE_TIME is not null and OO.ORDER_TYPE = #{orderTypee}
  495. <if test="carrierSsoId != null">
  496. and RCA.CARRIER_SSO_ID = #{carrierSsoId}
  497. </if>
  498. )
  499. <where>
  500. <if test="purchaseOrderNo != null">
  501. <foreach collection="purchaseOrderNo" item="item" open="(" separator="or" close=")">
  502. "purchaseOrderNo" like '%${item}%'
  503. </foreach>
  504. </if>
  505. <if test="materialName != null">
  506. and
  507. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  508. "materialName" like '%${item}%'
  509. </foreach>
  510. </if>
  511. <if test="resultForeignShipName != null">
  512. and
  513. <foreach collection="resultForeignShipName" item="item" open="(" separator="or" close=")">
  514. "resultForeignShipName" like '%${item}%'
  515. </foreach>
  516. </if>
  517. <if test="orderNumber != null">
  518. and
  519. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  520. "orderNumber" like '%${item}%'
  521. </foreach>
  522. </if>
  523. <if test="capacityNumber != null">
  524. and
  525. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  526. "capacityNumber" like '%${item}%'
  527. </foreach>
  528. </if>
  529. <if test="gatepostName != null">
  530. and
  531. <foreach collection="gatepostName" item="item" open="(" separator="or" close=")">
  532. "gatepostName" like '%${item}%'
  533. </foreach>
  534. </if>
  535. <if test="resultOutMode != null">
  536. and
  537. <foreach collection="resultOutMode" item="item" open="(" separator="or" close=")">
  538. "resultOutMode" like '%${item}%'
  539. </foreach>
  540. </if>
  541. <if test="resultOutGateTime != null">
  542. and
  543. <foreach collection="resultOutGateTime" item="item" open="(" separator="or" close=")">
  544. "resultOutGateTime" like '%${item}%'
  545. </foreach>
  546. </if>
  547. <if test="resultTruckSnapshotPicture != null">
  548. and
  549. <foreach collection="resultTruckSnapshotPicture" item="item" open="(" separator="or" close=")">
  550. "resultTruckSnapshotPicture" like '%${item}%'
  551. </foreach>
  552. </if>
  553. </where>
  554. <include refid="orderByOutTime"></include>
  555. </select>
  556. <!-- 通过运输订单号查询 路段顺序号是否为 4 :已计皮-->
  557. <select id="selectTransportRoute" parameterType="string" resultType="int">
  558. select ORDER_LINE_SEQUENCE
  559. from OMSTRUCK_ORDER
  560. where ORDER_NUMBER = #{orderNumber}
  561. </select>
  562. <!-- 通过运输订单号查询 出厂门岗ID 和 实绩ID -->
  563. <select id="selectCnAndGnByOrderNumber" parameterType="string" resultType="java.util.Map">
  564. select RL.LINE_END_NODE_ID "lineEndNodeId",
  565. TTR.RESULT_TOTAL_ID "resultTotalId"
  566. from OMSTRUCK_ORDER OO
  567. left join TMSTRUCK_TOTAL_RESULT TTR
  568. on TTR.ORDER_ID = OO.ORDER_ID
  569. left join RMS_LINE RL
  570. on RL.LINE_ID = OO.LINE_ID
  571. where OO.ORDER_NUMBER = #{orderNumber}
  572. </select>
  573. <!-- 通过运输订单号获取实绩ID -->
  574. <select id="selectResultId" parameterType="string" resultType="java.util.Map">
  575. select *
  576. from (
  577. select TLFR.RESULT_ID "resultId",
  578. OO.ORDER_ID "orderId",
  579. OO.ORDER_TYPE "orderTypee",
  580. TTR.RESULT_TOTAL_ID "resultTotalId",
  581. OO.CAPACITY_ID "capacityId",
  582. RC.CAPACITY_NUMBER "capacityNumber",
  583. TLFR.SEGMENT_SQE "segmentSqe"
  584. from OMSTRUCK_ORDER OO
  585. left join TMSTRUCK_TOTAL_RESULT TTR
  586. on OO.ORDER_ID = TTR.ORDER_ID
  587. left join TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
  588. on TLFR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  589. left join RMS_CAPACITY RC
  590. on RC.CAPACITY_ID = OO.CAPACITY_ID
  591. where OO.ORDER_NUMBER = #{orderNumber} and TLFR.RESULT_OUT_GATE_TIME is null
  592. order by TLFR.SEGMENT_SQE
  593. )
  594. where rownum = 1
  595. </select>
  596. <!--销售物流查询所有的出厂实绩-->
  597. <select id="selectAllLeaveFacatoryForSale" resultType="java.util.Map">
  598. select *
  599. from (
  600. select
  601. TLFR.RESULT_OUT_GATE_TIME "resultOutGateTime",
  602. TLFR.RESULT_OUT_MODE "resultOutMode",
  603. RG.GATEPOST_NAME "gatepostName",
  604. OO.ORDER_NUMBER "orderNumber",
  605. RC.CAPACITY_NUMBER "capacityNumber",
  606. OO.ORDER_ID "orderId",
  607. ASO.SALE_NUMBER "saleNum",
  608. RS.SUPPLIER_NAME "shipperName",
  609. RCON.CONSIGNEE_COMPANY_NAME "supplierName"
  610. FROM TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
  611. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  612. ON TTR.RESULT_TOTAL_ID = TLFR.RESULT_TOTAL_ID
  613. LEFT JOIN OMSTRUCK_ORDER OO
  614. ON OO.ORDER_ID = TTR.ORDER_ID
  615. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
  616. ON ASOM.SALE_ORDER_MATERIAL_ID = OO.ORDER_PLAN_ID
  617. LEFT JOIN AMS_SALE_ORDER ASO
  618. ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  619. LEFT JOIN RMS_GATEPOST RG
  620. ON RG.GATEPOST_ID = TLFR.GATEPOST_ID
  621. LEFT JOIN RMS_CAPACITY RC
  622. ON RC.CAPACITY_ID = OO.CAPACITY_ID
  623. LEFT JOIN RMS_SUPPLIER RS
  624. ON RS.SUPPLIER_ID = ASO.SHIPPER_ID
  625. LEFT JOIN RMS_CONSIGNEE RCON
  626. ON RCON.CONSIGNEE_ID = ASO.RECEIVE_ID
  627. WHERE TLFR.RESULT_OUT_GATE_TIME IS NOT NULL
  628. AND OO.ORDER_TYPE IN (1, 2, 3)
  629. )
  630. <where>
  631. <if test="saleNum != null">
  632. <foreach collection="saleNum" item="item" open="(" separator="or" close=")">
  633. "saleNum" like '%${item}%'
  634. </foreach>
  635. </if>
  636. <if test="gatepostName != null">
  637. and
  638. <foreach collection="gatepostName" item="item" open="(" separator="or" close=")">
  639. "gatepostName" like '%${item}%'
  640. </foreach>
  641. </if>
  642. <if test="orderNumber != null">
  643. and
  644. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  645. "orderNumber" like '%${item}%'
  646. </foreach>
  647. </if>
  648. <if test="capacityNumber != null">
  649. and
  650. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  651. "capacityNumber" like '%${item}%'
  652. </foreach>
  653. </if>
  654. <if test="shipperName != null">
  655. and
  656. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  657. "shipperName" like '%${item}%'
  658. </foreach>
  659. </if>
  660. <if test="resultEntryMode != null">
  661. and
  662. <foreach collection="resultEntryMode" item="item" open="(" separator="or" close=")">
  663. "resultEntryMode" like '%${item}%'
  664. </foreach>
  665. </if>
  666. <if test="resultEntryGateTime != null">
  667. and
  668. <foreach collection="resultEntryGateTime" item="item" open="(" separator="or" close=")">
  669. "resultEntryGateTime" like '%${item}%'
  670. </foreach>
  671. </if>
  672. <if test="supplierName != null">
  673. and
  674. <foreach collection="supplierName" item="item" open="(" separator="or" close=")">
  675. "supplierName" like '%${item}%'
  676. </foreach>
  677. </if>
  678. </where>
  679. <include refid="orderByOutTime"></include>
  680. </select>
  681. <!-- 通过总实绩Id 查询出厂实绩ID -->
  682. <select id="getResultIdByTotalId" parameterType="int" resultType="java.math.BigDecimal">
  683. select *
  684. from (
  685. select TLFR.RESULT_ID
  686. from TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
  687. where TLFR.RESULT_TOTAL_ID = #{resultTotalId}
  688. and TLFR.RESULT_OUT_GATE_TIME is null
  689. order by TLFR.SEGMENT_SQE
  690. )
  691. where rownum = 1
  692. </select>
  693. <select id="getTruckFactoryResult" resultType="java.util.Map">
  694. SELECT * from(
  695. SELECT
  696. -- 出厂时间
  697. to_char(TLFR.RESULT_OUT_GATE_TIME,'yyyy-mm-dd hh24:mi:ss') "resultOutGateTime",
  698. --出厂抓拍图片
  699. TLFR.RESULT_TRUCK_SNAPSHOT_PICTURE "resultTruckSnapshotPicture",
  700. --出厂方式
  701. TLFR.RESULT_OUT_MODE "resultOutMode",
  702. --门岗名称
  703. RG.GATEPOST_NAME "gatepostName",
  704. -- 运输订单号
  705. OO.ORDER_NUMBER "orderNumber",
  706. -- 车牌号
  707. RC.CAPACITY_NUMBER "capacityNumber",
  708. -- 运输订单id
  709. OO.ORDER_ID "orderId",
  710. -- 订单类型
  711. OO.ORDER_TYPE "orderType",
  712. -- 销售订单号
  713. ASO.SALE_NUMBER "saleNum",
  714. -- 收货地址
  715. RRA.ADDRESS_DELIVERY_ADDRESS "receiveAddress",
  716. -- 收货单位
  717. RS.SUPPLIER_NAME "supplierName" ,
  718. -- 发货单位
  719. RS2.SHIPPER_NAME "shipperName"
  720. FROM
  721. -- 出厂实绩
  722. TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
  723. -- 总实绩
  724. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR ON TLFR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  725. -- 运输订单
  726. LEFT JOIN OMSTRUCK_ORDER OO ON TTR.ORDER_ID = OO.ORDER_ID
  727. -- 销售订单信息
  728. LEFT JOIN AMS_SALE_ORDER ASO ON OO.ORDER_PLAN_ID = ASO.SALE_ORDER_ID
  729. -- 托运人
  730. LEFT JOIN RMS_SUPPLIER RS ON ASO.SHIPPER_ID = RS.SUPPLIER_ID
  731. -- 门岗
  732. LEFT JOIN RMS_GATEPOST RG ON TLFR.GATEPOST_ID = RG.GATEPOST_ID
  733. -- 运力信息
  734. LEFT JOIN RMS_CAPACITY RC ON OO.CAPACITY_ID = RC.CAPACITY_ID
  735. -- 销售订单中间表
  736. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM ON ASOM.SALE_ORDER_MATERIAL_ID =OO.ORDER_PLAN_ID
  737. -- 收货地址
  738. LEFT JOIN RMS_RECEIVE_ADDRESS RRA ON ASOM.SALE_SHIPPING_ADDRESS_ID =RRA.ADDRESS_ID
  739. -- 收货单位
  740. LEFT JOIN RMS_SHIPPER RS2 ON ASO.SHIPPER_ID = RS2.SHIPPER_ID
  741. WHERE
  742. -- 判断出厂实绩的出厂时间不为空
  743. TLFR.RESULT_OUT_GATE_TIME IS NOT NULL
  744. -- 并且订单类型等于1(销售订单),2(焦炭发运计划),3(水渣发运计划)
  745. AND OO.ORDER_TYPE =1 AND OO.ORDER_NUMBER=#{orderNumber}
  746. )
  747. </select>
  748. <!-- 查询内转钢材到异地库出厂实绩 -->
  749. <select id="selectSteelNzLeaveFactory" parameterType="java.util.Map" resultType="java.util.Map">
  750. SELECT
  751. *
  752. FROM (
  753. SELECT
  754. OO.ORDER_ID "orderId",
  755. TLFR.RESULT_ID "resultId",
  756. AROD.DAYPLAN_NO "dayplanNo",
  757. OO.ORDER_NUMBER "orderNumber",
  758. RG.GATEPOST_NAME "gatepostName",
  759. TLFR.RESULT_OUT_MODE "resultOutMode",
  760. RC.CAPACITY_NUMBER "capacityNumber",
  761. TLFR.RESULT_OUT_GATE_TIME "resultOutGateTime",
  762. TLFR.RESULT_TRUCK_SNAPSHOT_PICTURE "resultTruckSnapshotPicture"
  763. FROM TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
  764. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  765. ON TTR.RESULT_TOTAL_ID = TLFR.RESULT_TOTAL_ID
  766. LEFT JOIN OMSTRUCK_ORDER OO
  767. ON OO.ORDER_ID = TTR.ORDER_ID
  768. LEFT JOIN AMS_RAIL_OFFSET_DAYPLAN AROD
  769. ON AROD.DAYPLAN_ID = OO.ORDER_PLAN_ID
  770. LEFT JOIN RMS_CAPACITY RC
  771. ON RC.CAPACITY_ID = OO.CAPACITY_ID
  772. LEFT JOIN RMS_GATEPOST RG
  773. ON RG.GATEPOST_ID = TLFR.GATEPOST_ID
  774. WHERE OO.ORDER_TYPE = 4
  775. AND TLFR.RESULT_OUT_GATE_TIME IS NOT NULL
  776. )
  777. <where>
  778. <if test="dayplanNo != null">
  779. <foreach collection="dayplanNo" item="item" open="(" separator="or" close=")">
  780. "dayplanNo" like '%${item}%'
  781. </foreach>
  782. </if>
  783. <if test="orderNumber != null">
  784. and
  785. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  786. "orderNumber" like '%${item}%'
  787. </foreach>
  788. </if>
  789. <if test="gatepostName != null">
  790. and
  791. <foreach collection="gatepostName" item="item" open="(" separator="or" close=")">
  792. "gatepostName" like '%${item}%'
  793. </foreach>
  794. </if>
  795. <if test="resultOutMode != null">
  796. and
  797. <foreach collection="resultOutMode" item="item" open="(" separator="or" close=")">
  798. "resultOutMode" like '%${item}%'
  799. </foreach>
  800. </if>
  801. <if test="capacityNumber != null">
  802. and
  803. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  804. "dayplanNo" like '%${item}%'
  805. </foreach>
  806. </if>
  807. <if test="resultOutGateTime != null">
  808. and
  809. <foreach collection="resultOutGateTime" item="item" open="(" separator="or" close=")">
  810. "resultOutGateTime" like '%${item}%'
  811. </foreach>
  812. </if>
  813. <if test="resultTruckSnapshotPicture != null">
  814. and
  815. <foreach collection="resultTruckSnapshotPicture" item="item" open="(" separator="or" close=")">
  816. "resultTruckSnapshotPicture" like '%${item}%'
  817. </foreach>
  818. </if>
  819. </where>
  820. <include refid="orderByOutTime"></include>
  821. </select>
  822. <!-- 查询内转国产矿进口矿 -->
  823. <select id="getImportedDomesticNzEnFactoryResult" resultType="java.util.Map">
  824. select *
  825. from (
  826. select TLFR.RESULT_ID "resultId",
  827. APO.PURCHASE_ORDER_NO "purchaseOrderNo",
  828. RM.MATERIAL_NAME "materialName",
  829. DB.RESULT_FOREIGN_SHIP_NAME "resultForeignShipName",
  830. OO.ORDER_NUMBER "orderNumber",
  831. RC.CAPACITY_NUMBER "capacityNumber",
  832. RG.GATEPOST_NAME "gatepostName",
  833. TLFR.RESULT_OUT_MODE "resultOutMode",
  834. TLFR.RESULT_OUT_GATE_TIME "resultOutGateTime",
  835. TLFR.RESULT_TRUCK_SNAPSHOT_PICTURE "resultTruckSnapshotPicture"
  836. from TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
  837. left join TMSTRUCK_TOTAL_RESULT TTR
  838. on TTR.RESULT_TOTAL_ID = TLFR.RESULT_TOTAL_ID
  839. left join OMSTRUCK_ORDER OO
  840. on OO.ORDER_ID = TTR.ORDER_ID
  841. left join AMS_PURCHASE_ORDER APO
  842. on APO.PURCHASE_ORDER_ID = OO.ORDER_PLAN_ID
  843. left join DIL_BATCH DB
  844. on DB.BATCH_ID = APO.BATCH_ID
  845. left join OMSTRUCK_ORDER_MATERIAL OOM
  846. on OOM.ORDER_ID = OO.ORDER_ID
  847. left join RMS_MATERIAL RM
  848. on RM.MATERIAL_ID = OOM.MATERIAL_ID
  849. left join RMS_CAPACITY RC
  850. on RC.CAPACITY_ID = OO.CAPACITY_ID
  851. left join RMS_GATEPOST RG
  852. on RG.GATEPOST_ID = TLFR.GATEPOST_ID
  853. where RESULT_OUT_GATE_TIME is not null
  854. and OO.ORDER_TYPE = 9
  855. )
  856. <where>
  857. <if test="purchaseOrderNo != null">
  858. <foreach collection="purchaseOrderNo" item="item" open="(" separator="or" close=")">
  859. "purchaseOrderNo" like '%${item}%'
  860. </foreach>
  861. </if>
  862. <if test="materialName != null">
  863. and
  864. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  865. "materialName" like '%${item}%'
  866. </foreach>
  867. </if>
  868. <if test="resultForeignShipName != null">
  869. and
  870. <foreach collection="resultForeignShipName" item="item" open="(" separator="or" close=")">
  871. "resultForeignShipName" like '%${item}%'
  872. </foreach>
  873. </if>
  874. <if test="orderNumber != null">
  875. and
  876. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  877. "orderNumber" like '%${item}%'
  878. </foreach>
  879. </if>
  880. <if test="capacityNumber != null">
  881. and
  882. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  883. "capacityNumber" like '%${item}%'
  884. </foreach>
  885. </if>
  886. <if test="gatepostName != null">
  887. and
  888. <foreach collection="gatepostName" item="item" open="(" separator="or" close=")">
  889. "gatepostName" like '%${item}%'
  890. </foreach>
  891. </if>
  892. <if test="resultOutMode != null">
  893. and
  894. <foreach collection="resultOutMode" item="item" open="(" separator="or" close=")">
  895. "resultOutMode" like '%${item}%'
  896. </foreach>
  897. </if>
  898. <if test="resultOutGateTime != null">
  899. and
  900. <foreach collection="resultOutGateTime" item="item" open="(" separator="or" close=")">
  901. "resultOutGateTime" like '%${item}%'
  902. </foreach>
  903. </if>
  904. <if test="resultTruckSnapshotPicture != null">
  905. and
  906. <foreach collection="resultTruckSnapshotPicture" item="item" open="(" separator="or" close=")">
  907. "resultTruckSnapshotPicture" like '%${item}%'
  908. </foreach>
  909. </if>
  910. </where>
  911. <include refid="orderByOutTime"></include>
  912. </select>
  913. <!-- 查询内转厂内物资出厂实绩 -->
  914. <select id="getInFactoryOutFactoryResult" parameterType="java.util.Map" resultType="java.util.Map">
  915. select *
  916. from (
  917. select TLFR.RESULT_ID "resultId",
  918. OO.ORDER_NUMBER "orderNumber",
  919. RC.CAPACITY_NUMBER "capacityNumber",
  920. RG.GATEPOST_NAME "gatepostName",
  921. TLFR.RESULT_OUT_MODE "resultOutMode",
  922. TLFR.RESULT_OUT_GATE_TIME "resultOutGateTime",
  923. TLFR.RESULT_TRUCK_SNAPSHOT_PICTURE "resultTruckSnapshotPicture"
  924. from TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
  925. left join TMSTRUCK_TOTAL_RESULT TTR
  926. on TTR.RESULT_TOTAL_ID = TLFR.RESULT_TOTAL_ID
  927. left join OMSTRUCK_ORDER OO
  928. on OO.ORDER_ID = TTR.ORDER_ID
  929. left join RMS_CAPACITY RC
  930. on RC.CAPACITY_ID = OO.CAPACITY_ID
  931. left join RMS_GATEPOST RG
  932. on RG.GATEPOST_ID = TLFR.GATEPOST_ID
  933. where RESULT_OUT_GATE_TIME is not null
  934. and OO.ORDER_TYPE = 11
  935. )
  936. <where>
  937. <if test="orderNumber != null">
  938. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  939. "orderNumber" like '%${item}%'
  940. </foreach>
  941. </if>
  942. <if test="capacityNumber != null">
  943. and
  944. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  945. "capacityNumber" like '%${item}%'
  946. </foreach>
  947. </if>
  948. <if test="gatepostName != null">
  949. and
  950. <foreach collection="gatepostName" item="item" open="(" separator="or" close=")">
  951. "gatepostName" like '%${item}%'
  952. </foreach>
  953. </if>
  954. <if test="resultOutMode != null">
  955. and
  956. <foreach collection="resultOutMode" item="item" open="(" separator="or" close=")">
  957. "resultOutMode" like '%${item}%'
  958. </foreach>
  959. </if>
  960. <if test="resultOutGateTime != null">
  961. and
  962. <foreach collection="resultOutGateTime" item="item" open="(" separator="or" close=")">
  963. "resultOutGateTime" like '%${item}%'
  964. </foreach>
  965. </if>
  966. <if test="resultTruckSnapshotPicture != null">
  967. and
  968. <foreach collection="resultTruckSnapshotPicture" item="item" open="(" separator="or" close=")">
  969. "resultTruckSnapshotPicture" like '%${item}%'
  970. </foreach>
  971. </if>
  972. </where>
  973. <include refid="orderByOutTime"></include>
  974. </select>
  975. <select id="getDeliveryOrder" parameterType="java.lang.String" resultType="java.util.Map">
  976. select
  977. aso.sale_number "saleNo" ,
  978. oo.order_number "orderNumber",
  979. rc.capacity_number "capacityNumber",
  980. rce.consignee_company_name "consigeeName",
  981. rcr.carrier_name "carrierName",
  982. rca.address_province "province",
  983. rca.address_district "district",
  984. rca.address_town "town",
  985. rca.address_delivery_address "deliveryAddress",
  986. asom.sale_order_consignee "consignee",
  987. asom.sale_order_consignee_tel "consigneeTel",
  988. asom.sale_date_of_receipt "receiptDate",
  989. rsh.SHIPPER_NAME "shippername",
  990. sysdate "sendDate"
  991. from omstruck_order oo
  992. left join
  993. rms_capacity rc
  994. on
  995. rc.capacity_id = oo.capacity_id
  996. left join
  997. ams_sale_order_material asom
  998. on
  999. asom.sale_order_material_id = oo.order_plan_id
  1000. left join
  1001. ams_sale_order aso
  1002. on
  1003. aso.sale_order_id = asom.sale_order_id
  1004. left join
  1005. rms_consignee rce
  1006. on
  1007. rce.consignee_id = aso.receive_id
  1008. left join
  1009. ams_dispatch_sale_order adso
  1010. on
  1011. adso.sale_order_material_id = asom.sale_order_material_id
  1012. left join
  1013. rms_carrier rcr
  1014. on
  1015. rcr.carrier_id = adso.carrier_id
  1016. left join
  1017. rms_receive_address rca
  1018. on
  1019. rca.address_id = asom.sale_shipping_address_id
  1020. left join RMS_SHIPPER rsh
  1021. on rsh.SHIPPER_ID = aso.SHIPPER_ID
  1022. where oo.order_number =#{orderNumber}
  1023. </select>
  1024. <select id="getDeliveryOrderMaterial" parameterType="java.lang.String" resultType="java.util.LinkedHashMap">
  1025. select
  1026. rm.material_name "materialName",
  1027. rm.material_specification "materialSpe",
  1028. rm.material_model "materialModel",
  1029. oom.order_material_number "materialNumber",
  1030. oom.order_material_weight "materialWeight",
  1031. ruom.unit_of_measure_name "measureName",
  1032. twr.RESULT_NET_WEIGHT "resultWeight"
  1033. from omstruck_order oo
  1034. left join
  1035. omstruck_order_material oom
  1036. on
  1037. oom.order_id = oo.order_id
  1038. left join
  1039. rms_material rm
  1040. on
  1041. rm.material_id = oom.order_material_id
  1042. left join
  1043. rms_unit_of_measure ruom
  1044. on
  1045. ruom.unit_of_measure_id = rm.unit_of_measure_id
  1046. left join
  1047. TMSTRUCK_TOTAL_RESULT ttr
  1048. on ttr.ORDER_ID = oo.ORDER_ID
  1049. left join
  1050. TMSTRUCK_WEIGHT_RESULT twr
  1051. on
  1052. twr.RESULT_TOTAL_ID = ttr.ORDER_ID
  1053. and twr.MATERIAL_ID = oom.MATERIAL_ID
  1054. where oo.order_number = #{orderNumber}
  1055. </select>
  1056. <!--零星物资出厂实绩列表 -->
  1057. <select id="getSporadicLeaveFactory" parameterType="java.util.Map" resultType="java.util.Map">
  1058. select *
  1059. from (
  1060. select TLFR.RESULT_ID "resultId",
  1061. OO.ORDER_NUMBER "orderNumber",
  1062. RC.CAPACITY_NUMBER "capacityNumber",
  1063. RG.GATEPOST_NAME "gatepostName",
  1064. TLFR.RESULT_OUT_MODE "resultOutMode",
  1065. TLFR.RESULT_OUT_GATE_TIME "resultOutGateTime",
  1066. TLFR.RESULT_TRUCK_SNAPSHOT_PICTURE "resultTruckSnapshotPicture",
  1067. RM.MATERIAL_NAME "materialName",
  1068. OOM.ORDER_MATERIAL_WEIGHT "materialWeight",
  1069. OOM.ORDER_MATERIAL_NUMBER "materialNumber",
  1070. TWR.RESULT_NET_WEIGHT "netWeight"
  1071. from TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
  1072. left join TMSTRUCK_TOTAL_RESULT TTR
  1073. on TTR.RESULT_TOTAL_ID = TLFR.RESULT_TOTAL_ID
  1074. left join TMSTRUCK_WEIGHT_RESULT TWR
  1075. on TWR.RESULT_TOTAL_ID=TTR.RESULT_TOTAL_ID
  1076. left join OMSTRUCK_ORDER OO
  1077. on OO.ORDER_ID = TTR.ORDER_ID
  1078. left join OMSTRUCK_ORDER_MATERIAL OOM
  1079. on OO.ORDER_ID=OOM.ORDER_ID
  1080. left join RMS_MATERIAL RM
  1081. on RM.MATERIAL_ID=OOM.MATERIAL_ID
  1082. left join AMSTRUCK_SPORADIC_ORDER ASO
  1083. on ASO.SPORADIC_ORDER_ID = OO.ORDER_PLAN_ID
  1084. left join RMS_CAPACITY RC
  1085. on RC.CAPACITY_ID = OO.CAPACITY_ID
  1086. left join RMS_GATEPOST RG
  1087. on RG.GATEPOST_ID = TLFR.GATEPOST_ID
  1088. where RESULT_OUT_GATE_TIME is not null
  1089. and OO.ORDER_TYPE = #{orderTypee}
  1090. <if test="userId!=null">
  1091. AND ASO.INSERT_USERNAME=#{userId}
  1092. </if>
  1093. <if test="userIds!=null">
  1094. AND ASO.UPDATE_USERNAME=#{userIds}
  1095. </if>
  1096. )
  1097. <where>
  1098. <if test="orderNumber != null">
  1099. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  1100. "orderNumber" like '%${item}%'
  1101. </foreach>
  1102. </if>
  1103. <if test="capacityNumber != null">
  1104. and
  1105. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  1106. "capacityNumber" like '%${item}%'
  1107. </foreach>
  1108. </if>
  1109. <if test="gatepostName != null">
  1110. and
  1111. <foreach collection="gatepostName" item="item" open="(" separator="or" close=")">
  1112. "gatepostName" like '%${item}%'
  1113. </foreach>
  1114. </if>
  1115. <if test="resultOutMode != null">
  1116. and
  1117. <foreach collection="resultOutMode" item="item" open="(" separator="or" close=")">
  1118. "resultOutMode" like '%${item}%'
  1119. </foreach>
  1120. </if>
  1121. <if test="resultOutGateTime != null">
  1122. and
  1123. <foreach collection="resultOutGateTime" item="item" open="(" separator="or" close=")">
  1124. "resultOutGateTime" like '%${item}%'
  1125. </foreach>
  1126. </if>
  1127. <if test="resultTruckSnapshotPicture != null">
  1128. and
  1129. <foreach collection="resultTruckSnapshotPicture" item="item" open="(" separator="or" close=")">
  1130. "resultTruckSnapshotPicture" like '%${item}%'
  1131. </foreach>
  1132. </if>
  1133. </where>
  1134. <include refid="orderByOutTime"></include>
  1135. </select>
  1136. <select id="getPlanEnable" resultType="java.lang.Integer">
  1137. select aip.plan_eable_status
  1138. from omstruck_order oo
  1139. left join amstruck_inward_plan aip
  1140. on aip.plan_id = oo.order_plan_id
  1141. where oo.order_id = #{orderId}
  1142. </select>
  1143. <select id="getSeq" resultType="java.lang.Integer">
  1144. select oo.order_line_sequence from omstruck_order oo
  1145. where oo.order_id =#{orderId}
  1146. </select>
  1147. </mapper>