TmstrainLoadingResultMapper.xml 53 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272
  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.TmstrainLoadingResultMapper">
  4. <resultMap id="BaseResultMap" type="com.steerinfo.dil.model.TmstrainLoadingResult">
  5. <id column="RESULT_ID" jdbcType="DECIMAL" property="resultId" />
  6. <result column="PURCHASE_ORDER_RAIL_PLAN_ID" jdbcType="DECIMAL" property="purchaseOrderRailPlanId" />
  7. <result column="RESULT_WAGON_NO" jdbcType="VARCHAR" property="resultWagonNo" />
  8. <result column="RESULT_BILLABLE_TONNAGE" jdbcType="DECIMAL" property="resultBillableTonnage" />
  9. <result column="RESULT_ISCLEAR" jdbcType="VARCHAR" property="resultIsclear" />
  10. <result column="CAPACITY_ID" jdbcType="DECIMAL" property="capacityId" />
  11. <result column="MATERIAL_ID" jdbcType="DECIMAL" property="materialId" />
  12. <result column="RESULT_MATERIAL_NUMBER" jdbcType="DECIMAL" property="resultMaterialNumber" />
  13. <result column="RESULT_MATERIAL_THEORYWEIGHT" jdbcType="DECIMAL" property="resultMaterialTheoryweight" />
  14. <result column="BATCH_ID" jdbcType="DECIMAL" property="batchId" />
  15. <result column="RESULT_CLASS" jdbcType="VARCHAR" property="resultClass" />
  16. <result column="RESULT_LOADING_DATE" jdbcType="TIMESTAMP" property="resultLoadingDate" />
  17. <result column="RESULT_REMARKS" jdbcType="VARCHAR" property="resultRemarks" />
  18. <result column="INSERT_USERNAME" jdbcType="VARCHAR" property="insertUsername" />
  19. <result column="INSERT_TIME" jdbcType="TIMESTAMP" property="insertTime" />
  20. <result column="UPDATE_USERNAME" jdbcType="VARCHAR" property="updateUsername" />
  21. <result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime" />
  22. <result column="INSERT_UPDATE_REMARK" jdbcType="VARCHAR" property="insertUpdateRemark" />
  23. <result column="DELETED" jdbcType="DECIMAL" property="deleted" />
  24. <result column="SEND_STATION_ID" jdbcType="DECIMAL" property="sendStationId" />
  25. <result column="ARRIVAL_STATION_ID" jdbcType="DECIMAL" property="arrivalStationId" />
  26. <result column="RESULT_TYPE" jdbcType="DECIMAL" property="resultType" />
  27. <result column="TRAIN_CALCULATE_ID" jdbcType="DECIMAL" property="trainCalculateId" />
  28. <result column="UNLOADING_POINT_ID" jdbcType="DECIMAL" property="unloadingPointId" />
  29. </resultMap>
  30. <sql id="columns">
  31. RESULT_ID, PURCHASE_ORDER_RAIL_PLAN_ID, RESULT_WAGON_NO, RESULT_BILLABLE_TONNAGE,
  32. RESULT_ISCLEAR, CAPACITY_ID, MATERIAL_ID, RESULT_MATERIAL_NUMBER, RESULT_MATERIAL_THEORYWEIGHT,
  33. BATCH_ID, RESULT_CLASS, RESULT_LOADING_DATE, RESULT_REMARKS, INSERT_USERNAME, INSERT_TIME,
  34. UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK, DELETED, SEND_STATION_ID, ARRIVAL_STATION_ID,
  35. RESULT_TYPE, TRAIN_CALCULATE_ID, UNLOADING_POINT_ID
  36. </sql>
  37. <sql id="columns_alias">
  38. t.RESULT_ID, t.PURCHASE_ORDER_RAIL_PLAN_ID, t.RESULT_WAGON_NO, t.RESULT_BILLABLE_TONNAGE,
  39. t.RESULT_ISCLEAR, t.CAPACITY_ID, t.MATERIAL_ID, t.RESULT_MATERIAL_NUMBER, t.RESULT_MATERIAL_THEORYWEIGHT,
  40. t.BATCH_ID, t.RESULT_CLASS, t.RESULT_LOADING_DATE, t.RESULT_REMARKS, t.INSERT_USERNAME,
  41. t.INSERT_TIME, t.UPDATE_USERNAME, t.UPDATE_TIME, t.INSERT_UPDATE_REMARK, t.DELETED,
  42. t.SEND_STATION_ID, t.ARRIVAL_STATION_ID, t.RESULT_TYPE, t.TRAIN_CALCULATE_ID, t.UNLOADING_POINT_ID
  43. </sql>
  44. <sql id="select">
  45. SELECT <include refid="columns" /> FROM TMSTRAIN_LOADING_RESULT
  46. </sql>
  47. <sql id="select_alias">
  48. SELECT <include refid="columns_alias" /> FROM TMSTRAIN_LOADING_RESULT t
  49. </sql>
  50. <sql id="where">
  51. <where>
  52. <if test="resultId != null">
  53. and RESULT_ID = #{resultId}
  54. </if>
  55. <if test="purchaseOrderRailPlanId != null">
  56. and PURCHASE_ORDER_RAIL_PLAN_ID = #{purchaseOrderRailPlanId}
  57. </if>
  58. <if test="resultWagonNo != null and resultWagonNo != ''">
  59. and RESULT_WAGON_NO = #{resultWagonNo}
  60. </if>
  61. <if test="resultBillableTonnage != null">
  62. and RESULT_BILLABLE_TONNAGE = #{resultBillableTonnage}
  63. </if>
  64. <if test="resultIsclear != null and resultIsclear != ''">
  65. and RESULT_ISCLEAR = #{resultIsclear}
  66. </if>
  67. <if test="capacityId != null">
  68. and CAPACITY_ID = #{capacityId}
  69. </if>
  70. <if test="materialId != null">
  71. and MATERIAL_ID = #{materialId}
  72. </if>
  73. <if test="resultMaterialNumber != null">
  74. and RESULT_MATERIAL_NUMBER = #{resultMaterialNumber}
  75. </if>
  76. <if test="resultMaterialTheoryweight != null">
  77. and RESULT_MATERIAL_THEORYWEIGHT = #{resultMaterialTheoryweight}
  78. </if>
  79. <if test="batchId != null">
  80. and BATCH_ID = #{batchId}
  81. </if>
  82. <if test="resultClass != null and resultClass != ''">
  83. and RESULT_CLASS = #{resultClass}
  84. </if>
  85. <if test="resultLoadingDate != null">
  86. and TO_CHAR(RESULT_LOADING_DATE,'yyyy-MM-dd') = #{resultLoadingDate}
  87. </if>
  88. <if test="resultRemarks != null and resultRemarks != ''">
  89. and RESULT_REMARKS = #{resultRemarks}
  90. </if>
  91. <if test="insertUsername != null and insertUsername != ''">
  92. and INSERT_USERNAME = #{insertUsername}
  93. </if>
  94. <if test="insertTime != null">
  95. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  96. </if>
  97. <if test="updateUsername != null and updateUsername != ''">
  98. and UPDATE_USERNAME = #{updateUsername}
  99. </if>
  100. <if test="updateTime != null">
  101. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  102. </if>
  103. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  104. and INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  105. </if>
  106. <if test="deleted != null">
  107. and DELETED = #{deleted}
  108. </if>
  109. <if test="sendStationId != null">
  110. and SEND_STATION_ID = #{sendStationId}
  111. </if>
  112. <if test="arrivalStationId != null">
  113. and ARRIVAL_STATION_ID = #{arrivalStationId}
  114. </if>
  115. <if test="resultType != null">
  116. and RESULT_TYPE = #{resultType}
  117. </if>
  118. <if test="trainCalculateId != null">
  119. and TRAIN_CALCULATE_ID = #{trainCalculateId}
  120. </if>
  121. <if test="unloadingPointId != null">
  122. and UNLOADING_POINT_ID = #{unloadingPointId}
  123. </if>
  124. </where>
  125. </sql>
  126. <sql id="whereLike">
  127. <where>
  128. <if test="resultId != null">
  129. and RESULT_ID = #{resultId}
  130. </if>
  131. <if test="purchaseOrderRailPlanId != null">
  132. and PURCHASE_ORDER_RAIL_PLAN_ID = #{purchaseOrderRailPlanId}
  133. </if>
  134. <if test="resultWagonNo != null and resultWagonNo != ''">
  135. and RESULT_WAGON_NO LIKE '%${resultWagonNo}%'
  136. </if>
  137. <if test="resultBillableTonnage != null">
  138. and RESULT_BILLABLE_TONNAGE = #{resultBillableTonnage}
  139. </if>
  140. <if test="resultIsclear != null and resultIsclear != ''">
  141. and RESULT_ISCLEAR LIKE '%${resultIsclear}%'
  142. </if>
  143. <if test="capacityId != null">
  144. and CAPACITY_ID = #{capacityId}
  145. </if>
  146. <if test="materialId != null">
  147. and MATERIAL_ID = #{materialId}
  148. </if>
  149. <if test="resultMaterialNumber != null">
  150. and RESULT_MATERIAL_NUMBER = #{resultMaterialNumber}
  151. </if>
  152. <if test="resultMaterialTheoryweight != null">
  153. and RESULT_MATERIAL_THEORYWEIGHT = #{resultMaterialTheoryweight}
  154. </if>
  155. <if test="batchId != null">
  156. and BATCH_ID = #{batchId}
  157. </if>
  158. <if test="resultClass != null and resultClass != ''">
  159. and RESULT_CLASS LIKE '%${resultClass}%'
  160. </if>
  161. <if test="resultLoadingDate != null">
  162. and TO_CHAR(RESULT_LOADING_DATE,'yyyy-MM-dd') = #{resultLoadingDate}
  163. </if>
  164. <if test="resultRemarks != null and resultRemarks != ''">
  165. and RESULT_REMARKS LIKE '%${resultRemarks}%'
  166. </if>
  167. <if test="insertUsername != null and insertUsername != ''">
  168. and INSERT_USERNAME LIKE '%${insertUsername}%'
  169. </if>
  170. <if test="insertTime != null">
  171. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  172. </if>
  173. <if test="updateUsername != null and updateUsername != ''">
  174. and UPDATE_USERNAME LIKE '%${updateUsername}%'
  175. </if>
  176. <if test="updateTime != null">
  177. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  178. </if>
  179. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  180. and INSERT_UPDATE_REMARK LIKE '%${insertUpdateRemark}%'
  181. </if>
  182. <if test="deleted != null">
  183. and DELETED = #{deleted}
  184. </if>
  185. <if test="sendStationId != null">
  186. and SEND_STATION_ID = #{sendStationId}
  187. </if>
  188. <if test="arrivalStationId != null">
  189. and ARRIVAL_STATION_ID = #{arrivalStationId}
  190. </if>
  191. <if test="resultType != null">
  192. and RESULT_TYPE = #{resultType}
  193. </if>
  194. <if test="trainCalculateId != null">
  195. and TRAIN_CALCULATE_ID = #{trainCalculateId}
  196. </if>
  197. <if test="unloadingPointId != null">
  198. and UNLOADING_POINT_ID = #{unloadingPointId}
  199. </if>
  200. </where>
  201. </sql>
  202. <delete id="deleteByPrimaryKey" parameterType="java.lang.Short">
  203. delete from TMSTRAIN_LOADING_RESULT
  204. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  205. </delete>
  206. <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
  207. delete from TMSTRAIN_LOADING_RESULT
  208. where 1!=1
  209. <if test="purchaseOrderRailPlanId != null">
  210. or PURCHASE_ORDER_RAIL_PLAN_ID = #{purchaseOrderRailPlanId}
  211. </if>
  212. <if test="resultWagonNo != null and resultWagonNo != ''">
  213. or RESULT_WAGON_NO = #{resultWagonNo}
  214. </if>
  215. <if test="resultBillableTonnage != null">
  216. or RESULT_BILLABLE_TONNAGE = #{resultBillableTonnage}
  217. </if>
  218. <if test="resultIsclear != null and resultIsclear != ''">
  219. or RESULT_ISCLEAR = #{resultIsclear}
  220. </if>
  221. <if test="capacityId != null">
  222. or CAPACITY_ID = #{capacityId}
  223. </if>
  224. <if test="materialId != null">
  225. or MATERIAL_ID = #{materialId}
  226. </if>
  227. <if test="resultMaterialNumber != null">
  228. or RESULT_MATERIAL_NUMBER = #{resultMaterialNumber}
  229. </if>
  230. <if test="resultMaterialTheoryweight != null">
  231. or RESULT_MATERIAL_THEORYWEIGHT = #{resultMaterialTheoryweight}
  232. </if>
  233. <if test="batchId != null">
  234. or BATCH_ID = #{batchId}
  235. </if>
  236. <if test="resultClass != null and resultClass != ''">
  237. or RESULT_CLASS = #{resultClass}
  238. </if>
  239. <if test="resultLoadingDate != null">
  240. or TO_CHAR(RESULT_LOADING_DATE,'yyyy-MM-dd') = '#{resultLoadingDate}'
  241. </if>
  242. <if test="resultRemarks != null and resultRemarks != ''">
  243. or RESULT_REMARKS = #{resultRemarks}
  244. </if>
  245. <if test="insertUsername != null and insertUsername != ''">
  246. or INSERT_USERNAME = #{insertUsername}
  247. </if>
  248. <if test="insertTime != null">
  249. or TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = '#{insertTime}'
  250. </if>
  251. <if test="updateUsername != null and updateUsername != ''">
  252. or UPDATE_USERNAME = #{updateUsername}
  253. </if>
  254. <if test="updateTime != null">
  255. or TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = '#{updateTime}'
  256. </if>
  257. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  258. or INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  259. </if>
  260. <if test="deleted != null">
  261. or DELETED = #{deleted}
  262. </if>
  263. <if test="sendStationId != null">
  264. or SEND_STATION_ID = #{sendStationId}
  265. </if>
  266. <if test="arrivalStationId != null">
  267. or ARRIVAL_STATION_ID = #{arrivalStationId}
  268. </if>
  269. <if test="resultType != null">
  270. or RESULT_TYPE = #{resultType}
  271. </if>
  272. <if test="trainCalculateId != null">
  273. or TRAIN_CALCULATE_ID = #{trainCalculateId}
  274. </if>
  275. <if test="unloadingPointId != null">
  276. or UNLOADING_POINT_ID = #{unloadingPointId}
  277. </if>
  278. </delete>
  279. <insert id="insert" parameterType="com.steerinfo.dil.model.TmstrainLoadingResult">
  280. insert into TMSTRAIN_LOADING_RESULT (RESULT_ID, PURCHASE_ORDER_RAIL_PLAN_ID,
  281. RESULT_WAGON_NO, RESULT_BILLABLE_TONNAGE, RESULT_ISCLEAR,
  282. CAPACITY_ID, MATERIAL_ID, RESULT_MATERIAL_NUMBER,
  283. RESULT_MATERIAL_THEORYWEIGHT, BATCH_ID, RESULT_CLASS,
  284. RESULT_LOADING_DATE, RESULT_REMARKS, INSERT_USERNAME,
  285. INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME,
  286. INSERT_UPDATE_REMARK, DELETED, SEND_STATION_ID,
  287. ARRIVAL_STATION_ID, RESULT_TYPE, TRAIN_CALCULATE_ID,
  288. UNLOADING_POINT_ID)
  289. values (#{resultId,jdbcType=DECIMAL}, #{purchaseOrderRailPlanId,jdbcType=DECIMAL},
  290. #{resultWagonNo,jdbcType=VARCHAR}, #{resultBillableTonnage,jdbcType=DECIMAL}, #{resultIsclear,jdbcType=VARCHAR},
  291. #{capacityId,jdbcType=DECIMAL}, #{materialId,jdbcType=DECIMAL}, #{resultMaterialNumber,jdbcType=DECIMAL},
  292. #{resultMaterialTheoryweight,jdbcType=DECIMAL}, #{batchId,jdbcType=DECIMAL}, #{resultClass,jdbcType=VARCHAR},
  293. #{resultLoadingDate,jdbcType=TIMESTAMP}, #{resultRemarks,jdbcType=VARCHAR}, #{insertUsername,jdbcType=VARCHAR},
  294. #{insertTime,jdbcType=TIMESTAMP}, #{updateUsername,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
  295. #{insertUpdateRemark,jdbcType=VARCHAR}, #{deleted,jdbcType=DECIMAL}, #{sendStationId,jdbcType=DECIMAL},
  296. #{arrivalStationId,jdbcType=DECIMAL}, #{resultType,jdbcType=DECIMAL}, #{trainCalculateId,jdbcType=DECIMAL},
  297. #{unloadingPointId,jdbcType=DECIMAL})
  298. </insert>
  299. <insert id="insertSelective" parameterType="com.steerinfo.dil.model.TmstrainLoadingResult">
  300. insert into TMSTRAIN_LOADING_RESULT
  301. <trim prefix="(" suffix=")" suffixOverrides=",">
  302. <if test="resultId != null">
  303. RESULT_ID,
  304. </if>
  305. <if test="purchaseOrderRailPlanId != null">
  306. PURCHASE_ORDER_RAIL_PLAN_ID,
  307. </if>
  308. <if test="resultWagonNo != null">
  309. RESULT_WAGON_NO,
  310. </if>
  311. <if test="resultBillableTonnage != null">
  312. RESULT_BILLABLE_TONNAGE,
  313. </if>
  314. <if test="resultIsclear != null">
  315. RESULT_ISCLEAR,
  316. </if>
  317. <if test="capacityId != null">
  318. CAPACITY_ID,
  319. </if>
  320. <if test="materialId != null">
  321. MATERIAL_ID,
  322. </if>
  323. <if test="resultMaterialNumber != null">
  324. RESULT_MATERIAL_NUMBER,
  325. </if>
  326. <if test="resultMaterialTheoryweight != null">
  327. RESULT_MATERIAL_THEORYWEIGHT,
  328. </if>
  329. <if test="batchId != null">
  330. BATCH_ID,
  331. </if>
  332. <if test="resultClass != null">
  333. RESULT_CLASS,
  334. </if>
  335. <if test="resultLoadingDate != null">
  336. RESULT_LOADING_DATE,
  337. </if>
  338. <if test="resultRemarks != null">
  339. RESULT_REMARKS,
  340. </if>
  341. <if test="insertUsername != null">
  342. INSERT_USERNAME,
  343. </if>
  344. <if test="insertTime != null">
  345. INSERT_TIME,
  346. </if>
  347. <if test="updateUsername != null">
  348. UPDATE_USERNAME,
  349. </if>
  350. <if test="updateTime != null">
  351. UPDATE_TIME,
  352. </if>
  353. <if test="insertUpdateRemark != null">
  354. INSERT_UPDATE_REMARK,
  355. </if>
  356. <if test="deleted != null">
  357. DELETED,
  358. </if>
  359. <if test="sendStationId != null">
  360. SEND_STATION_ID,
  361. </if>
  362. <if test="arrivalStationId != null">
  363. ARRIVAL_STATION_ID,
  364. </if>
  365. <if test="resultType != null">
  366. RESULT_TYPE,
  367. </if>
  368. <if test="trainCalculateId != null">
  369. TRAIN_CALCULATE_ID,
  370. </if>
  371. <if test="unloadingPointId != null">
  372. UNLOADING_POINT_ID,
  373. </if>
  374. </trim>
  375. <trim prefix="values (" suffix=")" suffixOverrides=",">
  376. <if test="resultId != null">
  377. #{resultId,jdbcType=DECIMAL},
  378. </if>
  379. <if test="purchaseOrderRailPlanId != null">
  380. #{purchaseOrderRailPlanId,jdbcType=DECIMAL},
  381. </if>
  382. <if test="resultWagonNo != null">
  383. #{resultWagonNo,jdbcType=VARCHAR},
  384. </if>
  385. <if test="resultBillableTonnage != null">
  386. #{resultBillableTonnage,jdbcType=DECIMAL},
  387. </if>
  388. <if test="resultIsclear != null">
  389. #{resultIsclear,jdbcType=VARCHAR},
  390. </if>
  391. <if test="capacityId != null">
  392. #{capacityId,jdbcType=DECIMAL},
  393. </if>
  394. <if test="materialId != null">
  395. #{materialId,jdbcType=DECIMAL},
  396. </if>
  397. <if test="resultMaterialNumber != null">
  398. #{resultMaterialNumber,jdbcType=DECIMAL},
  399. </if>
  400. <if test="resultMaterialTheoryweight != null">
  401. #{resultMaterialTheoryweight,jdbcType=DECIMAL},
  402. </if>
  403. <if test="batchId != null">
  404. #{batchId,jdbcType=DECIMAL},
  405. </if>
  406. <if test="resultClass != null">
  407. #{resultClass,jdbcType=VARCHAR},
  408. </if>
  409. <if test="resultLoadingDate != null">
  410. #{resultLoadingDate,jdbcType=TIMESTAMP},
  411. </if>
  412. <if test="resultRemarks != null">
  413. #{resultRemarks,jdbcType=VARCHAR},
  414. </if>
  415. <if test="insertUsername != null">
  416. #{insertUsername,jdbcType=VARCHAR},
  417. </if>
  418. <if test="insertTime != null">
  419. #{insertTime,jdbcType=TIMESTAMP},
  420. </if>
  421. <if test="updateUsername != null">
  422. #{updateUsername,jdbcType=VARCHAR},
  423. </if>
  424. <if test="updateTime != null">
  425. #{updateTime,jdbcType=TIMESTAMP},
  426. </if>
  427. <if test="insertUpdateRemark != null">
  428. #{insertUpdateRemark,jdbcType=VARCHAR},
  429. </if>
  430. <if test="deleted != null">
  431. #{deleted,jdbcType=DECIMAL},
  432. </if>
  433. <if test="sendStationId != null">
  434. #{sendStationId,jdbcType=DECIMAL},
  435. </if>
  436. <if test="arrivalStationId != null">
  437. #{arrivalStationId,jdbcType=DECIMAL},
  438. </if>
  439. <if test="resultType != null">
  440. #{resultType,jdbcType=DECIMAL},
  441. </if>
  442. <if test="trainCalculateId != null">
  443. #{trainCalculateId,jdbcType=DECIMAL},
  444. </if>
  445. <if test="unloadingPointId != null">
  446. #{unloadingPointId,jdbcType=DECIMAL},
  447. </if>
  448. </trim>
  449. </insert>
  450. <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.TmstrainLoadingResult">
  451. update TMSTRAIN_LOADING_RESULT
  452. set PURCHASE_ORDER_RAIL_PLAN_ID = #{purchaseOrderRailPlanId,jdbcType=DECIMAL},
  453. RESULT_WAGON_NO = #{resultWagonNo,jdbcType=VARCHAR},
  454. RESULT_BILLABLE_TONNAGE = #{resultBillableTonnage,jdbcType=DECIMAL},
  455. RESULT_ISCLEAR = #{resultIsclear,jdbcType=VARCHAR},
  456. CAPACITY_ID = #{capacityId,jdbcType=DECIMAL},
  457. MATERIAL_ID = #{materialId,jdbcType=DECIMAL},
  458. RESULT_MATERIAL_NUMBER = #{resultMaterialNumber,jdbcType=DECIMAL},
  459. RESULT_MATERIAL_THEORYWEIGHT = #{resultMaterialTheoryweight,jdbcType=DECIMAL},
  460. BATCH_ID = #{batchId,jdbcType=DECIMAL},
  461. RESULT_CLASS = #{resultClass,jdbcType=VARCHAR},
  462. RESULT_LOADING_DATE = #{resultLoadingDate,jdbcType=TIMESTAMP},
  463. RESULT_REMARKS = #{resultRemarks,jdbcType=VARCHAR},
  464. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  465. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  466. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  467. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  468. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  469. DELETED = #{deleted,jdbcType=DECIMAL},
  470. SEND_STATION_ID = #{sendStationId,jdbcType=DECIMAL},
  471. ARRIVAL_STATION_ID = #{arrivalStationId,jdbcType=DECIMAL},
  472. RESULT_TYPE = #{resultType,jdbcType=DECIMAL},
  473. TRAIN_CALCULATE_ID = #{trainCalculateId,jdbcType=DECIMAL},
  474. UNLOADING_POINT_ID = #{unloadingPointId,jdbcType=DECIMAL}
  475. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  476. </update>
  477. <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.TmstrainLoadingResult">
  478. update TMSTRAIN_LOADING_RESULT
  479. <set>
  480. <if test="purchaseOrderRailPlanId != null">
  481. PURCHASE_ORDER_RAIL_PLAN_ID = #{purchaseOrderRailPlanId,jdbcType=DECIMAL},
  482. </if>
  483. <if test="resultWagonNo != null">
  484. RESULT_WAGON_NO = #{resultWagonNo,jdbcType=VARCHAR},
  485. </if>
  486. <if test="resultBillableTonnage != null">
  487. RESULT_BILLABLE_TONNAGE = #{resultBillableTonnage,jdbcType=DECIMAL},
  488. </if>
  489. <if test="resultIsclear != null">
  490. RESULT_ISCLEAR = #{resultIsclear,jdbcType=VARCHAR},
  491. </if>
  492. <if test="capacityId != null">
  493. CAPACITY_ID = #{capacityId,jdbcType=DECIMAL},
  494. </if>
  495. <if test="materialId != null">
  496. MATERIAL_ID = #{materialId,jdbcType=DECIMAL},
  497. </if>
  498. <if test="resultMaterialNumber != null">
  499. RESULT_MATERIAL_NUMBER = #{resultMaterialNumber,jdbcType=DECIMAL},
  500. </if>
  501. <if test="resultMaterialTheoryweight != null">
  502. RESULT_MATERIAL_THEORYWEIGHT = #{resultMaterialTheoryweight,jdbcType=DECIMAL},
  503. </if>
  504. <if test="batchId != null">
  505. BATCH_ID = #{batchId,jdbcType=DECIMAL},
  506. </if>
  507. <if test="resultClass != null">
  508. RESULT_CLASS = #{resultClass,jdbcType=VARCHAR},
  509. </if>
  510. <if test="resultLoadingDate != null">
  511. RESULT_LOADING_DATE = #{resultLoadingDate,jdbcType=TIMESTAMP},
  512. </if>
  513. <if test="resultRemarks != null">
  514. RESULT_REMARKS = #{resultRemarks,jdbcType=VARCHAR},
  515. </if>
  516. <if test="insertUsername != null">
  517. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  518. </if>
  519. <if test="insertTime != null">
  520. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  521. </if>
  522. <if test="updateUsername != null">
  523. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  524. </if>
  525. <if test="updateTime != null">
  526. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  527. </if>
  528. <if test="insertUpdateRemark != null">
  529. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  530. </if>
  531. <if test="deleted != null">
  532. DELETED = #{deleted,jdbcType=DECIMAL},
  533. </if>
  534. <if test="sendStationId != null">
  535. SEND_STATION_ID = #{sendStationId,jdbcType=DECIMAL},
  536. </if>
  537. <if test="arrivalStationId != null">
  538. ARRIVAL_STATION_ID = #{arrivalStationId,jdbcType=DECIMAL},
  539. </if>
  540. <if test="resultType != null">
  541. RESULT_TYPE = #{resultType,jdbcType=DECIMAL},
  542. </if>
  543. <if test="trainCalculateId != null">
  544. TRAIN_CALCULATE_ID = #{trainCalculateId,jdbcType=DECIMAL},
  545. </if>
  546. <if test="unloadingPointId != null">
  547. UNLOADING_POINT_ID = #{unloadingPointId,jdbcType=DECIMAL},
  548. </if>
  549. </set>
  550. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  551. </update>
  552. <select id="selectByPrimaryKey" parameterType="java.lang.Short" resultMap="BaseResultMap">
  553. <include refid="select" />
  554. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  555. </select>
  556. <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  557. <include refid="select" />
  558. <include refid="where" />
  559. </select>
  560. <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  561. <include refid="select" />
  562. <include refid="whereLike" />
  563. </select>
  564. <insert id="batchInsert" parameterType="java.util.List">
  565. insert into TMSTRAIN_LOADING_RESULT
  566. (RESULT_ID,
  567. PURCHASE_ORDER_RAIL_PLAN_ID, RESULT_WAGON_NO,
  568. RESULT_BILLABLE_TONNAGE, RESULT_ISCLEAR,
  569. CAPACITY_ID, MATERIAL_ID, RESULT_MATERIAL_NUMBER,
  570. RESULT_MATERIAL_THEORYWEIGHT, BATCH_ID,
  571. RESULT_CLASS, RESULT_LOADING_DATE,
  572. RESULT_REMARKS, INSERT_USERNAME,
  573. INSERT_TIME, UPDATE_USERNAME,
  574. UPDATE_TIME, INSERT_UPDATE_REMARK,
  575. DELETED, SEND_STATION_ID, ARRIVAL_STATION_ID,
  576. RESULT_TYPE, TRAIN_CALCULATE_ID,
  577. UNLOADING_POINT_ID)
  578. ( <foreach collection="list" item="item" separator="union all">
  579. select
  580. #{item.resultId,jdbcType=DECIMAL},
  581. #{item.purchaseOrderRailPlanId,jdbcType=DECIMAL}, #{item.resultWagonNo,jdbcType=VARCHAR},
  582. #{item.resultBillableTonnage,jdbcType=DECIMAL}, #{item.resultIsclear,jdbcType=VARCHAR},
  583. #{item.capacityId,jdbcType=DECIMAL}, #{item.materialId,jdbcType=DECIMAL}, #{item.resultMaterialNumber,jdbcType=DECIMAL},
  584. #{item.resultMaterialTheoryweight,jdbcType=DECIMAL}, #{item.batchId,jdbcType=DECIMAL},
  585. #{item.resultClass,jdbcType=VARCHAR}, #{item.resultLoadingDate,jdbcType=TIMESTAMP},
  586. #{item.resultRemarks,jdbcType=VARCHAR}, #{item.insertUsername,jdbcType=VARCHAR},
  587. #{item.insertTime,jdbcType=TIMESTAMP}, #{item.updateUsername,jdbcType=VARCHAR},
  588. #{item.updateTime,jdbcType=TIMESTAMP}, #{item.insertUpdateRemark,jdbcType=VARCHAR},
  589. #{item.deleted,jdbcType=DECIMAL}, #{item.sendStationId,jdbcType=DECIMAL}, #{item.arrivalStationId,jdbcType=DECIMAL},
  590. #{item.resultType,jdbcType=DECIMAL}, #{item.trainCalculateId,jdbcType=DECIMAL},
  591. #{item.unloadingPointId,jdbcType=DECIMAL} from dual
  592. </foreach> )
  593. </insert>
  594. <update id="batchUpdate" parameterType="java.util.List">
  595. update TMSTRAIN_LOADING_RESULT
  596. set
  597. RESULT_ID=
  598. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  599. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultId,jdbcType=DECIMAL}
  600. </foreach>
  601. ,PURCHASE_ORDER_RAIL_PLAN_ID=
  602. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  603. when #{item.resultId,jdbcType=DECIMAL} then #{item.purchaseOrderRailPlanId,jdbcType=DECIMAL}
  604. </foreach>
  605. ,RESULT_WAGON_NO=
  606. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  607. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultWagonNo,jdbcType=VARCHAR}
  608. </foreach>
  609. ,RESULT_BILLABLE_TONNAGE=
  610. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  611. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultBillableTonnage,jdbcType=DECIMAL}
  612. </foreach>
  613. ,RESULT_ISCLEAR=
  614. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  615. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultIsclear,jdbcType=VARCHAR}
  616. </foreach>
  617. ,CAPACITY_ID=
  618. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  619. when #{item.resultId,jdbcType=DECIMAL} then #{item.capacityId,jdbcType=DECIMAL}
  620. </foreach>
  621. ,MATERIAL_ID=
  622. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  623. when #{item.resultId,jdbcType=DECIMAL} then #{item.materialId,jdbcType=DECIMAL}
  624. </foreach>
  625. ,RESULT_MATERIAL_NUMBER=
  626. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  627. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultMaterialNumber,jdbcType=DECIMAL}
  628. </foreach>
  629. ,RESULT_MATERIAL_THEORYWEIGHT=
  630. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  631. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultMaterialTheoryweight,jdbcType=DECIMAL}
  632. </foreach>
  633. ,BATCH_ID=
  634. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  635. when #{item.resultId,jdbcType=DECIMAL} then #{item.batchId,jdbcType=DECIMAL}
  636. </foreach>
  637. ,RESULT_CLASS=
  638. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  639. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultClass,jdbcType=VARCHAR}
  640. </foreach>
  641. ,RESULT_LOADING_DATE=
  642. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  643. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultLoadingDate,jdbcType=TIMESTAMP}
  644. </foreach>
  645. ,RESULT_REMARKS=
  646. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  647. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultRemarks,jdbcType=VARCHAR}
  648. </foreach>
  649. ,INSERT_USERNAME=
  650. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  651. when #{item.resultId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
  652. </foreach>
  653. ,INSERT_TIME=
  654. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  655. when #{item.resultId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
  656. </foreach>
  657. ,UPDATE_USERNAME=
  658. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  659. when #{item.resultId,jdbcType=DECIMAL} then #{item.updateUsername,jdbcType=VARCHAR}
  660. </foreach>
  661. ,UPDATE_TIME=
  662. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  663. when #{item.resultId,jdbcType=DECIMAL} then #{item.updateTime,jdbcType=TIMESTAMP}
  664. </foreach>
  665. ,INSERT_UPDATE_REMARK=
  666. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  667. when #{item.resultId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
  668. </foreach>
  669. ,DELETED=
  670. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  671. when #{item.resultId,jdbcType=DECIMAL} then #{item.deleted,jdbcType=DECIMAL}
  672. </foreach>
  673. ,SEND_STATION_ID=
  674. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  675. when #{item.resultId,jdbcType=DECIMAL} then #{item.sendStationId,jdbcType=DECIMAL}
  676. </foreach>
  677. ,ARRIVAL_STATION_ID=
  678. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  679. when #{item.resultId,jdbcType=DECIMAL} then #{item.arrivalStationId,jdbcType=DECIMAL}
  680. </foreach>
  681. ,RESULT_TYPE=
  682. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  683. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultType,jdbcType=DECIMAL}
  684. </foreach>
  685. ,TRAIN_CALCULATE_ID=
  686. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  687. when #{item.resultId,jdbcType=DECIMAL} then #{item.trainCalculateId,jdbcType=DECIMAL}
  688. </foreach>
  689. ,UNLOADING_POINT_ID=
  690. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
  691. when #{item.resultId,jdbcType=DECIMAL} then #{item.unloadingPointId,jdbcType=DECIMAL}
  692. </foreach>
  693. where RESULT_ID in
  694. <foreach close=")" collection="list" index="index" item="item" open="(" separator=",">
  695. #{item.resultId,jdbcType=DECIMAL}
  696. </foreach>
  697. </update>
  698. <delete id="batchDelete" parameterType="java.util.List">
  699. delete from TMSTRAIN_LOADING_RESULT
  700. where RESULT_ID in
  701. <foreach close=")" collection="list" item="id" open="(" separator=",">
  702. #{id}
  703. </foreach>
  704. </delete>
  705. <!-- 友情提示!!!-->
  706. <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
  707. <select id="getTmsWagonLoadInfo" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
  708. select * from(
  709. select t_load.RESULT_ID "resultId",
  710. a_order.PURCHASE_ORDER_NO "purchaseOrderNo",
  711. t_load.RESULT_WAGON_NO "resultWagonNo",
  712. to_char(t_load.RESULT_LOADING_DATE, 'yyyy-mm-dd') "resultLoadingDate",
  713. t_load.RESULT_CLASS "resultClass",
  714. d_batch.RESULT_FOREIGN_SHIP_NAME "resultForeignShipName",
  715. r_material.MATERIAL_NAME "materialName",
  716. r_s_arrival.ARRIVAL_NAME "sendStationName",
  717. r_a_arrival.ARRIVAL_NAME "arrivalStationName",
  718. t_load.RESULT_BILLABLE_TONNAGE "resultBillableTonnage",
  719. t_load.RESULT_ISCLEAR "resultIsclear",
  720. t_load.RESULT_REMARKS "resultRemarks",
  721. RS.SUPPLIER_NAME "supplierName",
  722. t_load.INSERT_TIME "insertTime"
  723. from TMSTRAIN_LOADING_RESULT t_load
  724. left join AMS_PURCHASE_ORDER a_order
  725. on t_load.PURCHASE_ORDER_RAIL_PLAN_ID=a_order.PURCHASE_ORDER_ID
  726. left join RMS_SUPPLIER RS
  727. on RS.SUPPLIER_ID = a_order.SUPPLIER_UNIT_ID
  728. left join DIL_BATCH d_batch
  729. on t_load.BATCH_ID=d_batch.BATCH_ID
  730. left join RMS_MATERIAL r_material
  731. on d_batch.MATERIAL_ID=r_material.MATERIAL_ID
  732. left join RMSTRAIN_ARRIVAL_SEND r_s_arrival
  733. on r_s_arrival.ARRIVAL_ID=t_load.SEND_STATION_ID
  734. left join RMSTRAIN_ARRIVAL_SEND r_a_arrival
  735. on r_a_arrival.ARRIVAL_ID=t_load.ARRIVAL_STATION_ID
  736. where t_load.DELETED in (0, 2) and t_load.RESULT_TYPE = #{resultType}
  737. )
  738. <where>
  739. <if test="purchaseOrderNo != null">
  740. <foreach collection="purchaseOrderNo" item="item" open="(" separator="or" close=")">
  741. "purchaseOrderNo" like '%${item}%'
  742. </foreach>
  743. </if>
  744. <if test="resultWagonNo != null">
  745. and
  746. <foreach collection="resultWagonNo" item="item" open="(" separator="or" close=")">
  747. "resultWagonNo" like '%${item}%'
  748. </foreach>
  749. </if>
  750. <if test="resultLoadingDate != null">
  751. and
  752. <foreach collection="resultLoadingDate" item="item" open="(" separator="or" close=")">
  753. "resultLoadingDate" like '%${item}%'
  754. </foreach>
  755. </if>
  756. <if test="resultClass != null">
  757. and
  758. <foreach collection="resultClass" item="item" open="(" separator="or" close=")">
  759. "resultClass" like '%${item}%'
  760. </foreach>
  761. </if>
  762. <if test="resultForeignShipName != null">
  763. and
  764. <foreach collection="resultForeignShipName" item="item" open="(" separator="or" close=")">
  765. "resultForeignShipName" like '%${item}%'
  766. </foreach>
  767. </if>
  768. <if test="materialName != null">
  769. and
  770. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  771. materialName like '%${item}%'
  772. </foreach>
  773. </if>
  774. <if test="sendStationName != null">
  775. and
  776. <foreach collection="sendStationName" item="item" open="(" separator="or" close=")">
  777. "sendStationName" like '%${item}%'
  778. </foreach>
  779. </if>
  780. <if test="arrivalStationName != null">
  781. and
  782. <foreach collection="arrivalStationName" item="item" open="(" separator="or" close=")">
  783. arrivalStationName like '%${item}%'
  784. </foreach>
  785. </if>
  786. <if test="resultBillableTonnage != null">
  787. and
  788. <foreach collection="resultBillableTonnage" item="item" open="(" separator="or" close=")">
  789. "resultBillableTonnage" like '%${item}%'
  790. </foreach>
  791. </if>
  792. <if test="resultIsclear != null">
  793. and
  794. <foreach collection="resultIsclear" item="item" open="(" separator="or" close=")">
  795. "resultIsclear" like '%${item}%'
  796. </foreach>
  797. </if>
  798. <if test="resultRemarks != null">
  799. and
  800. <foreach collection="resultRemarks" item="item" open="(" separator="or" close=")">
  801. "resultRemarks" like '%${item}%'
  802. </foreach>
  803. </if>
  804. </where>
  805. <include refid="orderBy"></include>
  806. <if test="orderField == null ">
  807. order by "insertTime" desc
  808. </if>
  809. </select>
  810. <sql id="orderBy">
  811. <if test="orderField != null and orderField != ''">
  812. order by "${orderField}"
  813. <if test="orderType != null and orderType != ''">
  814. ${orderType}
  815. </if>
  816. </if>
  817. </sql>
  818. <select id="getResultForeignShipName" parameterType="java.math.BigDecimal" resultType="String">
  819. select RESULT_FOREIGN_SHIP_NAME
  820. FROM DIL_BATCH d_batch
  821. where d_batch.BATCH_ID = #{batchId}
  822. </select>
  823. <select id="getMaterialID" parameterType="java.math.BigDecimal" resultType="java.math.BigDecimal">
  824. select MATERIAL_ID
  825. FROM DIL_BATCH d_batch
  826. where d_batch.BATCH_ID = #{batchId}
  827. </select>
  828. <select id="getPurchaseOrderId" parameterType="java.util.Map" resultType="java.math.BigDecimal">
  829. select
  830. APO.PURCHASE_ORDER_ID
  831. from AMS_PURCHASE_ORDER APO
  832. left join DIL_BATCH DB
  833. on DB.BATCH_ID = APO.BATCH_ID
  834. where DB.BATCH_ID = #{batchId}
  835. </select>
  836. <select id="getSendStationName" resultType="java.util.LinkedHashMap">
  837. select
  838. ARRIVAL_ID "id",
  839. ARRIVAL_ID "value",
  840. ARRIVAL_NAME "label"
  841. from RMSTRAIN_ARRIVAL_SEND
  842. </select>
  843. <select id="getArrivalStationName" resultType="java.util.LinkedHashMap">
  844. select
  845. ras.ARRIVAL_ID "id",
  846. ras.ARRIVAL_ID "value",
  847. ras.ARRIVAL_NAME "label"
  848. from RMSTRAIN_ARRIVAL_SEND ras
  849. </select>
  850. <select id="getBatchId" resultType="java.util.LinkedHashMap">
  851. select
  852. BATCH_ID "id",
  853. BATCH_ID "value",
  854. CONCAT(CONCAT(RM.MATERIAL_NAME, '"'), CONCAT(DB.RESULT_FOREIGN_SHIP_NAME, '"')) "label"
  855. from DIL_BATCH DB
  856. left join RMS_MATERIAL RM
  857. on RM.MATERIAL_ID = DB.MATERIAL_ID
  858. </select>
  859. <!-- 获取装车实绩中还未卸车的装车实绩-->
  860. <select id="getWagonNo" resultType="java.util.LinkedHashMap" parameterType="java.util.Map">
  861. select *
  862. from (
  863. select TLR.RESULT_WAGON_NO "resultWagonNo",
  864. TLR.RESULT_ID "resultId",
  865. TLR.RESULT_LOADING_DATE "resultLoadingDate",
  866. APO.PURCHASE_ORDER_NO "purchaseOrderNo",
  867. RM.MATERIAL_NAME "materialName"
  868. from TMSTRAIN_LOADING_RESULT TLR
  869. left join AMS_PURCHASE_ORDER APO
  870. on APO.PURCHASE_ORDER_ID = TLR.PURCHASE_ORDER_RAIL_PLAN_ID
  871. left join DIL_BATCH DB
  872. on DB.BATCH_ID = APO.BATCH_ID
  873. left join RMS_MATERIAL RM
  874. on DB.MATERIAL_ID = RM.MATERIAL_ID
  875. where TLR.DELETED not in (2, 1)
  876. and TLR.RESULT_TYPE = #{resultType}
  877. )
  878. <where>
  879. <if test="resultWagonNo != null">
  880. <foreach collection="resultWagonNo" item="item" open="(" separator="or" close=")">
  881. "resultWagonNo" like '%${item}%'
  882. </foreach>
  883. </if>
  884. <if test="resultLoadingDate != null">
  885. and
  886. <foreach collection="resultLoadingDate" item="item" open="(" separator="or" close=")">
  887. "resultLoadingDate" like '%${item}%'
  888. </foreach>
  889. </if>
  890. <if test="purchaseOrderNo != null">
  891. and
  892. <foreach collection="purchaseOrderNo" item="item" open="(" separator="or" close=")">
  893. "purchaseOrderNo" like '%${item}%'
  894. </foreach>
  895. </if>
  896. <if test="materialName != null">
  897. and
  898. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  899. "materialName" like '%${item}%'
  900. </foreach>
  901. </if>
  902. </where>
  903. <include refid="orderBy"></include>
  904. <if test="orderField == null ">
  905. order by "resultLoadingDate" desc
  906. </if>
  907. </select>
  908. <select id="selectByResultId" parameterType="java.math.BigDecimal" resultType="java.util.LinkedHashMap">
  909. select
  910. APO.PURCHASE_ORDER_NO "purchaseOrderNo",
  911. t_load.RESULT_WAGON_NO "resultWagonNo",
  912. t_load.RESULT_BILLABLE_TONNAGE "resultBillableTonnage",
  913. t_load.RESULT_ISCLEAR "resultIsclear",
  914. t_load.RESULT_CLASS "resultClass",
  915. t_load.SEND_STATION_ID "sendStationId",
  916. t_load.ARRIVAL_STATION_ID "arrivalStationId",
  917. t_load.RESULT_LOADING_DATE "resultLoadingDate",
  918. t_load.BATCH_ID "batchId",
  919. t_load.RESULT_REMARKS "resultRemarks",
  920. t_load.RESULT_WAGON_NO "resultWagonNo"
  921. from TMSTRAIN_LOADING_RESULT t_load
  922. left join AMS_PURCHASE_ORDER APO
  923. on APO.PURCHASE_ORDER_ID = t_load.PURCHASE_ORDER_RAIL_PLAN_ID
  924. where t_load.RESULT_ID = #{resultId}
  925. </select>
  926. <select id="getPortIdBySendStationId" parameterType="java.math.BigDecimal" resultType="java.math.BigDecimal">
  927. select RAS.OWNED_PORT_ID from RMSTRAIN_ARRIVAL_SEND RAS where RAS.ARRIVAL_ID = #{sendStationId}
  928. </select>
  929. <!-- 通过发运计划号查找物资信息 -->
  930. <select id="getMaterialInfoByRailPlanId" resultType="java.util.Map" parameterType="java.lang.Integer">
  931. SELECT RM.MATERIAL_NAME "materialName",
  932. AROM.OFFSET_MATERIAL_NUMBER "materialNumber",
  933. AROM.OFFSET_MATERIAL_WEIGHT "materialWeight",
  934. AROM.MATERIAL_ID "materialId"
  935. FROM AMS_RAIL_OFFSET_DAYPLAN AROD
  936. LEFT JOIN AMS_RAIL_OFFSET_MATERIAL AROM
  937. ON AROM.DAYPLAN_ID=AROD.DAYPLAN_ID
  938. LEFT JOIN RMS_MATERIAL RM
  939. ON RM.MATERIAL_ID=AROM.MATERIAL_ID
  940. WHERE AROD.DAYPLAN_ID=#{dayPlanId}
  941. </select>
  942. <!-- 内转物流查询装车作业 -->
  943. <select id="selectLoadedForConverted" parameterType="java.util.Map" resultType="java.util.Map">
  944. select *
  945. from (
  946. select TLR.RESULT_ID "resultId",
  947. TLR.RESULT_BILLABLE_TONNAGE "resultBillableTonnage",
  948. AROD.DAYPLAN_NO "dayplanNo",
  949. TLR.RESULT_CLASS "resultClass",
  950. TLR.INSERT_UPDATE_REMARK "insertUpdateRemark",
  951. TO_CHAR(TLR.RESULT_LOADING_DATE, 'yyyy-mm-dd') "resultLoadingDate",
  952. TLR.RESULT_LOADING_DATE "loadDate",
  953. TLR.RESULT_WAGON_NO "resultWagonNo",
  954. RAS.ARRIVAL_NAME "dayplanSendStationName",
  955. RAS2.ARRIVAL_NAME "dayplanToTheStationName",
  956. AROD.DAYPLAN_CONSIGNEE_NAME "dayplanConsigneeName",
  957. AROD.DAYPLAN_CONSIGNEE_TEL "dayplanConsigneeTel",
  958. RAS2.DAYPLAN_DEDICATED_LINE "dayplanDedicatedLine",
  959. RS.SHIPPER_NAME "shipperName",
  960. RC.CONSIGNEE_COMPANY_NAME "consigneeCompanyName"
  961. from TMSTRAIN_LOADING_RESULT TLR
  962. LEFT JOIN AMS_RAIL_OFFSET_DAYPLAN AROD
  963. ON AROD.DAYPLAN_ID = TLR.PURCHASE_ORDER_RAIL_PLAN_ID
  964. LEFT JOIN RMSTRAIN_ARRIVAL_SEND RAS
  965. ON RAS.ARRIVAL_ID = AROD.DAYPLAN_SEND_STATION_ID
  966. LEFT JOIN RMSTRAIN_ARRIVAL_SEND RAS2
  967. ON AROD.DAYPLAN_TO_THE_STATION_ID = RAS2.ARRIVAL_ID
  968. LEFT JOIN RMS_CONSIGNEE RC
  969. ON RC.CONSIGNEE_ID = AROD.RECEIVING_UNIT_ID
  970. LEFT JOIN RMS_SHIPPER RS
  971. ON RS.SHIPPER_ID = AROD.SHIPPER_ID
  972. WHERE TLR.DELETED = 0
  973. AND TLR.RESULT_TYPE = 4
  974. )
  975. <where>
  976. <if test="resultBillableTonnage != null">
  977. and
  978. <foreach collection="resultBillableTonnage" item="item" open="(" separator="or" close=")">
  979. "resultBillableTonnage" like '%${item}%'
  980. </foreach>
  981. </if>
  982. <if test="dayplanNo != null">
  983. and
  984. <foreach collection="dayplanNo" item="item" open="(" separator="or" close=")">
  985. "dayplanNo" like '%${item}%'
  986. </foreach>
  987. </if>
  988. <if test="resultClass != null">
  989. and
  990. <foreach collection="resultClass" item="item" open="(" separator="or" close=")">
  991. "resultClass" like '%${item}%'
  992. </foreach>
  993. </if>
  994. <if test="insertUpdateRemark != null">
  995. and
  996. <foreach collection="insertUpdateRemark" item="item" open="(" separator="or" close=")">
  997. "insertUpdateRemark" like '%${item}%'
  998. </foreach>
  999. </if>
  1000. <if test="resultLoadingDate != null">
  1001. and
  1002. <foreach collection="resultLoadingDate" item="item" open="(" separator="or" close=")">
  1003. "resultLoadingDate" like '%${item}%'
  1004. </foreach>
  1005. </if>
  1006. <if test="resultWagonNo != null">
  1007. and
  1008. <foreach collection="resultWagonNo" item="item" open="(" separator="or" close=")">
  1009. "resultWagonNo" like '%${item}%'
  1010. </foreach>
  1011. </if>
  1012. <if test="dayplanSendStationName != null">
  1013. and
  1014. <foreach collection="dayplanSendStationName" item="item" open="(" separator="or" close=")">
  1015. "dayplanSendStationName" like '%${item}%'
  1016. </foreach>
  1017. </if>
  1018. <if test="dayplanToTheStationName != null">
  1019. and
  1020. <foreach collection="dayplanToTheStationName" item="item" open="(" separator="or" close=")">
  1021. "dayplanToTheStationName" like '%${item}%'
  1022. </foreach>
  1023. </if>
  1024. <if test="dayplanConsigneeName != null">
  1025. and
  1026. <foreach collection="dayplanConsigneeName" item="item" open="(" separator="or" close=")">
  1027. "dayplanConsigneeName" like '%${item}%'
  1028. </foreach>
  1029. </if>
  1030. <if test="dayplanConsigneeTel != null">
  1031. and
  1032. <foreach collection="dayplanConsigneeTel" item="item" open="(" separator="or" close=")">
  1033. "dayplanConsigneeTel" like '%${item}%'
  1034. </foreach>
  1035. </if>
  1036. <if test="shipperName != null">
  1037. and
  1038. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  1039. "shipperName" like '%${item}%'
  1040. </foreach>
  1041. </if>
  1042. <if test="consigneeCompanyName != null">
  1043. and
  1044. <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
  1045. "consigneeCompanyName" like '%${item}%'
  1046. </foreach>
  1047. </if>
  1048. </where>
  1049. <include refid="orderBy"></include>
  1050. <if test="orderField == null ">
  1051. order by "loadDate" desc
  1052. </if>
  1053. </select>
  1054. <select id="selectLoadByResultId" parameterType="java.math.BigDecimal" resultType="java.util.LinkedHashMap">
  1055. select
  1056. t_load.RESULT_WAGON_NO "resultWagonNo",
  1057. t_load.RESULT_BILLABLE_TONNAGE "resultBillableTonnage",
  1058. t_load.RESULT_CLASS "resultClass",
  1059. t_load.SEND_STATION_ID "sendStationId",
  1060. t_load.ARRIVAL_STATION_ID "arrivalStationId",
  1061. t_load.RESULT_LOADING_DATE "resultLoadingDate",
  1062. t_load.RESULT_REMARKS "resultRemarks",
  1063. t_load.RESULT_MATERIAL_NUMBER "materialNumber",
  1064. t_load.RESULT_MATERIAL_THEORYWEIGHT "materialTheoryWeight"
  1065. from TMSTRAIN_LOADING_RESULT t_load
  1066. where t_load.RESULT_ID = #{resultId}
  1067. </select>
  1068. <!-- 通过扫描结果匹配 出库扫描实绩中出库实绩Id -->
  1069. <select id="getOutBoundResultIdByScan" parameterType="string" resultType="java.lang.Integer">
  1070. SELECT WOSR.OUTBOUND_RESULT_ID
  1071. FROM WMSP_OUTBOUND_SCAN_RESULT WOSR
  1072. WHERE WOSR.RESULT_MATERIAL = #{scanText} AND WOSR.RESULT_CHECK = 0
  1073. </select>
  1074. <!-- 通过出库主键ID查询订单总实绩ID -->
  1075. <select id="getResultTotalIdByOutBoundResultId" parameterType="int" resultType="java.util.Map">
  1076. SELECT WOR.MATERIAL_ID "materialId",
  1077. (
  1078. select TTR.RESULT_TOTAL_ID
  1079. from TMSTRUCK_TOTAL_RESULT TTR
  1080. where TTR.ORDER_ID = WOR.BILL_LADING_ID
  1081. ) "resultTotalId"
  1082. FROM WMSP_OUTBOUND_RESULT WOR
  1083. WHERE WOR.RESULT_ID = #{outboundResultId}
  1084. </select>
  1085. <!-- 通过发运计划ID和车皮号查询装车实绩ID -->
  1086. <select id="getLoadingIdByWnoAndRailPlanId" parameterType="java.util.Map" resultType="java.lang.Integer">
  1087. SELECT
  1088. TLR.RESULT_ID
  1089. FROM TMSTRAIN_LOADING_RESULT TLR
  1090. WHERE TLR.RESULT_WAGON_NO = #{resultWagonNo} AND TLR.PURCHASE_ORDER_RAIL_PLAN_ID = #{railPlanId}
  1091. </select>
  1092. <!-- 通过装车实绩主键查询关联的物资信息与车牌号 -->
  1093. <select id="getMaterialAndCarByLoadingId" parameterType="java.util.Map" resultType="java.util.Map">
  1094. select RC.CAPACITY_NUMBER "capacityNumber",
  1095. RM.MATERIAL_NAME "materialName",
  1096. RM.MATERIAL_SPECIFICATION "materialSpecification",
  1097. RM.MATERIAL_MODEL "materialModel",
  1098. OOM.ORDER_MATERIAL_NUMBER "orderMaterialNumber"
  1099. from TMSTRAIN_TRUCK_TOTAL_RESULT TTTR
  1100. left join TMSTRUCK_TOTAL_RESULT TTR
  1101. on TTR.RESULT_TOTAL_ID = TTTR.TMSTRUCK_TOTAL_RESULT_ID
  1102. left join OMSTRUCK_ORDER OO
  1103. on OO.ORDER_ID = TTR.ORDER_ID
  1104. left join RMS_CAPACITY RC
  1105. on RC.CAPACITY_ID = OO.CAPACITY_ID
  1106. left join OMSTRUCK_ORDER_MATERIAL OOM
  1107. on OOM.ORDER_ID = OO.ORDER_ID
  1108. left join RMS_MATERIAL RM
  1109. on RM.MATERIAL_ID = OOM.MATERIAL_ID
  1110. <where>
  1111. <if test="loadingId != null">
  1112. TTTR.TMSTRAIN_TOTAL_RESULT_ID = (
  1113. select TTR.TOTAL_RESULT_ID
  1114. from TMSTRAIN_LOADING_RESULT TLR
  1115. left join TMSTRAIN_TOTAL_RESULT TTR
  1116. on TLR.RESULT_ID = TTR.LOADING_ID
  1117. where TLR.RESULT_ID = #{loadingId}
  1118. )
  1119. </if>
  1120. <if test="unloadingId != null">
  1121. and TTTR.TMSTRAIN_TOTAL_RESULT_ID = (
  1122. select TTR.TOTAL_RESULT_ID
  1123. from TMSTRAIN_WAGON_UNLOAD_RESULT TWUR
  1124. left join TMSTRAIN_TOTAL_RESULT TTR
  1125. on TTR.UNLOADING_ID = TWUR.UNLOADING_ID
  1126. where TWUR.UNLOADING_ID = #{unloadingId}
  1127. )
  1128. </if>
  1129. </where>
  1130. </select>
  1131. <!-- 通过汽车总实绩ID查询中间表-->
  1132. <select id="getTrainTruckIdByTruckTotalId" parameterType="java.math.BigDecimal" resultType="java.lang.Integer">
  1133. select TTTR.RESULT_ID
  1134. from TMSTRAIN_TRUCK_TOTAL_RESULT TTTR
  1135. where TTTR.TMSTRUCK_TOTAL_RESULT_ID = #{resultTotalId}
  1136. </select>
  1137. <!-- 通过批次Id查询订单ID -->
  1138. <select id="getBatchIdByPurOrderId" parameterType="java.math.BigDecimal" resultType="java.math.BigDecimal">
  1139. select APO.BATCH_ID
  1140. from AMS_PURCHASE_ORDER APO
  1141. where APO.PURCHASE_ORDER_ID = #{purchaseOrderId}
  1142. </select>
  1143. <!-- 查询还没有采购订单的装车实绩 (补录) -->
  1144. <select id="getNoPurOrderIdLoadResult" parameterType="map" resultType="java.util.Map">
  1145. select * from(
  1146. select t_load.RESULT_ID "resultId",
  1147. a_order.PURCHASE_ORDER_NO "purchaseOrderNo",
  1148. t_load.RESULT_WAGON_NO "resultWagonNo",
  1149. to_char(t_load.RESULT_LOADING_DATE, 'yyyy-mm-dd') "resultLoadingDate",
  1150. t_load.RESULT_CLASS "resultClass",
  1151. d_batch.RESULT_FOREIGN_SHIP_NAME "resultForeignShipName",
  1152. r_material.MATERIAL_NAME "materialName",
  1153. r_s_arrival.ARRIVAL_NAME "sendStationName",
  1154. r_a_arrival.ARRIVAL_NAME "arrivalStationName",
  1155. t_load.RESULT_BILLABLE_TONNAGE "resultBillableTonnage",
  1156. t_load.RESULT_ISCLEAR "resultIsclear",
  1157. t_load.RESULT_REMARKS "resultRemarks",
  1158. RS.SUPPLIER_NAME "supplierName",
  1159. t_load.INSERT_TIME "insertTime"
  1160. from TMSTRAIN_LOADING_RESULT t_load
  1161. left join AMS_PURCHASE_ORDER a_order
  1162. on t_load.PURCHASE_ORDER_RAIL_PLAN_ID=a_order.PURCHASE_ORDER_ID
  1163. left join RMS_SUPPLIER RS
  1164. on RS.SUPPLIER_ID = a_order.SUPPLIER_UNIT_ID
  1165. left join DIL_BATCH d_batch
  1166. on t_load.BATCH_ID=d_batch.BATCH_ID
  1167. left join RMS_MATERIAL r_material
  1168. on d_batch.MATERIAL_ID=r_material.MATERIAL_ID
  1169. left join RMSTRAIN_ARRIVAL_SEND r_s_arrival
  1170. on r_s_arrival.ARRIVAL_ID=t_load.SEND_STATION_ID
  1171. left join RMSTRAIN_ARRIVAL_SEND r_a_arrival
  1172. on r_a_arrival.ARRIVAL_ID=t_load.ARRIVAL_STATION_ID
  1173. where t_load.DELETED = 0
  1174. and t_load.RESULT_TYPE = 3
  1175. and t_load.PURCHASE_ORDER_RAIL_PLAN_ID is null
  1176. )
  1177. <where>
  1178. <if test="purchaseOrderNo != null">
  1179. <foreach collection="purchaseOrderNo" item="item" open="(" separator="or" close=")">
  1180. "purchaseOrderNo" like '%${item}%'
  1181. </foreach>
  1182. </if>
  1183. <if test="resultWagonNo != null">
  1184. and
  1185. <foreach collection="resultWagonNo" item="item" open="(" separator="or" close=")">
  1186. "resultWagonNo" like '%${item}%'
  1187. </foreach>
  1188. </if>
  1189. <if test="resultLoadingDate != null">
  1190. and
  1191. <foreach collection="resultLoadingDate" item="item" open="(" separator="or" close=")">
  1192. "resultLoadingDate" like '%${item}%'
  1193. </foreach>
  1194. </if>
  1195. <if test="resultClass != null">
  1196. and
  1197. <foreach collection="resultClass" item="item" open="(" separator="or" close=")">
  1198. "resultClass" like '%${item}%'
  1199. </foreach>
  1200. </if>
  1201. <if test="resultForeignShipName != null">
  1202. and
  1203. <foreach collection="resultForeignShipName" item="item" open="(" separator="or" close=")">
  1204. "resultForeignShipName" like '%${item}%'
  1205. </foreach>
  1206. </if>
  1207. <if test="materialName != null">
  1208. and
  1209. <foreach collection="materialName" item="item" open="(" separator="or" close=")">
  1210. materialName like '%${item}%'
  1211. </foreach>
  1212. </if>
  1213. <if test="sendStationName != null">
  1214. and
  1215. <foreach collection="sendStationName" item="item" open="(" separator="or" close=")">
  1216. "sendStationName" like '%${item}%'
  1217. </foreach>
  1218. </if>
  1219. <if test="arrivalStationName != null">
  1220. and
  1221. <foreach collection="arrivalStationName" item="item" open="(" separator="or" close=")">
  1222. arrivalStationName like '%${item}%'
  1223. </foreach>
  1224. </if>
  1225. <if test="resultBillableTonnage != null">
  1226. and
  1227. <foreach collection="resultBillableTonnage" item="item" open="(" separator="or" close=")">
  1228. "resultBillableTonnage" like '%${item}%'
  1229. </foreach>
  1230. </if>
  1231. <if test="resultIsclear != null">
  1232. and
  1233. <foreach collection="resultIsclear" item="item" open="(" separator="or" close=")">
  1234. "resultIsclear" like '%${item}%'
  1235. </foreach>
  1236. </if>
  1237. <if test="resultRemarks != null">
  1238. and
  1239. <foreach collection="resultRemarks" item="item" open="(" separator="or" close=")">
  1240. "resultRemarks" like '%${item}%'
  1241. </foreach>
  1242. </if>
  1243. </where>
  1244. <include refid="orderBy"></include>
  1245. <if test="orderField == null ">
  1246. order by "insertTime" desc
  1247. </if>
  1248. </select>
  1249. </mapper>