TmstruckQualityResultMapper.xml 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742
  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.TmstruckQualityResultMapper">
  4. <resultMap id="BaseResultMap" type="com.steerinfo.dil.model.TmstruckQualityResult">
  5. <id column="RESULT_ID" jdbcType="DECIMAL" property="resultId" />
  6. <result column="TOTAL_RESULT_ID" jdbcType="DECIMAL" property="totalResultId" />
  7. <result column="RESULT_ISSAMPLING" jdbcType="DECIMAL" property="resultIssampling" />
  8. <result column="RESULT_DEDUCTION" jdbcType="DECIMAL" property="resultDeduction" />
  9. <result column="RESULT_DEDUCTION_DESCRIPTION" jdbcType="VARCHAR" property="resultDeductionDescription" />
  10. <result column="RESULT_SAMPLING_POINT_ID" jdbcType="DECIMAL" property="resultSamplingPointId" />
  11. <result column="RESULT_CONCLUSION" jdbcType="DECIMAL" property="resultConclusion" />
  12. <result column="INSERT_USERNAME" jdbcType="VARCHAR" property="insertUsername" />
  13. <result column="INSERT_TIME" jdbcType="TIMESTAMP" property="insertTime" />
  14. <result column="UPDATE_USERNAME" jdbcType="VARCHAR" property="updateUsername" />
  15. <result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime" />
  16. <result column="INSERT_UPDATE_REMARK" jdbcType="VARCHAR" property="insertUpdateRemark" />
  17. </resultMap>
  18. <sql id="columns">
  19. RESULT_ID, TOTAL_RESULT_ID, RESULT_ISSAMPLING, RESULT_DEDUCTION, RESULT_DEDUCTION_DESCRIPTION,
  20. RESULT_SAMPLING_POINT_ID, RESULT_CONCLUSION, INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME,
  21. UPDATE_TIME, INSERT_UPDATE_REMARK
  22. </sql>
  23. <sql id="columns_alias">
  24. t.RESULT_ID, t.TOTAL_RESULT_ID, t.RESULT_ISSAMPLING, t.RESULT_DEDUCTION, t.RESULT_DEDUCTION_DESCRIPTION,
  25. t.RESULT_SAMPLING_POINT_ID, t.RESULT_CONCLUSION, t.INSERT_USERNAME, t.INSERT_TIME,
  26. t.UPDATE_USERNAME, t.UPDATE_TIME, t.INSERT_UPDATE_REMARK
  27. </sql>
  28. <sql id="select">
  29. SELECT <include refid="columns"/> FROM TMSTRUCK_QUALITY_RESULT
  30. </sql>
  31. <sql id="select_alias">
  32. SELECT <include refid="columns_alias"/> FROM TMSTRUCK_QUALITY_RESULT t
  33. </sql>
  34. <sql id="where">
  35. <where>
  36. <if test="resultId != null">
  37. and RESULT_ID = #{resultId}
  38. </if>
  39. <if test="totalResultId != null">
  40. and TOTAL_RESULT_ID = #{totalResultId}
  41. </if>
  42. <if test="resultIssampling != null">
  43. and RESULT_ISSAMPLING = #{resultIssampling}
  44. </if>
  45. <if test="resultDeduction != null">
  46. and RESULT_DEDUCTION = #{resultDeduction}
  47. </if>
  48. <if test="resultDeductionDescription != null and resultDeductionDescription != ''">
  49. and RESULT_DEDUCTION_DESCRIPTION = #{resultDeductionDescription}
  50. </if>
  51. <if test="resultSamplingPointId != null">
  52. and RESULT_SAMPLING_POINT_ID = #{resultSamplingPointId}
  53. </if>
  54. <if test="resultConclusion != null">
  55. and RESULT_CONCLUSION = #{resultConclusion}
  56. </if>
  57. <if test="insertUsername != null and insertUsername != ''">
  58. and INSERT_USERNAME = #{insertUsername}
  59. </if>
  60. <if test="insertTime != null">
  61. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  62. </if>
  63. <if test="updateUsername != null and updateUsername != ''">
  64. and UPDATE_USERNAME = #{updateUsername}
  65. </if>
  66. <if test="updateTime != null">
  67. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  68. </if>
  69. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  70. and INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  71. </if>
  72. </where>
  73. </sql>
  74. <sql id="whereLike">
  75. <where>
  76. <if test="resultId != null">
  77. and RESULT_ID = #{resultId}
  78. </if>
  79. <if test="totalResultId != null">
  80. and TOTAL_RESULT_ID = #{totalResultId}
  81. </if>
  82. <if test="resultIssampling != null">
  83. and RESULT_ISSAMPLING = #{resultIssampling}
  84. </if>
  85. <if test="resultDeduction != null">
  86. and RESULT_DEDUCTION = #{resultDeduction}
  87. </if>
  88. <if test="resultDeductionDescription != null and resultDeductionDescription != ''">
  89. and RESULT_DEDUCTION_DESCRIPTION LIKE '%${resultDeductionDescription}%'
  90. </if>
  91. <if test="resultSamplingPointId != null">
  92. and RESULT_SAMPLING_POINT_ID = #{resultSamplingPointId}
  93. </if>
  94. <if test="resultConclusion != null">
  95. and RESULT_CONCLUSION = #{resultConclusion}
  96. </if>
  97. <if test="insertUsername != null and insertUsername != ''">
  98. and INSERT_USERNAME LIKE '%${insertUsername}%'
  99. </if>
  100. <if test="insertTime != null">
  101. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  102. </if>
  103. <if test="updateUsername != null and updateUsername != ''">
  104. and UPDATE_USERNAME LIKE '%${updateUsername}%'
  105. </if>
  106. <if test="updateTime != null">
  107. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  108. </if>
  109. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  110. and INSERT_UPDATE_REMARK LIKE '%${insertUpdateRemark}%'
  111. </if>
  112. </where>
  113. </sql>
  114. <delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal">
  115. delete from TMSTRUCK_QUALITY_RESULT
  116. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  117. </delete>
  118. <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
  119. delete from TMSTRUCK_QUALITY_RESULT
  120. where 1!=1
  121. <if test="totalResultId != null">
  122. or TOTAL_RESULT_ID = #{totalResultId}
  123. </if>
  124. <if test="resultIssampling != null">
  125. or RESULT_ISSAMPLING = #{resultIssampling}
  126. </if>
  127. <if test="resultDeduction != null">
  128. or RESULT_DEDUCTION = #{resultDeduction}
  129. </if>
  130. <if test="resultDeductionDescription != null and resultDeductionDescription != ''">
  131. or RESULT_DEDUCTION_DESCRIPTION = #{resultDeductionDescription}
  132. </if>
  133. <if test="resultSamplingPointId != null">
  134. or RESULT_SAMPLING_POINT_ID = #{resultSamplingPointId}
  135. </if>
  136. <if test="resultConclusion != null">
  137. or RESULT_CONCLUSION = #{resultConclusion}
  138. </if>
  139. <if test="insertUsername != null and insertUsername != ''">
  140. or INSERT_USERNAME = #{insertUsername}
  141. </if>
  142. <if test="insertTime != null">
  143. or TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = '#{insertTime}'
  144. </if>
  145. <if test="updateUsername != null and updateUsername != ''">
  146. or UPDATE_USERNAME = #{updateUsername}
  147. </if>
  148. <if test="updateTime != null">
  149. or TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = '#{updateTime}'
  150. </if>
  151. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  152. or INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  153. </if>
  154. </delete>
  155. <insert id="insert" parameterType="com.steerinfo.dil.model.TmstruckQualityResult">
  156. insert into TMSTRUCK_QUALITY_RESULT (RESULT_ID, TOTAL_RESULT_ID, RESULT_ISSAMPLING,
  157. RESULT_DEDUCTION, RESULT_DEDUCTION_DESCRIPTION,
  158. RESULT_SAMPLING_POINT_ID, RESULT_CONCLUSION,
  159. INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME,
  160. UPDATE_TIME, INSERT_UPDATE_REMARK)
  161. values (#{resultId,jdbcType=DECIMAL}, #{totalResultId,jdbcType=DECIMAL}, #{resultIssampling,jdbcType=DECIMAL},
  162. #{resultDeduction,jdbcType=DECIMAL}, #{resultDeductionDescription,jdbcType=VARCHAR},
  163. #{resultSamplingPointId,jdbcType=DECIMAL}, #{resultConclusion,jdbcType=DECIMAL},
  164. #{insertUsername,jdbcType=VARCHAR}, #{insertTime,jdbcType=TIMESTAMP}, #{updateUsername,jdbcType=VARCHAR},
  165. #{updateTime,jdbcType=TIMESTAMP}, #{insertUpdateRemark,jdbcType=VARCHAR})
  166. </insert>
  167. <insert id="insertSelective" parameterType="com.steerinfo.dil.model.TmstruckQualityResult">
  168. insert into TMSTRUCK_QUALITY_RESULT
  169. <trim prefix="(" suffix=")" suffixOverrides=",">
  170. <if test="resultId != null">
  171. RESULT_ID,
  172. </if>
  173. <if test="totalResultId != null">
  174. TOTAL_RESULT_ID,
  175. </if>
  176. <if test="resultIssampling != null">
  177. RESULT_ISSAMPLING,
  178. </if>
  179. <if test="resultDeduction != null">
  180. RESULT_DEDUCTION,
  181. </if>
  182. <if test="resultDeductionDescription != null">
  183. RESULT_DEDUCTION_DESCRIPTION,
  184. </if>
  185. <if test="resultSamplingPointId != null">
  186. RESULT_SAMPLING_POINT_ID,
  187. </if>
  188. <if test="resultConclusion != null">
  189. RESULT_CONCLUSION,
  190. </if>
  191. <if test="insertUsername != null">
  192. INSERT_USERNAME,
  193. </if>
  194. <if test="insertTime != null">
  195. INSERT_TIME,
  196. </if>
  197. <if test="updateUsername != null">
  198. UPDATE_USERNAME,
  199. </if>
  200. <if test="updateTime != null">
  201. UPDATE_TIME,
  202. </if>
  203. <if test="insertUpdateRemark != null">
  204. INSERT_UPDATE_REMARK,
  205. </if>
  206. </trim>
  207. <trim prefix="values (" suffix=")" suffixOverrides=",">
  208. <if test="resultId != null">
  209. #{resultId,jdbcType=DECIMAL},
  210. </if>
  211. <if test="totalResultId != null">
  212. #{totalResultId,jdbcType=DECIMAL},
  213. </if>
  214. <if test="resultIssampling != null">
  215. #{resultIssampling,jdbcType=DECIMAL},
  216. </if>
  217. <if test="resultDeduction != null">
  218. #{resultDeduction,jdbcType=DECIMAL},
  219. </if>
  220. <if test="resultDeductionDescription != null">
  221. #{resultDeductionDescription,jdbcType=VARCHAR},
  222. </if>
  223. <if test="resultSamplingPointId != null">
  224. #{resultSamplingPointId,jdbcType=DECIMAL},
  225. </if>
  226. <if test="resultConclusion != null">
  227. #{resultConclusion,jdbcType=DECIMAL},
  228. </if>
  229. <if test="insertUsername != null">
  230. #{insertUsername,jdbcType=VARCHAR},
  231. </if>
  232. <if test="insertTime != null">
  233. #{insertTime,jdbcType=TIMESTAMP},
  234. </if>
  235. <if test="updateUsername != null">
  236. #{updateUsername,jdbcType=VARCHAR},
  237. </if>
  238. <if test="updateTime != null">
  239. #{updateTime,jdbcType=TIMESTAMP},
  240. </if>
  241. <if test="insertUpdateRemark != null">
  242. #{insertUpdateRemark,jdbcType=VARCHAR},
  243. </if>
  244. </trim>
  245. </insert>
  246. <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.TmstruckQualityResult">
  247. update TMSTRUCK_QUALITY_RESULT
  248. set TOTAL_RESULT_ID = #{totalResultId,jdbcType=DECIMAL},
  249. RESULT_ISSAMPLING = #{resultIssampling,jdbcType=DECIMAL},
  250. RESULT_DEDUCTION = #{resultDeduction,jdbcType=DECIMAL},
  251. RESULT_DEDUCTION_DESCRIPTION = #{resultDeductionDescription,jdbcType=VARCHAR},
  252. RESULT_SAMPLING_POINT_ID = #{resultSamplingPointId,jdbcType=DECIMAL},
  253. RESULT_CONCLUSION = #{resultConclusion,jdbcType=DECIMAL},
  254. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  255. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  256. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  257. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  258. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR}
  259. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  260. </update>
  261. <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.TmstruckQualityResult">
  262. update TMSTRUCK_QUALITY_RESULT
  263. <set>
  264. <if test="totalResultId != null">
  265. TOTAL_RESULT_ID = #{totalResultId,jdbcType=DECIMAL},
  266. </if>
  267. <if test="resultIssampling != null">
  268. RESULT_ISSAMPLING = #{resultIssampling,jdbcType=DECIMAL},
  269. </if>
  270. <if test="resultDeduction != null">
  271. RESULT_DEDUCTION = #{resultDeduction,jdbcType=DECIMAL},
  272. </if>
  273. <if test="resultDeductionDescription != null">
  274. RESULT_DEDUCTION_DESCRIPTION = #{resultDeductionDescription,jdbcType=VARCHAR},
  275. </if>
  276. <if test="resultSamplingPointId != null">
  277. RESULT_SAMPLING_POINT_ID = #{resultSamplingPointId,jdbcType=DECIMAL},
  278. </if>
  279. <if test="resultConclusion != null">
  280. RESULT_CONCLUSION = #{resultConclusion,jdbcType=DECIMAL},
  281. </if>
  282. <if test="insertUsername != null">
  283. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  284. </if>
  285. <if test="insertTime != null">
  286. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  287. </if>
  288. <if test="updateUsername != null">
  289. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  290. </if>
  291. <if test="updateTime != null">
  292. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  293. </if>
  294. <if test="insertUpdateRemark != null">
  295. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  296. </if>
  297. </set>
  298. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  299. </update>
  300. <select id="selectByPrimaryKey" parameterType="java.math.BigDecimal" resultMap="BaseResultMap">
  301. <include refid="select"/>
  302. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  303. </select>
  304. <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  305. <include refid="select"/>
  306. <include refid="where"/>
  307. </select>
  308. <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  309. <include refid="select"/>
  310. <include refid="whereLike"/>
  311. </select>
  312. <insert id="batchInsert" parameterType="java.util.List">
  313. insert into TMSTRUCK_QUALITY_RESULT
  314. (RESULT_ID,
  315. TOTAL_RESULT_ID, RESULT_ISSAMPLING,
  316. RESULT_DEDUCTION, RESULT_DEDUCTION_DESCRIPTION,
  317. RESULT_SAMPLING_POINT_ID, RESULT_CONCLUSION,
  318. INSERT_USERNAME, INSERT_TIME,
  319. UPDATE_USERNAME, UPDATE_TIME,
  320. INSERT_UPDATE_REMARK)
  321. ( <foreach collection="list" item="item" separator="union all">
  322. select
  323. #{item.resultId,jdbcType=DECIMAL},
  324. #{item.totalResultId,jdbcType=DECIMAL}, #{item.resultIssampling,jdbcType=DECIMAL},
  325. #{item.resultDeduction,jdbcType=DECIMAL}, #{item.resultDeductionDescription,jdbcType=VARCHAR},
  326. #{item.resultSamplingPointId,jdbcType=DECIMAL}, #{item.resultConclusion,jdbcType=DECIMAL},
  327. #{item.insertUsername,jdbcType=VARCHAR}, #{item.insertTime,jdbcType=TIMESTAMP},
  328. #{item.updateUsername,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP},
  329. #{item.insertUpdateRemark,jdbcType=VARCHAR} from dual
  330. </foreach> )
  331. </insert>
  332. <update id="batchUpdate" parameterType="java.util.List">
  333. update TMSTRUCK_QUALITY_RESULT
  334. set
  335. RESULT_ID=
  336. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  337. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultId,jdbcType=DECIMAL}
  338. </foreach>
  339. ,TOTAL_RESULT_ID=
  340. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  341. when #{item.resultId,jdbcType=DECIMAL} then #{item.totalResultId,jdbcType=DECIMAL}
  342. </foreach>
  343. ,RESULT_ISSAMPLING=
  344. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  345. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultIssampling,jdbcType=DECIMAL}
  346. </foreach>
  347. ,RESULT_DEDUCTION=
  348. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  349. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultDeduction,jdbcType=DECIMAL}
  350. </foreach>
  351. ,RESULT_DEDUCTION_DESCRIPTION=
  352. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  353. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultDeductionDescription,jdbcType=VARCHAR}
  354. </foreach>
  355. ,RESULT_SAMPLING_POINT_ID=
  356. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  357. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultSamplingPointId,jdbcType=DECIMAL}
  358. </foreach>
  359. ,RESULT_CONCLUSION=
  360. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  361. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultConclusion,jdbcType=DECIMAL}
  362. </foreach>
  363. ,INSERT_USERNAME=
  364. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  365. when #{item.resultId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
  366. </foreach>
  367. ,INSERT_TIME=
  368. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  369. when #{item.resultId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
  370. </foreach>
  371. ,UPDATE_USERNAME=
  372. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  373. when #{item.resultId,jdbcType=DECIMAL} then #{item.updateUsername,jdbcType=VARCHAR}
  374. </foreach>
  375. ,UPDATE_TIME=
  376. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  377. when #{item.resultId,jdbcType=DECIMAL} then #{item.updateTime,jdbcType=TIMESTAMP}
  378. </foreach>
  379. ,INSERT_UPDATE_REMARK=
  380. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  381. when #{item.resultId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
  382. </foreach>
  383. where RESULT_ID in
  384. <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
  385. #{item.resultId,jdbcType=DECIMAL}
  386. </foreach>
  387. </update>
  388. <delete id="batchDelete" parameterType="java.util.List">
  389. delete from TMSTRUCK_QUALITY_RESULT
  390. where RESULT_ID in
  391. <foreach collection="list" item="id" open="(" close=")" separator=",">
  392. #{id}
  393. </foreach>
  394. </delete>
  395. <!-- 友情提示!!!-->
  396. <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
  397. <!-- 通过签收时间排序 -->
  398. <sql id="orderBy">
  399. <if test="orderField != null and orderField != ''">
  400. order by "${orderField}"
  401. <if test="orderType != null and orderType != ''">
  402. ${orderType}
  403. </if>
  404. </if>
  405. <if test="orderField == null ">
  406. order by "insertTime" desc
  407. </if>
  408. </sql>
  409. <!-- 查询所有的质检作业 -->
  410. <select id="getQualityResult" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
  411. select *
  412. from (
  413. select
  414. TQR.RESULT_ID "resultId",
  415. APO.PURCHASE_ORDER_NO "purchaseOrderNo",
  416. RM.MATERIAL_NAME "materialName",
  417. DB.RESULT_FOREIGN_SHIP_NAME "resultForeignShipName",
  418. OO.ORDER_NUMBER "orderNumber",
  419. TWR.RESULT_POUND_NO "resultPoundNo",
  420. RC.CAPACITY_NUMBER "capacityNumber",
  421. TQR.RESULT_ISSAMPLING "resultIssampling",
  422. TQR.RESULT_DEDUCTION "resultDeduction",
  423. TQR.RESULT_DEDUCTION_DESCRIPTION "resultDeductionDescription",
  424. RW.WAREHOUSE_NAME "warehouseName",
  425. TQR.INSERT_TIME "insertTime",
  426. TQR.RESULT_SAMPLING_TIME "samplingTime"
  427. from TMSTRUCK_QUALITY_RESULT TQR
  428. left join TMSTRUCK_TOTAL_RESULT TTR
  429. on TQR.TOTAL_RESULT_ID = TTR.RESULT_TOTAL_ID
  430. left join OMSTRUCK_ORDER OO
  431. on OO.ORDER_ID = TTR.ORDER_ID
  432. left join AMS_PURCHASE_ORDER APO
  433. on APO.PURCHASE_ORDER_ID = OO.ORDER_PLAN_ID
  434. left join DIL_BATCH DB
  435. on DB.BATCH_ID = APO.BATCH_ID
  436. left join TMSTRUCK_WEIGHT_RESULT TWR
  437. on TWR.RESULT_TOTAL_ID = TQR.TOTAL_RESULT_ID
  438. left join RMS_CAPACITY RC
  439. on RC.CAPACITY_ID = OO.CAPACITY_ID
  440. left join RMS_WAREHOUSE RW
  441. on RW.WAREHOUSE_ID = TQR.RESULT_SAMPLING_POINT_ID
  442. left join RMS_MATERIAL RM
  443. on RM.MATERIAL_ID = DB.MATERIAL_ID
  444. WHERE
  445. <if test="oneDate != null">
  446. to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt; = TQR.RESULT_SAMPLING_TIME
  447. </if>
  448. <if test="startDate != null">
  449. to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt; = TQR.RESULT_SAMPLING_TIME
  450. and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TQR.RESULT_SAMPLING_TIME
  451. </if>
  452. <if test="con!=null">
  453. and ((instr(RW.WAREHOUSE_NAME, #{con}) > 0) or (instr(OO.ORDER_NUMBER, #{con}) > 0)
  454. or (instr( RC.CAPACITY_NUMBER, #{con}) > 0) or (instr(RM.MATERIAL_NAME , #{con}) > 0))
  455. </if>
  456. )
  457. <where>
  458. <if test="purchaseOrderNo != null">
  459. <foreach collection="purchaseOrderNo" item="item" open="(" separator="or" close=")">
  460. "purchaseOrderNo" like '%${item}%'
  461. </foreach>
  462. </if>
  463. <if test="materialName != null">
  464. and
  465. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  466. "materialName" like '%${item}%'
  467. </foreach>
  468. </if>
  469. <if test="orderNumber != null">
  470. and
  471. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  472. "orderNumber" like '%${item}%'
  473. </foreach>
  474. </if>
  475. <if test="capacityNumber != null">
  476. and
  477. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  478. "capacityNumber" like '%${item}%'
  479. </foreach>
  480. </if>
  481. <if test="resultForeignShipName != null">
  482. and
  483. <foreach collection="resultForeignShipName" item="item" open="(" separator="or" close=")">
  484. "resultForeignShipName" like '%${item}%'
  485. </foreach>
  486. </if>
  487. <if test="resultPoundNo != null">
  488. and
  489. <foreach collection="resultPoundNo" item="item" open="(" separator="or" close=")">
  490. "resultPoundNo" like '%${item}%'
  491. </foreach>
  492. </if>
  493. <if test="resultIssampling != null">
  494. and
  495. <foreach collection="resultIssampling" item="item" open="(" separator="or" close=")">
  496. "resultIssampling" like '%${item}%'
  497. </foreach>
  498. </if>
  499. <if test="resultDeduction != null">
  500. and
  501. <foreach collection="resultDeduction" item="item" open="(" separator="or" close=")">
  502. "resultDeduction" like '%${item}%'
  503. </foreach>
  504. </if>
  505. <if test="resultDeductionDescription != null">
  506. and
  507. <foreach collection="resultDeductionDescription" item="item" open="(" separator="or" close=")">
  508. "resultDeductionDescription" like '%${item}%'
  509. </foreach>
  510. </if>
  511. <if test="warehouseName != null">
  512. and
  513. <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
  514. "warehouseName" like '%${item}%'
  515. </foreach>
  516. </if>
  517. </where>
  518. <include refid="orderBy"></include>
  519. </select>
  520. <!-- 通过ID查询质检作业实绩 -->
  521. <select id="getQualityResultById" parameterType="int" resultType="java.util.Map">
  522. select
  523. OO.ORDER_NUMBER "orderNumber",
  524. TWR.RESULT_POUND_NO "resultPoundNo",
  525. RC.CAPACITY_NUMBER "capacityNumber",
  526. TQR.RESULT_ISSAMPLING "resultIssampling",
  527. TQR.RESULT_DEDUCTION "resultDeduction",
  528. TQR.RESULT_DEDUCTION_DESCRIPTION "resultDeductionDescription",
  529. TQR.RESULT_SAMPLING_POINT_ID "resultSamplingPointId"
  530. from TMSTRUCK_QUALITY_RESULT TQR
  531. left join TMSTRUCK_TOTAL_RESULT TTR
  532. on TQR.TOTAL_RESULT_ID = TTR.RESULT_TOTAL_ID
  533. left join OMSTRUCK_ORDER OO
  534. on OO.ORDER_ID = TTR.ORDER_ID
  535. left join RMS_CAPACITY RC
  536. on RC.CAPACITY_ID = OO.CAPACITY_ID
  537. left join TMSTRUCK_WEIGHT_RESULT TWR
  538. on TWR.RESULT_TOTAL_ID = TQR.TOTAL_RESULT_ID
  539. where RESULT_ID = #{resultId}
  540. </select>
  541. <select id="getInwardQualityResult" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
  542. select
  543. *
  544. from(
  545. select TQR.RESULT_ID "resultId",
  546. APO.PURCHASE_ORDER_NO "purchaseOrderNo",
  547. RM.MATERIAL_NAME "materialName",
  548. DB.RESULT_FOREIGN_SHIP_NAME "resultForeignShipName",
  549. OO.ORDER_NUMBER "orderNumber",
  550. TWR.RESULT_POUND_NO "resultPoundNo",
  551. RC.CAPACITY_NUMBER "capacityNumber",
  552. TQR.RESULT_ISSAMPLING "resultIssampling",
  553. TQR.RESULT_DEDUCTION "resultDeduction",
  554. TQR.RESULT_DEDUCTION_DESCRIPTION "resultDeductionDescription",
  555. RW.WAREHOUSE_NAME "warehouseName",
  556. TQR.INSERT_TIME "insertTime"
  557. from TMSTRUCK_QUALITY_RESULT TQR
  558. left join rms_warehouse rw
  559. on rw.warehouse_id = tqr.result_sampling_point_id
  560. left join TMSTRUCK_TOTAL_RESULT TTR
  561. on TQR.TOTAL_RESULT_ID = TTR.RESULT_TOTAL_ID
  562. left join OMSTRUCK_ORDER OO
  563. on OO.ORDER_ID = TTR.ORDER_ID
  564. left join tmstruck_weight_result twr
  565. on twr.result_total_id = ttr.result_total_id
  566. left join rms_capacity rc
  567. on rc.capacity_id = oo.capacity_id
  568. left join amstruck_inward_plan aip
  569. on aip.plan_id = oo.order_plan_id
  570. left join amstruck_requirement_plan arp
  571. on arp.plan_id = aip.plan_id
  572. left join amstruck_inward_requirement air
  573. on air.requirement_id = arp.requirement_id
  574. left join ams_purchase_order apo
  575. on apo.purchase_order_id = air.purchase_order_id
  576. left join dil_batch db
  577. on db.batch_id = apo.batch_id
  578. left join rms_material rm
  579. on rm.material_id = db.material_id
  580. where oo.order_type = #{orderTypee}
  581. )
  582. <where>
  583. <if test="purchaseOrderNo != null">
  584. <foreach collection="purchaseOrderNo" item="item" open="(" separator="or" close=")">
  585. "purchaseOrderNo" like '%${item}%'
  586. </foreach>
  587. </if>
  588. <if test="materialName != null">
  589. and
  590. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  591. "materialName" like '%${item}%'
  592. </foreach>
  593. </if>
  594. <if test="orderNumber != null">
  595. and
  596. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  597. "orderNumber" like '%${item}%'
  598. </foreach>
  599. </if>
  600. <if test="capacityNumber != null">
  601. and
  602. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  603. "capacityNumber" like '%${item}%'
  604. </foreach>
  605. </if>
  606. <if test="resultForeignShipName != null">
  607. and
  608. <foreach collection="resultForeignShipName" item="item" open="(" separator="or" close=")">
  609. "resultForeignShipName" like '%${item}%'
  610. </foreach>
  611. </if>
  612. <if test="resultPoundNo != null">
  613. and
  614. <foreach collection="resultPoundNo" item="item" open="(" separator="or" close=")">
  615. "resultPoundNo" like '%${item}%'
  616. </foreach>
  617. </if>
  618. <if test="resultIssampling != null">
  619. and
  620. <foreach collection="resultIssampling" item="item" open="(" separator="or" close=")">
  621. "resultIssampling" like '%${item}%'
  622. </foreach>
  623. </if>
  624. <if test="resultDeduction != null">
  625. and
  626. <foreach collection="resultDeduction" item="item" open="(" separator="or" close=")">
  627. "resultDeduction" like '%${item}%'
  628. </foreach>
  629. </if>
  630. <if test="resultDeductionDescription != null">
  631. and
  632. <foreach collection="resultDeductionDescription" item="item" open="(" separator="or" close=")">
  633. "resultDeductionDescription" like '%${item}%'
  634. </foreach>
  635. </if>
  636. <if test="warehouseName != null">
  637. and
  638. <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
  639. "warehouseName" like '%${item}%'
  640. </foreach>
  641. </if>
  642. </where>
  643. <include refid="orderBy"></include>
  644. </select>
  645. <!-- 查询销售废钢材物资单拼 -->
  646. <select id="getSaleQualityResult" parameterType="java.util.Map" resultType="java.util.Map" >
  647. SELECT *
  648. FROM (
  649. SELECT ASO.SALE_NUMBER AS "saleNumber",
  650. RM.MATERIAL_NAME AS "materialName",
  651. OO.ORDER_NUMBER AS "orderNumber",
  652. RCA.CAPACITY_NUMBER AS "capacityNumber",
  653. TQR.RESULT_ISSAMPLING AS "resultIssampling",
  654. TQR.RESULT_DEDUCTION AS "resultDeduction",
  655. TQR.RESULT_DEDUCTION_DESCRIPTION AS "resultDeductionDescription",
  656. RW.WAREHOUSE_NAME AS "warehouseName",
  657. TQR.RESULT_SAMPLING_TIME AS "insertTime",
  658. TQR.RESULT_ID AS "resultId"
  659. FROM TMSTRUCK_QUALITY_RESULT TQR
  660. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  661. ON TQR.TOTAL_RESULT_ID = TTR.RESULT_TOTAL_ID
  662. LEFT JOIN OMSTRUCK_ORDER OO
  663. ON OO.ORDER_ID = TTR.ORDER_ID
  664. LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM
  665. ON OOM.ORDER_ID = OO.ORDER_ID
  666. LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
  667. ON ASOM.SALE_ORDER_MATERIAL_ID = OO.ORDER_PLAN_ID
  668. LEFT JOIN AMS_SALE_ORDER ASO
  669. ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
  670. LEFT JOIN RMS_MATERIAL RM
  671. ON RM.MATERIAL_ID = OOM.MATERIAL_ID
  672. LEFT JOIN RMS_SHIPPER RS
  673. ON RS.SHIPPER_ID = ASO.SHIPPER_ID
  674. LEFT JOIN RMS_CONSIGNEE RCO
  675. ON RCO.CONSIGNEE_ID = ASO.RECEIVE_ID
  676. LEFT JOIN RMS_CAPACITY RCA
  677. ON RCA.CAPACITY_ID = OO.CAPACITY_ID
  678. LEFT JOIN RMS_WAREHOUSE RW
  679. ON RW.WAREHOUSE_ID = TQR.RESULT_SAMPLING_POINT_ID
  680. WHERE OO.ORDER_TYPE = #{orderTypee}
  681. )
  682. <where>
  683. <if test="saleNumber != null">
  684. <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
  685. "saleNumber" like '%${item}%'
  686. </foreach>
  687. </if>
  688. <if test="materialName != null">
  689. and
  690. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  691. "materialName" like '%${item}%'
  692. </foreach>
  693. </if>
  694. <if test="orderNumber != null">
  695. and
  696. <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
  697. "orderNumber" like '%${item}%'
  698. </foreach>
  699. </if>
  700. <if test="capacityNumber != null">
  701. and
  702. <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
  703. "capacityNumber" like '%${item}%'
  704. </foreach>
  705. </if>
  706. <if test="resultIssampling != null">
  707. and
  708. <foreach collection="resultIssampling" item="item" open="(" separator="or" close=")">
  709. "resultIssampling" like '%${item}%'
  710. </foreach>
  711. </if>
  712. <if test="resultDeduction != null">
  713. and
  714. <foreach collection="resultDeduction" item="item" open="(" separator="or" close=")">
  715. "resultDeduction" like '%${item}%'
  716. </foreach>
  717. </if>
  718. <if test="resultDeductionDescription != null">
  719. and
  720. <foreach collection="resultDeductionDescription" item="item" open="(" separator="or" close=")">
  721. "resultDeductionDescription" like '%${item}%'
  722. </foreach>
  723. </if>
  724. <if test="warehouseName != null">
  725. and
  726. <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
  727. "warehouseName" like '%${item}%'
  728. </foreach>
  729. </if>
  730. <if test="insertTime != null">
  731. and
  732. <foreach collection="insertTime" item="item" open="(" separator="or" close=")">
  733. "insertTime" like '%${item}%'
  734. </foreach>
  735. </if>
  736. </where>
  737. <include refid="orderBy"></include>
  738. </select>
  739. </mapper>