BmstruckDetailsOrderMapper.xml 58 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277
  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.BmstruckDetailsOrderMapper">
  4. <resultMap id="BaseResultMap" type="com.steerinfo.dil.model.BmstruckDetailsOrder">
  5. <id column="DETAILS_ID" jdbcType="DECIMAL" property="detailsId" />
  6. <result column="PURCHASE_ORDER_ID" jdbcType="DECIMAL" property="purchaseOrderId" />
  7. <result column="WEIGHT_TASK_RESULT_ID" jdbcType="DECIMAL" property="weightTaskResultId" />
  8. <result column="DETAILS_NO" jdbcType="VARCHAR" property="detailsNo" />
  9. <result column="DETAILS_TIME" jdbcType="TIMESTAMP" property="detailsTime" />
  10. <result column="PRICE_ID" jdbcType="DECIMAL" property="priceId" />
  11. <result column="DETAILS_AMOUNT" jdbcType="DECIMAL" property="detailsAmount" />
  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. <result column="WETHER_TO_STATEMENT" jdbcType="DECIMAL" property="wetherToStatement" />
  18. <result column="EAS_AMOUNT" jdbcType="DECIMAL" property="easAmount" />
  19. </resultMap>
  20. <sql id="columns">
  21. DETAILS_ID, PURCHASE_ORDER_ID, WEIGHT_TASK_RESULT_ID, DETAILS_NO, DETAILS_TIME, PRICE_ID,
  22. DETAILS_AMOUNT, INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK,
  23. WETHER_TO_STATEMENT, EAS_AMOUNT
  24. </sql>
  25. <sql id="columns_alias">
  26. t.DETAILS_ID, t.PURCHASE_ORDER_ID, t.WEIGHT_TASK_RESULT_ID, t.DETAILS_NO, t.DETAILS_TIME,
  27. t.PRICE_ID, t.DETAILS_AMOUNT, t.INSERT_USERNAME, t.INSERT_TIME, t.UPDATE_USERNAME,
  28. t.UPDATE_TIME, t.INSERT_UPDATE_REMARK, t.WETHER_TO_STATEMENT, t.EAS_AMOUNT
  29. </sql>
  30. <sql id="select">
  31. SELECT <include refid="columns" /> FROM BMSTRUCK_DETAILS_ORDER
  32. </sql>
  33. <sql id="select_alias">
  34. SELECT <include refid="columns_alias" /> FROM BMSTRUCK_DETAILS_ORDER t
  35. </sql>
  36. <sql id="where">
  37. <where>
  38. <if test="detailsId != null">
  39. and DETAILS_ID = #{detailsId}
  40. </if>
  41. <if test="purchaseOrderId != null">
  42. and PURCHASE_ORDER_ID = #{purchaseOrderId}
  43. </if>
  44. <if test="weightTaskResultId != null">
  45. and WEIGHT_TASK_RESULT_ID = #{weightTaskResultId}
  46. </if>
  47. <if test="detailsNo != null and detailsNo != ''">
  48. and DETAILS_NO = #{detailsNo}
  49. </if>
  50. <if test="detailsTime != null">
  51. and TO_CHAR(DETAILS_TIME,'yyyy-MM-dd') = #{detailsTime}
  52. </if>
  53. <if test="priceId != null">
  54. and PRICE_ID = #{priceId}
  55. </if>
  56. <if test="detailsAmount != null">
  57. and DETAILS_AMOUNT = #{detailsAmount}
  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="wetherToStatement != null">
  75. and WETHER_TO_STATEMENT = #{wetherToStatement}
  76. </if>
  77. <if test="easAmount != null">
  78. and EAS_AMOUNT = #{easAmount}
  79. </if>
  80. </where>
  81. </sql>
  82. <sql id="whereLike">
  83. <where>
  84. <if test="detailsId != null">
  85. and DETAILS_ID = #{detailsId}
  86. </if>
  87. <if test="purchaseOrderId != null">
  88. and PURCHASE_ORDER_ID = #{purchaseOrderId}
  89. </if>
  90. <if test="weightTaskResultId != null">
  91. and WEIGHT_TASK_RESULT_ID = #{weightTaskResultId}
  92. </if>
  93. <if test="detailsNo != null and detailsNo != ''">
  94. and DETAILS_NO LIKE '%${detailsNo}%'
  95. </if>
  96. <if test="detailsTime != null">
  97. and TO_CHAR(DETAILS_TIME,'yyyy-MM-dd') = #{detailsTime}
  98. </if>
  99. <if test="priceId != null">
  100. and PRICE_ID = #{priceId}
  101. </if>
  102. <if test="detailsAmount != null">
  103. and DETAILS_AMOUNT = #{detailsAmount}
  104. </if>
  105. <if test="insertUsername != null and insertUsername != ''">
  106. and INSERT_USERNAME LIKE '%${insertUsername}%'
  107. </if>
  108. <if test="insertTime != null">
  109. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  110. </if>
  111. <if test="updateUsername != null and updateUsername != ''">
  112. and UPDATE_USERNAME LIKE '%${updateUsername}%'
  113. </if>
  114. <if test="updateTime != null">
  115. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  116. </if>
  117. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  118. and INSERT_UPDATE_REMARK LIKE '%${insertUpdateRemark}%'
  119. </if>
  120. <if test="wetherToStatement != null">
  121. and WETHER_TO_STATEMENT = #{wetherToStatement}
  122. </if>
  123. <if test="easAmount != null">
  124. and EAS_AMOUNT = #{easAmount}
  125. </if>
  126. </where>
  127. </sql>
  128. <delete id="deleteByPrimaryKey" parameterType="DECIMAL">
  129. delete from BMSTRUCK_DETAILS_ORDER
  130. where DETAILS_ID = #{detailsId,jdbcType=DECIMAL}
  131. </delete>
  132. <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
  133. delete from BMSTRUCK_DETAILS_ORDER
  134. where 1!=1
  135. <if test="purchaseOrderId != null">
  136. or PURCHASE_ORDER_ID = #{purchaseOrderId}
  137. </if>
  138. <if test="weightTaskResultId != null">
  139. or WEIGHT_TASK_RESULT_ID = #{weightTaskResultId}
  140. </if>
  141. <if test="detailsNo != null and detailsNo != ''">
  142. or DETAILS_NO = #{detailsNo}
  143. </if>
  144. <if test="detailsTime != null">
  145. or TO_CHAR(DETAILS_TIME,'yyyy-MM-dd') = '#{detailsTime}'
  146. </if>
  147. <if test="priceId != null">
  148. or PRICE_ID = #{priceId}
  149. </if>
  150. <if test="detailsAmount != null">
  151. or DETAILS_AMOUNT = #{detailsAmount}
  152. </if>
  153. <if test="insertUsername != null and insertUsername != ''">
  154. or INSERT_USERNAME = #{insertUsername}
  155. </if>
  156. <if test="insertTime != null">
  157. or TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = '#{insertTime}'
  158. </if>
  159. <if test="updateUsername != null and updateUsername != ''">
  160. or UPDATE_USERNAME = #{updateUsername}
  161. </if>
  162. <if test="updateTime != null">
  163. or TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = '#{updateTime}'
  164. </if>
  165. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  166. or INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  167. </if>
  168. <if test="wetherToStatement != null">
  169. or WETHER_TO_STATEMENT = #{wetherToStatement}
  170. </if>
  171. <if test="easAmount != null">
  172. or EAS_AMOUNT = #{easAmount}
  173. </if>
  174. </delete>
  175. <insert id="insert" parameterType="com.steerinfo.dil.model.BmstruckDetailsOrder">
  176. insert into BMSTRUCK_DETAILS_ORDER (DETAILS_ID, PURCHASE_ORDER_ID, WEIGHT_TASK_RESULT_ID,
  177. DETAILS_NO, DETAILS_TIME, PRICE_ID,
  178. DETAILS_AMOUNT, INSERT_USERNAME, INSERT_TIME,
  179. UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK,
  180. WETHER_TO_STATEMENT, EAS_AMOUNT)
  181. values (#{detailsId,jdbcType=DECIMAL}, #{purchaseOrderId,jdbcType=DECIMAL}, #{weightTaskResultId,jdbcType=DECIMAL},
  182. #{detailsNo,jdbcType=VARCHAR}, #{detailsTime,jdbcType=TIMESTAMP}, #{priceId,jdbcType=DECIMAL},
  183. #{detailsAmount,jdbcType=DECIMAL}, #{insertUsername,jdbcType=VARCHAR}, #{insertTime,jdbcType=TIMESTAMP},
  184. #{updateUsername,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{insertUpdateRemark,jdbcType=VARCHAR},
  185. #{wetherToStatement,jdbcType=DECIMAL}, #{easAmount,jdbcType=DECIMAL})
  186. </insert>
  187. <insert id="insertSelective" parameterType="com.steerinfo.dil.model.BmstruckDetailsOrder">
  188. insert into BMSTRUCK_DETAILS_ORDER
  189. <trim prefix="(" suffix=")" suffixOverrides=",">
  190. <if test="detailsId != null">
  191. DETAILS_ID,
  192. </if>
  193. <if test="purchaseOrderId != null">
  194. PURCHASE_ORDER_ID,
  195. </if>
  196. <if test="weightTaskResultId != null">
  197. WEIGHT_TASK_RESULT_ID,
  198. </if>
  199. <if test="detailsNo != null">
  200. DETAILS_NO,
  201. </if>
  202. <if test="detailsTime != null">
  203. DETAILS_TIME,
  204. </if>
  205. <if test="priceId != null">
  206. PRICE_ID,
  207. </if>
  208. <if test="detailsAmount != null">
  209. DETAILS_AMOUNT,
  210. </if>
  211. <if test="insertUsername != null">
  212. INSERT_USERNAME,
  213. </if>
  214. <if test="insertTime != null">
  215. INSERT_TIME,
  216. </if>
  217. <if test="updateUsername != null">
  218. UPDATE_USERNAME,
  219. </if>
  220. <if test="updateTime != null">
  221. UPDATE_TIME,
  222. </if>
  223. <if test="insertUpdateRemark != null">
  224. INSERT_UPDATE_REMARK,
  225. </if>
  226. <if test="wetherToStatement != null">
  227. WETHER_TO_STATEMENT,
  228. </if>
  229. <if test="easAmount != null">
  230. EAS_AMOUNT,
  231. </if>
  232. </trim>
  233. <trim prefix="values (" suffix=")" suffixOverrides=",">
  234. <if test="detailsId != null">
  235. #{detailsId,jdbcType=DECIMAL},
  236. </if>
  237. <if test="purchaseOrderId != null">
  238. #{purchaseOrderId,jdbcType=DECIMAL},
  239. </if>
  240. <if test="weightTaskResultId != null">
  241. #{weightTaskResultId,jdbcType=DECIMAL},
  242. </if>
  243. <if test="detailsNo != null">
  244. #{detailsNo,jdbcType=VARCHAR},
  245. </if>
  246. <if test="detailsTime != null">
  247. #{detailsTime,jdbcType=TIMESTAMP},
  248. </if>
  249. <if test="priceId != null">
  250. #{priceId,jdbcType=DECIMAL},
  251. </if>
  252. <if test="detailsAmount != null">
  253. #{detailsAmount,jdbcType=DECIMAL},
  254. </if>
  255. <if test="insertUsername != null">
  256. #{insertUsername,jdbcType=VARCHAR},
  257. </if>
  258. <if test="insertTime != null">
  259. #{insertTime,jdbcType=TIMESTAMP},
  260. </if>
  261. <if test="updateUsername != null">
  262. #{updateUsername,jdbcType=VARCHAR},
  263. </if>
  264. <if test="updateTime != null">
  265. #{updateTime,jdbcType=TIMESTAMP},
  266. </if>
  267. <if test="insertUpdateRemark != null">
  268. #{insertUpdateRemark,jdbcType=VARCHAR},
  269. </if>
  270. <if test="wetherToStatement != null">
  271. #{wetherToStatement,jdbcType=DECIMAL},
  272. </if>
  273. <if test="easAmount != null">
  274. #{easAmount,jdbcType=DECIMAL},
  275. </if>
  276. </trim>
  277. </insert>
  278. <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.BmstruckDetailsOrder">
  279. update BMSTRUCK_DETAILS_ORDER
  280. set PURCHASE_ORDER_ID = #{purchaseOrderId,jdbcType=DECIMAL},
  281. WEIGHT_TASK_RESULT_ID = #{weightTaskResultId,jdbcType=DECIMAL},
  282. DETAILS_NO = #{detailsNo,jdbcType=VARCHAR},
  283. DETAILS_TIME = #{detailsTime,jdbcType=TIMESTAMP},
  284. PRICE_ID = #{priceId,jdbcType=DECIMAL},
  285. DETAILS_AMOUNT = #{detailsAmount,jdbcType=DECIMAL},
  286. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  287. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  288. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  289. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  290. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  291. WETHER_TO_STATEMENT = #{wetherToStatement,jdbcType=DECIMAL},
  292. EAS_AMOUNT = #{easAmount,jdbcType=DECIMAL}
  293. where DETAILS_ID = #{detailsId,jdbcType=DECIMAL}
  294. </update>
  295. <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.BmstruckDetailsOrder">
  296. update BMSTRUCK_DETAILS_ORDER
  297. <set>
  298. <if test="purchaseOrderId != null">
  299. PURCHASE_ORDER_ID = #{purchaseOrderId,jdbcType=DECIMAL},
  300. </if>
  301. <if test="weightTaskResultId != null">
  302. WEIGHT_TASK_RESULT_ID = #{weightTaskResultId,jdbcType=DECIMAL},
  303. </if>
  304. <if test="detailsNo != null">
  305. DETAILS_NO = #{detailsNo,jdbcType=VARCHAR},
  306. </if>
  307. <if test="detailsTime != null">
  308. DETAILS_TIME = #{detailsTime,jdbcType=TIMESTAMP},
  309. </if>
  310. <if test="priceId != null">
  311. PRICE_ID = #{priceId,jdbcType=DECIMAL},
  312. </if>
  313. <if test="detailsAmount != null">
  314. DETAILS_AMOUNT = #{detailsAmount,jdbcType=DECIMAL},
  315. </if>
  316. <if test="insertUsername != null">
  317. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  318. </if>
  319. <if test="insertTime != null">
  320. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  321. </if>
  322. <if test="updateUsername != null">
  323. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  324. </if>
  325. <if test="updateTime != null">
  326. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  327. </if>
  328. <if test="insertUpdateRemark != null">
  329. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  330. </if>
  331. <if test="wetherToStatement != null">
  332. WETHER_TO_STATEMENT = #{wetherToStatement,jdbcType=DECIMAL},
  333. </if>
  334. <if test="easAmount != null">
  335. EAS_AMOUNT = #{easAmount,jdbcType=DECIMAL},
  336. </if>
  337. </set>
  338. where DETAILS_ID = #{detailsId,jdbcType=DECIMAL}
  339. </update>
  340. <select id="selectByPrimaryKey" parameterType="DECIMAL" resultMap="BaseResultMap">
  341. <include refid="select" />
  342. where DETAILS_ID = #{detailsId,jdbcType=DECIMAL}
  343. </select>
  344. <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  345. <include refid="select" />
  346. <include refid="where" />
  347. </select>
  348. <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  349. <include refid="select" />
  350. <include refid="whereLike" />
  351. </select>
  352. <insert id="batchInsert" parameterType="java.util.List">
  353. insert into BMSTRUCK_DETAILS_ORDER
  354. (DETAILS_ID,
  355. PURCHASE_ORDER_ID, WEIGHT_TASK_RESULT_ID,
  356. DETAILS_NO, DETAILS_TIME, PRICE_ID,
  357. DETAILS_AMOUNT, INSERT_USERNAME,
  358. INSERT_TIME, UPDATE_USERNAME,
  359. UPDATE_TIME, INSERT_UPDATE_REMARK,
  360. WETHER_TO_STATEMENT, EAS_AMOUNT)
  361. ( <foreach collection="list" item="item" separator="union all">
  362. select
  363. #{item.detailsId,jdbcType=DECIMAL},
  364. #{item.purchaseOrderId,jdbcType=DECIMAL}, #{item.weightTaskResultId,jdbcType=DECIMAL},
  365. #{item.detailsNo,jdbcType=VARCHAR}, #{item.detailsTime,jdbcType=TIMESTAMP}, #{item.priceId,jdbcType=DECIMAL},
  366. #{item.detailsAmount,jdbcType=DECIMAL}, #{item.insertUsername,jdbcType=VARCHAR},
  367. #{item.insertTime,jdbcType=TIMESTAMP}, #{item.updateUsername,jdbcType=VARCHAR},
  368. #{item.updateTime,jdbcType=TIMESTAMP}, #{item.insertUpdateRemark,jdbcType=VARCHAR},
  369. #{item.wetherToStatement,jdbcType=DECIMAL}, #{item.easAmount,jdbcType=DECIMAL} from dual
  370. </foreach> )
  371. </insert>
  372. <update id="batchUpdate" parameterType="java.util.List">
  373. update BMSTRUCK_DETAILS_ORDER
  374. set
  375. DETAILS_ID=
  376. <foreach close="end" collection="list" index="index" item="item" open="case DETAILS_ID" separator=" ">
  377. when #{item.detailsId,jdbcType=DECIMAL} then #{item.detailsId,jdbcType=DECIMAL}
  378. </foreach>
  379. ,PURCHASE_ORDER_ID=
  380. <foreach close="end" collection="list" index="index" item="item" open="case DETAILS_ID" separator=" ">
  381. when #{item.detailsId,jdbcType=DECIMAL} then #{item.purchaseOrderId,jdbcType=DECIMAL}
  382. </foreach>
  383. ,WEIGHT_TASK_RESULT_ID=
  384. <foreach close="end" collection="list" index="index" item="item" open="case DETAILS_ID" separator=" ">
  385. when #{item.detailsId,jdbcType=DECIMAL} then #{item.weightTaskResultId,jdbcType=DECIMAL}
  386. </foreach>
  387. ,DETAILS_NO=
  388. <foreach close="end" collection="list" index="index" item="item" open="case DETAILS_ID" separator=" ">
  389. when #{item.detailsId,jdbcType=DECIMAL} then #{item.detailsNo,jdbcType=VARCHAR}
  390. </foreach>
  391. ,DETAILS_TIME=
  392. <foreach close="end" collection="list" index="index" item="item" open="case DETAILS_ID" separator=" ">
  393. when #{item.detailsId,jdbcType=DECIMAL} then #{item.detailsTime,jdbcType=TIMESTAMP}
  394. </foreach>
  395. ,PRICE_ID=
  396. <foreach close="end" collection="list" index="index" item="item" open="case DETAILS_ID" separator=" ">
  397. when #{item.detailsId,jdbcType=DECIMAL} then #{item.priceId,jdbcType=DECIMAL}
  398. </foreach>
  399. ,DETAILS_AMOUNT=
  400. <foreach close="end" collection="list" index="index" item="item" open="case DETAILS_ID" separator=" ">
  401. when #{item.detailsId,jdbcType=DECIMAL} then #{item.detailsAmount,jdbcType=DECIMAL}
  402. </foreach>
  403. ,INSERT_USERNAME=
  404. <foreach close="end" collection="list" index="index" item="item" open="case DETAILS_ID" separator=" ">
  405. when #{item.detailsId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
  406. </foreach>
  407. ,INSERT_TIME=
  408. <foreach close="end" collection="list" index="index" item="item" open="case DETAILS_ID" separator=" ">
  409. when #{item.detailsId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
  410. </foreach>
  411. ,UPDATE_USERNAME=
  412. <foreach close="end" collection="list" index="index" item="item" open="case DETAILS_ID" separator=" ">
  413. when #{item.detailsId,jdbcType=DECIMAL} then #{item.updateUsername,jdbcType=VARCHAR}
  414. </foreach>
  415. ,UPDATE_TIME=
  416. <foreach close="end" collection="list" index="index" item="item" open="case DETAILS_ID" separator=" ">
  417. when #{item.detailsId,jdbcType=DECIMAL} then #{item.updateTime,jdbcType=TIMESTAMP}
  418. </foreach>
  419. ,INSERT_UPDATE_REMARK=
  420. <foreach close="end" collection="list" index="index" item="item" open="case DETAILS_ID" separator=" ">
  421. when #{item.detailsId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
  422. </foreach>
  423. ,WETHER_TO_STATEMENT=
  424. <foreach close="end" collection="list" index="index" item="item" open="case DETAILS_ID" separator=" ">
  425. when #{item.detailsId,jdbcType=DECIMAL} then #{item.wetherToStatement,jdbcType=DECIMAL}
  426. </foreach>
  427. ,EAS_AMOUNT=
  428. <foreach close="end" collection="list" index="index" item="item" open="case DETAILS_ID" separator=" ">
  429. when #{item.detailsId,jdbcType=DECIMAL} then #{item.easAmount,jdbcType=DECIMAL}
  430. </foreach>
  431. where DETAILS_ID in
  432. <foreach close=")" collection="list" index="index" item="item" open="(" separator=",">
  433. #{item.detailsId,jdbcType=DECIMAL}
  434. </foreach>
  435. </update>
  436. <delete id="batchDelete" parameterType="java.util.List">
  437. delete from BMSTRUCK_DETAILS_ORDER
  438. where DETAILS_ID in
  439. <foreach close=")" collection="list" item="id" open="(" separator=",">
  440. #{id}
  441. </foreach>
  442. </delete>
  443. <!-- 友情提示!!!-->
  444. <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
  445. <!-- 销售汽运结算详单 -->
  446. <select id="getTruckDetailsOrderList" resultType="java.util.Map" parameterType="java.util.Map">
  447. SELECT * FROM(
  448. SELECT DISTINCT
  449. bdo.INSERT_TIME as "insertTime",
  450. bdo.DETAILS_ID as "detailsId",
  451. apo.RECEIVE_UNIT_ID as "statementShipperId",
  452. db.BATCH_ID as "batchId",
  453. oo.ORDER_ID as "orderId",
  454. apo.PURCHASE_ORDER_NO as "purchaseOrderNo",
  455. rm.MATERIAL_NAME as "materialName",
  456. db.RESULT_FOREIGN_SHIP_NAME as "resultForeignShipName",
  457. bdo.DETAILS_NO as "detailsNo",
  458. bdo.DETAILS_TIME as "detailsTime",
  459. rc.CAPACITY_NUMBER as "capacityNumber",
  460. twr.RESULT_NET_WEIGHT as "resultNetWeight",
  461. actp.PRICE_VALUE as "priceValue",
  462. bdo.DETAILS_AMOUNT as "detailsAmount"
  463. FROM BMSTRUCK_DETAILS_ORDER bdo
  464. LEFT JOIN AMS_PURCHASE_ORDER apo
  465. ON apo.PURCHASE_ORDER_ID = bdo.PURCHASE_ORDER_ID
  466. LEFT JOIN RMS_SHIPPER rs
  467. ON rs.SHIPPER_ID = apo.RECEIVE_UNIT_ID
  468. LEFT JOIN DIL_BATCH db
  469. ON db.BATCH_ID = apo.BATCH_ID
  470. LEFT JOIN RMS_MATERIAL rm
  471. ON rm.MATERIAL_ID = db.MATERIAL_ID
  472. LEFT JOIN TMSTRUCK_WEIGHT_RESULT twr
  473. ON twr.WEIGHT_TASK_RESULT_ID = bdo.WEIGHT_TASK_RESULT_ID
  474. LEFT JOIN TMSTRUCK_TOTAL_RESULT ttl
  475. ON ttl.RESULT_TOTAL_ID = twr.RESULT_TOTAL_ID
  476. LEFT JOIN OMSTRUCK_ORDER oo
  477. ON oo.ORDER_ID = ttl.ORDER_ID
  478. LEFT JOIN RMS_CAPACITY rc
  479. ON oo.CAPACITY_ID = rc.CAPACITY_ID
  480. LEFT JOIN AMS_CONTRACT_TRANSPORT_PRICE actp
  481. ON actp.PRICE_ID = bdo.PRICE_ID
  482. WHERE oo.ORDER_TYPE = #{orderType}
  483. )
  484. <where>
  485. <if test="purchaseOrderNo!= null">
  486. and
  487. <foreach collection="purchaseOrderNo" item="item" open="(" separator="," close=")">
  488. "purchaseOrderNo" in #{item}
  489. </foreach>
  490. </if>
  491. <if test="materialName!= null">
  492. and
  493. <foreach collection="materialName" item="item" open="(" separator="," close=")">
  494. "materialName" in #{item}
  495. </foreach>
  496. </if>
  497. <if test="resultForeignShipName!= null">
  498. and
  499. <foreach collection="resultForeignShipName" item="item" open="(" separator="," close=")">
  500. "resultForeignShipName" in #{item}
  501. </foreach>
  502. </if>
  503. <if test="detailsNo!= null">
  504. and
  505. <foreach collection="detailsNo" item="item" open="(" separator="," close=")">
  506. "detailsNo" in #{item}
  507. </foreach>
  508. </if>
  509. <if test="detailsTime!= null">
  510. and
  511. <foreach collection="detailsTime" item="item" open="(" separator="," close=")">
  512. "detailsTime" in to_date('${item}','yyyy-mm-dd hh24:mi:ss')
  513. </foreach>
  514. </if>
  515. <if test="capacityNumber!= null">
  516. and
  517. <foreach collection="capacityNumber" item="item" open="(" separator="," close=")">
  518. "capacityNumber" in #{item}
  519. </foreach>
  520. </if>
  521. <if test="resultNetWeight!= null">
  522. and
  523. <foreach collection="resultNetWeight" item="item" open="(" separator="," close=")">
  524. "resultNetWeight" in #{item}
  525. </foreach>
  526. </if>
  527. <if test="priceValue!= null">
  528. and
  529. <foreach collection="priceValue" item="item" open="(" separator="," close=")">
  530. "priceValue" in #{item}
  531. </foreach>
  532. </if>
  533. <if test="detailsAmount!= null">
  534. and
  535. <foreach collection="detailsAmount" item="item" open="(" separator="," close=")">
  536. "detailsAmount" in #{item}
  537. </foreach>
  538. </if>
  539. </where>
  540. <include refid="orderBy"></include>
  541. </select>
  542. <!-- 未转账单的销售详单 -->
  543. <select id="getUnFinishedTruckDetailsOrderList" resultType="java.util.Map" parameterType="java.util.Map">
  544. SELECT * FROM(
  545. SELECT DISTINCT
  546. bdo.INSERT_TIME as "insertTime",
  547. bdo.DETAILS_ID as "detailsId",
  548. oo.ORDER_ID as "orderId",
  549. bdo.DETAILS_NO as "detailsNo",
  550. oo.ORDER_NUMBER as "orderNumber",
  551. bdo.DETAILS_TIME as "detailsTime",
  552. rc.CAPACITY_NUMBER as "capacityNumber",
  553. rct.CAPACITY_TYPE_NAME as "capacityTypeName",
  554. RC2.CARRIER_NAME as "carrierName",
  555. rs.SHIPPER_NAME as "shipperName",
  556. rco.CONSIGNEE_COMPANY_NAME as "consigneeReceiveAddress",
  557. actp.PRICE_VALUE as "priceValue",
  558. bdo.DETAILS_AMOUNT as "detailsAmount",
  559. RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN || RRP.ADDRESS_DELIVERY_ADDRESS AS "realAddress",
  560. ter.RESULT_ENTRY_GATE_TIME as "resultEntryGateTime",
  561. rge.GATEPOST_NAME as "enGatepostName",
  562. twr.RESULT_TARE_WEIGHT_TIME as "resultTareWeightTime",
  563. twr.RESULT_TARE_WEIGHT as "resultTareWeight",
  564. rtct.TRUCK_CALCULATE_NUMBER as "tareCalculateNumber",
  565. tlr.RESULT_LOAD_START_TIME as "resultLoadStartTime",
  566. rw.WAREHOUSE_NAME as "warehouseName",
  567. twr.RESULT_GROSS_WEIGHT_TIME as "resultGrossWeightTime",
  568. twr.RESULT_GROSS_WEIGHT as "resultGrossWeight",
  569. rtcg.TRUCK_CALCULATE_NUMBER as "grossCalculateNumber",
  570. tlfr.RESULT_OUT_GATE_TIME as "resultOutGateTime",
  571. rgl.GATEPOST_NAME as "leaveGatepostName",
  572. twr.RESULT_NET_WEIGHT as "resultNetWeight"
  573. FROM BMSTRUCK_DETAILS_ORDER bdo
  574. LEFT JOIN TMSTRUCK_WEIGHT_RESULT twr
  575. ON twr.WEIGHT_TASK_RESULT_ID = bdo.WEIGHT_TASK_RESULT_ID
  576. LEFT JOIN TMSTRUCK_TOTAL_RESULT ttl
  577. ON ttl.RESULT_TOTAL_ID = twr.RESULT_TOTAL_ID
  578. LEFT JOIN TMSTRUCK_ENFACTORY_RESULT ter
  579. ON ter.RESULT_TOTAL_ID = ttl.RESULT_TOTAL_ID
  580. LEFT JOIN RMS_GATEPOST rge
  581. ON rge.GATEPOST_ID = ter.GATEPOST_ID
  582. LEFT JOIN RMS_TRUCK_CALCULATE rtct
  583. ON rtct.TRUCK_CALCULATE_ID = twr.RESULT_TARE_PLACE_ID
  584. LEFT JOIN TMSTRUCK_LOAD_RESULT tlr
  585. ON tlr.RESULT_TOTAL_ID = ttl.RESULT_TOTAL_ID
  586. LEFT JOIN RMS_WAREHOUSE rw
  587. ON rw.WAREHOUSE_ID = tlr.LOADING_ID
  588. LEFT JOIN RMS_TRUCK_CALCULATE rtcg
  589. ON rtcg.TRUCK_CALCULATE_ID = twr.RESULT_TARE_PLACE_ID
  590. LEFT JOIN TMSTRUCK_LEAVE_FACTORY_RESULT tlfr
  591. ON tlfr.RESULT_TOTAL_ID = ttl.RESULT_TOTAL_ID
  592. LEFT JOIN RMS_GATEPOST rgl
  593. ON rgl.GATEPOST_ID = ter.GATEPOST_ID
  594. LEFT JOIN OMSTRUCK_ORDER oo
  595. ON oo.ORDER_ID = ttl.ORDER_ID
  596. LEFT JOIN AMS_SALE_ORDER_MATERIAL asom
  597. ON oo.ORDER_PLAN_ID = asom.SALE_ORDER_MATERIAL_ID
  598. LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
  599. ON ADSO.SALE_ORDER_MATERIAL_ID = asom.SALE_ORDER_MATERIAL_ID
  600. LEFT JOIN RMS_CARRIER RC2
  601. ON RC2.CARRIER_ID = ADSO.CARRIER_ID
  602. LEFT JOIN AMS_SALE_ORDER aso
  603. ON aso.SALE_ORDER_ID = asom.SALE_ORDER_ID
  604. LEFT JOIN RMS_SHIPPER rs
  605. ON rs.SHIPPER_ID = aso.SHIPPER_ID
  606. LEFT JOIN RMS_CONSIGNEE rco
  607. ON rco.CONSIGNEE_ID = aso.RECEIVE_ID
  608. LEFT JOIN RMS_CAPACITY rc
  609. ON oo.CAPACITY_ID = rc.CAPACITY_ID
  610. LEFT JOIN RMS_CAPACITY_TYPE rct
  611. ON rct.CAPACITY_TYPE_ID = rc.CAPACITY_TYPE_ID
  612. LEFT JOIN AMS_CONTRACT_TRANSPORT_PRICE actp
  613. ON actp.PRICE_ID = bdo.PRICE_ID
  614. LEFT JOIN RMS_RECEIVE_PLACE RRP
  615. ON RRP.PLACE_ID = asom.SALE_SHIPPING_ADDRESS_ID
  616. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  617. ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
  618. WHERE oo.ORDER_TYPE in (1,2)
  619. AND bdo.WETHER_TO_STATEMENT = 0
  620. <if test="carrierId != null" >
  621. AND RC2.CARRIER_ID = #{carrierId}
  622. </if>
  623. )
  624. <where>
  625. <if test="detailsNo!= null">
  626. and
  627. <foreach collection="detailsNo" item="item" open="(" separator="," close=")">
  628. "detailsNo" in #{item}
  629. </foreach>
  630. </if>
  631. <if test="orderNumber!= null">
  632. and
  633. <foreach collection="orderNumber" item="item" open="(" separator="," close=")">
  634. "orderNumber" in #{item}
  635. </foreach>
  636. </if>
  637. <if test="carrierName!= null">
  638. and
  639. <foreach collection="carrierName" item="item" open="(" separator="," close=")">
  640. "carrierName" in #{item}
  641. </foreach>
  642. </if>
  643. <if test="detailsTime!= null">
  644. and
  645. <foreach collection="detailsTime" item="item" open="(" separator="," close=")">
  646. "detailsTime" in to_date('${item}','yyyy-mm-dd hh24:mi:ss')
  647. </foreach>
  648. </if>
  649. <if test="capacityNumber!= null">
  650. and
  651. <foreach collection="capacityNumber" item="item" open="(" separator="," close=")">
  652. "capacityNumber" in #{item}
  653. </foreach>
  654. </if>
  655. <if test="capacityTypeName!= null">
  656. and
  657. <foreach collection="capacityTypeName" item="item" open="(" separator="," close=")">
  658. "capacityTypeName" in #{item}
  659. </foreach>
  660. </if>
  661. <if test="shipperName!= null">
  662. and
  663. <foreach collection="shipperName" item="item" open="(" separator="," close=")">
  664. "shipperName" in #{item}
  665. </foreach>
  666. </if>
  667. <if test="consigneeReceiveAddress!= null">
  668. and
  669. <foreach collection="consigneeReceiveAddress" item="item" open="(" separator="," close=")">
  670. "consigneeReceiveAddress" in #{item}
  671. </foreach>
  672. </if>
  673. <if test="priceValue!= null">
  674. and
  675. <foreach collection="priceValue" item="item" open="(" separator="," close=")">
  676. "priceValue" in #{item}
  677. </foreach>
  678. </if>
  679. <if test="detailsAmount!= null">
  680. and
  681. <foreach collection="detailsAmount" item="item" open="(" separator="," close=")">
  682. "detailsAmount" in #{item}
  683. </foreach>
  684. </if>
  685. </where>
  686. <include refid="orderBy"></include>
  687. </select>
  688. <!-- 销售汽运结算详单 -->
  689. <select id="getSaleTruckDetailsOrderList" resultType="java.util.Map" parameterType="java.util.Map">
  690. SELECT * FROM(
  691. SELECT DISTINCT
  692. bdo.INSERT_TIME as "insertTime",
  693. bdo.DETAILS_ID as "detailsId",
  694. oo.ORDER_ID as "orderId",
  695. bdo.DETAILS_NO as "detailsNo",
  696. oo.ORDER_NUMBER as "orderNumber",
  697. bdo.DETAILS_TIME as "detailsTime",
  698. rc.CAPACITY_NUMBER as "capacityNumber",
  699. rct.CAPACITY_TYPE_NAME as "capacityTypeName",
  700. rs.SHIPPER_NAME as "shipperName",
  701. rco.CONSIGNEE_COMPANY_NAME as "consigneeReceiveAddress",
  702. rc2.CARRIER_NAME as "carrierName",
  703. actp.PRICE_VALUE as "priceValue",
  704. bdo.DETAILS_AMOUNT as "detailsAmount",
  705. bdo.WETHER_TO_STATEMENT as "wetherToStatement",
  706. RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN || RRP.ADDRESS_DELIVERY_ADDRESS AS "realAddress",
  707. ter.RESULT_ENTRY_GATE_TIME as "resultEntryGateTime",
  708. rge.GATEPOST_NAME as "enGatepostName",
  709. twr.RESULT_TARE_WEIGHT_TIME as "resultTareWeightTime",
  710. twr.RESULT_TARE_WEIGHT as "resultTareWeight",
  711. rtct.TRUCK_CALCULATE_NUMBER as "tareCalculateNumber",
  712. tlr.RESULT_LOAD_START_TIME as "resultLoadStartTime",
  713. rw.WAREHOUSE_NAME as "warehouseName",
  714. twr.RESULT_GROSS_WEIGHT_TIME as "resultGrossWeightTime",
  715. twr.RESULT_GROSS_WEIGHT as "resultGrossWeight",
  716. rtcg.TRUCK_CALCULATE_NUMBER as "grossCalculateNumber",
  717. tlfr.RESULT_OUT_GATE_TIME as "resultOutGateTime",
  718. rgl.GATEPOST_NAME as "leaveGatepostName",
  719. twr.RESULT_NET_WEIGHT as "resultNetWeight"
  720. FROM BMSTRUCK_DETAILS_ORDER bdo
  721. LEFT JOIN TMSTRUCK_WEIGHT_RESULT twr
  722. ON twr.WEIGHT_TASK_RESULT_ID = bdo.WEIGHT_TASK_RESULT_ID
  723. LEFT JOIN TMSTRUCK_TOTAL_RESULT ttl
  724. ON ttl.RESULT_TOTAL_ID = twr.RESULT_TOTAL_ID
  725. LEFT JOIN TMSTRUCK_ENFACTORY_RESULT ter
  726. ON ter.RESULT_TOTAL_ID = ttl.RESULT_TOTAL_ID
  727. LEFT JOIN RMS_GATEPOST rge
  728. ON rge.GATEPOST_ID = ter.GATEPOST_ID
  729. LEFT JOIN RMS_TRUCK_CALCULATE rtct
  730. ON rtct.TRUCK_CALCULATE_ID = twr.RESULT_TARE_PLACE_ID
  731. LEFT JOIN TMSTRUCK_LOAD_RESULT tlr
  732. ON tlr.RESULT_TOTAL_ID = ttl.RESULT_TOTAL_ID
  733. LEFT JOIN RMS_WAREHOUSE rw
  734. ON rw.WAREHOUSE_ID = tlr.LOADING_ID
  735. LEFT JOIN RMS_TRUCK_CALCULATE rtcg
  736. ON rtcg.TRUCK_CALCULATE_ID = twr.RESULT_TARE_PLACE_ID
  737. LEFT JOIN TMSTRUCK_LEAVE_FACTORY_RESULT tlfr
  738. ON tlfr.RESULT_TOTAL_ID = ttl.RESULT_TOTAL_ID
  739. LEFT JOIN RMS_GATEPOST rgl
  740. ON rgl.GATEPOST_ID = ter.GATEPOST_ID
  741. LEFT JOIN OMSTRUCK_ORDER oo
  742. ON oo.ORDER_ID = ttl.ORDER_ID
  743. LEFT JOIN AMS_SALE_ORDER_MATERIAL asom
  744. ON oo.ORDER_PLAN_ID = asom.SALE_ORDER_MATERIAL_ID
  745. LEFT JOIN AMS_DISPATCH_SALE_ORDER adso
  746. ON adso.SALE_ORDER_MATERIAL_ID = asom.SALE_ORDER_MATERIAL_ID
  747. LEFT JOIN RMS_CARRIER rc2
  748. ON rc2.CARRIER_ID = adso.CARRIER_ID
  749. LEFT JOIN AMS_SALE_ORDER aso
  750. ON aso.SALE_ORDER_ID = asom.SALE_ORDER_ID
  751. LEFT JOIN RMS_SHIPPER rs
  752. ON rs.SHIPPER_ID = aso.SHIPPER_ID
  753. LEFT JOIN RMS_CONSIGNEE rco
  754. ON rco.CONSIGNEE_ID = aso.RECEIVE_ID
  755. LEFT JOIN RMS_CAPACITY rc
  756. ON oo.CAPACITY_ID = rc.CAPACITY_ID
  757. LEFT JOIN RMS_CAPACITY_TYPE rct
  758. ON rct.CAPACITY_TYPE_ID = rc.CAPACITY_TYPE_ID
  759. LEFT JOIN AMS_CONTRACT_TRANSPORT_PRICE actp
  760. ON actp.PRICE_ID = bdo.PRICE_ID
  761. LEFT JOIN RMS_RECEIVE_PLACE RRP
  762. ON RRP.PLACE_ID = asom.SALE_SHIPPING_ADDRESS_ID
  763. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  764. ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
  765. WHERE oo.ORDER_TYPE in (1,2)
  766. AND bdo.WETHER_TO_STATEMENT = 1
  767. <if test="carrierId != null" >
  768. AND rc2.CARRIER_ID = #{carrierId}
  769. </if>
  770. )
  771. <where>
  772. <if test="detailsNo!= null">
  773. and
  774. <foreach collection="detailsNo" item="item" open="(" separator="," close=")">
  775. "detailsNo" in #{item}
  776. </foreach>
  777. </if>
  778. <if test="orderNumber!= null">
  779. and
  780. <foreach collection="orderNumber" item="item" open="(" separator="," close=")">
  781. "orderNumber" in #{item}
  782. </foreach>
  783. </if>
  784. <if test="detailsTime!= null">
  785. and
  786. <foreach collection="detailsTime" item="item" open="(" separator="," close=")">
  787. "detailsTime" in to_date('${item}','yyyy-mm-dd hh24:mi:ss')
  788. </foreach>
  789. </if>
  790. <if test="capacityNumber!= null">
  791. and
  792. <foreach collection="capacityNumber" item="item" open="(" separator="," close=")">
  793. "capacityNumber" in #{item}
  794. </foreach>
  795. </if>
  796. <if test="capacityTypeName!= null">
  797. and
  798. <foreach collection="capacityTypeName" item="item" open="(" separator="," close=")">
  799. "capacityTypeName" in #{item}
  800. </foreach>
  801. </if>
  802. <if test="shipperName!= null">
  803. and
  804. <foreach collection="shipperName" item="item" open="(" separator="," close=")">
  805. "shipperName" in #{item}
  806. </foreach>
  807. </if>
  808. <if test="consigneeReceiveAddress!= null">
  809. and
  810. <foreach collection="consigneeReceiveAddress" item="item" open="(" separator="," close=")">
  811. "consigneeReceiveAddress" in #{item}
  812. </foreach>
  813. </if>
  814. <if test="priceValue!= null">
  815. and
  816. <foreach collection="priceValue" item="item" open="(" separator="," close=")">
  817. "priceValue" in #{item}
  818. </foreach>
  819. </if>
  820. <if test="detailsAmount!= null">
  821. and
  822. <foreach collection="detailsAmount" item="item" open="(" separator="," close=")">
  823. "detailsAmount" in #{item}
  824. </foreach>
  825. </if>
  826. </where>
  827. <include refid="orderBy"></include>
  828. </select>
  829. <!-- 得到最大id -->
  830. <select id="selectMaxId" resultType="DECIMAL">
  831. SELECT MAX(DETAILS_ID)
  832. FROM BMSTRUCK_DETAILS_ORDER
  833. </select>
  834. <sql id="orderBy">
  835. <if test="orderField != null and orderField != ''">
  836. order by "${orderField}"
  837. <if test="orderType != null and orderType != ''">
  838. ${orderType}
  839. </if>
  840. </if>
  841. <if test="orderField == null ">
  842. order by "insertTime" desc
  843. </if>
  844. </sql>
  845. <!-- 根据运单id查询运单类型 -->
  846. <select id="getOrderType" parameterType="DECIMAL" resultType="DECIMAL">
  847. SELECT ORDER_TYPE
  848. FROM OMSTRUCK_ORDER
  849. WHERE ORDER_ID = #{orderId}
  850. </select>
  851. <!-- 展示采购汽运实绩列表 -->
  852. <select id="getTruckResultList" parameterType="java.util.Map" resultType="java.util.Map">
  853. SELECT *
  854. FROM (
  855. SELECT oo.INSERT_TIME as "insertTime",
  856. apo.PURCHASE_ORDER_NO as "purchaseOrderNo",
  857. rm.MATERIAL_NAME as "materialName",
  858. db.RESULT_FOREIGN_SHIP_NAME as "resultForeignShipName",
  859. oo.ORDER_ISSUE_TIME as "orderIssueTime",
  860. rc.CONSIGNEE_COMPANY_NAME as "consigneeCompanyName",
  861. rsu.SUPPLIER_NAME as "supplierName",
  862. rca.CAPACITY_NUMBER as "capacityNumber",
  863. twr.RESULT_NET_WEIGHT as "resultNetWeight"
  864. FROM OMSTRUCK_ORDER oo
  865. LEFT JOIN RMS_CAPACITY rca
  866. ON rca.CAPACITY_ID = oo.CAPACITY_ID
  867. LEFT JOIN AMS_PURCHASE_ORDER apo
  868. ON apo.PURCHASE_ORDER_ID = oo.ORDER_PLAN_ID
  869. LEFT JOIN RMS_SUPPLIER rsu
  870. ON rsu.SUPPLIER_ID = apo.SUPPLIER_UNIT_ID
  871. LEFT JOIN RMS_CONSIGNEE rc
  872. ON rc.CONSIGNEE_ID = apo.RECEIVE_UNIT_ID
  873. LEFT JOIN DIL_BATCH db
  874. ON db.BATCH_ID = apo.BATCH_ID
  875. LEFT JOIN RMS_MATERIAL rm
  876. ON rm.MATERIAL_ID = db.MATERIAL_ID
  877. LEFT JOIN TMSTRUCK_TOTAL_RESULT ttr
  878. ON oo.ORDER_ID = ttr.ORDER_ID
  879. LEFT JOIN TMSTRUCK_WEIGHT_RESULT twr
  880. ON twr.RESULT_TOTAL_ID = ttr.RESULT_TOTAL_ID
  881. WHERE oo.ORDER_ID = #{orderId}
  882. )
  883. <where>
  884. <if test="purchaseOrderNo!= null">
  885. and
  886. <foreach collection="purchaseOrderNo" item="item" open="(" separator="," close=")">
  887. "purchaseOrderNo" in #{item}
  888. </foreach>
  889. </if>
  890. <if test="materialName!= null">
  891. and
  892. <foreach collection="materialName" item="item" open="(" separator="," close=")">
  893. "materialName" in #{item}
  894. </foreach>
  895. </if>
  896. <if test="resultForeignShipName!= null">
  897. and
  898. <foreach collection="resultForeignShipName" item="item" open="(" separator="," close=")">
  899. "resultForeignShipName" in #{item}
  900. </foreach>
  901. </if>
  902. <if test="orderIssueTime!= null">
  903. and
  904. <foreach collection="orderIssueTime" item="item" open="(" separator="," close=")">
  905. "orderIssueTime" in to_date('${item}','yyyy-mm-dd hh24:mi:ss')
  906. </foreach>
  907. </if>
  908. <if test="consigneeCompanyName!= null">
  909. and
  910. <foreach collection="consigneeCompanyName" item="item" open="(" separator="," close=")">
  911. "consigneeCompanyName" in #{item}
  912. </foreach>
  913. </if>
  914. <if test="supplierName!= null">
  915. and
  916. <foreach collection="supplierName" item="item" open="(" separator="," close=")">
  917. "supplierName" in #{item}
  918. </foreach>
  919. </if>
  920. <if test="capacityNumber!= null">
  921. and
  922. <foreach collection="capacityNumber" item="item" open="(" separator="," close=")">
  923. "capacityNumber" in #{item}
  924. </foreach>
  925. </if>
  926. <if test="resultNetWeight!= null">
  927. and
  928. <foreach collection="resultNetWeight" item="item" open="(" separator="," close=")">
  929. "resultNetWeight" in #{item}
  930. </foreach>
  931. </if>
  932. </where>
  933. <include refid="orderBy"></include>
  934. </select>
  935. <!-- 得到销售汽运实绩 -->
  936. <select id="getSaleTruckResultList" parameterType="java.util.Map" resultType="java.util.Map">
  937. SELECT *
  938. FROM (
  939. SELECT oo.INSERT_TIME as "insertTime",
  940. oo.ORDER_NUMBER as "orderNumber",
  941. rca.CAPACITY_NUMBER as "capacityNumber",
  942. rc.CARRIER_NAME as "carrierName",
  943. rl.LINE_NAME as "lineNo",
  944. ter.RESULT_ENTRY_GATE_TIME as "resultEntryGateTime",
  945. rge.GATEPOST_NAME as "enGatepostName",
  946. twr.RESULT_TARE_WEIGHT_TIME as "resultTareWeightTime",
  947. twr.RESULT_TARE_WEIGHT as "resultTareWeight",
  948. rtct.TRUCK_CALCULATE_NUMBER as "tareCalculateNumber",
  949. tlr.RESULT_LOAD_START_TIME as "resultLoadStartTime",
  950. rw.WAREHOUSE_NAME as "warehouseName",
  951. twr.RESULT_GROSS_WEIGHT_TIME as "resultGrossWeightTime",
  952. twr.RESULT_GROSS_WEIGHT as "resultGrossWeight",
  953. rtcg.TRUCK_CALCULATE_NUMBER as "grossCalculateNumber",
  954. tlfr.RESULT_OUT_GATE_TIME as "resultOutGateTime",
  955. rgl.GATEPOST_NAME as "leaveGatepostName",
  956. twr.RESULT_NET_WEIGHT as "resultNetWeight"
  957. FROM OMSTRUCK_ORDER oo
  958. LEFT JOIN RMS_CAPACITY rca
  959. ON rca.CAPACITY_ID = oo.CAPACITY_ID
  960. LEFT JOIN AMS_SALE_ORDER_MATERIAL asom
  961. ON asom.SALE_ORDER_MATERIAL_ID = oo.ORDER_PLAN_ID
  962. LEFT JOIN AMS_DISPATCH_SALE_ORDER adso
  963. ON adso.SALE_ORDER_MATERIAL_ID = asom.SALE_ORDER_MATERIAL_ID
  964. LEFT JOIN RMS_CARRIER rc
  965. ON rc.CARRIER_ID = adso.CARRIER_ID
  966. LEFT JOIN RMS_LINE rl
  967. ON oo.LINE_ID = rl.LINE_ID
  968. LEFT JOIN TMSTRUCK_TOTAL_RESULT ttr
  969. ON oo.ORDER_ID = ttr.ORDER_ID
  970. LEFT JOIN TMSTRUCK_ENFACTORY_RESULT ter
  971. ON ter.RESULT_TOTAL_ID = ttr.RESULT_TOTAL_ID
  972. LEFT JOIN RMS_GATEPOST rge
  973. ON rge.GATEPOST_ID = ter.GATEPOST_ID
  974. LEFT JOIN TMSTRUCK_WEIGHT_RESULT twr
  975. ON twr.RESULT_TOTAL_ID = ttr.RESULT_TOTAL_ID
  976. LEFT JOIN RMS_TRUCK_CALCULATE rtct
  977. ON rtct.TRUCK_CALCULATE_ID = twr.RESULT_TARE_PLACE_ID
  978. LEFT JOIN TMSTRUCK_LOAD_RESULT tlr
  979. ON tlr.RESULT_TOTAL_ID = ttr.RESULT_TOTAL_ID
  980. LEFT JOIN RMS_WAREHOUSE rw
  981. ON rw.WAREHOUSE_ID = tlr.LOADING_ID
  982. LEFT JOIN RMS_TRUCK_CALCULATE rtcg
  983. ON rtcg.TRUCK_CALCULATE_ID = twr.RESULT_TARE_PLACE_ID
  984. LEFT JOIN TMSTRUCK_LEAVE_FACTORY_RESULT tlfr
  985. ON tlfr.RESULT_TOTAL_ID = ttr.RESULT_TOTAL_ID
  986. LEFT JOIN RMS_GATEPOST rgl
  987. ON rgl.GATEPOST_ID = ter.GATEPOST_ID
  988. WHERE oo.ORDER_ID = #{orderId}
  989. )
  990. <where>
  991. <if test="orderNumber!= null">
  992. and
  993. <foreach collection="orderNumber" item="item" open="(" separator="," close=")">
  994. "orderNumber" in #{item}
  995. </foreach>
  996. </if>
  997. <if test="capacityNumber!= null">
  998. and
  999. <foreach collection="capacityNumber" item="item" open="(" separator="," close=")">
  1000. "capacityNumber" in #{item}
  1001. </foreach>
  1002. </if>
  1003. <if test="driverName!= null">
  1004. and
  1005. <foreach collection="driverName" item="item" open="(" separator="," close=")">
  1006. "driverName" in #{item}
  1007. </foreach>
  1008. </if>
  1009. <if test="carrierName!= null">
  1010. and
  1011. <foreach collection="carrierName" item="item" open="(" separator="," close=")">
  1012. "carrierName" in #{item}
  1013. </foreach>
  1014. </if>
  1015. <if test="lineNo!= null">
  1016. and
  1017. <foreach collection="lineNo" item="item" open="(" separator="," close=")">
  1018. "lineNo" in #{item}
  1019. </foreach>
  1020. </if>
  1021. <if test="resultEntryGateTime!= null">
  1022. and
  1023. <foreach collection="resultEntryGateTime" item="item" open="(" separator="," close=")">
  1024. "resultEntryGateTime" in to_date('${item}','yyyy-mm-dd hh24:mi:ss')
  1025. </foreach>
  1026. </if>
  1027. <if test="enGatepostName!= null">
  1028. and
  1029. <foreach collection="enGatepostName" item="item" open="(" separator="," close=")">
  1030. "enGatepostName" in #{item}
  1031. </foreach>
  1032. </if>
  1033. <if test="resultTareWeightTime!= null">
  1034. and
  1035. <foreach collection="resultTareWeightTime" item="item" open="(" separator="," close=")">
  1036. "resultTareWeightTime" in to_date('${item}','yyyy-mm-dd hh24:mi:ss')
  1037. </foreach>
  1038. </if>
  1039. <if test="resultTareWeight!= null">
  1040. and
  1041. <foreach collection="resultTareWeight" item="item" open="(" separator="," close=")">
  1042. "resultTareWeight" in #{item}
  1043. </foreach>
  1044. </if>
  1045. <if test="tareCalculateNumber!= null">
  1046. and
  1047. <foreach collection="tareCalculateNumber" item="item" open="(" separator="," close=")">
  1048. "tareCalculateNumber" in #{item}
  1049. </foreach>
  1050. </if>
  1051. <if test="resultLoadStartTime!= null">
  1052. and
  1053. <foreach collection="resultLoadStartTime" item="item" open="(" separator="," close=")">
  1054. "resultLoadStartTime" in to_date('${item}','yyyy-mm-dd hh24:mi:ss')
  1055. </foreach>
  1056. </if>
  1057. <if test="resultMeasuredTonnage!= null">
  1058. and
  1059. <foreach collection="resultMeasuredTonnage" item="item" open="(" separator="," close=")">
  1060. "resultMeasuredTonnage" in #{item}
  1061. </foreach>
  1062. </if>
  1063. <if test="warehouseName!= null">
  1064. and
  1065. <foreach collection="warehouseName" item="item" open="(" separator="," close=")">
  1066. "warehouseName" in #{item}
  1067. </foreach>
  1068. </if>
  1069. <if test="resultGrossWeightTime!= null">
  1070. and
  1071. <foreach collection="resultGrossWeightTime" item="item" open="(" separator="," close=")">
  1072. "resultGrossWeightTime" in to_date('${item}','yyyy-mm-dd hh24:mi:ss')
  1073. </foreach>
  1074. </if>
  1075. <if test="resultGrossWeight!= null">
  1076. and
  1077. <foreach collection="resultGrossWeight" item="item" open="(" separator="," close=")">
  1078. "resultGrossWeight" in #{item}
  1079. </foreach>
  1080. </if>
  1081. <if test="grossCalculateNumber!= null">
  1082. and
  1083. <foreach collection="grossCalculateNumber" item="item" open="(" separator="," close=")">
  1084. "grossCalculateNumber" in #{item}
  1085. </foreach>
  1086. </if>
  1087. <if test="resultOutGateTime!= null">
  1088. and
  1089. <foreach collection="resultOutGateTime" item="item" open="(" separator="," close=")">
  1090. "resultOutGateTime" in to_date('${item}','yyyy-mm-dd hh24:mi:ss')
  1091. </foreach>
  1092. </if>
  1093. <if test="leaveGatepostName!= null">
  1094. and
  1095. <foreach collection="leaveGatepostName" item="item" open="(" separator="," close=")">
  1096. "leaveGatepostName" in #{item}
  1097. </foreach>
  1098. </if>
  1099. </where>
  1100. <include refid="orderBy"></include>
  1101. </select>
  1102. <!-- 得到计算因子 -->
  1103. <select id="getFormulaMembers" parameterType="DECIMAL" resultType="DECIMAL">
  1104. SELECT apo.PURCHASE_ORDER_ID
  1105. FROM OMSTRUCK_ORDER oo
  1106. LEFT JOIN AMS_PURCHASE_ORDER apo
  1107. ON apo.PURCHASE_ORDER_ID = oo.ORDER_PLAN_ID
  1108. WHERE oo.ORDER_ID = #{orderId}
  1109. </select>
  1110. <!-- 得到单价id -->
  1111. <select id="getPriceId" resultType="java.util.Map" parameterType="DECIMAL">
  1112. SELECT OO.PRICE_ID AS "priceId"
  1113. FROM OMSTRUCK_ORDER OO
  1114. WHERE OO.ORDER_ID = #{orderId}
  1115. </select>
  1116. <select id="getPriceValue" parameterType="DECIMAL" resultType="DECIMAL">
  1117. SELECT actp.PRICE_VALUE as "priceValue"
  1118. FROM AMS_CONTRACT_TRANSPORT_PRICE actp
  1119. WHERE PRICE_ID = #{priceId}
  1120. </select>
  1121. <select id="getNetWeight" parameterType="DECIMAL" resultType="DECIMAL">
  1122. SELECT SUM(twr.RESULT_NET_WEIGHT) as "weightTaskResultId"
  1123. FROM TMSTRUCK_WEIGHT_RESULT twr
  1124. WHERE twr.WEIGHT_TASK_RESULT_ID = #{weightTaskResultId}
  1125. </select>
  1126. <select id="getOrderId" parameterType="DECIMAL" resultType="DECIMAL" >
  1127. SELECT OO.ORDER_ID AS "orderId"
  1128. FROM TMSTRUCK_WEIGHT_RESULT TWR
  1129. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  1130. ON TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
  1131. LEFT JOIN OMSTRUCK_ORDER OO
  1132. ON OO.ORDER_ID = TTR.ORDER_ID
  1133. WHERE TWR.WEIGHT_TASK_RESULT_ID = #{weightTaskResultId}
  1134. </select>
  1135. <!-- 查询未生成账单的计时详单 -->
  1136. <!--计时-->
  1137. <select id="getUnFinishedTimeTruckDetailsOrderList" parameterType="java.util.Map" resultType="java.util.Map">
  1138. select bdo.details_no as "detailsNo",
  1139. bdo.order_id as "orderId",
  1140. bdo.details_time as "detailsTime",
  1141. rc.capacity_number as "capacityNumber",
  1142. rct.capacity_type_name as "capacityType",
  1143. air.requirement_type as "requirementType",
  1144. bdo.price_id as "priceId",
  1145. bdo.details_amount as "detailsAmount"
  1146. from bmstruck_details_order bdo
  1147. join omstruck_order oo on bdo.order_id = oo.order_id
  1148. join rms_capacity rc on oo.capacity_id = rc.capacity_id
  1149. join rms_capacity_type rct on rc.capacity_type_id = rct.capacity_type_id
  1150. join amstruck_inward_plan aip on oo.order_plan_id = aip.plan_id
  1151. join amstruck_requirement_plan arp on aip.plan_id = arp.plan_id
  1152. join amstruck_inward_requirement air on arp.requirement_plan_id = air.requirement_id
  1153. join rms_line rl on air.line_id = rl.line_id
  1154. where air.requirement_type = 1
  1155. and bdo.wether_to_statement = 0
  1156. and oo.order_type = 4
  1157. </select>
  1158. <!--计数-->
  1159. <select id="getUnFinishedNumTruckDetailsOrderList" parameterType="java.util.Map" resultType="java.util.Map">
  1160. select bdo.details_no as "detailsNo",
  1161. bdo.order_id as "orderId",
  1162. bdo.details_time as "detailsTime",
  1163. rc.capacity_number as "capacityNumber",
  1164. rct.capacity_type_name as "capacityType",
  1165. air.requirement_type as "requirementType",
  1166. bdo.price_id as "priceId",
  1167. bdo.details_amount as "detailsAmount"
  1168. from bmstruck_details_order bdo
  1169. join omstruck_order oo on bdo.order_id = oo.order_id
  1170. join rms_capacity rc on oo.capacity_id = rc.capacity_id
  1171. join rms_capacity_type rct on rc.capacity_type_id = rct.capacity_type_id
  1172. join amstruck_inward_plan aip on oo.order_plan_id = aip.plan_id
  1173. join amstruck_requirement_plan arp on aip.plan_id = arp.plan_id
  1174. join amstruck_inward_requirement air on arp.requirement_plan_id = air.requirement_id
  1175. join rms_line rl on air.line_id = rl.line_id
  1176. where air.requirement_type = 2
  1177. and bdo.wether_to_statement = 0
  1178. and oo.order_type = 4
  1179. </select>
  1180. <!--计重-->
  1181. <select id="getUnFinishedWeightTruckDetailsOrderList" parameterType="java.util.Map" resultType="java.util.Map">
  1182. select bdo.details_no as "detailsNo",
  1183. bdo.order_id as "orderId",
  1184. bdo.details_time as "detailsTime",
  1185. rc.capacity_number as "capacityNumber",
  1186. rct.capacity_type_name as "capacityType",
  1187. air.requirement_type as "requirementType",
  1188. bdo.price_id as "priceId",
  1189. bdo.details_amount as "detailsAmount"
  1190. from bmstruck_details_order bdo
  1191. join omstruck_order oo on bdo.order_id = oo.order_id
  1192. join rms_capacity rc on oo.capacity_id = rc.capacity_id
  1193. join rms_capacity_type rct on rc.capacity_type_id = rct.capacity_type_id
  1194. join amstruck_inward_plan aip on oo.order_plan_id = aip.plan_id
  1195. join amstruck_requirement_plan arp on aip.plan_id = arp.plan_id
  1196. join amstruck_inward_requirement air on arp.requirement_plan_id = air.requirement_id
  1197. join rms_line rl on air.line_id = rl.line_id
  1198. where air.requirement_type = 0
  1199. and bdo.wether_to_statement = 0
  1200. and oo.order_type = 4
  1201. </select>
  1202. <!--包月-->
  1203. <select id="getUnFinishedMonthTruckDetailsOrderList" parameterType="java.util.Map" resultType="java.util.Map">
  1204. select bdo.details_no as "detailsNo",
  1205. bdo.order_id as "orderId",
  1206. bdo.details_time as "detailsTime",
  1207. rc.capacity_number as "capacityNumber",
  1208. rct.capacity_type_name as "capacityType",
  1209. air.requirement_type as "requirementType",
  1210. bdo.price_id as "priceId",
  1211. bdo.details_amount as "detailsAmount"
  1212. from bmstruck_details_order bdo
  1213. join omstruck_order oo on bdo.order_id = oo.order_id
  1214. join rms_capacity rc on oo.capacity_id = rc.capacity_id
  1215. join rms_capacity_type rct on rc.capacity_type_id = rct.capacity_type_id
  1216. join amstruck_inward_plan aip on oo.order_plan_id = aip.plan_id
  1217. join amstruck_requirement_plan arp on aip.plan_id = arp.plan_id
  1218. join amstruck_inward_requirement air on arp.requirement_plan_id = air.requirement_id
  1219. join rms_line rl on air.line_id = rl.line_id
  1220. where air.requirement_type = 3
  1221. and bdo.wether_to_statement = 0
  1222. and oo.order_type = 4
  1223. </select>
  1224. <!-- 通过运单id获取需求类型(需求类型(0:计重;1:计时;2:计次;3:包月))-->
  1225. <select id="getSettlement" parameterType="java.math.BigDecimal" resultType="java.util.Map">
  1226. select air.requirement_type as "requirementType",
  1227. oom.material_id as "materialId"
  1228. from omstruck_order oo
  1229. left join omstruck_order_material oom on oo.order_id = oom.order_id
  1230. left join amstruck_inward_plan aip on oo.order_plan_id = aip.plan_id
  1231. left join amstruck_requirement_plan arp on arp.plan_id = aip.plan_id
  1232. left join amstruck_inward_requirement air on arp.requirement_id = air.requirement_id
  1233. where oo.order_id = #{orderId}
  1234. </select>
  1235. <select id="getCarrierIdBySSO" parameterType="java.lang.String" resultType="DECIMAL" >
  1236. SELECT
  1237. RC.CARRIER_ID AS "carrierId"
  1238. FROM RMS_CARRIER RC
  1239. WHERE RC.CARRIER_SSO_ID = #{carrierSsoId}
  1240. </select>
  1241. <select id="findAddressAndPrice" parameterType="DECIMAL" resultType="java.util.Map" >
  1242. SELECT ACTP.PRICE_VALUE AS "priceValue",
  1243. RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT || RRA.ADDRESS_TOWN || RRP.ADDRESS_DELIVERY_ADDRESS AS ""
  1244. FROM AMS_CONTRACT_TRANSPORT_PRICE ACTP
  1245. LEFT JOIN RMS_RECEIVE_PLACE RRP
  1246. ON ACTP.PLACE_ID = RRP.PLACE_ID
  1247. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  1248. ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
  1249. WHERE ACTP.PRICE_ID = #{priceId}
  1250. </select>
  1251. <select id="getWeightTaskResultId" parameterType="DECIMAL" resultType="java.util.Map" >
  1252. SELECT TWR.WEIGHT_TASK_RESULT_ID AS "weightTaskResultId"
  1253. FROM OMSTRUCK_ORDER OO
  1254. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  1255. ON TTR.ORDER_ID = OO.ORDER_ID
  1256. LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR
  1257. ON TTR.RESULT_TOTAL_ID = TWR.RESULT_TOTAL_ID
  1258. WHERE OO.ORDER_ID = #{orderId}
  1259. </select>
  1260. </mapper>