TmstruckEnfactoryResultMapper.xml 56 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293
  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.TmstruckEnfactoryResultMapper">
  4. <resultMap id="BaseResultMap" type="com.steerinfo.dil.model.TmstruckEnfactoryResult">
  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_ENTRY_MODE" jdbcType="VARCHAR" property="resultEntryMode" />
  9. <result column="RESULT_ENTRY_GATE_TIME" jdbcType="TIMESTAMP" property="resultEntryGateTime" />
  10. <result column="RESULT_MEMO" jdbcType="VARCHAR" property="resultMemo" />
  11. <result column="INSERT_USERNAME" jdbcType="VARCHAR" property="insertUsername" />
  12. <result column="INSERT_TIME" jdbcType="TIMESTAMP" property="insertTime" />
  13. <result column="UPDATE_USERNAME" jdbcType="VARCHAR" property="updateUsername" />
  14. <result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime" />
  15. <result column="INSERT_UPDATE_REMARK" jdbcType="VARCHAR" property="insertUpdateRemark" />
  16. <result column="DELETE_USERNAME" jdbcType="VARCHAR" property="deleteUsername" />
  17. <result column="DELETE_TIME" jdbcType="TIMESTAMP" property="deleteTime" />
  18. <result column="SEGMEN_SQE" jdbcType="DECIMAL" property="segmenSqe" />
  19. </resultMap>
  20. <sql id="columns">
  21. RESULT_ID, RESULT_TOTAL_ID, GATEPOST_ID, RESULT_ENTRY_MODE, RESULT_ENTRY_GATE_TIME,
  22. RESULT_MEMO, INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK,
  23. DELETE_USERNAME, DELETE_TIME, SEGMEN_SQE
  24. </sql>
  25. <sql id="columns_alias">
  26. t.RESULT_ID, t.RESULT_TOTAL_ID, t.GATEPOST_ID, t.RESULT_ENTRY_MODE, t.RESULT_ENTRY_GATE_TIME,
  27. t.RESULT_MEMO, t.INSERT_USERNAME, t.INSERT_TIME, t.UPDATE_USERNAME, t.UPDATE_TIME,
  28. t.INSERT_UPDATE_REMARK, t.DELETE_USERNAME, t.DELETE_TIME, t.SEGMEN_SQE
  29. </sql>
  30. <sql id="select">
  31. SELECT <include refid="columns"/> FROM TMSTRUCK_ENFACTORY_RESULT
  32. </sql>
  33. <sql id="select_alias">
  34. SELECT <include refid="columns_alias"/> FROM TMSTRUCK_ENFACTORY_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="resultEntryMode != null and resultEntryMode != ''">
  48. and RESULT_ENTRY_MODE = #{resultEntryMode}
  49. </if>
  50. <if test="resultEntryGateTime != null">
  51. and TO_CHAR(RESULT_ENTRY_GATE_TIME,'yyyy-MM-dd') = #{resultEntryGateTime}
  52. </if>
  53. <if test="resultMemo != null and resultMemo != ''">
  54. and RESULT_MEMO = #{resultMemo}
  55. </if>
  56. <if test="insertUsername != null and insertUsername != ''">
  57. and INSERT_USERNAME = #{insertUsername}
  58. </if>
  59. <if test="insertTime != null">
  60. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  61. </if>
  62. <if test="updateUsername != null and updateUsername != ''">
  63. and UPDATE_USERNAME = #{updateUsername}
  64. </if>
  65. <if test="updateTime != null">
  66. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  67. </if>
  68. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  69. and INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  70. </if>
  71. <if test="deleteUsername != null and deleteUsername != ''">
  72. and DELETE_USERNAME = #{deleteUsername}
  73. </if>
  74. <if test="deleteTime != null">
  75. and TO_CHAR(DELETE_TIME,'yyyy-MM-dd') = #{deleteTime}
  76. </if>
  77. <if test="segmenSqe != null">
  78. and SEGMEN_SQE = #{segmenSqe}
  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="resultEntryMode != null and resultEntryMode != ''">
  94. and RESULT_ENTRY_MODE LIKE '%${resultEntryMode}%'
  95. </if>
  96. <if test="resultEntryGateTime != null">
  97. and TO_CHAR(RESULT_ENTRY_GATE_TIME,'yyyy-MM-dd') = #{resultEntryGateTime}
  98. </if>
  99. <if test="resultMemo != null and resultMemo != ''">
  100. and RESULT_MEMO LIKE '%${resultMemo}%'
  101. </if>
  102. <if test="insertUsername != null and insertUsername != ''">
  103. and INSERT_USERNAME LIKE '%${insertUsername}%'
  104. </if>
  105. <if test="insertTime != null">
  106. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  107. </if>
  108. <if test="updateUsername != null and updateUsername != ''">
  109. and UPDATE_USERNAME LIKE '%${updateUsername}%'
  110. </if>
  111. <if test="updateTime != null">
  112. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  113. </if>
  114. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  115. and INSERT_UPDATE_REMARK LIKE '%${insertUpdateRemark}%'
  116. </if>
  117. <if test="deleteUsername != null and deleteUsername != ''">
  118. and DELETE_USERNAME LIKE '%${deleteUsername}%'
  119. </if>
  120. <if test="deleteTime != null">
  121. and TO_CHAR(DELETE_TIME,'yyyy-MM-dd') = #{deleteTime}
  122. </if>
  123. <if test="segmenSqe != null">
  124. and SEGMEN_SQE = #{segmenSqe}
  125. </if>
  126. </where>
  127. </sql>
  128. <delete id="deleteByPrimaryKey" parameterType="java.lang.Short">
  129. delete from TMSTRUCK_ENFACTORY_RESULT
  130. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  131. </delete>
  132. <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
  133. delete from TMSTRUCK_ENFACTORY_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="resultEntryMode != null and resultEntryMode != ''">
  142. or RESULT_ENTRY_MODE = #{resultEntryMode}
  143. </if>
  144. <if test="resultEntryGateTime != null">
  145. or TO_CHAR(RESULT_ENTRY_GATE_TIME,'yyyy-MM-dd') = '#{resultEntryGateTime}'
  146. </if>
  147. <if test="resultMemo != null and resultMemo != ''">
  148. or RESULT_MEMO = #{resultMemo}
  149. </if>
  150. <if test="insertUsername != null and insertUsername != ''">
  151. or INSERT_USERNAME = #{insertUsername}
  152. </if>
  153. <if test="insertTime != null">
  154. or TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = '#{insertTime}'
  155. </if>
  156. <if test="updateUsername != null and updateUsername != ''">
  157. or UPDATE_USERNAME = #{updateUsername}
  158. </if>
  159. <if test="updateTime != null">
  160. or TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = '#{updateTime}'
  161. </if>
  162. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  163. or INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  164. </if>
  165. <if test="deleteUsername != null and deleteUsername != ''">
  166. or DELETE_USERNAME = #{deleteUsername}
  167. </if>
  168. <if test="deleteTime != null">
  169. or TO_CHAR(DELETE_TIME,'yyyy-MM-dd') = '#{deleteTime}'
  170. </if>
  171. <if test="segmenSqe != null">
  172. or SEGMEN_SQE = #{segmenSqe}
  173. </if>
  174. </delete>
  175. <insert id="insert" parameterType="com.steerinfo.dil.model.TmstruckEnfactoryResult">
  176. insert into TMSTRUCK_ENFACTORY_RESULT (RESULT_ID, RESULT_TOTAL_ID, GATEPOST_ID,
  177. RESULT_ENTRY_MODE, RESULT_ENTRY_GATE_TIME,
  178. RESULT_MEMO, INSERT_USERNAME, INSERT_TIME,
  179. UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK,
  180. DELETE_USERNAME, DELETE_TIME, SEGMEN_SQE
  181. )
  182. values (#{resultId,jdbcType=DECIMAL}, #{resultTotalId,jdbcType=DECIMAL}, #{gatepostId,jdbcType=DECIMAL},
  183. #{resultEntryMode,jdbcType=VARCHAR}, #{resultEntryGateTime,jdbcType=TIMESTAMP},
  184. #{resultMemo,jdbcType=VARCHAR}, #{insertUsername,jdbcType=VARCHAR}, #{insertTime,jdbcType=TIMESTAMP},
  185. #{updateUsername,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{insertUpdateRemark,jdbcType=VARCHAR},
  186. #{deleteUsername,jdbcType=VARCHAR}, #{deleteTime,jdbcType=TIMESTAMP}, #{segmenSqe,jdbcType=DECIMAL}
  187. )
  188. </insert>
  189. <insert id="insertSelective" parameterType="com.steerinfo.dil.model.TmstruckEnfactoryResult">
  190. insert into TMSTRUCK_ENFACTORY_RESULT
  191. <trim prefix="(" suffix=")" suffixOverrides=",">
  192. <if test="resultId != null">
  193. RESULT_ID,
  194. </if>
  195. <if test="resultTotalId != null">
  196. RESULT_TOTAL_ID,
  197. </if>
  198. <if test="gatepostId != null">
  199. GATEPOST_ID,
  200. </if>
  201. <if test="resultEntryMode != null">
  202. RESULT_ENTRY_MODE,
  203. </if>
  204. <if test="resultEntryGateTime != null">
  205. RESULT_ENTRY_GATE_TIME,
  206. </if>
  207. <if test="resultMemo != null">
  208. RESULT_MEMO,
  209. </if>
  210. <if test="insertUsername != null">
  211. INSERT_USERNAME,
  212. </if>
  213. <if test="insertTime != null">
  214. INSERT_TIME,
  215. </if>
  216. <if test="updateUsername != null">
  217. UPDATE_USERNAME,
  218. </if>
  219. <if test="updateTime != null">
  220. UPDATE_TIME,
  221. </if>
  222. <if test="insertUpdateRemark != null">
  223. INSERT_UPDATE_REMARK,
  224. </if>
  225. <if test="deleteUsername != null">
  226. DELETE_USERNAME,
  227. </if>
  228. <if test="deleteTime != null">
  229. DELETE_TIME,
  230. </if>
  231. <if test="segmenSqe != null">
  232. SEGMEN_SQE,
  233. </if>
  234. </trim>
  235. <trim prefix="values (" suffix=")" suffixOverrides=",">
  236. <if test="resultId != null">
  237. #{resultId,jdbcType=DECIMAL},
  238. </if>
  239. <if test="resultTotalId != null">
  240. #{resultTotalId,jdbcType=DECIMAL},
  241. </if>
  242. <if test="gatepostId != null">
  243. #{gatepostId,jdbcType=DECIMAL},
  244. </if>
  245. <if test="resultEntryMode != null">
  246. #{resultEntryMode,jdbcType=VARCHAR},
  247. </if>
  248. <if test="resultEntryGateTime != null">
  249. #{resultEntryGateTime,jdbcType=TIMESTAMP},
  250. </if>
  251. <if test="resultMemo != null">
  252. #{resultMemo,jdbcType=VARCHAR},
  253. </if>
  254. <if test="insertUsername != null">
  255. #{insertUsername,jdbcType=VARCHAR},
  256. </if>
  257. <if test="insertTime != null">
  258. #{insertTime,jdbcType=TIMESTAMP},
  259. </if>
  260. <if test="updateUsername != null">
  261. #{updateUsername,jdbcType=VARCHAR},
  262. </if>
  263. <if test="updateTime != null">
  264. #{updateTime,jdbcType=TIMESTAMP},
  265. </if>
  266. <if test="insertUpdateRemark != null">
  267. #{insertUpdateRemark,jdbcType=VARCHAR},
  268. </if>
  269. <if test="deleteUsername != null">
  270. #{deleteUsername,jdbcType=VARCHAR},
  271. </if>
  272. <if test="deleteTime != null">
  273. #{deleteTime,jdbcType=TIMESTAMP},
  274. </if>
  275. <if test="segmenSqe != null">
  276. #{segmenSqe,jdbcType=DECIMAL},
  277. </if>
  278. </trim>
  279. </insert>
  280. <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.TmstruckEnfactoryResult">
  281. update TMSTRUCK_ENFACTORY_RESULT
  282. set RESULT_TOTAL_ID = #{resultTotalId,jdbcType=DECIMAL},
  283. GATEPOST_ID = #{gatepostId,jdbcType=DECIMAL},
  284. RESULT_ENTRY_MODE = #{resultEntryMode,jdbcType=VARCHAR},
  285. RESULT_ENTRY_GATE_TIME = #{resultEntryGateTime,jdbcType=TIMESTAMP},
  286. RESULT_MEMO = #{resultMemo,jdbcType=VARCHAR},
  287. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  288. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  289. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  290. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  291. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  292. DELETE_USERNAME = #{deleteUsername,jdbcType=VARCHAR},
  293. DELETE_TIME = #{deleteTime,jdbcType=TIMESTAMP},
  294. SEGMEN_SQE = #{segmenSqe,jdbcType=DECIMAL}
  295. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  296. </update>
  297. <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.TmstruckEnfactoryResult">
  298. update TMSTRUCK_ENFACTORY_RESULT
  299. <set>
  300. <if test="resultTotalId != null">
  301. RESULT_TOTAL_ID = #{resultTotalId,jdbcType=DECIMAL},
  302. </if>
  303. <if test="gatepostId != null">
  304. GATEPOST_ID = #{gatepostId,jdbcType=DECIMAL},
  305. </if>
  306. <if test="resultEntryMode != null">
  307. RESULT_ENTRY_MODE = #{resultEntryMode,jdbcType=VARCHAR},
  308. </if>
  309. <if test="resultEntryGateTime != null">
  310. RESULT_ENTRY_GATE_TIME = #{resultEntryGateTime,jdbcType=TIMESTAMP},
  311. </if>
  312. <if test="resultMemo != null">
  313. RESULT_MEMO = #{resultMemo,jdbcType=VARCHAR},
  314. </if>
  315. <if test="insertUsername != null">
  316. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  317. </if>
  318. <if test="insertTime != null">
  319. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  320. </if>
  321. <if test="updateUsername != null">
  322. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  323. </if>
  324. <if test="updateTime != null">
  325. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  326. </if>
  327. <if test="insertUpdateRemark != null">
  328. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  329. </if>
  330. <if test="deleteUsername != null">
  331. DELETE_USERNAME = #{deleteUsername,jdbcType=VARCHAR},
  332. </if>
  333. <if test="deleteTime != null">
  334. DELETE_TIME = #{deleteTime,jdbcType=TIMESTAMP},
  335. </if>
  336. <if test="segmenSqe != null">
  337. SEGMEN_SQE = #{segmenSqe,jdbcType=DECIMAL},
  338. </if>
  339. </set>
  340. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  341. </update>
  342. <select id="selectByPrimaryKey" parameterType="java.lang.Short" resultMap="BaseResultMap">
  343. <include refid="select"/>
  344. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  345. </select>
  346. <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  347. <include refid="select"/>
  348. <include refid="where"/>
  349. </select>
  350. <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  351. <include refid="select"/>
  352. <include refid="whereLike"/>
  353. </select>
  354. <insert id="batchInsert" parameterType="java.util.List">
  355. insert into TMSTRUCK_ENFACTORY_RESULT
  356. (RESULT_ID,
  357. RESULT_TOTAL_ID, GATEPOST_ID, RESULT_ENTRY_MODE,
  358. RESULT_ENTRY_GATE_TIME, RESULT_MEMO,
  359. INSERT_USERNAME, INSERT_TIME,
  360. UPDATE_USERNAME, UPDATE_TIME,
  361. INSERT_UPDATE_REMARK, DELETE_USERNAME,
  362. DELETE_TIME, SEGMEN_SQE)
  363. ( <foreach collection="list" item="item" separator="union all">
  364. select
  365. #{item.resultId,jdbcType=DECIMAL},
  366. #{item.resultTotalId,jdbcType=DECIMAL}, #{item.gatepostId,jdbcType=DECIMAL}, #{item.resultEntryMode,jdbcType=VARCHAR},
  367. #{item.resultEntryGateTime,jdbcType=TIMESTAMP}, #{item.resultMemo,jdbcType=VARCHAR},
  368. #{item.insertUsername,jdbcType=VARCHAR}, #{item.insertTime,jdbcType=TIMESTAMP},
  369. #{item.updateUsername,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP},
  370. #{item.insertUpdateRemark,jdbcType=VARCHAR}, #{item.deleteUsername,jdbcType=VARCHAR},
  371. #{item.deleteTime,jdbcType=TIMESTAMP}, #{item.segmenSqe,jdbcType=DECIMAL} from dual
  372. </foreach> )
  373. </insert>
  374. <update id="batchUpdate" parameterType="java.util.List">
  375. update TMSTRUCK_ENFACTORY_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_ENTRY_MODE=
  390. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  391. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultEntryMode,jdbcType=VARCHAR}
  392. </foreach>
  393. ,RESULT_ENTRY_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.resultEntryGateTime,jdbcType=TIMESTAMP}
  396. </foreach>
  397. ,RESULT_MEMO=
  398. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  399. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultMemo,jdbcType=VARCHAR}
  400. </foreach>
  401. ,INSERT_USERNAME=
  402. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  403. when #{item.resultId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
  404. </foreach>
  405. ,INSERT_TIME=
  406. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  407. when #{item.resultId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
  408. </foreach>
  409. ,UPDATE_USERNAME=
  410. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  411. when #{item.resultId,jdbcType=DECIMAL} then #{item.updateUsername,jdbcType=VARCHAR}
  412. </foreach>
  413. ,UPDATE_TIME=
  414. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  415. when #{item.resultId,jdbcType=DECIMAL} then #{item.updateTime,jdbcType=TIMESTAMP}
  416. </foreach>
  417. ,INSERT_UPDATE_REMARK=
  418. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  419. when #{item.resultId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
  420. </foreach>
  421. ,DELETE_USERNAME=
  422. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  423. when #{item.resultId,jdbcType=DECIMAL} then #{item.deleteUsername,jdbcType=VARCHAR}
  424. </foreach>
  425. ,DELETE_TIME=
  426. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  427. when #{item.resultId,jdbcType=DECIMAL} then #{item.deleteTime,jdbcType=TIMESTAMP}
  428. </foreach>
  429. ,SEGMEN_SQE=
  430. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  431. when #{item.resultId,jdbcType=DECIMAL} then #{item.segmenSqe,jdbcType=DECIMAL}
  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_ENFACTORY_RESULT
  440. where RESULT_ID in
  441. <foreach collection="list" item="id" open="(" close=")" separator=",">
  442. #{id}
  443. </foreach>
  444. </delete>
  445. <!-- 友情提示!!!-->
  446. <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
  447. <!-- 按照进厂时间进行排序 -->
  448. <sql id="orderByEnterTime">
  449. <if test="orderField != null and orderField != ''">
  450. order by "${orderField}"
  451. <if test="orderType != null and orderType != ''">
  452. ${orderType}
  453. </if>
  454. </if>
  455. <if test="orderField == null ">
  456. order by "resultEntryGateTime" desc
  457. </if>
  458. </sql>
  459. <!-- 查询所有的采购进厂作业实绩 -->
  460. <select id="getCGJKEnFactoryResult" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
  461. select *
  462. from (
  463. select
  464. TER.RESULT_ID "resultId",
  465. APO.PURCHASE_ORDER_NO "purchaseOrderNo",
  466. RM.MATERIAL_NAME "materialName",
  467. DB.RESULT_FOREIGN_SHIP_NAME "resultForeignShipName",
  468. OO.ORDER_NUMBER "orderNumber",
  469. RC.CAPACITY_NUMBER "capacityNumber",
  470. RG.GATEPOST_NAME "gatepostName",
  471. TER.RESULT_ENTRY_MODE "resultEntryMode",
  472. TER.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
  473. RS.SUPPLIER_NAME "supplierName",
  474. OOM.ORDER_MATERIAL_WEIGHT "orderMaterialWeight",
  475. TER.INSERT_TIME "insertTime",
  476. RCON. CONSIGNEE_COMPANY_NAME "consigneeCompanyName"
  477. from TMSTRUCK_ENFACTORY_RESULT TER
  478. left join TMSTRUCK_TOTAL_RESULT TTR
  479. on TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  480. left join OMSTRUCK_ORDER OO
  481. on TTR.ORDER_ID = OO.ORDER_ID
  482. left join AMS_PURCHASE_ORDER APO
  483. on APO.PURCHASE_ORDER_ID = OO.ORDER_PLAN_ID
  484. left join DIL_BATCH DB
  485. on DB.BATCH_ID = APO.BATCH_ID
  486. left join RMS_CAPACITY RC
  487. on RC.CAPACITY_ID = OO.CAPACITY_ID
  488. left join RMS_SUPPLIER RS
  489. on RS.SUPPLIER_ID = APO.SUPPLIER_UNIT_ID
  490. left join RMS_CONSIGNEE RCON
  491. on RCON.CONSIGNEE_ID = APO.RECEIVE_UNIT_ID
  492. left join OMSTRUCK_ORDER_MATERIAL OOM
  493. on OOM.ORDER_ID = OO.ORDER_ID
  494. left join RMS_MATERIAL RM
  495. on RM.MATERIAL_ID = OOM.MATERIAL_ID
  496. left join RMS_GATEPOST RG
  497. on RG.GATEPOST_ID = TER.GATEPOST_ID
  498. where TER.RESULT_ENTRY_GATE_TIME is not null and OO.ORDER_TYPE = #{orderTypee}
  499. )
  500. <where>
  501. <if test="purchaseOrderId != null">
  502. <foreach collection="purchaseOrderId" item="item" open="(" separator="or" close=")">
  503. "purchaseOrderId" like '%${item}%'
  504. </foreach>
  505. </if>
  506. <if test="materialName != null">
  507. and
  508. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  509. "materialName" like '%${item}%'
  510. </foreach>
  511. </if>
  512. <if test="resultForeignShipName != null">
  513. and
  514. <foreach collection="resultForeignShipName" item="item" open="(" separator="or" close=")">
  515. "resultForeignShipName" like '%${item}%'
  516. </foreach>
  517. </if>
  518. <if test="orderNumber != null">
  519. and
  520. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  521. "orderNumber" like '%${item}%'
  522. </foreach>
  523. </if>
  524. <if test="capacityNumber != null">
  525. and
  526. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  527. "capacityNumber" like '%${item}%'
  528. </foreach>
  529. </if>
  530. <if test="warehouseName != null">
  531. and
  532. <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
  533. "warehouseName" like '%${item}%'
  534. </foreach>
  535. </if>
  536. <if test="resultEntryMode != null">
  537. and
  538. <foreach collection="resultEntryMode" item="item" open="(" separator="or" close=")">
  539. "resultEntryMode" like '%${item}%'
  540. </foreach>
  541. </if>
  542. <if test="supplierName != null">
  543. and
  544. <foreach collection="supplierName" item="item" open="(" separator="or" close=")">
  545. "supplierName" like '%${item}%'
  546. </foreach>
  547. </if>
  548. <if test="orderMaterialWeight != null">
  549. and
  550. <foreach collection="orderMaterialWeight" item="item" open="(" separator="or" close=")">
  551. "orderMaterialWeight" like '%${item}%'
  552. </foreach>
  553. </if>
  554. </where>
  555. <include refid="orderByEnterTime"></include>
  556. </select>
  557. <!-- 查询内转进厂作业实绩 -->
  558. <select id="getAllInwardTurnEnFactoryResult" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
  559. select *
  560. from (
  561. select
  562. RM.MATERIAL_NAME "materialName",
  563. OO.ORDER_NUMBER "orderNumber",
  564. RC.CAPACITY_NUMBER "capacityNumber",
  565. RG.GATEPOST_NAME "gatepostName",
  566. TER.RESULT_ENTRY_MODE "resultEntryMode",
  567. TER.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
  568. (
  569. CASE
  570. WHEN OOM.ORDER_MATERIAL_WEIGHT is null
  571. THEN OOM.ORDER_MATERIAL_NUMBER
  572. ELSE OOM.ORDER_MATERIAL_WEIGHT
  573. END
  574. ) "orderMaterialNo"
  575. from TMSTRUCK_ENFACTORY_RESULT TER
  576. left join TMSTRUCK_TOTAL_RESULT TTR
  577. on TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  578. left join OMSTRUCK_ORDER OO
  579. on TTR.ORDER_ID = OO.ORDER_ID
  580. left join RMS_CAPACITY RC
  581. on RC.CAPACITY_ID = OO.CAPACITY_ID
  582. left join OMSTRUCK_ORDER_MATERIAL OOM
  583. on OOM.ORDER_ID = OO.ORDER_ID
  584. left join RMS_MATERIAL RM
  585. on RM.MATERIAL_ID = OOM.MATERIAL_ID
  586. left join RMS_GATEPOST RG
  587. on RG.GATEPOST_ID = TER.GATEPOST_ID
  588. where TER.RESULT_ENTRY_GATE_TIME is not null and OO.ORDER_TYPE = 4
  589. )
  590. <where>
  591. <if test="materialName != null">
  592. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  593. "materialName" like '%${item}%'
  594. </foreach>
  595. </if>
  596. <if test="orderNumber != null">
  597. and
  598. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  599. "orderNumber" like '%${item}%'
  600. </foreach>
  601. </if>
  602. <if test="capacityNumber != null">
  603. and
  604. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  605. "capacityNumber" like '%${item}%'
  606. </foreach>
  607. </if>
  608. <if test="resultEntryMode != null">
  609. and
  610. <foreach collection="resultEntryMode" item="item" open="(" separator="or" close=")">
  611. "resultEntryMode" like '%${item}%'
  612. </foreach>
  613. </if>
  614. <if test="orderMaterialNo != null">
  615. and
  616. <foreach collection="orderMaterialNo" item="item" open="(" separator="or" close=")">
  617. "orderMaterialNo" like '%${item}%'
  618. </foreach>
  619. </if>
  620. </where>
  621. <include refid="orderByEnterTime"></include>
  622. </select>
  623. <!-- 通过车牌号并且状态不为2 或 运输订单 或运输订单ID 查询关联的实绩总表ID -->
  624. <select id="selectTotalResultIdByCpAndOn" parameterType="java.util.Map" resultType="java.util.Map">
  625. select TTR.RESULT_TOTAL_ID "resultTotalId",
  626. RC.CAPACITY_NUMBER "capacityNumber",
  627. OO.ORDER_TYPE "orderType"
  628. from OMSTRUCK_ORDER OO
  629. left join TMSTRUCK_TOTAL_RESULT TTR
  630. on TTR.ORDER_ID = OO.ORDER_ID
  631. left join RMS_CAPACITY RC
  632. on RC.CAPACITY_ID = OO.CAPACITY_ID
  633. <where>
  634. <if test="orderId != null">
  635. OO.ORDER_ID = #{orderId}
  636. </if>
  637. <if test="orderNumber != null and orderId == null">
  638. and OO.ORDER_NUMBER = #{orderNumber}
  639. </if>
  640. </where>
  641. </select>
  642. <!-- 通过门岗名称查询门岗Id-->
  643. <select id="selectGatepostIdByGatepostName" parameterType="java.lang.String" resultType="int">
  644. select GATEPOST_ID "gatepostId"
  645. from RMS_GATEPOST
  646. where GATEPOST_NAME = #{gatepostName}
  647. </select>
  648. <!-- 通过运输订单号查找实绩Id -->
  649. <select id="selectEnFactoryResultId" parameterType="string" resultType="java.util.Map">
  650. select * from (select TER.RESULT_ID "resultId",
  651. OO.ORDER_ID "orderId",
  652. OO.ORDER_TYPE "orderTypee", --避免与筛选条件重名
  653. TER.RESULT_TOTAL_ID "resultTotalId",
  654. RC.CAPACITY_NUMBER "capacityNumber",
  655. TER.SEGMEN_SQE "segmentSqe", --进厂的路段顺序号
  656. ter.result_entry_gate_time
  657. from OMSTRUCK_ORDER OO
  658. left join TMSTRUCK_TOTAL_RESULT TTR
  659. on OO.ORDER_ID = TTR.ORDER_ID
  660. left join TMSTRUCK_ENFACTORY_RESULT TER
  661. on TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  662. left join RMS_CAPACITY RC
  663. on RC.CAPACITY_ID = OO.CAPACITY_ID
  664. where OO.ORDER_NUMBER = #{orderNumber}
  665. and ter.result_entry_gate_time is null
  666. order by TER.SEGMEN_SQE)
  667. where rownum=1
  668. </select>
  669. <!-- 查找排队序号 -->
  670. <select id="selectNodeNumber" resultType="int" parameterType="string">
  671. select (
  672. <![CDATA[
  673. select count(*)
  674. from QMS_QUEUE_LIST QQL2
  675. join QMS_QUEUE_GRID QQG2
  676. on QQG2.GRID_ID = QQL2.GRID_ID
  677. where QQL2.LIST_NODE_ORDER <= QQL.LIST_NODE_ORDER
  678. and QQL2.GRID_ID = QQL.GRID_ID
  679. and QQL2.DELETED = 0
  680. ]]>
  681. ) "listNodeOrder"
  682. from OMSTRUCK_ORDER OO
  683. left join QMS_QUEUE_LIST QQL
  684. on OO.CAPACITY_ID = QQL.CAPACITY_ID
  685. where OO.ORDER_NUMBER = #{orderNumber}
  686. and QQL.DELETED = 1
  687. </select>
  688. <!--查询销售进厂实绩 -->
  689. <select id="getXSEnFactoryResult" parameterType="java.util.Map" resultType="java.util.Map">
  690. select
  691. *
  692. from (
  693. SELECT
  694. -- 进厂时间
  695. TER.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
  696. -- 进厂方式
  697. TER.RESULT_ENTRY_MODE "resultEntryMode",
  698. -- 门岗名称
  699. RG.GATEPOST_NAME "gatepostName",
  700. -- 运输订单号
  701. OO.ORDER_NUMBER "orderNumber",
  702. -- 车牌号
  703. RC.CAPACITY_NUMBER "capacityNumber",
  704. -- 运输订单id
  705. OO.ORDER_ID "orderId",
  706. -- 根据订单类型查询销售订单号/发运计划号
  707. (CASE
  708. -- 运输订单类型等于1的查询销售订单表
  709. WHEN OO.ORDER_TYPE = 1
  710. THEN (
  711. SELECT
  712. -- 销售订单号
  713. ASO.SALE_NUMBER
  714. FROM
  715. -- 销售订单
  716. AMS_SALE_ORDER ASO
  717. WHERE OO.ORDER_PLAN_ID = ASO.SALE_ORDER_ID
  718. )
  719. -- 运输订单类型等于2,3的查询发运计划表
  720. WHEN OO.ORDER_TYPE IN ( 2, 3 )
  721. THEN(
  722. SELECT
  723. -- 发运计划号
  724. ARD.DAYPLAN_NO
  725. -- 发运计划
  726. FROM
  727. AMSTRUCK_RAIL_DAYPLAN ARD
  728. WHERE OO.ORDER_PLAN_ID = ARD.DAYPLAN_ID
  729. )
  730. END) "saleNum",
  731. --根据订单类型查询发货单位
  732. (CASE
  733. WHEN OO.ORDER_TYPE = 1
  734. THEN(
  735. SELECT
  736. -- 发货单位
  737. RS.SHIPPER_NAME
  738. FROM
  739. -- 销售订单
  740. AMS_SALE_ORDER ASO
  741. -- 托运人
  742. LEFT JOIN RMS_SHIPPER RS ON ASO.SHIPPER_ID = RS.SHIPPER_ID
  743. WHERE OO.ORDER_PLAN_ID = ASO.SALE_ORDER_ID
  744. )
  745. -- 运输订单类型等于2,3的查询发运计划表
  746. WHEN OO.ORDER_TYPE IN ( 2, 3 )
  747. THEN(
  748. SELECT
  749. -- 发货单位
  750. RS.SHIPPER_NAME
  751. -- 发运计划
  752. FROM AMSTRUCK_RAIL_DAYPLAN ARD
  753. -- 托运人
  754. LEFT JOIN RMS_SHIPPER RS ON ARD.SHIPMENT_UNIT_ID = RS.SHIPPER_ID
  755. WHERE OO.ORDER_PLAN_ID = ARD.DAYPLAN_ID
  756. )
  757. END) "shipperName",
  758. --根据订单类型查询收货单位
  759. (CASE
  760. WHEN OO.ORDER_TYPE = 1
  761. THEN(
  762. SELECT
  763. -- 收货单位
  764. RS.SUPPLIER_NAME
  765. FROM
  766. -- 销售订单
  767. AMS_SALE_ORDER ASO
  768. -- 托运人
  769. LEFT JOIN RMS_SUPPLIER RS ON ASO.SHIPPER_ID = RS.SUPPLIER_ID
  770. WHERE OO.ORDER_PLAN_ID = ASO.SALE_ORDER_ID
  771. )
  772. -- 运输订单类型等于2,3的查询发运计划表
  773. WHEN OO.ORDER_TYPE IN ( 2, 3 )
  774. THEN(
  775. SELECT
  776. --发货单位
  777. RS.SUPPLIER_NAME
  778. FROM
  779. -- 发运计划
  780. AMSTRUCK_RAIL_DAYPLAN ARD
  781. --托运人
  782. LEFT JOIN RMS_SUPPLIER RS ON ARD.SHIPMENT_UNIT_ID = RS.SUPPLIER_ID
  783. WHERE OO.ORDER_PLAN_ID = ARD.DAYPLAN_ID
  784. )
  785. END) "supplierName"
  786. FROM
  787. -- 进厂实绩
  788. TMSTRUCK_ENFACTORY_RESULT TER
  789. -- 门岗
  790. LEFT JOIN RMS_GATEPOST RG ON TER.GATEPOST_ID = RG.GATEPOST_ID
  791. -- 总实绩
  792. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR ON TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  793. -- 运输订单
  794. LEFT JOIN OMSTRUCK_ORDER OO ON TTR.ORDER_ID = OO.ORDER_ID
  795. -- 运力信息
  796. LEFT JOIN RMS_CAPACITY RC ON OO.CAPACITY_ID = RC.CAPACITY_ID
  797. -- 判断进厂实绩的进厂时间不为空
  798. WHERE TER.RESULT_ENTRY_GATE_TIME IS NOT NULL
  799. -- 并且订单类型等于1(销售订单),2(焦炭发运计划),3(水渣发运计划)
  800. AND OO.ORDER_TYPE IN ( 1, 2, 3 )
  801. )
  802. <where>
  803. <if test="saleNum != null">
  804. <foreach collection="saleNum" item="item" open="(" separator="or" close=")">
  805. "saleNum" like '%${item}%'
  806. </foreach>
  807. </if>
  808. <if test="gatepostName != null">
  809. and
  810. <foreach collection="gatepostName" item="item" open="(" separator="or" close=")">
  811. "gatepostName" like '%${item}%'
  812. </foreach>
  813. </if>
  814. <if test="orderNumber != null">
  815. and
  816. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  817. "orderNumber" like '%${item}%'
  818. </foreach>
  819. </if>
  820. <if test="capacityNumber != null">
  821. and
  822. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  823. "capacityNumber" like '%${item}%'
  824. </foreach>
  825. </if>
  826. <if test="shipperName != null">
  827. and
  828. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  829. "shipperName" like '%${item}%'
  830. </foreach>
  831. </if>
  832. <if test="resultEntryMode != null">
  833. and
  834. <foreach collection="resultEntryMode" item="item" open="(" separator="or" close=")">
  835. "resultEntryMode" like '%${item}%'
  836. </foreach>
  837. </if>
  838. <if test="resultEntryGateTime != null">
  839. and
  840. <foreach collection="resultEntryGateTime" item="item" open="(" separator="or" close=")">
  841. "resultEntryGateTime" like '%${item}%'
  842. </foreach>
  843. </if>
  844. <if test="supplierName != null">
  845. and
  846. <foreach collection="supplierName" item="item" open="(" separator="or" close=")">
  847. "supplierName" like '%${item}%'
  848. </foreach>
  849. </if>
  850. </where>
  851. <include refid="orderByEnterTime"></include>
  852. </select>
  853. <select id="getMaterial" parameterType="int" resultType="java.util.Map">
  854. SELECT RM.MATERIAL_NAME "materialName",
  855. CONCAT(CONCAT(RM.MATERIAL_SPECIFICATION, '('), CONCAT(RM.MATERIAL_MODEL, ')')) "specificationModel",
  856. OM.ORDER_MATERIAL_NUMBER "orderMaterialNumber"
  857. FROM OMSTRUCK_ORDER OO
  858. LEFT JOIN OMSTRUCK_ORDER_MATERIAL OM
  859. ON OO.ORDER_ID = OM.ORDER_ID
  860. LEFT JOIN RMS_MATERIAL RM
  861. ON OM.MATERIAL_ID = RM.MATERIAL_ID
  862. WHERE OO.ORDER_ID = #{orderId}
  863. </select>
  864. <!-- APP查询进厂实绩 -->
  865. <select id="getEnfactoryResultList" resultType="java.util.Map">
  866. SELECT OO.ORDER_NUMBER AS "orderNumber",
  867. TER.RESULT_ENTRY_GATE_TIME AS "resultEntryGateTime",
  868. RC.CAPACITY_NUMBER AS "capacityNumber"
  869. FROM OMSTRUCK_ORDER OO
  870. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  871. ON TTR.ORDER_ID = OO.ORDER_ID
  872. LEFT JOIN TMSTRUCK_ENFACTORY_RESULT TER
  873. ON TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  874. LEFT JOIN RMS_CAPACITY RC
  875. ON RC.CAPACITY_ID = OO.CAPACITY_ID
  876. -- WHERE TER
  877. </select>
  878. <!-- APP通过运输订单id查询进厂实绩 -->
  879. <select id="getEnfactoryMessageByOrderId" parameterType="java.lang.String" resultType="java.util.Map">
  880. SELECT OO.ORDER_NUMBER AS "orderNumber",
  881. RCA.CAPACITY_NUMBER AS "capacityNumber"
  882. FROM OMSTRUCK_ORDER OO
  883. LEFT JOIN RMS_CAPACITY RCA
  884. ON RCA.CAPACITY_ID = OO.CAPACITY_ID
  885. WHERE OO.ORDER_NUMBER = #{orderNumber}
  886. </select>
  887. <!-- 查询内转钢材到异地库进厂实绩 -->
  888. <select id="getSteelNZEnFactoryResult" parameterType="java.util.Map" resultType="java.util.Map">
  889. SELECT *
  890. FROM (
  891. SELECT
  892. OO.ORDER_ID "orderId",
  893. AROD.DAYPLAN_NO "dayplanNo",
  894. OO.ORDER_NUMBER "orderNumber",
  895. RG.GATEPOST_NAME "gatepostName",
  896. TER.RESULT_ENTRY_MODE "resultEntryMode",
  897. RC.CAPACITY_NUMBER "capacityNumber",
  898. TER.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
  899. RS.SHIPPER_NAME "shipperName",
  900. RW.WAREHOUSE_NAME "warehouseName"
  901. FROM OMSTRUCK_ORDER OO
  902. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  903. ON TTR.ORDER_ID = OO.ORDER_ID
  904. LEFT JOIN AMS_RAIL_OFFSET_DAYPLAN AROD
  905. ON AROD.DAYPLAN_ID = OO.ORDER_PLAN_ID
  906. LEFT JOIN TMSTRUCK_ENFACTORY_RESULT TER
  907. ON TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  908. LEFT JOIN RMS_GATEPOST RG
  909. ON RG.GATEPOST_ID = TER.GATEPOST_ID
  910. LEFT JOIN RMS_SHIPPER RS
  911. ON RS.SHIPPER_ID = AROD.SHIPPER_ID
  912. LEFT JOIN RMS_WAREHOUSE RW
  913. ON RW.WAREHOUSE_ID = AROD.RECEIVING_UNIT_ID
  914. LEFT JOIN RMS_CAPACITY RC
  915. ON RC.CAPACITY_ID = OO.CAPACITY_ID
  916. WHERE OO.ORDER_TYPE = 4
  917. AND TER.RESULT_ENTRY_GATE_TIME IS NOT NULL
  918. )
  919. <where>
  920. <if test="dayplanNo != null">
  921. <foreach collection="dayplanNo" item="item" open="(" separator="or" close=")">
  922. "dayplanNo" like '%${item}%'
  923. </foreach>
  924. </if>
  925. <if test="orderNumber != null">
  926. and
  927. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  928. "orderNumber" like '%${item}%'
  929. </foreach>
  930. </if>
  931. <if test="gatepostName != null">
  932. and
  933. <foreach collection="gatepostName" item="item" open="(" separator="or" close=")">
  934. "gatepostName" like '%${item}%'
  935. </foreach>
  936. </if>
  937. <if test="resultEntryMode != null">
  938. and
  939. <foreach collection="resultEntryMode" item="item" open="(" separator="or" close=")">
  940. "resultEntryMode" like '%${item}%'
  941. </foreach>
  942. </if>
  943. <if test="capacityNumber != null">
  944. and
  945. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  946. "capacityNumber" like '%${item}%'
  947. </foreach>
  948. </if>
  949. <if test="resultEntryGateTime != null">
  950. and
  951. <foreach collection="resultEntryGateTime" item="item" open="(" separator="or" close=")">
  952. "resultEntryGateTime" like '%${item}%'
  953. </foreach>
  954. </if>
  955. <if test="shipperName != null">
  956. and
  957. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  958. "shipperName" like '%${item}%'
  959. </foreach>
  960. </if>
  961. <if test="warehouseName != null">
  962. and
  963. <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
  964. "warehouseName" like '%${item}%'
  965. </foreach>
  966. </if>
  967. </where>
  968. <include refid="orderByEnterTime"></include>
  969. </select>
  970. <!-- 查询内转国产矿进口矿 进厂实绩 -->
  971. <select id="getImportedDomesticNzLoadResult" parameterType="java.util.Map" resultType="java.util.Map">
  972. select *
  973. from (
  974. select TER.RESULT_ID "resultId",
  975. APO.PURCHASE_ORDER_NO "purchaseOrderNo",
  976. RM.MATERIAL_NAME "materialName",
  977. DB.RESULT_FOREIGN_SHIP_NAME "resultForeignShipName",
  978. OO.ORDER_NUMBER "orderNumber",
  979. RC.CAPACITY_NUMBER "capacityNumber",
  980. RG.GATEPOST_NAME "gatepostName",
  981. TER.RESULT_ENTRY_MODE "resultEntryMode",
  982. TER.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
  983. RS.SUPPLIER_NAME "supplierName",
  984. OOM.ORDER_MATERIAL_WEIGHT "orderMaterialWeight",
  985. TER.INSERT_TIME "insertTime",
  986. RCON.CONSIGNEE_COMPANY_NAME "consigneeCompanyName"
  987. from TMSTRUCK_ENFACTORY_RESULT TER
  988. left join TMSTRUCK_TOTAL_RESULT TTR
  989. on TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  990. left join OMSTRUCK_ORDER OO
  991. on TTR.ORDER_ID = OO.ORDER_ID
  992. left join AMS_PURCHASE_ORDER APO
  993. on APO.PURCHASE_ORDER_ID = OO.ORDER_PLAN_ID
  994. left join DIL_BATCH DB
  995. on DB.BATCH_ID = APO.BATCH_ID
  996. left join RMS_CAPACITY RC
  997. on RC.CAPACITY_ID = OO.CAPACITY_ID
  998. left join RMS_SUPPLIER RS
  999. on RS.SUPPLIER_ID = APO.SUPPLIER_UNIT_ID
  1000. left join RMS_CONSIGNEE RCON
  1001. on RCON.CONSIGNEE_ID = APO.RECEIVE_UNIT_ID
  1002. left join OMSTRUCK_ORDER_MATERIAL OOM
  1003. on OOM.ORDER_ID = OO.ORDER_ID
  1004. left join RMS_MATERIAL RM
  1005. on RM.MATERIAL_ID = OOM.MATERIAL_ID
  1006. left join RMS_GATEPOST RG
  1007. on RG.GATEPOST_ID = TER.GATEPOST_ID
  1008. where TER.RESULT_ENTRY_GATE_TIME is not null
  1009. and OO.ORDER_TYPE = 9
  1010. )
  1011. <where>
  1012. <if test="purchaseOrderId != null">
  1013. <foreach collection="purchaseOrderId" item="item" open="(" separator="or" close=")">
  1014. "purchaseOrderId" like '%${item}%'
  1015. </foreach>
  1016. </if>
  1017. <if test="materialName != null">
  1018. and
  1019. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  1020. "materialName" like '%${item}%'
  1021. </foreach>
  1022. </if>
  1023. <if test="resultForeignShipName != null">
  1024. and
  1025. <foreach collection="resultForeignShipName" item="item" open="(" separator="or" close=")">
  1026. "resultForeignShipName" like '%${item}%'
  1027. </foreach>
  1028. </if>
  1029. <if test="orderNumber != null">
  1030. and
  1031. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  1032. "orderNumber" like '%${item}%'
  1033. </foreach>
  1034. </if>
  1035. <if test="capacityNumber != null">
  1036. and
  1037. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  1038. "capacityNumber" like '%${item}%'
  1039. </foreach>
  1040. </if>
  1041. <if test="warehouseName != null">
  1042. and
  1043. <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
  1044. "warehouseName" like '%${item}%'
  1045. </foreach>
  1046. </if>
  1047. <if test="resultEntryMode != null">
  1048. and
  1049. <foreach collection="resultEntryMode" item="item" open="(" separator="or" close=")">
  1050. "resultEntryMode" like '%${item}%'
  1051. </foreach>
  1052. </if>
  1053. <if test="supplierName != null">
  1054. and
  1055. <foreach collection="supplierName" item="item" open="(" separator="or" close=")">
  1056. "supplierName" like '%${item}%'
  1057. </foreach>
  1058. </if>
  1059. <if test="orderMaterialWeight != null">
  1060. and
  1061. <foreach collection="orderMaterialWeight" item="item" open="(" separator="or" close=")">
  1062. "orderMaterialWeight" like '%${item}%'
  1063. </foreach>
  1064. </if>
  1065. </where>
  1066. <include refid="orderByEnterTime"></include>
  1067. </select>
  1068. <!-- 查询内转厂内物资进厂实绩 -->
  1069. <select id="getInFactoryMaterialEnFactoryResult" parameterType="java.util.Map" resultType="java.util.Map">
  1070. select *
  1071. from (
  1072. select TER.RESULT_ID "resultId",
  1073. RM.MATERIAL_NAME "materialName",
  1074. OO.ORDER_NUMBER "orderNumber",
  1075. RC.CAPACITY_NUMBER "capacityNumber",
  1076. RG.GATEPOST_NAME "gatepostName",
  1077. TER.RESULT_ENTRY_MODE "resultEntryMode",
  1078. TER.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
  1079. OOM.ORDER_MATERIAL_WEIGHT "orderMaterialWeight",
  1080. RW1.WAREHOUSE_NAME "loadingName",
  1081. RW2.WAREHOUSE_NAME "unloadingName"
  1082. from TMSTRUCK_ENFACTORY_RESULT TER
  1083. left join TMSTRUCK_TOTAL_RESULT TTR
  1084. on TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  1085. LEFT JOIN TMSTRUCK_LOAD_RESULT TLR
  1086. ON TLR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  1087. LEFT JOIN TMSTRUCK_UNLOAD_RESULT TUR
  1088. ON TUR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  1089. LEFT JOIN RMS_WAREHOUSE RW1
  1090. ON RW1.WAREHOUSE_ID = TLR.LOADING_ID
  1091. LEFT JOIN RMS_WAREHOUSE RW2
  1092. ON RW2.WAREHOUSE_ID = TUR.RESULT_UNLOAD_PLACE_ID
  1093. left join OMSTRUCK_ORDER OO
  1094. on TTR.ORDER_ID = OO.ORDER_ID
  1095. left join RMS_CAPACITY RC
  1096. on RC.CAPACITY_ID = OO.CAPACITY_ID
  1097. left join OMSTRUCK_ORDER_MATERIAL OOM
  1098. on OOM.ORDER_ID = OO.ORDER_ID
  1099. left join RMS_MATERIAL RM
  1100. on RM.MATERIAL_ID = OOM.MATERIAL_ID
  1101. left join RMS_GATEPOST RG
  1102. on RG.GATEPOST_ID = TER.GATEPOST_ID
  1103. where TER.RESULT_ENTRY_GATE_TIME is not null
  1104. and OO.ORDER_TYPE = 11
  1105. )
  1106. <where>
  1107. <if test="materialName != null">
  1108. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  1109. "materialName" like '%${item}%'
  1110. </foreach>
  1111. </if>
  1112. <if test="loadingName != null">
  1113. and
  1114. <foreach collection="loadingName" item="item" open="(" separator="or" close=")">
  1115. "loadingName" like '%${item}%'
  1116. </foreach>
  1117. </if>
  1118. <if test="orderNumber != null">
  1119. and
  1120. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  1121. "orderNumber" like '%${item}%'
  1122. </foreach>
  1123. </if>
  1124. <if test="capacityNumber != null">
  1125. and
  1126. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  1127. "capacityNumber" like '%${item}%'
  1128. </foreach>
  1129. </if>
  1130. <if test="unloadingName != null">
  1131. and
  1132. <foreach collection="unloadingName" item="item" open="(" separator="or" close=")">
  1133. "unloadingName" like '%${item}%'
  1134. </foreach>
  1135. </if>
  1136. <if test="resultEntryMode != null">
  1137. and
  1138. <foreach collection="resultEntryMode" item="item" open="(" separator="or" close=")">
  1139. "resultEntryMode" like '%${item}%'
  1140. </foreach>
  1141. </if>
  1142. <if test="orderMaterialWeight != null">
  1143. and
  1144. <foreach collection="orderMaterialWeight" item="item" open="(" separator="or" close=")">
  1145. "orderMaterialWeight" like '%${item}%'
  1146. </foreach>
  1147. </if>
  1148. <if test="loadingName != null">
  1149. and
  1150. <foreach collection="loadingName" item="item" open="(" separator="or" close=")">
  1151. "loadingName" like '%${item}%'
  1152. </foreach>
  1153. </if>
  1154. <if test="resultEntryGateTime != null">
  1155. and
  1156. <foreach collection="resultEntryGateTime" item="item" open="(" separator="or" close=")">
  1157. "resultEntryGateTime" like '%${item}%'
  1158. </foreach>
  1159. </if>
  1160. </where>
  1161. <include refid="orderByEnterTime"></include>
  1162. </select>
  1163. <select id="getBillOrder" parameterType="java.lang.String" resultType="java.util.Map">
  1164. select
  1165. oo.order_number "orderNumber",
  1166. rc.capacity_number "capacityNumber",
  1167. rce.consignee_company_name "consigeeName",
  1168. rcr.carrier_name "carrierName",
  1169. TO_CHAR(SYSDATE,'YYYY-MM-DD') "billDate"
  1170. from omstruck_order oo
  1171. left join
  1172. rms_capacity rc
  1173. on
  1174. rc.capacity_id = oo.capacity_id
  1175. left join
  1176. ams_sale_order_material asom
  1177. on
  1178. asom.sale_order_material_id = oo.order_plan_id
  1179. left join
  1180. ams_sale_order aso
  1181. on
  1182. aso.sale_order_id = asom.sale_order_id
  1183. left join
  1184. rms_consignee rce
  1185. on
  1186. rce.consignee_id = aso.receive_id
  1187. left join
  1188. ams_dispatch_sale_order adso
  1189. on
  1190. adso.sale_order_material_id = asom.sale_order_material_id
  1191. left join
  1192. rms_carrier rcr
  1193. on
  1194. rcr.carrier_id = adso.carrier_id
  1195. where oo.order_number = #{orderNumber}
  1196. </select>
  1197. <select id="getBillOrderMaterial" parameterType="java.lang.String" resultType="java.util.Map" >
  1198. select
  1199. rm.material_name "materialName",
  1200. rm.material_specification "materialSpe",
  1201. rm.material_model "materialModel",
  1202. oom.order_material_number "materialNumber",
  1203. oom.order_material_weight "materialWeight"
  1204. from omstruck_order oo
  1205. left join
  1206. omstruck_order_material oom
  1207. on
  1208. oom.order_id = oo.order_id
  1209. left join
  1210. rms_material rm
  1211. on
  1212. rm.material_id = oom.order_material_id
  1213. where oo.order_number = #{orderNumber}
  1214. </select>
  1215. <!-- 通过id获取零星物资id-->
  1216. <select id="getSporadicSuppliesEnFactoryResult" parameterType="java.util.Map" resultType="java.util.Map">
  1217. select *
  1218. from (
  1219. select TER.RESULT_ID "resultId",
  1220. OO.ORDER_ID "orderId",
  1221. OO.ORDER_NUMBER "orderNumber",
  1222. RC.CAPACITY_NUMBER "capacityNumber",
  1223. RG.GATEPOST_NAME "gatepostName",
  1224. TER.RESULT_ENTRY_MODE "resultEntryMode",
  1225. TER.RESULT_ENTRY_GATE_TIME "resultEntryGateTime"
  1226. from TMSTRUCK_ENFACTORY_RESULT TER
  1227. left join TMSTRUCK_TOTAL_RESULT TTR
  1228. on TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  1229. left join OMSTRUCK_ORDER OO
  1230. on TTR.ORDER_ID = OO.ORDER_ID
  1231. left join AMSTRUCK_SPORADIC_ORDER ASO
  1232. on OO.ORDER_PLAN_ID = ASO.SPORADIC_ORDER_ID
  1233. left join RMS_GATEPOST RG
  1234. on RG.GATEPOST_ID = TER.GATEPOST_ID
  1235. left join RMS_CAPACITY RC
  1236. on RC.CAPACITY_ID = OO.CAPACITY_ID
  1237. WHERE OO.ORDER_TYPE = #{orderTypee}
  1238. )
  1239. <where>
  1240. <if test="orderNumber != null">
  1241. and
  1242. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  1243. "orderNumber" like '%${item}%'
  1244. </foreach>
  1245. </if>
  1246. <if test="capacityNumber != null">
  1247. and
  1248. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  1249. "capacityNumber" like '%${item}%'
  1250. </foreach>
  1251. </if>
  1252. <if test="gatepostName != null">
  1253. and
  1254. <foreach collection="gatepostName" item="item" open="(" separator="or" close=")">
  1255. "capacityNumber" like '%${item}%'
  1256. </foreach>
  1257. </if>
  1258. <if test="gatepostName != null">
  1259. and
  1260. <foreach collection="resultEntryMode" item="item" open="(" separator="or" close=")">
  1261. "resultEntryMode" like '%${item}%'
  1262. </foreach>
  1263. </if>
  1264. <if test="resultEntryGateTime != null">
  1265. and
  1266. <foreach collection="resultEntryGateTime" item="item" open="(" separator="or" close=")">
  1267. "resultEntryGateTime" like '%${item}%'
  1268. </foreach>
  1269. </if>
  1270. </where>
  1271. <include refid="orderByEnterTime"></include>
  1272. </select>
  1273. </mapper>