TmstruckEnfactoryResultMapper.xml 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778
  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. </resultMap>
  19. <sql id="columns">
  20. RESULT_ID, RESULT_TOTAL_ID, GATEPOST_ID, RESULT_ENTRY_MODE, RESULT_ENTRY_GATE_TIME,
  21. RESULT_MEMO, INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK,
  22. DELETE_USERNAME, DELETE_TIME
  23. </sql>
  24. <sql id="columns_alias">
  25. t.RESULT_ID, t.RESULT_TOTAL_ID, t.GATEPOST_ID, t.RESULT_ENTRY_MODE, t.RESULT_ENTRY_GATE_TIME,
  26. t.RESULT_MEMO, t.INSERT_USERNAME, t.INSERT_TIME, t.UPDATE_USERNAME, t.UPDATE_TIME,
  27. t.INSERT_UPDATE_REMARK, t.DELETE_USERNAME, t.DELETE_TIME
  28. </sql>
  29. <sql id="select">
  30. SELECT
  31. <include refid="columns"/>
  32. FROM TMSTRUCK_ENFACTORY_RESULT
  33. </sql>
  34. <sql id="select_alias">
  35. SELECT
  36. <include refid="columns_alias"/>
  37. FROM TMSTRUCK_ENFACTORY_RESULT t
  38. </sql>
  39. <sql id="where">
  40. <where>
  41. <if test="resultId != null">
  42. and RESULT_ID = #{resultId}
  43. </if>
  44. <if test="resultTotalId != null">
  45. and RESULT_TOTAL_ID = #{resultTotalId}
  46. </if>
  47. <if test="gatepostId != null">
  48. and GATEPOST_ID = #{gatepostId}
  49. </if>
  50. <if test="resultEntryMode != null and resultEntryMode != ''">
  51. and RESULT_ENTRY_MODE = #{resultEntryMode}
  52. </if>
  53. <if test="resultEntryGateTime != null">
  54. and TO_CHAR(RESULT_ENTRY_GATE_TIME,'yyyy-MM-dd') = #{resultEntryGateTime}
  55. </if>
  56. <if test="resultMemo != null and resultMemo != ''">
  57. and RESULT_MEMO = #{resultMemo}
  58. </if>
  59. <if test="insertUsername != null and insertUsername != ''">
  60. and INSERT_USERNAME = #{insertUsername}
  61. </if>
  62. <if test="insertTime != null">
  63. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  64. </if>
  65. <if test="updateUsername != null and updateUsername != ''">
  66. and UPDATE_USERNAME = #{updateUsername}
  67. </if>
  68. <if test="updateTime != null">
  69. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  70. </if>
  71. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  72. and INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  73. </if>
  74. <if test="deleteUsername != null and deleteUsername != ''">
  75. and DELETE_USERNAME = #{deleteUsername}
  76. </if>
  77. <if test="deleteTime != null">
  78. and TO_CHAR(DELETE_TIME,'yyyy-MM-dd') = #{deleteTime}
  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. </where>
  124. </sql>
  125. <delete id="deleteByPrimaryKey" parameterType="java.lang.Short">
  126. delete
  127. from TMSTRUCK_ENFACTORY_RESULT
  128. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  129. </delete>
  130. <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
  131. delete from TMSTRUCK_ENFACTORY_RESULT
  132. where 1!=1
  133. <if test="resultTotalId != null">
  134. or RESULT_TOTAL_ID = #{resultTotalId}
  135. </if>
  136. <if test="gatepostId != null">
  137. or GATEPOST_ID = #{gatepostId}
  138. </if>
  139. <if test="resultEntryMode != null and resultEntryMode != ''">
  140. or RESULT_ENTRY_MODE = #{resultEntryMode}
  141. </if>
  142. <if test="resultEntryGateTime != null">
  143. or TO_CHAR(RESULT_ENTRY_GATE_TIME,'yyyy-MM-dd') = '#{resultEntryGateTime}'
  144. </if>
  145. <if test="resultMemo != null and resultMemo != ''">
  146. or RESULT_MEMO = #{resultMemo}
  147. </if>
  148. <if test="insertUsername != null and insertUsername != ''">
  149. or INSERT_USERNAME = #{insertUsername}
  150. </if>
  151. <if test="insertTime != null">
  152. or TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = '#{insertTime}'
  153. </if>
  154. <if test="updateUsername != null and updateUsername != ''">
  155. or UPDATE_USERNAME = #{updateUsername}
  156. </if>
  157. <if test="updateTime != null">
  158. or TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = '#{updateTime}'
  159. </if>
  160. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  161. or INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  162. </if>
  163. <if test="deleteUsername != null and deleteUsername != ''">
  164. or DELETE_USERNAME = #{deleteUsername}
  165. </if>
  166. <if test="deleteTime != null">
  167. or TO_CHAR(DELETE_TIME,'yyyy-MM-dd') = '#{deleteTime}'
  168. </if>
  169. </delete>
  170. <insert id="insert" parameterType="com.steerinfo.dil.model.TmstruckEnfactoryResult">
  171. insert into TMSTRUCK_ENFACTORY_RESULT (RESULT_ID, RESULT_TOTAL_ID, GATEPOST_ID,
  172. RESULT_ENTRY_MODE, RESULT_ENTRY_GATE_TIME,
  173. RESULT_MEMO, INSERT_USERNAME, INSERT_TIME,
  174. UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK,
  175. DELETE_USERNAME, DELETE_TIME)
  176. values (#{resultId,jdbcType=DECIMAL}, #{resultTotalId,jdbcType=DECIMAL}, #{gatepostId,jdbcType=DECIMAL},
  177. #{resultEntryMode,jdbcType=VARCHAR}, #{resultEntryGateTime,jdbcType=TIMESTAMP},
  178. #{resultMemo,jdbcType=VARCHAR}, #{insertUsername,jdbcType=VARCHAR}, #{insertTime,jdbcType=TIMESTAMP},
  179. #{updateUsername,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
  180. #{insertUpdateRemark,jdbcType=VARCHAR},
  181. #{deleteUsername,jdbcType=VARCHAR}, #{deleteTime,jdbcType=TIMESTAMP})
  182. </insert>
  183. <insert id="insertSelective" parameterType="com.steerinfo.dil.model.TmstruckEnfactoryResult">
  184. insert into TMSTRUCK_ENFACTORY_RESULT
  185. <trim prefix="(" suffix=")" suffixOverrides=",">
  186. <if test="resultId != null">
  187. RESULT_ID,
  188. </if>
  189. <if test="resultTotalId != null">
  190. RESULT_TOTAL_ID,
  191. </if>
  192. <if test="gatepostId != null">
  193. GATEPOST_ID,
  194. </if>
  195. <if test="resultEntryMode != null">
  196. RESULT_ENTRY_MODE,
  197. </if>
  198. <if test="resultEntryGateTime != null">
  199. RESULT_ENTRY_GATE_TIME,
  200. </if>
  201. <if test="resultMemo != null">
  202. RESULT_MEMO,
  203. </if>
  204. <if test="insertUsername != null">
  205. INSERT_USERNAME,
  206. </if>
  207. <if test="insertTime != null">
  208. INSERT_TIME,
  209. </if>
  210. <if test="updateUsername != null">
  211. UPDATE_USERNAME,
  212. </if>
  213. <if test="updateTime != null">
  214. UPDATE_TIME,
  215. </if>
  216. <if test="insertUpdateRemark != null">
  217. INSERT_UPDATE_REMARK,
  218. </if>
  219. <if test="deleteUsername != null">
  220. DELETE_USERNAME,
  221. </if>
  222. <if test="deleteTime != null">
  223. DELETE_TIME,
  224. </if>
  225. </trim>
  226. <trim prefix="values (" suffix=")" suffixOverrides=",">
  227. <if test="resultId != null">
  228. #{resultId,jdbcType=DECIMAL},
  229. </if>
  230. <if test="resultTotalId != null">
  231. #{resultTotalId,jdbcType=DECIMAL},
  232. </if>
  233. <if test="gatepostId != null">
  234. #{gatepostId,jdbcType=DECIMAL},
  235. </if>
  236. <if test="resultEntryMode != null">
  237. #{resultEntryMode,jdbcType=VARCHAR},
  238. </if>
  239. <if test="resultEntryGateTime != null">
  240. #{resultEntryGateTime,jdbcType=TIMESTAMP},
  241. </if>
  242. <if test="resultMemo != null">
  243. #{resultMemo,jdbcType=VARCHAR},
  244. </if>
  245. <if test="insertUsername != null">
  246. #{insertUsername,jdbcType=VARCHAR},
  247. </if>
  248. <if test="insertTime != null">
  249. #{insertTime,jdbcType=TIMESTAMP},
  250. </if>
  251. <if test="updateUsername != null">
  252. #{updateUsername,jdbcType=VARCHAR},
  253. </if>
  254. <if test="updateTime != null">
  255. #{updateTime,jdbcType=TIMESTAMP},
  256. </if>
  257. <if test="insertUpdateRemark != null">
  258. #{insertUpdateRemark,jdbcType=VARCHAR},
  259. </if>
  260. <if test="deleteUsername != null">
  261. #{deleteUsername,jdbcType=VARCHAR},
  262. </if>
  263. <if test="deleteTime != null">
  264. #{deleteTime,jdbcType=TIMESTAMP},
  265. </if>
  266. </trim>
  267. </insert>
  268. <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.TmstruckEnfactoryResult">
  269. update TMSTRUCK_ENFACTORY_RESULT
  270. set RESULT_TOTAL_ID = #{resultTotalId,jdbcType=DECIMAL},
  271. GATEPOST_ID = #{gatepostId,jdbcType=DECIMAL},
  272. RESULT_ENTRY_MODE = #{resultEntryMode,jdbcType=VARCHAR},
  273. RESULT_ENTRY_GATE_TIME = #{resultEntryGateTime,jdbcType=TIMESTAMP},
  274. RESULT_MEMO = #{resultMemo,jdbcType=VARCHAR},
  275. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  276. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  277. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  278. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  279. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  280. DELETE_USERNAME = #{deleteUsername,jdbcType=VARCHAR},
  281. DELETE_TIME = #{deleteTime,jdbcType=TIMESTAMP}
  282. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  283. </update>
  284. <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.TmstruckEnfactoryResult">
  285. update TMSTRUCK_ENFACTORY_RESULT
  286. <set>
  287. <if test="resultTotalId != null">
  288. RESULT_TOTAL_ID = #{resultTotalId,jdbcType=DECIMAL},
  289. </if>
  290. <if test="gatepostId != null">
  291. GATEPOST_ID = #{gatepostId,jdbcType=DECIMAL},
  292. </if>
  293. <if test="resultEntryMode != null">
  294. RESULT_ENTRY_MODE = #{resultEntryMode,jdbcType=VARCHAR},
  295. </if>
  296. <if test="resultEntryGateTime != null">
  297. RESULT_ENTRY_GATE_TIME = #{resultEntryGateTime,jdbcType=TIMESTAMP},
  298. </if>
  299. <if test="resultMemo != null">
  300. RESULT_MEMO = #{resultMemo,jdbcType=VARCHAR},
  301. </if>
  302. <if test="insertUsername != null">
  303. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  304. </if>
  305. <if test="insertTime != null">
  306. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  307. </if>
  308. <if test="updateUsername != null">
  309. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  310. </if>
  311. <if test="updateTime != null">
  312. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  313. </if>
  314. <if test="insertUpdateRemark != null">
  315. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  316. </if>
  317. <if test="deleteUsername != null">
  318. DELETE_USERNAME = #{deleteUsername,jdbcType=VARCHAR},
  319. </if>
  320. <if test="deleteTime != null">
  321. DELETE_TIME = #{deleteTime,jdbcType=TIMESTAMP},
  322. </if>
  323. </set>
  324. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  325. </update>
  326. <select id="selectByPrimaryKey" parameterType="java.lang.Short" resultMap="BaseResultMap">
  327. <include refid="select"/>
  328. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  329. </select>
  330. <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  331. <include refid="select"/>
  332. <include refid="where"/>
  333. </select>
  334. <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  335. <include refid="select"/>
  336. <include refid="whereLike"/>
  337. </select>
  338. <insert id="batchInsert" parameterType="java.util.List">
  339. insert into TMSTRUCK_ENFACTORY_RESULT
  340. (RESULT_ID,
  341. RESULT_TOTAL_ID, GATEPOST_ID, RESULT_ENTRY_MODE,
  342. RESULT_ENTRY_GATE_TIME, RESULT_MEMO,
  343. INSERT_USERNAME, INSERT_TIME,
  344. UPDATE_USERNAME, UPDATE_TIME,
  345. INSERT_UPDATE_REMARK, DELETE_USERNAME,
  346. DELETE_TIME)
  347. ( <foreach collection="list" item="item" separator="union all">
  348. select
  349. #{item.resultId,jdbcType=DECIMAL},
  350. #{item.resultTotalId,jdbcType=DECIMAL}, #{item.gatepostId,jdbcType=DECIMAL},
  351. #{item.resultEntryMode,jdbcType=VARCHAR},
  352. #{item.resultEntryGateTime,jdbcType=TIMESTAMP}, #{item.resultMemo,jdbcType=VARCHAR},
  353. #{item.insertUsername,jdbcType=VARCHAR}, #{item.insertTime,jdbcType=TIMESTAMP},
  354. #{item.updateUsername,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP},
  355. #{item.insertUpdateRemark,jdbcType=VARCHAR}, #{item.deleteUsername,jdbcType=VARCHAR},
  356. #{item.deleteTime,jdbcType=TIMESTAMP} from dual
  357. </foreach> )
  358. </insert>
  359. <update id="batchUpdate" parameterType="java.util.List">
  360. update TMSTRUCK_ENFACTORY_RESULT
  361. set
  362. RESULT_ID=
  363. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  364. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultId,jdbcType=DECIMAL}
  365. </foreach>
  366. ,RESULT_TOTAL_ID=
  367. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  368. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultTotalId,jdbcType=DECIMAL}
  369. </foreach>
  370. ,GATEPOST_ID=
  371. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  372. when #{item.resultId,jdbcType=DECIMAL} then #{item.gatepostId,jdbcType=DECIMAL}
  373. </foreach>
  374. ,RESULT_ENTRY_MODE=
  375. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  376. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultEntryMode,jdbcType=VARCHAR}
  377. </foreach>
  378. ,RESULT_ENTRY_GATE_TIME=
  379. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  380. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultEntryGateTime,jdbcType=TIMESTAMP}
  381. </foreach>
  382. ,RESULT_MEMO=
  383. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  384. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultMemo,jdbcType=VARCHAR}
  385. </foreach>
  386. ,INSERT_USERNAME=
  387. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  388. when #{item.resultId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
  389. </foreach>
  390. ,INSERT_TIME=
  391. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  392. when #{item.resultId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
  393. </foreach>
  394. ,UPDATE_USERNAME=
  395. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  396. when #{item.resultId,jdbcType=DECIMAL} then #{item.updateUsername,jdbcType=VARCHAR}
  397. </foreach>
  398. ,UPDATE_TIME=
  399. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  400. when #{item.resultId,jdbcType=DECIMAL} then #{item.updateTime,jdbcType=TIMESTAMP}
  401. </foreach>
  402. ,INSERT_UPDATE_REMARK=
  403. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  404. when #{item.resultId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
  405. </foreach>
  406. ,DELETE_USERNAME=
  407. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  408. when #{item.resultId,jdbcType=DECIMAL} then #{item.deleteUsername,jdbcType=VARCHAR}
  409. </foreach>
  410. ,DELETE_TIME=
  411. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  412. when #{item.resultId,jdbcType=DECIMAL} then #{item.deleteTime,jdbcType=TIMESTAMP}
  413. </foreach>
  414. where RESULT_ID in
  415. <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
  416. #{item.resultId,jdbcType=DECIMAL}
  417. </foreach>
  418. </update>
  419. <delete id="batchDelete" parameterType="java.util.List">
  420. delete from TMSTRUCK_ENFACTORY_RESULT
  421. where RESULT_ID in
  422. <foreach collection="list" item="id" open="(" close=")" separator=",">
  423. #{id}
  424. </foreach>
  425. </delete>
  426. <!-- 友情提示!!!-->
  427. <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
  428. <!-- 按照进厂时间进行排序 -->
  429. <sql id="orderByEnterTime">
  430. <if test="orderField != null and orderField != ''">
  431. order by "${orderField}"
  432. <if test="orderType != null and orderType != ''">
  433. ${orderType}
  434. </if>
  435. </if>
  436. <if test="orderField == null ">
  437. order by "resultEntryGateTime" desc
  438. </if>
  439. </sql>
  440. <!-- 查询所有的采购进厂作业实绩 -->
  441. <select id="getCGJKEnFactoryResult" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
  442. select *
  443. from (
  444. select
  445. TER.RESULT_ID "resultId",
  446. APO.PURCHASE_ORDER_NO "purchaseOrderNo",
  447. RM.MATERIAL_NAME "materialName",
  448. DB.RESULT_FOREIGN_SHIP_NAME "resultForeignShipName",
  449. OO.ORDER_NUMBER "orderNumber",
  450. RC.CAPACITY_NUMBER "capacityNumber",
  451. RG.GATEPOST_NAME "gatepostName",
  452. TER.RESULT_ENTRY_MODE "resultEntryMode",
  453. TER.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
  454. RS.SUPPLIER_NAME "supplierName",
  455. OOM.ORDER_MATERIAL_WEIGHT "orderMaterialWeight",
  456. TER.INSERT_TIME "insertTime",
  457. RCON. CONSIGNEE_COMPANY_NAME "consigneeCompanyName"
  458. from TMSTRUCK_ENFACTORY_RESULT TER
  459. left join TMSTRUCK_TOTAL_RESULT TTR
  460. on TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  461. left join OMSTRUCK_ORDER OO
  462. on TTR.ORDER_ID = OO.ORDER_ID
  463. left join AMS_PURCHASE_ORDER APO
  464. on APO.PURCHASE_ORDER_ID = OO.ORDER_PLAN_ID
  465. left join DIL_BATCH DB
  466. on DB.BATCH_ID = APO.BATCH_ID
  467. left join RMS_DRIVER_CAPACITY RDC
  468. on RDC.DRIVER_CAPACITY_ID = OO.DRIVER_CAPACITY_ID
  469. left join RMS_CAPACITY RC
  470. on RC.CAPACITY_ID = RDC.CAPACITY_ID
  471. left join RMS_SUPPLIER RS
  472. on RS.SUPPLIER_ID = APO.SUPPLIER_UNIT_ID
  473. left join RMS_CONSIGNEE RCON
  474. on RCON.CONSIGNEE_ID = APO.RECEIVE_UNIT_ID
  475. left join OMSTRUCK_ORDER_MATERIAL OOM
  476. on OOM.ORDER_ID = OO.ORDER_ID
  477. left join RMS_MATERIAL RM
  478. on RM.MATERIAL_ID = OOM.MATERIAL_ID
  479. left join RMS_GATEPOST RG
  480. on RG.GATEPOST_ID = TER.GATEPOST_ID
  481. where TER.RESULT_ENTRY_GATE_TIME is not null and OO.ORDER_TYPE = #{orderTypee}
  482. )
  483. <where>
  484. <if test="purchaseOrderId != null">
  485. <foreach collection="purchaseOrderId" item="item" open="(" separator="or" close=")">
  486. "purchaseOrderId" like '%${item}%'
  487. </foreach>
  488. </if>
  489. <if test="materialName != null">
  490. and
  491. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  492. "materialName" like '%${item}%'
  493. </foreach>
  494. </if>
  495. <if test="resultForeignShipName != null">
  496. and
  497. <foreach collection="resultForeignShipName" item="item" open="(" separator="or" close=")">
  498. "resultForeignShipName" like '%${item}%'
  499. </foreach>
  500. </if>
  501. <if test="orderNumber != null">
  502. and
  503. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  504. "orderNumber" like '%${item}%'
  505. </foreach>
  506. </if>
  507. <if test="capacityNumber != null">
  508. and
  509. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  510. "capacityNumber" like '%${item}%'
  511. </foreach>
  512. </if>
  513. <if test="warehouseName != null">
  514. and
  515. <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
  516. "warehouseName" like '%${item}%'
  517. </foreach>
  518. </if>
  519. <if test="resultEntryMode != null">
  520. and
  521. <foreach collection="resultEntryMode" item="item" open="(" separator="or" close=")">
  522. "resultEntryMode" like '%${item}%'
  523. </foreach>
  524. </if>
  525. <if test="supplierName != null">
  526. and
  527. <foreach collection="supplierName" item="item" open="(" separator="or" close=")">
  528. "supplierName" like '%${item}%'
  529. </foreach>
  530. </if>
  531. <if test="orderMaterialWeight != null">
  532. and
  533. <foreach collection="orderMaterialWeight" item="item" open="(" separator="or" close=")">
  534. "orderMaterialWeight" like '%${item}%'
  535. </foreach>
  536. </if>
  537. </where>
  538. <include refid="orderByEnterTime"></include>
  539. </select>
  540. <!-- 查询内转进厂作业实绩 -->
  541. <select id="getAllInwardTurnEnFactoryResult" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
  542. select *
  543. from (
  544. select
  545. RM.MATERIAL_NAME "materialName",
  546. OO.ORDER_NUMBER "orderNumber",
  547. RC.CAPACITY_NUMBER "capacityNumber",
  548. RG.GATEPOST_NAME "gatepostName",
  549. TER.RESULT_ENTRY_MODE "resultEntryMode",
  550. TER.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
  551. (
  552. CASE
  553. WHEN OOM.ORDER_MATERIAL_WEIGHT is null
  554. THEN OOM.ORDER_MATERIAL_NUMBER
  555. ELSE OOM.ORDER_MATERIAL_WEIGHT
  556. END
  557. ) "orderMaterialNo"
  558. from TMSTRUCK_ENFACTORY_RESULT TER
  559. left join TMSTRUCK_TOTAL_RESULT TTR
  560. on TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  561. left join OMSTRUCK_ORDER OO
  562. on TTR.ORDER_ID = OO.ORDER_ID
  563. left join RMS_CAPACITY RC
  564. on RC.CAPACITY_ID = OO.CAPACITY_ID
  565. left join OMSTRUCK_ORDER_MATERIAL OOM
  566. on OOM.ORDER_ID = OO.ORDER_ID
  567. left join RMS_MATERIAL RM
  568. on RM.MATERIAL_ID = OOM.MATERIAL_ID
  569. left join RMS_GATEPOST RG
  570. on RG.GATEPOST_ID = TER.GATEPOST_ID
  571. where TER.RESULT_ENTRY_GATE_TIME is not null and OO.ORDER_TYPE = 4
  572. )
  573. <where>
  574. <if test="materialName != null">
  575. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  576. "materialName" like '%${item}%'
  577. </foreach>
  578. </if>
  579. <if test="orderNumber != null">
  580. and
  581. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  582. "orderNumber" like '%${item}%'
  583. </foreach>
  584. </if>
  585. <if test="capacityNumber != null">
  586. and
  587. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  588. "capacityNumber" like '%${item}%'
  589. </foreach>
  590. </if>
  591. <if test="resultEntryMode != null">
  592. and
  593. <foreach collection="resultEntryMode" item="item" open="(" separator="or" close=")">
  594. "resultEntryMode" like '%${item}%'
  595. </foreach>
  596. </if>
  597. <if test="orderMaterialNo != null">
  598. and
  599. <foreach collection="orderMaterialNo" item="item" open="(" separator="or" close=")">
  600. "orderMaterialNo" like '%${item}%'
  601. </foreach>
  602. </if>
  603. </where>
  604. <include refid="orderByEnterTime"></include>
  605. </select>
  606. <!-- 通过车牌号并且状态不为2 或 运输订单 或运输订单ID 查询关联的实绩总表ID -->
  607. <select id="selectOrderIdByCpAndOn" parameterType="java.util.Map" resultType="int">
  608. select TTR.RESULT_TOTAL_ID "resultTotalId"
  609. from OMSTRUCK_ORDER OO
  610. left join TMSTRUCK_TOTAL_RESULT TTR
  611. on TTR.ORDER_ID = OO.ORDER_ID
  612. left join RMS_CAPACITY RC
  613. on RC.CAPACITY_ID = OO.CAPACITY_ID
  614. <where>
  615. <if test="orderId != null">
  616. OO.ORDER_ID = #{orderId}
  617. </if>
  618. <if test="orderNumber != null">
  619. and OO.ORDER_NUMBER = #{orderNumber}
  620. </if>
  621. <if test="capacityNumber != null">
  622. RC.CAPACITY_NUMBER = #{capacityNumber} and OO.ORDER_STATUS != 2 --司机还未结束不能生成下一单
  623. </if>
  624. </where>
  625. </select>
  626. <!-- 通过门岗名称查询门岗Id-->
  627. <select id="selectGatepostIdByGatepostName" parameterType="java.lang.String" resultType="int">
  628. select GATEPOST_ID "gatepostId"
  629. from RMS_GATEPOST
  630. where GATEPOST_NAME = #{gatepostName}
  631. </select>
  632. <!-- 通过运输订单号查找实绩Id -->
  633. <select id="selectEnFactoryResultId" parameterType="string" resultType="java.util.Map">
  634. select TER.RESULT_ID "resultId",
  635. OO.ORDER_ID "orderId",
  636. OO.ORDER_TYPE "orderTypee", --避免与筛选条件重名
  637. TER.RESULT_TOTAL_ID "resultTotalId"
  638. from OMSTRUCK_ORDER OO
  639. left join TMSTRUCK_TOTAL_RESULT TTR
  640. on OO.ORDER_ID = TTR.ORDER_ID
  641. left join TMSTRUCK_ENFACTORY_RESULT TER
  642. on TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  643. where OO.ORDER_NUMBER = #{orderNumber}
  644. </select>
  645. <!-- 查找排队序号 -->
  646. <select id="selectNodeNumber" resultType="int" parameterType="string">
  647. select (
  648. <![CDATA[
  649. select count(*)
  650. from QMS_QUEUE_LIST QQL2
  651. join QMS_QUEUE_GRID QQG2
  652. on QQG2.GRID_ID = QQL2.GRID_ID
  653. where QQL2.LIST_NODE_ORDER <= QQL.LIST_NODE_ORDER
  654. and QQL2.GRID_ID = QQL.GRID_ID
  655. and QQL2.DELETED = 0
  656. ]]>
  657. ) "listNodeOrder"
  658. from OMSTRUCK_ORDER OO
  659. left join QMS_QUEUE_LIST QQL
  660. on OO.CAPACITY_ID = QQL.CAPACITY_ID
  661. where OO.ORDER_NUMBER = #{orderNumber}
  662. and QQL.DELETED = 1
  663. </select>
  664. <!--查询销售进厂实绩 -->
  665. <select id="getXSEnFactoryResult" parameterType="java.util.Map" resultType="java.util.Map">
  666. select *
  667. from (
  668. select
  669. TER.RESULT_ID "resultId",
  670. ASO.SALE_NUMBER "saleNumber",
  671. RM.MATERIAL_NAME "materialName",
  672. OO.ORDER_NUMBER "orderNumber",
  673. RC.CAPACITY_NUMBER "capacityNumber",
  674. RG.GATEPOST_NAME "gatepostName",
  675. TER.RESULT_ENTRY_MODE "resultEntryMode",
  676. TER.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
  677. RS.SHIPPER_NAME "shipperName",
  678. OOM.ORDER_MATERIAL_NUMBER "orderMaterialNumber",
  679. TER.INSERT_TIME "insertTime",
  680. RCON. CONSIGNEE_COMPANY_NAME "consigneeCompanyName"
  681. from TMSTRUCK_ENFACTORY_RESULT TER
  682. left join TMSTRUCK_TOTAL_RESULT TTR
  683. on TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  684. left join OMSTRUCK_ORDER OO
  685. on TTR.ORDER_ID = OO.ORDER_ID
  686. left join AMS_SALE_ORDER ASO
  687. on ASO.SALE_ORDER_ID = OO.ORDER_PLAN_ID
  688. left join RMS_DRIVER_CAPACITY RDC
  689. on RDC.DRIVER_CAPACITY_ID = OO.DRIVER_CAPACITY_ID
  690. left join RMS_CAPACITY RC
  691. on RC.CAPACITY_ID = RDC.CAPACITY_ID
  692. left join RMS_SHIPPER RS
  693. on RS.SHIPPER_ID = ASO.SHIPPER_ID
  694. left join RMS_CONSIGNEE RCON
  695. on RCON.CONSIGNEE_ID = ASO.RECEIVE_ID
  696. left join OMSTRUCK_ORDER_MATERIAL OOM
  697. on OOM.ORDER_ID = OO.ORDER_ID
  698. left join RMS_MATERIAL RM
  699. on RM.MATERIAL_ID = OOM.MATERIAL_ID
  700. left join RMS_GATEPOST RG
  701. on RG.GATEPOST_ID = TER.GATEPOST_ID
  702. where TER.RESULT_ENTRY_GATE_TIME is not null and OO.ORDER_TYPE = #{orderTypee}
  703. )
  704. <where>
  705. <if test="saleNumber != null">
  706. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  707. "saleNumber" like '%${item}%'
  708. </foreach>
  709. </if>
  710. <if test="materialName != null">
  711. and
  712. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  713. "materialName" like '%${item}%'
  714. </foreach>
  715. </if>
  716. <if test="gatepostName != null">
  717. and
  718. <foreach collection="gatepostName" item="item" open="(" separator="or" close=")">
  719. "gatepostName" like '%${item}%'
  720. </foreach>
  721. </if>
  722. <if test="orderNumber != null">
  723. and
  724. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  725. "orderNumber" like '%${item}%'
  726. </foreach>
  727. </if>
  728. <if test="capacityNumber != null">
  729. and
  730. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  731. "capacityNumber" like '%${item}%'
  732. </foreach>
  733. </if>
  734. <if test="shipperName != null">
  735. and
  736. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  737. "shipperName" like '%${item}%'
  738. </foreach>
  739. </if>
  740. <if test="resultEntryMode != null">
  741. and
  742. <foreach collection="resultEntryMode" item="item" open="(" separator="or" close=")">
  743. "resultEntryMode" like '%${item}%'
  744. </foreach>
  745. </if>
  746. <if test="resultEntryGateTime != null">
  747. and
  748. <foreach collection="resultEntryGateTime" item="item" open="(" separator="or" close=")">
  749. "resultEntryGateTime" like '%${item}%'
  750. </foreach>
  751. </if>
  752. <if test="consigneeCompanyName != null">
  753. and
  754. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  755. "consigneeCompanyName" like '%${item}%'
  756. </foreach>
  757. </if>
  758. <if test="orderMaterialNumber != null">
  759. and
  760. <foreach collection="orderMaterialNumber" item="item" open="(" separator="or" close=")">
  761. "orderMaterialNumber" like '%${item}%'
  762. </foreach>
  763. </if>
  764. </where>
  765. <include refid="orderByEnterTime"></include>
  766. </select>
  767. </mapper>