AmsContractTruckPriceMapper.xml 62 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620
  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.AmsContractTruckPriceMapper">
  4. <resultMap id="BaseResultMap" type="com.steerinfo.dil.model.AmsContractTransportPrice">
  5. <id column="PRICE_ID" jdbcType="DECIMAL" property="priceId" />
  6. <result column="SHIPPER_ID" jdbcType="DECIMAL" property="shipperId" />
  7. <result column="CARRIER_ID" jdbcType="DECIMAL" property="carrierId" />
  8. <result column="LINE_ID" jdbcType="DECIMAL" property="lineId" />
  9. <result column="CAPACITY_TYPE_ID" jdbcType="DECIMAL" property="capacityTypeId" />
  10. <result column="CARGONAME_ID" jdbcType="DECIMAL" property="cargonameId" />
  11. <result column="PRICE_TON_KILOMETER" jdbcType="DECIMAL" property="priceTonKilometer" />
  12. <result column="PRICE_VALUE" jdbcType="DECIMAL" property="priceValue" />
  13. <result column="PRICE_DATE" jdbcType="TIMESTAMP" property="priceDate" />
  14. <result column="INSERT_USERNAME" jdbcType="VARCHAR" property="insertUsername" />
  15. <result column="INSERT_TIME" jdbcType="TIMESTAMP" property="insertTime" />
  16. <result column="UPDATE_USERNAME" jdbcType="VARCHAR" property="updateUsername" />
  17. <result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime" />
  18. <result column="INSERT_UPDATE_REMARK" jdbcType="VARCHAR" property="insertUpdateRemark" />
  19. <result column="DELETED" jdbcType="DECIMAL" property="deleted" />
  20. <result column="PLACE_ID" jdbcType="DECIMAL" property="placeId" />
  21. <result column="TYPE" jdbcType="DECIMAL" property="type" />
  22. <result column="DEPARTMENT" jdbcType="DECIMAL" property="department" />
  23. <result column="OILPRICE_BASE" jdbcType="DECIMAL" property="oilpriceBase" />
  24. <result column="OIL_TYPE_ID" jdbcType="DECIMAL" property="oilTypeId" />
  25. <result column="OILPRICE_CHANGE_THRESHOLD" jdbcType="DECIMAL" property="oilpriceChangeThreshold" />
  26. <result column="OLD_DATE" jdbcType="TIMESTAMP" property="oldDate" />
  27. <result column="HAUL_DISTANCE" jdbcType="DECIMAL" property="haulDistance" />
  28. <result column="REFERENCE_HT" jdbcType="DECIMAL" property="referenceHt" />
  29. <result column="INVENTORY" jdbcType="DECIMAL" property="inventory" />
  30. </resultMap>
  31. <sql id="columns">
  32. PRICE_ID, SHIPPER_ID, CARRIER_ID, LINE_ID, CAPACITY_TYPE_ID, CARGONAME_ID, PRICE_TON_KILOMETER,
  33. PRICE_VALUE, PRICE_DATE, INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME,
  34. INSERT_UPDATE_REMARK, DELETED, PLACE_ID, TYPE, DEPARTMENT, OILPRICE_BASE, OIL_TYPE_ID,
  35. OILPRICE_CHANGE_THRESHOLD, OLD_DATE, HAUL_DISTANCE, REFERENCE_HT, INVENTORY
  36. </sql>
  37. <sql id="columns_alias">
  38. t.PRICE_ID, t.SHIPPER_ID, t.CARRIER_ID, t.LINE_ID, t.CAPACITY_TYPE_ID, t.CARGONAME_ID,
  39. t.PRICE_TON_KILOMETER, t.PRICE_VALUE, t.PRICE_DATE, t.INSERT_USERNAME, t.INSERT_TIME,
  40. t.UPDATE_USERNAME, t.UPDATE_TIME, t.INSERT_UPDATE_REMARK, t.DELETED, t.PLACE_ID,
  41. t.TYPE, t.DEPARTMENT, t.OILPRICE_BASE, t.OIL_TYPE_ID, t.OILPRICE_CHANGE_THRESHOLD,
  42. t.OLD_DATE, t.HAUL_DISTANCE, t.REFERENCE_HT, t.INVENTORY
  43. </sql>
  44. <sql id="select">
  45. SELECT <include refid="columns" /> FROM AMS_CONTRACT_TRANSPORT_PRICE
  46. </sql>
  47. <sql id="select_alias">
  48. SELECT <include refid="columns_alias" /> FROM AMS_CONTRACT_TRANSPORT_PRICE t
  49. </sql>
  50. <sql id="where">
  51. <where>
  52. <if test="priceId != null">
  53. and PRICE_ID = #{priceId}
  54. </if>
  55. <if test="shipperId != null">
  56. and SHIPPER_ID = #{shipperId}
  57. </if>
  58. <if test="carrierId != null">
  59. and CARRIER_ID = #{carrierId}
  60. </if>
  61. <if test="lineId != null">
  62. and LINE_ID = #{lineId}
  63. </if>
  64. <if test="capacityTypeId != null">
  65. and CAPACITY_TYPE_ID = #{capacityTypeId}
  66. </if>
  67. <if test="cargonameId != null">
  68. and CARGONAME_ID = #{cargonameId}
  69. </if>
  70. <if test="priceTonKilometer != null">
  71. and PRICE_TON_KILOMETER = #{priceTonKilometer}
  72. </if>
  73. <if test="priceValue != null">
  74. and PRICE_VALUE = #{priceValue}
  75. </if>
  76. <if test="priceDate != null">
  77. and TO_CHAR(PRICE_DATE,'yyyy-MM-dd') = #{priceDate}
  78. </if>
  79. <if test="insertUsername != null and insertUsername != ''">
  80. and INSERT_USERNAME = #{insertUsername}
  81. </if>
  82. <if test="insertTime != null">
  83. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  84. </if>
  85. <if test="updateUsername != null and updateUsername != ''">
  86. and UPDATE_USERNAME = #{updateUsername}
  87. </if>
  88. <if test="updateTime != null">
  89. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  90. </if>
  91. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  92. and INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  93. </if>
  94. <if test="deleted != null">
  95. and DELETED = #{deleted}
  96. </if>
  97. <if test="placeId != null">
  98. and PLACE_ID = #{placeId}
  99. </if>
  100. <if test="type != null">
  101. and TYPE = #{type}
  102. </if>
  103. <if test="department != null">
  104. and DEPARTMENT = #{department}
  105. </if>
  106. <if test="oilpriceBase != null">
  107. and OILPRICE_BASE = #{oilpriceBase}
  108. </if>
  109. <if test="oilTypeId != null">
  110. and OIL_TYPE_ID = #{oilTypeId}
  111. </if>
  112. <if test="oilpriceChangeThreshold != null">
  113. and OILPRICE_CHANGE_THRESHOLD = #{oilpriceChangeThreshold}
  114. </if>
  115. <if test="oldDate != null">
  116. and TO_CHAR(OLD_DATE,'yyyy-MM-dd') = #{oldDate}
  117. </if>
  118. <if test="haulDistance != null">
  119. and HAUL_DISTANCE = #{haulDistance}
  120. </if>
  121. <if test="referenceHt != null">
  122. and REFERENCE_HT = #{referenceHt}
  123. </if>
  124. <if test="inventory != null">
  125. and INVENTORY = #{inventory}
  126. </if>
  127. </where>
  128. </sql>
  129. <sql id="whereLike">
  130. <where>
  131. <if test="priceId != null">
  132. and PRICE_ID = #{priceId}
  133. </if>
  134. <if test="shipperId != null">
  135. and SHIPPER_ID = #{shipperId}
  136. </if>
  137. <if test="carrierId != null">
  138. and CARRIER_ID = #{carrierId}
  139. </if>
  140. <if test="lineId != null">
  141. and LINE_ID = #{lineId}
  142. </if>
  143. <if test="capacityTypeId != null">
  144. and CAPACITY_TYPE_ID = #{capacityTypeId}
  145. </if>
  146. <if test="cargonameId != null">
  147. and CARGONAME_ID = #{cargonameId}
  148. </if>
  149. <if test="priceTonKilometer != null">
  150. and PRICE_TON_KILOMETER = #{priceTonKilometer}
  151. </if>
  152. <if test="priceValue != null">
  153. and PRICE_VALUE = #{priceValue}
  154. </if>
  155. <if test="priceDate != null">
  156. and TO_CHAR(PRICE_DATE,'yyyy-MM-dd') = #{priceDate}
  157. </if>
  158. <if test="insertUsername != null and insertUsername != ''">
  159. and INSERT_USERNAME LIKE '%${insertUsername}%'
  160. </if>
  161. <if test="insertTime != null">
  162. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  163. </if>
  164. <if test="updateUsername != null and updateUsername != ''">
  165. and UPDATE_USERNAME LIKE '%${updateUsername}%'
  166. </if>
  167. <if test="updateTime != null">
  168. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  169. </if>
  170. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  171. and INSERT_UPDATE_REMARK LIKE '%${insertUpdateRemark}%'
  172. </if>
  173. <if test="deleted != null">
  174. and DELETED = #{deleted}
  175. </if>
  176. <if test="placeId != null">
  177. and PLACE_ID = #{placeId}
  178. </if>
  179. <if test="type != null">
  180. and TYPE = #{type}
  181. </if>
  182. <if test="department != null">
  183. and DEPARTMENT = #{department}
  184. </if>
  185. <if test="oilpriceBase != null">
  186. and OILPRICE_BASE = #{oilpriceBase}
  187. </if>
  188. <if test="oilTypeId != null">
  189. and OIL_TYPE_ID = #{oilTypeId}
  190. </if>
  191. <if test="oilpriceChangeThreshold != null">
  192. and OILPRICE_CHANGE_THRESHOLD = #{oilpriceChangeThreshold}
  193. </if>
  194. <if test="oldDate != null">
  195. and TO_CHAR(OLD_DATE,'yyyy-MM-dd') = #{oldDate}
  196. </if>
  197. <if test="haulDistance != null">
  198. and HAUL_DISTANCE = #{haulDistance}
  199. </if>
  200. <if test="referenceHt != null">
  201. and REFERENCE_HT = #{referenceHt}
  202. </if>
  203. <if test="inventory != null">
  204. and INVENTORY = #{inventory}
  205. </if>
  206. </where>
  207. </sql>
  208. <sql id="whereLikeForeach">
  209. <where>
  210. <if test="priceId != null">
  211. <foreach collection="priceId" item="item" open="(" separator="or" close=")">
  212. "priceId" = '${item}'
  213. </foreach>
  214. </if>
  215. <if test="oilTypeName != null">
  216. and
  217. <foreach collection="oilTypeName" item="item" open="(" separator="or" close=")">
  218. "oilTypeName" = '${item}'
  219. </foreach>
  220. </if>
  221. <if test="capacityTypeName != null">
  222. and
  223. <foreach collection="capacityTypeName" item="item" open="(" separator="or" close=")">
  224. "capacityTypeName" = '${item}'
  225. </foreach>
  226. </if>
  227. <if test="priceValue != null">
  228. and
  229. <foreach collection="priceValue" item="item" open="(" separator="or" close=")">
  230. "priceValue" = '${item}'
  231. </foreach>
  232. </if>
  233. <if test="priceDate != null">
  234. and
  235. <foreach collection="priceDate" item="item" open="(" separator="or" close=")">
  236. TO_CHAR("priceDate",'yyyy-mm-dd hh24:mi:ss') = '${item}'
  237. </foreach>
  238. </if>
  239. <if test="oilpriceBase != null">
  240. and
  241. <foreach collection="oilpriceBase" item="item" open="(" separator="or" close=")">
  242. "oilpriceBase" = '${item}'
  243. </foreach>
  244. </if>
  245. <if test="insertTime != null">
  246. and
  247. <foreach collection="insertTime" item="item" open="(" separator="or" close=")">
  248. TO_CHAR("insertTime",'yyyy-mm-dd hh24:mi:ss') = '${item}'
  249. </foreach>
  250. </if>
  251. <if test="oilpriceChangeThreshold != null">
  252. and
  253. <foreach collection="oilpriceChangeThreshold" item="item" open="(" separator="or" close=")">
  254. "oilpriceChangeThreshold" = '${item}'
  255. </foreach>
  256. </if>
  257. <if test="transRange != null">
  258. and
  259. <foreach collection="transRange" item="item" open="(" separator="or" close=")">
  260. "transRange" = '${item}'
  261. </foreach>
  262. </if>
  263. <if test="type != null">
  264. and
  265. <foreach collection="type" item="item" open="(" separator="or" close=")">
  266. <if test="item=='元/吨'">
  267. "type" = '2'
  268. </if>
  269. <if test="item=='元/小时'">
  270. "type" = '5'
  271. </if>
  272. <if test="item=='元/趟'">
  273. "type" = '6'
  274. </if>
  275. </foreach>
  276. </if>
  277. </where>
  278. </sql>
  279. <delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal">
  280. delete from AMS_CONTRACT_TRANSPORT_PRICE
  281. where PRICE_ID = #{priceId,jdbcType=DECIMAL}
  282. </delete>
  283. <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
  284. delete from AMS_CONTRACT_TRANSPORT_PRICE
  285. where 1!=1
  286. <if test="shipperId != null">
  287. or SHIPPER_ID = #{shipperId}
  288. </if>
  289. <if test="carrierId != null">
  290. or CARRIER_ID = #{carrierId}
  291. </if>
  292. <if test="lineId != null">
  293. or LINE_ID = #{lineId}
  294. </if>
  295. <if test="capacityTypeId != null">
  296. or CAPACITY_TYPE_ID = #{capacityTypeId}
  297. </if>
  298. <if test="cargonameId != null">
  299. or CARGONAME_ID = #{cargonameId}
  300. </if>
  301. <if test="priceTonKilometer != null">
  302. or PRICE_TON_KILOMETER = #{priceTonKilometer}
  303. </if>
  304. <if test="priceValue != null">
  305. or PRICE_VALUE = #{priceValue}
  306. </if>
  307. <if test="priceDate != null">
  308. or TO_CHAR(PRICE_DATE,'yyyy-MM-dd') = '#{priceDate}'
  309. </if>
  310. <if test="insertUsername != null and insertUsername != ''">
  311. or INSERT_USERNAME = #{insertUsername}
  312. </if>
  313. <if test="insertTime != null">
  314. or TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = '#{insertTime}'
  315. </if>
  316. <if test="updateUsername != null and updateUsername != ''">
  317. or UPDATE_USERNAME = #{updateUsername}
  318. </if>
  319. <if test="updateTime != null">
  320. or TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = '#{updateTime}'
  321. </if>
  322. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  323. or INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  324. </if>
  325. <if test="deleted != null">
  326. or DELETED = #{deleted}
  327. </if>
  328. <if test="placeId != null">
  329. or PLACE_ID = #{placeId}
  330. </if>
  331. <if test="type != null">
  332. or TYPE = #{type}
  333. </if>
  334. <if test="department != null">
  335. or DEPARTMENT = #{department}
  336. </if>
  337. <if test="oilpriceBase != null">
  338. or OILPRICE_BASE = #{oilpriceBase}
  339. </if>
  340. <if test="oilTypeId != null">
  341. or OIL_TYPE_ID = #{oilTypeId}
  342. </if>
  343. <if test="oilpriceChangeThreshold != null">
  344. or OILPRICE_CHANGE_THRESHOLD = #{oilpriceChangeThreshold}
  345. </if>
  346. <if test="oldDate != null">
  347. or TO_CHAR(OLD_DATE,'yyyy-MM-dd') = '#{oldDate}'
  348. </if>
  349. <if test="haulDistance != null">
  350. or HAUL_DISTANCE = #{haulDistance}
  351. </if>
  352. </delete>
  353. <insert id="insert" parameterType="com.steerinfo.dil.model.AmsContractTransportPrice">
  354. insert into AMS_CONTRACT_TRANSPORT_PRICE (PRICE_ID, SHIPPER_ID, CARRIER_ID,
  355. LINE_ID, CAPACITY_TYPE_ID, CARGONAME_ID,
  356. PRICE_TON_KILOMETER, PRICE_VALUE, PRICE_DATE,
  357. INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME,
  358. UPDATE_TIME, INSERT_UPDATE_REMARK, DELETED,
  359. PLACE_ID, TYPE, DEPARTMENT,
  360. OILPRICE_BASE, OIL_TYPE_ID, OILPRICE_CHANGE_THRESHOLD,
  361. OLD_DATE, HAUL_DISTANCE)
  362. values (#{priceId,jdbcType=DECIMAL}, #{shipperId,jdbcType=DECIMAL}, #{carrierId,jdbcType=DECIMAL},
  363. #{lineId,jdbcType=DECIMAL}, #{capacityTypeId,jdbcType=DECIMAL}, #{cargonameId,jdbcType=CHAR},
  364. #{priceTonKilometer,jdbcType=DECIMAL}, #{priceValue,jdbcType=DECIMAL}, #{priceDate,jdbcType=TIMESTAMP},
  365. #{insertUsername,jdbcType=VARCHAR}, #{insertTime,jdbcType=TIMESTAMP}, #{updateUsername,jdbcType=VARCHAR},
  366. #{updateTime,jdbcType=TIMESTAMP}, #{insertUpdateRemark,jdbcType=VARCHAR}, #{deleted,jdbcType=DECIMAL},
  367. #{placeId,jdbcType=DECIMAL}, #{type,jdbcType=DECIMAL}, #{department,jdbcType=DECIMAL},
  368. #{oilpriceBase,jdbcType=DECIMAL}, #{oilTypeId,jdbcType=DECIMAL}, #{oilpriceChangeThreshold,jdbcType=DECIMAL},
  369. #{oldDate,jdbcType=TIMESTAMP}, #{haulDistance,jdbcType=DECIMAL})
  370. </insert>
  371. <insert id="insertSelective" parameterType="com.steerinfo.dil.model.AmsContractTransportPrice">
  372. insert into AMS_CONTRACT_TRANSPORT_PRICE
  373. <trim prefix="(" suffix=")" suffixOverrides=",">
  374. <if test="priceId != null">
  375. PRICE_ID,
  376. </if>
  377. <if test="shipperId != null">
  378. SHIPPER_ID,
  379. </if>
  380. <if test="carrierId != null">
  381. CARRIER_ID,
  382. </if>
  383. <if test="lineId != null">
  384. LINE_ID,
  385. </if>
  386. <if test="capacityTypeId != null">
  387. CAPACITY_TYPE_ID,
  388. </if>
  389. <if test="cargonameId != null">
  390. CARGONAME_ID,
  391. </if>
  392. <if test="priceTonKilometer != null">
  393. PRICE_TON_KILOMETER,
  394. </if>
  395. <if test="priceValue != null">
  396. PRICE_VALUE,
  397. </if>
  398. <if test="priceDate != null">
  399. PRICE_DATE,
  400. </if>
  401. <if test="insertUsername != null">
  402. INSERT_USERNAME,
  403. </if>
  404. <if test="insertTime != null">
  405. INSERT_TIME,
  406. </if>
  407. <if test="updateUsername != null">
  408. UPDATE_USERNAME,
  409. </if>
  410. <if test="updateTime != null">
  411. UPDATE_TIME,
  412. </if>
  413. <if test="insertUpdateRemark != null">
  414. INSERT_UPDATE_REMARK,
  415. </if>
  416. <if test="deleted != null">
  417. DELETED,
  418. </if>
  419. <if test="placeId != null">
  420. PLACE_ID,
  421. </if>
  422. <if test="type != null">
  423. TYPE,
  424. </if>
  425. <if test="department != null">
  426. DEPARTMENT,
  427. </if>
  428. <if test="oilpriceBase != null">
  429. OILPRICE_BASE,
  430. </if>
  431. <if test="oilTypeId != null">
  432. OIL_TYPE_ID,
  433. </if>
  434. <if test="oilpriceChangeThreshold != null">
  435. OILPRICE_CHANGE_THRESHOLD,
  436. </if>
  437. <if test="oldDate != null">
  438. OLD_DATE,
  439. </if>
  440. <if test="haulDistance != null">
  441. HAUL_DISTANCE,
  442. </if>
  443. </trim>
  444. <trim prefix="values (" suffix=")" suffixOverrides=",">
  445. <if test="priceId != null">
  446. #{priceId,jdbcType=DECIMAL},
  447. </if>
  448. <if test="shipperId != null">
  449. #{shipperId,jdbcType=DECIMAL},
  450. </if>
  451. <if test="carrierId != null">
  452. #{carrierId,jdbcType=DECIMAL},
  453. </if>
  454. <if test="lineId != null">
  455. #{lineId,jdbcType=DECIMAL},
  456. </if>
  457. <if test="capacityTypeId != null">
  458. #{capacityTypeId,jdbcType=DECIMAL},
  459. </if>
  460. <if test="cargonameId != null">
  461. #{cargonameId,jdbcType=CHAR},
  462. </if>
  463. <if test="priceTonKilometer != null">
  464. #{priceTonKilometer,jdbcType=DECIMAL},
  465. </if>
  466. <if test="priceValue != null">
  467. #{priceValue,jdbcType=DECIMAL},
  468. </if>
  469. <if test="priceDate != null">
  470. #{priceDate,jdbcType=TIMESTAMP},
  471. </if>
  472. <if test="insertUsername != null">
  473. #{insertUsername,jdbcType=VARCHAR},
  474. </if>
  475. <if test="insertTime != null">
  476. #{insertTime,jdbcType=TIMESTAMP},
  477. </if>
  478. <if test="updateUsername != null">
  479. #{updateUsername,jdbcType=VARCHAR},
  480. </if>
  481. <if test="updateTime != null">
  482. #{updateTime,jdbcType=TIMESTAMP},
  483. </if>
  484. <if test="insertUpdateRemark != null">
  485. #{insertUpdateRemark,jdbcType=VARCHAR},
  486. </if>
  487. <if test="deleted != null">
  488. #{deleted,jdbcType=DECIMAL},
  489. </if>
  490. <if test="placeId != null">
  491. #{placeId,jdbcType=DECIMAL},
  492. </if>
  493. <if test="type != null">
  494. #{type,jdbcType=DECIMAL},
  495. </if>
  496. <if test="department != null">
  497. #{department,jdbcType=DECIMAL},
  498. </if>
  499. <if test="oilpriceBase != null">
  500. #{oilpriceBase,jdbcType=DECIMAL},
  501. </if>
  502. <if test="oilTypeId != null">
  503. #{oilTypeId,jdbcType=DECIMAL},
  504. </if>
  505. <if test="oilpriceChangeThreshold != null">
  506. #{oilpriceChangeThreshold,jdbcType=DECIMAL},
  507. </if>
  508. <if test="oldDate != null">
  509. #{oldDate,jdbcType=TIMESTAMP},
  510. </if>
  511. <if test="haulDistance != null">
  512. #{haulDistance,jdbcType=DECIMAL},
  513. </if>
  514. </trim>
  515. </insert>
  516. <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.AmsContractTransportPrice">
  517. update AMS_CONTRACT_TRANSPORT_PRICE
  518. set SHIPPER_ID = #{shipperId,jdbcType=DECIMAL},
  519. CARRIER_ID = #{carrierId,jdbcType=DECIMAL},
  520. LINE_ID = #{lineId,jdbcType=DECIMAL},
  521. CAPACITY_TYPE_ID = #{capacityTypeId,jdbcType=DECIMAL},
  522. CARGONAME_ID = #{cargonameId,jdbcType=CHAR},
  523. PRICE_TON_KILOMETER = #{priceTonKilometer,jdbcType=DECIMAL},
  524. PRICE_VALUE = #{priceValue,jdbcType=DECIMAL},
  525. PRICE_DATE = #{priceDate,jdbcType=TIMESTAMP},
  526. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  527. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  528. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  529. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  530. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  531. DELETED = #{deleted,jdbcType=DECIMAL},
  532. PLACE_ID = #{placeId,jdbcType=DECIMAL},
  533. TYPE = #{type,jdbcType=DECIMAL},
  534. DEPARTMENT = #{department,jdbcType=DECIMAL},
  535. OILPRICE_BASE = #{oilpriceBase,jdbcType=DECIMAL},
  536. OIL_TYPE_ID = #{oilTypeId,jdbcType=DECIMAL},
  537. OILPRICE_CHANGE_THRESHOLD = #{oilpriceChangeThreshold,jdbcType=DECIMAL},
  538. OLD_DATE = #{oldDate,jdbcType=TIMESTAMP},
  539. HAUL_DISTANCE = #{haulDistance,jdbcType=DECIMAL}
  540. where PRICE_ID = #{priceId,jdbcType=DECIMAL}
  541. </update>
  542. <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.AmsContractTransportPrice">
  543. update AMS_CONTRACT_TRANSPORT_PRICE
  544. <set>
  545. <if test="shipperId != null">
  546. SHIPPER_ID = #{shipperId,jdbcType=DECIMAL},
  547. </if>
  548. <if test="carrierId != null">
  549. CARRIER_ID = #{carrierId,jdbcType=DECIMAL},
  550. </if>
  551. <if test="lineId != null">
  552. LINE_ID = #{lineId,jdbcType=DECIMAL},
  553. </if>
  554. <if test="capacityTypeId != null">
  555. CAPACITY_TYPE_ID = #{capacityTypeId,jdbcType=DECIMAL},
  556. </if>
  557. <if test="cargonameId != null">
  558. CARGONAME_ID = #{cargonameId,jdbcType=CHAR},
  559. </if>
  560. <if test="priceTonKilometer != null">
  561. PRICE_TON_KILOMETER = #{priceTonKilometer,jdbcType=DECIMAL},
  562. </if>
  563. <if test="priceValue != null">
  564. PRICE_VALUE = #{priceValue,jdbcType=DECIMAL},
  565. </if>
  566. <if test="priceDate != null">
  567. PRICE_DATE = #{priceDate,jdbcType=TIMESTAMP},
  568. </if>
  569. <if test="insertUsername != null">
  570. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  571. </if>
  572. <if test="insertTime != null">
  573. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  574. </if>
  575. <if test="updateUsername != null">
  576. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  577. </if>
  578. <if test="updateTime != null">
  579. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  580. </if>
  581. <if test="insertUpdateRemark != null">
  582. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  583. </if>
  584. <if test="deleted != null">
  585. DELETED = #{deleted,jdbcType=DECIMAL},
  586. </if>
  587. <if test="placeId != null">
  588. PLACE_ID = #{placeId,jdbcType=DECIMAL},
  589. </if>
  590. <if test="type != null">
  591. TYPE = #{type,jdbcType=DECIMAL},
  592. </if>
  593. <if test="department != null">
  594. DEPARTMENT = #{department,jdbcType=DECIMAL},
  595. </if>
  596. <if test="oilpriceBase != null">
  597. OILPRICE_BASE = #{oilpriceBase,jdbcType=DECIMAL},
  598. </if>
  599. <if test="oilTypeId != null">
  600. OIL_TYPE_ID = #{oilTypeId,jdbcType=DECIMAL},
  601. </if>
  602. <if test="oilpriceChangeThreshold != null">
  603. OILPRICE_CHANGE_THRESHOLD = #{oilpriceChangeThreshold,jdbcType=DECIMAL},
  604. </if>
  605. <if test="oldDate != null">
  606. OLD_DATE = #{oldDate,jdbcType=TIMESTAMP},
  607. </if>
  608. <if test="haulDistance != null">
  609. HAUL_DISTANCE = #{haulDistance,jdbcType=DECIMAL},
  610. </if>
  611. </set>
  612. where PRICE_ID = #{priceId,jdbcType=DECIMAL}
  613. </update>
  614. <select id="selectByPrimaryKey" parameterType="java.math.BigDecimal" resultMap="BaseResultMap">
  615. <include refid="select" />
  616. where PRICE_ID = #{priceId,jdbcType=DECIMAL}
  617. </select>
  618. <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  619. <include refid="select" />
  620. <include refid="where" />
  621. </select>
  622. <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  623. <include refid="select" />
  624. <include refid="whereLike" />
  625. </select>
  626. <insert id="batchInsert" parameterType="java.util.List">
  627. insert into AMS_CONTRACT_TRANSPORT_PRICE
  628. (PRICE_ID,
  629. SHIPPER_ID, CARRIER_ID, LINE_ID,
  630. CAPACITY_TYPE_ID, CARGONAME_ID, PRICE_TON_KILOMETER,
  631. PRICE_VALUE, PRICE_DATE, INSERT_USERNAME,
  632. INSERT_TIME, UPDATE_USERNAME,
  633. UPDATE_TIME, INSERT_UPDATE_REMARK,
  634. DELETED, PLACE_ID, TYPE,
  635. DEPARTMENT, OILPRICE_BASE, OIL_TYPE_ID,
  636. OILPRICE_CHANGE_THRESHOLD, OLD_DATE,
  637. HAUL_DISTANCE)
  638. ( <foreach collection="list" item="item" separator="union all">
  639. select
  640. #{item.priceId,jdbcType=DECIMAL},
  641. #{item.shipperId,jdbcType=DECIMAL}, #{item.carrierId,jdbcType=DECIMAL}, #{item.lineId,jdbcType=DECIMAL},
  642. #{item.capacityTypeId,jdbcType=DECIMAL}, #{item.cargonameId,jdbcType=CHAR}, #{item.priceTonKilometer,jdbcType=DECIMAL},
  643. #{item.priceValue,jdbcType=DECIMAL}, #{item.priceDate,jdbcType=TIMESTAMP}, #{item.insertUsername,jdbcType=VARCHAR},
  644. #{item.insertTime,jdbcType=TIMESTAMP}, #{item.updateUsername,jdbcType=VARCHAR},
  645. #{item.updateTime,jdbcType=TIMESTAMP}, #{item.insertUpdateRemark,jdbcType=VARCHAR},
  646. #{item.deleted,jdbcType=DECIMAL}, #{item.placeId,jdbcType=DECIMAL}, #{item.type,jdbcType=DECIMAL},
  647. #{item.department,jdbcType=DECIMAL}, #{item.oilpriceBase,jdbcType=DECIMAL}, #{item.oilTypeId,jdbcType=DECIMAL},
  648. #{item.oilpriceChangeThreshold,jdbcType=DECIMAL}, #{item.oldDate,jdbcType=TIMESTAMP},
  649. #{item.haulDistance,jdbcType=DECIMAL} from dual
  650. </foreach> )
  651. </insert>
  652. <update id="batchUpdate" parameterType="java.util.List">
  653. update AMS_CONTRACT_TRANSPORT_PRICE
  654. set
  655. PRICE_ID=
  656. <foreach close="end" collection="list" index="index" item="item" open="case PRICE_ID" separator=" ">
  657. when #{item.priceId,jdbcType=DECIMAL} then #{item.priceId,jdbcType=DECIMAL}
  658. </foreach>
  659. ,SHIPPER_ID=
  660. <foreach close="end" collection="list" index="index" item="item" open="case PRICE_ID" separator=" ">
  661. when #{item.priceId,jdbcType=DECIMAL} then #{item.shipperId,jdbcType=DECIMAL}
  662. </foreach>
  663. ,CARRIER_ID=
  664. <foreach close="end" collection="list" index="index" item="item" open="case PRICE_ID" separator=" ">
  665. when #{item.priceId,jdbcType=DECIMAL} then #{item.carrierId,jdbcType=DECIMAL}
  666. </foreach>
  667. ,LINE_ID=
  668. <foreach close="end" collection="list" index="index" item="item" open="case PRICE_ID" separator=" ">
  669. when #{item.priceId,jdbcType=DECIMAL} then #{item.lineId,jdbcType=DECIMAL}
  670. </foreach>
  671. ,CAPACITY_TYPE_ID=
  672. <foreach close="end" collection="list" index="index" item="item" open="case PRICE_ID" separator=" ">
  673. when #{item.priceId,jdbcType=DECIMAL} then #{item.capacityTypeId,jdbcType=DECIMAL}
  674. </foreach>
  675. ,CARGONAME_ID=
  676. <foreach close="end" collection="list" index="index" item="item" open="case PRICE_ID" separator=" ">
  677. when #{item.priceId,jdbcType=DECIMAL} then #{item.cargonameId,jdbcType=CHAR}
  678. </foreach>
  679. ,PRICE_TON_KILOMETER=
  680. <foreach close="end" collection="list" index="index" item="item" open="case PRICE_ID" separator=" ">
  681. when #{item.priceId,jdbcType=DECIMAL} then #{item.priceTonKilometer,jdbcType=DECIMAL}
  682. </foreach>
  683. ,PRICE_VALUE=
  684. <foreach close="end" collection="list" index="index" item="item" open="case PRICE_ID" separator=" ">
  685. when #{item.priceId,jdbcType=DECIMAL} then #{item.priceValue,jdbcType=DECIMAL}
  686. </foreach>
  687. ,PRICE_DATE=
  688. <foreach close="end" collection="list" index="index" item="item" open="case PRICE_ID" separator=" ">
  689. when #{item.priceId,jdbcType=DECIMAL} then #{item.priceDate,jdbcType=TIMESTAMP}
  690. </foreach>
  691. ,INSERT_USERNAME=
  692. <foreach close="end" collection="list" index="index" item="item" open="case PRICE_ID" separator=" ">
  693. when #{item.priceId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
  694. </foreach>
  695. ,INSERT_TIME=
  696. <foreach close="end" collection="list" index="index" item="item" open="case PRICE_ID" separator=" ">
  697. when #{item.priceId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
  698. </foreach>
  699. ,UPDATE_USERNAME=
  700. <foreach close="end" collection="list" index="index" item="item" open="case PRICE_ID" separator=" ">
  701. when #{item.priceId,jdbcType=DECIMAL} then #{item.updateUsername,jdbcType=VARCHAR}
  702. </foreach>
  703. ,UPDATE_TIME=
  704. <foreach close="end" collection="list" index="index" item="item" open="case PRICE_ID" separator=" ">
  705. when #{item.priceId,jdbcType=DECIMAL} then #{item.updateTime,jdbcType=TIMESTAMP}
  706. </foreach>
  707. ,INSERT_UPDATE_REMARK=
  708. <foreach close="end" collection="list" index="index" item="item" open="case PRICE_ID" separator=" ">
  709. when #{item.priceId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
  710. </foreach>
  711. ,DELETED=
  712. <foreach close="end" collection="list" index="index" item="item" open="case PRICE_ID" separator=" ">
  713. when #{item.priceId,jdbcType=DECIMAL} then #{item.deleted,jdbcType=DECIMAL}
  714. </foreach>
  715. ,PLACE_ID=
  716. <foreach close="end" collection="list" index="index" item="item" open="case PRICE_ID" separator=" ">
  717. when #{item.priceId,jdbcType=DECIMAL} then #{item.placeId,jdbcType=DECIMAL}
  718. </foreach>
  719. ,TYPE=
  720. <foreach close="end" collection="list" index="index" item="item" open="case PRICE_ID" separator=" ">
  721. when #{item.priceId,jdbcType=DECIMAL} then #{item.type,jdbcType=DECIMAL}
  722. </foreach>
  723. ,DEPARTMENT=
  724. <foreach close="end" collection="list" index="index" item="item" open="case PRICE_ID" separator=" ">
  725. when #{item.priceId,jdbcType=DECIMAL} then #{item.department,jdbcType=DECIMAL}
  726. </foreach>
  727. ,OILPRICE_BASE=
  728. <foreach close="end" collection="list" index="index" item="item" open="case PRICE_ID" separator=" ">
  729. when #{item.priceId,jdbcType=DECIMAL} then #{item.oilpriceBase,jdbcType=DECIMAL}
  730. </foreach>
  731. ,OIL_TYPE_ID=
  732. <foreach close="end" collection="list" index="index" item="item" open="case PRICE_ID" separator=" ">
  733. when #{item.priceId,jdbcType=DECIMAL} then #{item.oilTypeId,jdbcType=DECIMAL}
  734. </foreach>
  735. ,OILPRICE_CHANGE_THRESHOLD=
  736. <foreach close="end" collection="list" index="index" item="item" open="case PRICE_ID" separator=" ">
  737. when #{item.priceId,jdbcType=DECIMAL} then #{item.oilpriceChangeThreshold,jdbcType=DECIMAL}
  738. </foreach>
  739. ,OLD_DATE=
  740. <foreach close="end" collection="list" index="index" item="item" open="case PRICE_ID" separator=" ">
  741. when #{item.priceId,jdbcType=DECIMAL} then #{item.oldDate,jdbcType=TIMESTAMP}
  742. </foreach>
  743. ,HAUL_DISTANCE=
  744. <foreach close="end" collection="list" index="index" item="item" open="case PRICE_ID" separator=" ">
  745. when #{item.priceId,jdbcType=DECIMAL} then #{item.haulDistance,jdbcType=DECIMAL}
  746. </foreach>
  747. where PRICE_ID in
  748. <foreach close=")" collection="list" index="index" item="item" open="(" separator=",">
  749. #{item.priceId,jdbcType=DECIMAL}
  750. </foreach>
  751. </update>
  752. <delete id="batchDelete" parameterType="java.util.List">
  753. delete from AMS_CONTRACT_TRANSPORT_PRICE
  754. where PRICE_ID in
  755. <foreach close=")" collection="list" item="id" open="(" separator=",">
  756. #{id}
  757. </foreach>
  758. </delete>
  759. <!-- 友情提示!!!-->
  760. <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
  761. <select id="getAmsContractTransportPrice" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
  762. select p0.* from(
  763. select distinct
  764. r_r_address.ADDRESS_PROVINCE "addressProvince",
  765. r_r_address.ADDRESS_DISTRICT "addressDistrict",
  766. r_r_address.ADDRESS_TOWN "addressTown",
  767. r_r_place.ADDRESS_DELIVERY_ADDRESS "addressDeliveryAddress",
  768. case
  769. when (SELECT COUNT(P."carrierName") FROM(select DISTINCT RC.CARRIER_NAME "carrierName"
  770. from RMS_RECEIVE_PLACE RRP
  771. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  772. ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
  773. LEFT JOIN AMS_CONTRACT_TRANSPORT_PRICE ACTP
  774. ON ACTP.PLACE_ID = RRP.PLACE_ID
  775. LEFT JOIN RMS_CARRIER RC
  776. ON RC.CARRIER_ID = ACTP.CARRIER_ID
  777. WHERE RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT ||
  778. RRA.ADDRESS_TOWN || RRP.ADDRESS_DELIVERY_ADDRESS =
  779. r_r_address.ADDRESS_PROVINCE || r_r_address.ADDRESS_DISTRICT ||
  780. r_r_address.ADDRESS_TOWN || r_r_place.ADDRESS_DELIVERY_ADDRESS
  781. AND ACTP.PRICE_ID IS NOT NULL
  782. AND ACTP.DELETED = 0
  783. AND ACTP.TYPE = 1
  784. AND ACTP.ISSTANDARD is null)P) >1
  785. THEN (SELECT LISTAGG(P."carrierName",',') FROM(select DISTINCT RC.CARRIER_NAME "carrierName"
  786. from RMS_RECEIVE_PLACE RRP
  787. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  788. ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
  789. LEFT JOIN AMS_CONTRACT_TRANSPORT_PRICE ACTP
  790. ON ACTP.PLACE_ID = RRP.PLACE_ID
  791. LEFT JOIN RMS_CARRIER RC
  792. ON RC.CARRIER_ID = ACTP.CARRIER_ID
  793. WHERE RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT ||
  794. RRA.ADDRESS_TOWN || RRP.ADDRESS_DELIVERY_ADDRESS =
  795. r_r_address.ADDRESS_PROVINCE || r_r_address.ADDRESS_DISTRICT ||
  796. r_r_address.ADDRESS_TOWN || r_r_place.ADDRESS_DELIVERY_ADDRESS
  797. AND ACTP.PRICE_ID IS NOT NULL
  798. AND ACTP.DELETED = 0
  799. AND ACTP.TYPE = 1
  800. AND ACTP.ISSTANDARD is null)P)
  801. else r_carrier.CARRIER_NAME
  802. end
  803. "carrierName",
  804. r_line.LINE_PATH_LENGTH "linePathLength",
  805. r_o_type.OIL_TYPE_NAME "oilTypeName",
  806. r_c_type.CAPACITY_TYPE_NAME "capacityTypeName",
  807. a_t_price.PRICE_VALUE "priceValue",
  808. a_t_price.PRICE_TON_KILOMETER "priceTonKilometer",
  809. a_t_price.PRICE_DATE "priceDate",
  810. a_t_price.OILPRICE_BASE "oilpriceBase",
  811. a_t_price.INSERT_TIME "insertTime",
  812. rs.SHIPPER_NAME "shipperName",
  813. a_t_price.OILPRICE_CHANGE_THRESHOLD "oilpriceChangeThreshold",
  814. a_t_price.haul_distance "haulDistance",
  815. r_r_place.place_id "placeId"
  816. from AMS_CONTRACT_TRANSPORT_PRICE a_t_price
  817. left join RMS_RECEIVE_PLACE r_r_place
  818. on a_t_price.PLACE_ID=r_r_place.PLACE_ID
  819. left join RMS_RECEIVE_ADDRESS r_r_address
  820. on r_r_place.ADDRESS_ID = r_r_address.ADDRESS_ID
  821. left join RMS_CAPACITY_TYPE r_c_type
  822. on a_t_price.CAPACITY_TYPE_ID=r_c_type.CAPACITY_TYPE_ID
  823. left join RMS_CARRIER r_carrier
  824. on a_t_price.CARRIER_ID=r_carrier.CARRIER_ID
  825. left join RMS_LINE r_line
  826. on a_t_price.LINE_ID=r_line.LINE_ID
  827. left join RMS_OIL_TYPE r_o_type
  828. on a_t_price.OIL_TYPE_ID = r_o_type.OIL_TYPE_ID
  829. left join RMS_SHIPPER rs
  830. on rs.SHIPPER_ID = a_t_price.SHIPPER_ID
  831. <where>
  832. TYPE=1
  833. and a_t_price.ISSTANDARD is null
  834. <if test="deleted != null">
  835. and a_t_price.DELETED = #{deleted}
  836. </if>
  837. <if test="con !=null and con != ''.toString()">
  838. and
  839. r_r_address.ADDRESS_PROVINCE || r_r_address.ADDRESS_DISTRICT || r_r_address.ADDRESS_TOWN
  840. || r_r_place.ADDRESS_DELIVERY_ADDRESS || r_carrier.CARRIER_NAME || r_c_type.CAPACITY_TYPE_NAME
  841. like CONCAT('%',CONCAT(#{con},'%'))
  842. </if>
  843. </where>
  844. )p0
  845. <where>
  846. <if test="addressProvince != null">
  847. and
  848. <foreach collection="addressProvince" item="item" open="(" separator="or" close=")">
  849. "addressProvince" like '%${item}%'
  850. </foreach>
  851. </if>
  852. <if test="shipperName != null">
  853. and
  854. <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
  855. "shipperName" like '%${item}%'
  856. </foreach>
  857. </if>
  858. <if test="addressDistrict != null">
  859. and
  860. <foreach collection="addressDistrict" item="item" open="(" separator="or" close=")">
  861. "addressDistrict" like '%${item}%'
  862. </foreach>
  863. </if>
  864. <if test="addressTown != null">
  865. and
  866. <foreach collection="addressTown" item="item" open="(" separator="or" close=")">
  867. "addressTown" like '%${item}%'
  868. </foreach>
  869. </if>
  870. <if test="addressDeliveryAddress != null">
  871. and
  872. <foreach collection="addressDeliveryAddress" item="item" open="(" separator="or" close=")">
  873. "addressDeliveryAddress" like '%${item}%'
  874. </foreach>
  875. </if>
  876. <if test="linePathLength != null">
  877. and
  878. <foreach collection="linePathLength" item="item" open="(" separator="or" close=")">
  879. "linePathLength" like '%${item}%'
  880. </foreach>
  881. </if>
  882. <if test="carrierName != null">
  883. and
  884. <foreach collection="carrierName" item="item" open="(" separator="or" close=")">
  885. "carrierName" like '%${item}%'
  886. </foreach>
  887. </if>
  888. <if test="capacityTypeName != null">
  889. and
  890. <foreach collection="capacityTypeName" item="item" open="(" separator="or" close=")">
  891. "capacityTypeName" like '%${item}%'
  892. </foreach>
  893. </if>
  894. <if test="priceValue != null">
  895. and
  896. <foreach collection="priceValue" item="item" open="(" separator="or" close=")">
  897. "priceValue" like '%${item}%'
  898. </foreach>
  899. </if>
  900. <if test="priceTonKilometer != null">
  901. and
  902. <foreach collection="priceTonKilometer" item="item" open="(" separator="or" close=")">
  903. "priceTonKilometer" like '%${item}%'
  904. </foreach>
  905. </if>
  906. <if test="priceDate != null">
  907. and
  908. <foreach collection="priceDate" item="item" open="(" separator="or" close=")">
  909. "priceDate" like '%${item}%'
  910. </foreach>
  911. </if>
  912. </where>
  913. <include refid="orderBy"></include>
  914. <if test="orderField == null ">
  915. order by "priceDate" desc
  916. </if>
  917. </select>
  918. <!--删除单价-->
  919. <delete id="deleteSalePrice">
  920. DELETE AMS_CONTRACT_TRANSPORT_PRICE ACTP
  921. where ACTP.PRICE_ID IN(
  922. select
  923. ACTP.PRICE_ID from RMS_RECEIVE_PLACE RRP
  924. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  925. ON RRA.ADDRESS_ID=RRP.ADDRESS_ID
  926. LEFT JOIN AMS_CONTRACT_TRANSPORT_PRICE ACTP
  927. ON ACTP.PLACE_ID=RRP.PLACE_ID
  928. LEFT JOIN RMS_CARRIER RC
  929. ON RC.CARRIER_ID=ACTP.CARRIER_ID
  930. WHERE RRA.ADDRESS_PROVINCE||RRA.ADDRESS_DISTRICT||RRA.ADDRESS_TOWN||
  931. RRP.ADDRESS_DELIVERY_ADDRESS = #{addressProvince}||#{addressDistrict}||#{addressTown}||#{addressDeliveryAddress}
  932. AND ACTP.PRICE_ID IS NOT NULL
  933. AND ACTP.DELETED=0
  934. AND ACTP.TYPE=1
  935. AND ACTP.ISSTANDARD is null)
  936. </delete>
  937. <!--查询出其中的值-->
  938. <select id="getOnePriceMap" resultType="com.steerinfo.dil.model.AmsContractTransportPrice">
  939. select
  940. ACTP.SHIPPER_ID "shipperId",
  941. ACTP.CAPACITY_TYPE_ID "capacityTypeId",
  942. ACTP.CARGONAME_ID "cargonameId",
  943. ACTP.PRICE_TON_KILOMETER "priceTonKilometer",
  944. ACTP.PRICE_VALUE "priceValue",
  945. ACTP.INSERT_USERNAME "insertUsername",
  946. ACTP.DELETED "deleted",
  947. ACTP.HAUL_DISTANCE "haulDistance",
  948. ACTP.OLD_DATE "oldDate",
  949. ACTP.OILPRICE_CHANGE_THRESHOLD "oilpriceChangeThreshold",
  950. ACTP.OILPRICE_BASE "oilpriceBase",
  951. ACTP.OIL_TYPE_ID "oilTypeId",
  952. ACTP.TYPE "type",
  953. ACTP.PLACE_ID "placeId",
  954. ACTP.DELETED "deleted"
  955. from RMS_RECEIVE_PLACE RRP
  956. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  957. ON RRA.ADDRESS_ID=RRP.ADDRESS_ID
  958. LEFT JOIN AMS_CONTRACT_TRANSPORT_PRICE ACTP
  959. ON ACTP.PLACE_ID=RRP.PLACE_ID
  960. LEFT JOIN RMS_CARRIER RC
  961. ON RC.CARRIER_ID=ACTP.CARRIER_ID
  962. WHERE RRA.ADDRESS_PROVINCE||RRA.ADDRESS_DISTRICT||RRA.ADDRESS_TOWN||
  963. RRP.ADDRESS_DELIVERY_ADDRESS = #{addressProvince}||#{addressDistrict}||#{addressTown}||#{addressDeliveryAddress}
  964. and rownum=1
  965. order by ACTP.PRICE_ID DESC
  966. </select>
  967. <!--获取承运商名字-->
  968. <select id="getCarrierNameForDetail" resultType="java.lang.String">
  969. select SU.USER_NAME from
  970. "SSO".SYS_USER SU
  971. WHERE SU.USER_ID=#{userId}
  972. </select>
  973. <!--获取全部承运商的信息-->
  974. <select id="getCarrierListByPrice" resultType="java.util.LinkedHashMap">
  975. select p0.*,(SELECT COUNT(*) "total" FROM RMS_CARRIER RC) "total" from (select RC.CARRIER_NAME "carrierName",RC.CARRIER_ID "carrierId",ROWNUM r
  976. from RMS_CARRIER RC
  977. <where>
  978. <if test="index!=null">
  979. RC.CARRIER_NAME LIKE #{index}
  980. </if>
  981. </where>)p0 where p0.r between ((#{pageNum} - 1) * #{pageSize} + 1) AND (#{pageNum}*#{pageSize})
  982. </select>
  983. <!--获取全部承运商的信息-->
  984. <select id="getCarrierListByAddress" resultType="java.util.LinkedHashMap">
  985. select
  986. DISTINCT
  987. NVL(RC.CARRIER_ID,0) "carrierId",RC.CARRIER_NAME "carrierName" from RMS_RECEIVE_PLACE RRP
  988. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  989. ON RRA.ADDRESS_ID=RRP.ADDRESS_ID
  990. LEFT JOIN AMS_CONTRACT_TRANSPORT_PRICE ACTP
  991. ON ACTP.PLACE_ID=RRP.PLACE_ID
  992. LEFT JOIN RMS_CARRIER RC
  993. ON RC.CARRIER_ID=ACTP.CARRIER_ID
  994. WHERE RRA.ADDRESS_PROVINCE||RRA.ADDRESS_DISTRICT||RRA.ADDRESS_TOWN||
  995. RRP.ADDRESS_DELIVERY_ADDRESS
  996. =#{addressProvince}||#{addressDistrict}||#{addressTown}||#{addressDeliveryAddress}
  997. and ACTP.TYPE=1 AND ACTP.DELETED=0
  998. and RC.CARRIER_NAME is not null
  999. </select>
  1000. <!--获取全部承运商的信息-->
  1001. <select id="getCarrierListByAddressNew" resultType="java.util.LinkedHashMap">
  1002. select
  1003. DISTINCT
  1004. NVL(ACTP.PRICE_ID,0) "priceId" from RMS_RECEIVE_PLACE RRP
  1005. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  1006. ON RRA.ADDRESS_ID=RRP.ADDRESS_ID
  1007. LEFT JOIN AMS_CONTRACT_TRANSPORT_PRICE ACTP
  1008. ON ACTP.PLACE_ID=RRP.PLACE_ID
  1009. LEFT JOIN RMS_CARRIER RC
  1010. ON RC.CARRIER_ID=ACTP.CARRIER_ID
  1011. WHERE RRP.ADDRESS_DELIVERY_ADDRESS=#{addressDeliveryAddress} and RRA.ADDRESS_ID=#{addressId}
  1012. </select>
  1013. <!--更新旧数据-->
  1014. <update id="updateOldDate">
  1015. update AMS_CONTRACT_TRANSPORT_PRICE ACTP
  1016. set ACTP.PRICE_DATE =TO_DATE(#{priceDate},'yyyy-mm-dd hh24:mi:ss'),
  1017. ACTP.INSERT_TIME=TO_DATE(#{insertTime},'yyyy-mm-dd hh24:mi:ss')
  1018. where ACTP.PRICE_ID=#{priceId}
  1019. </update>
  1020. <!--删除单价信息-->
  1021. <delete id="deleteSomeOneSalePrice">
  1022. delete AMS_CONTRACT_TRANSPORT_PRICE ACTP
  1023. where ACTP.PRICE_ID IN
  1024. (select ACTP.PRICE_ID from RMS_RECEIVE_PLACE RRP
  1025. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  1026. ON RRA.ADDRESS_ID=RRP.ADDRESS_ID
  1027. LEFT JOIN AMS_CONTRACT_TRANSPORT_PRICE ACTP
  1028. ON ACTP.PLACE_ID=RRP.PLACE_ID
  1029. LEFT JOIN RMS_CARRIER RC
  1030. ON RC.CARRIER_ID=ACTP.CARRIER_ID
  1031. WHERE RRA.ADDRESS_PROVINCE||RRA.ADDRESS_DISTRICT||RRA.ADDRESS_TOWN||
  1032. RRP.ADDRESS_DELIVERY_ADDRESS
  1033. =#{addressProvince}||#{addressDistrict}||#{addressTown}||#{addressDeliveryAddress}
  1034. AND RC.CARRIER_ID=#{carrierId})
  1035. </delete>
  1036. <!--修改单价信息-->
  1037. <update id="updateSomeOneSalePrice">
  1038. update AMS_CONTRACT_TRANSPORT_PRICE ACTP
  1039. set ACTP.PRICE_DATE =to_date(#{priceDate},'yyyy-mm-dd hh24:mi:ss'),
  1040. ACTP.INSERT_TIME=to_date(#{insertTime},'yyyy-mm-dd hh24:mi:ss')
  1041. where ACTP.PRICE_ID IN
  1042. (select ACTP.PRICE_ID from RMS_RECEIVE_PLACE RRP
  1043. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  1044. ON RRA.ADDRESS_ID=RRP.ADDRESS_ID
  1045. LEFT JOIN AMS_CONTRACT_TRANSPORT_PRICE ACTP
  1046. ON ACTP.PLACE_ID=RRP.PLACE_ID
  1047. LEFT JOIN RMS_CARRIER RC
  1048. ON RC.CARRIER_ID=ACTP.CARRIER_ID
  1049. WHERE RRA.ADDRESS_PROVINCE||RRA.ADDRESS_DISTRICT||RRA.ADDRESS_TOWN||
  1050. RRP.ADDRESS_DELIVERY_ADDRESS
  1051. =#{addressProvince}||#{addressDistrict}||#{addressTown}||#{addressDeliveryAddress}
  1052. AND RC.CARRIER_ID=#{carrierId})
  1053. </update>
  1054. <!--更新卸货地址-->
  1055. <update id="updateaddressDeliveryAddress">
  1056. update RMS_RECEIVE_PLACE RRP
  1057. SET RRP.ADDRESS_DELIVERY_ADDRESS=#{addressDeliveryAddress}
  1058. WHERE RRP.PLACE_ID=#{placeId}
  1059. </update>
  1060. <!--更新运价-->
  1061. <update id="updatePriceValue">
  1062. UPDATE AMS_CONTRACT_TRANSPORT_PRICE ACTP
  1063. SET ACTP.PRICE_VALUE=#{priceValue},ACTP.HAUL_DISTANCE=#{haulDistance},
  1064. ACTP.PRICE_TON_KILOMETER=#{priceTonKilometer}
  1065. where ACTP.PRICE_ID IN(
  1066. select
  1067. DISTINCT
  1068. ACTP.PRICE_ID from RMS_RECEIVE_PLACE RRP
  1069. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  1070. ON RRA.ADDRESS_ID=RRP.ADDRESS_ID
  1071. LEFT JOIN AMS_CONTRACT_TRANSPORT_PRICE ACTP
  1072. ON ACTP.PLACE_ID=RRP.PLACE_ID
  1073. WHERE RRA.ADDRESS_PROVINCE||RRA.ADDRESS_DISTRICT||RRA.ADDRESS_TOWN||
  1074. RRP.ADDRESS_DELIVERY_ADDRESS
  1075. =#{addressProvince}||#{addressDistrict}||#{addressTown}||#{addressDeliveryAddress})
  1076. </update>
  1077. <!--更新运价(无运输距离的)-->
  1078. <update id="updatePriceValueNew">
  1079. UPDATE AMS_CONTRACT_TRANSPORT_PRICE ACTP
  1080. SET ACTP.PRICE_VALUE=#{priceValue},ACTP.HAUL_DISTANCE=#{haulDistance}
  1081. where ACTP.PRICE_ID IN(
  1082. select
  1083. DISTINCT
  1084. ACTP.PRICE_ID from RMS_RECEIVE_PLACE RRP
  1085. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  1086. ON RRA.ADDRESS_ID=RRP.ADDRESS_ID
  1087. LEFT JOIN AMS_CONTRACT_TRANSPORT_PRICE ACTP
  1088. ON ACTP.PLACE_ID=RRP.PLACE_ID
  1089. WHERE RRA.ADDRESS_PROVINCE||RRA.ADDRESS_DISTRICT||RRA.ADDRESS_TOWN||
  1090. RRP.ADDRESS_DELIVERY_ADDRESS
  1091. =#{addressProvince}||#{addressDistrict}||#{addressTown}||#{addressDeliveryAddress})
  1092. </update>
  1093. <!--更新距离-->
  1094. <update id="updateHaulDistance">
  1095. UPDATE AMS_CONTRACT_TRANSPORT_PRICE ACTP
  1096. SET ACTP.HAUL_DISTANCE=#{haulDistance}
  1097. where ACTP.PRICE_ID IN(
  1098. select
  1099. DISTINCT
  1100. ACTP.PRICE_ID from RMS_RECEIVE_PLACE RRP
  1101. LEFT JOIN RMS_RECEIVE_ADDRESS RRA
  1102. ON RRA.ADDRESS_ID=RRP.ADDRESS_ID
  1103. LEFT JOIN AMS_CONTRACT_TRANSPORT_PRICE ACTP
  1104. ON ACTP.PLACE_ID=RRP.PLACE_ID
  1105. WHERE RRA.ADDRESS_PROVINCE||RRA.ADDRESS_DISTRICT||RRA.ADDRESS_TOWN||
  1106. RRP.ADDRESS_DELIVERY_ADDRESS
  1107. =#{addressProvince}||#{addressDistrict}||#{addressTown}||#{addressDeliveryAddress})
  1108. </update>
  1109. <select id="getAmsContractTransportPriceForDetail" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
  1110. select p0.*,ROWNUM "ROW_ID" from(
  1111. select a_t_price.PRICE_ID "priceId",
  1112. r_r_address.ADDRESS_PROVINCE "addressProvince",
  1113. r_r_address.ADDRESS_DISTRICT "addressDistrict",
  1114. r_r_address.ADDRESS_TOWN "addressTown",
  1115. rrp.ADDRESS_DELIVERY_ADDRESS "addressDeliveryAddress",
  1116. r_carrier.CARRIER_NAME "carrierName",
  1117. r_line.LINE_PATH_LENGTH "linePathLength",
  1118. a_t_price.PRICE_VALUE "priceValue",
  1119. a_t_price.PRICE_TON_KILOMETER "priceTonKilometer",
  1120. a_t_price.PRICE_DATE "priceDate",
  1121. a_t_price.INSERT_TIME "insertTime"
  1122. from AMS_CONTRACT_TRANSPORT_PRICE a_t_price
  1123. left join RMS_RECEIVE_PLACE rrp
  1124. on a_t_price.PLACE_ID=rrp.PLACE_ID
  1125. left join RMS_RECEIVE_ADDRESS r_r_address
  1126. on rrp.ADDRESS_ID = r_r_address.ADDRESS_ID
  1127. left join RMS_CAPACITY_TYPE r_c_type
  1128. on a_t_price.CAPACITY_TYPE_ID=r_c_type.CAPACITY_TYPE_ID
  1129. left join RMS_CARRIER r_carrier
  1130. on a_t_price.CARRIER_ID=r_carrier.CARRIER_ID
  1131. left join RMS_LINE r_line
  1132. on a_t_price.LINE_ID=r_line.LINE_ID
  1133. left join RMS_OIL_TYPE r_o_type
  1134. on a_t_price.OIL_TYPE_ID = r_o_type.OIL_TYPE_ID
  1135. left join RMS_SHIPPER rs
  1136. on rs.SHIPPER_ID = a_t_price.SHIPPER_ID
  1137. <where>
  1138. TYPE=1
  1139. and a_t_price.ISSTANDARD is null
  1140. and a_t_price.DELETED = 0
  1141. <if test="carrierName1!=null and carrierName1 != ''.toString() ">
  1142. and r_carrier.CARRIER_NAME like CONCAT('%',CONCAT(#{carrierName1},'%'))
  1143. </if>
  1144. <if test="con !=null and con != ''.toString()">
  1145. and
  1146. r_r_address.ADDRESS_PROVINCE || r_r_address.ADDRESS_DISTRICT || r_r_address.ADDRESS_TOWN
  1147. || rrp.ADDRESS_DELIVERY_ADDRESS || r_carrier.CARRIER_NAME || r_c_type.CAPACITY_TYPE_NAME
  1148. like CONCAT('%',CONCAT(#{con},'%'))
  1149. </if>
  1150. </where>
  1151. ) p0
  1152. </select>
  1153. <sql id="orderBy">
  1154. <if test="orderField != null and orderField != ''">
  1155. order by "${orderField}"
  1156. <if test="orderType != null and orderType != ''">
  1157. ${orderType}
  1158. </if>
  1159. </if>
  1160. </sql>
  1161. <select id="getCarrierName" resultType="java.util.LinkedHashMap">
  1162. select
  1163. CARRIER_ID "id",
  1164. CARRIER_ID "value",
  1165. CARRIER_NAME "label"
  1166. from RMS_CARRIER
  1167. </select>
  1168. <select id="getLineNo" resultType="java.util.LinkedHashMap">
  1169. select
  1170. LINE_ID "id",
  1171. LINE_ID "value",
  1172. LINE_NO "label"
  1173. from RMS_LINE
  1174. </select>
  1175. <select id="getCapacityNumber" resultType="java.util.LinkedHashMap">
  1176. select
  1177. CAPACITY_ID "id",
  1178. CAPACITY_ID "value",
  1179. CAPACITY_NUMBER "label"
  1180. from RMS_CAPACITY
  1181. </select>
  1182. <select id="getAddressDeliveryAddress" resultType="java.util.LinkedHashMap">
  1183. SELECT *
  1184. FROM (SELECT
  1185. distinct
  1186. RRA.ADDRESS_ID "addressId",
  1187. RRA.ADDRESS_PROVINCE "province",
  1188. RRA.ADDRESS_DISTRICT "district",
  1189. RRA.ADDRESS_TOWN "town",
  1190. RRP.ADDRESS_DELIVERY_ADDRESS "address1",
  1191. RRA.ADDRESS_PROVINCE ||RRA.ADDRESS_DISTRICT|| RRA.ADDRESS_TOWN||RRP.ADDRESS_DELIVERY_ADDRESS "address",
  1192. RRP.PLACE_ID "placeId",
  1193. TO_CHAR(ACTP.PRICE_VALUE, '9999999990.99') "pricevalue",
  1194. ACTP.PRICE_ID "priceid"
  1195. FROM RMS_RECEIVE_ADDRESS RRA
  1196. LEFT JOIN RMS_RECEIVE_PLACE RRP
  1197. ON RRP.ADDRESS_ID=RRA.ADDRESS_ID
  1198. LEFT JOIN AMS_CONTRACT_TRANSPORT_PRICE ACTP
  1199. ON ACTP.PLACE_ID=RRP.PLACE_ID
  1200. WHERE ACTP.DELETED = 0
  1201. and ACTP.ISSTANDARD IS NULL
  1202. ) RRRA
  1203. <if test="con != null" >
  1204. WHERE RRRA."address" LIKE #{con}
  1205. </if>
  1206. order by RRRA."pricevalue" asc nulls last
  1207. </select>
  1208. <select id="getAddressDeliveryAddressForDetails" resultType="java.util.LinkedHashMap">
  1209. <!--SELECT *
  1210. FROM (SELECT
  1211. distinct
  1212. RRA.ADDRESS_ID "addressId",
  1213. RRA.ADDRESS_PROVINCE "province",
  1214. RRA.ADDRESS_DISTRICT "district",
  1215. RRA.ADDRESS_TOWN "town",
  1216. RRP.ADDRESS_DELIVERY_ADDRESS "address1",
  1217. RRA.ADDRESS_PROVINCE ||RRA.ADDRESS_DISTRICT|| RRA.ADDRESS_TOWN||RRP.ADDRESS_DELIVERY_ADDRESS "address",
  1218. RRP.PLACE_ID "placeId",
  1219. TO_CHAR(ACTP.PRICE_VALUE, '9999999990.99') "pricevalue",
  1220. ACTP.PRICE_ID "priceid"
  1221. FROM RMS_RECEIVE_ADDRESS RRA
  1222. LEFT JOIN RMS_RECEIVE_PLACE RRP
  1223. ON RRP.ADDRESS_ID=RRA.ADDRESS_ID
  1224. LEFT JOIN AMS_CONTRACT_TRANSPORT_PRICE ACTP
  1225. ON ACTP.PLACE_ID=RRP.PLACE_ID
  1226. WHERE ACTP.DELETED = 0
  1227. and ACTP.ISSTANDARD IS NULL
  1228. ) RRRA
  1229. <if test="con != null" >
  1230. WHERE RRRA."address" LIKE #{con}
  1231. </if>
  1232. order by RRRA."pricevalue" asc nulls last-->
  1233. select * from(
  1234. select a_t_price.PRICE_ID "priceid",
  1235. r_r_address.ADDRESS_PROVINCE "addressProvince",
  1236. r_r_address.ADDRESS_DISTRICT "addressDistrict",
  1237. r_r_address.ADDRESS_TOWN "addressTown",
  1238. rrp.ADDRESS_DELIVERY_ADDRESS "addressDeliveryAddress",
  1239. rrp.PLACE_ID "placeId",
  1240. r_r_address.ADDRESS_ID "addressId",
  1241. r_r_address.ADDRESS_PROVINCE||r_r_address.ADDRESS_DISTRICT||r_r_address.ADDRESS_TOWN
  1242. ||rrp.ADDRESS_DELIVERY_ADDRESS "address",
  1243. r_carrier.CARRIER_NAME "carrierName",
  1244. r_line.LINE_PATH_LENGTH "linePathLength",
  1245. a_t_price.PRICE_VALUE "priceValue",
  1246. a_t_price.PRICE_TON_KILOMETER "priceTonKilometer",
  1247. a_t_price.PRICE_DATE "priceDate",
  1248. a_t_price.INSERT_TIME "insertTime",
  1249. a_t_price.haul_distance "haulDistance"
  1250. from AMS_CONTRACT_TRANSPORT_PRICE a_t_price
  1251. left join RMS_RECEIVE_PLACE rrp
  1252. on a_t_price.PLACE_ID=rrp.PLACE_ID
  1253. left join RMS_RECEIVE_ADDRESS r_r_address
  1254. on rrp.ADDRESS_ID = r_r_address.ADDRESS_ID
  1255. left join RMS_CAPACITY_TYPE r_c_type
  1256. on a_t_price.CAPACITY_TYPE_ID=r_c_type.CAPACITY_TYPE_ID
  1257. left join RMS_CARRIER r_carrier
  1258. on a_t_price.CARRIER_ID=r_carrier.CARRIER_ID
  1259. left join RMS_LINE r_line
  1260. on a_t_price.LINE_ID=r_line.LINE_ID
  1261. left join RMS_OIL_TYPE r_o_type
  1262. on a_t_price.OIL_TYPE_ID = r_o_type.OIL_TYPE_ID
  1263. left join RMS_SHIPPER rs
  1264. on rs.SHIPPER_ID = a_t_price.SHIPPER_ID
  1265. <where>
  1266. TYPE=1
  1267. and a_t_price.ISSTANDARD is null
  1268. and a_t_price.DELETED = 0
  1269. <if test="carrierName1!=null and carrierName1 != ''.toString() ">
  1270. and r_carrier.CARRIER_NAME like CONCAT('%',CONCAT(#{carrierName1},'%'))
  1271. </if>
  1272. <if test="con !=null and con != ''.toString()">
  1273. and
  1274. r_r_address.ADDRESS_PROVINCE || r_r_address.ADDRESS_DISTRICT || r_r_address.ADDRESS_TOWN
  1275. || rrp.ADDRESS_DELIVERY_ADDRESS || r_carrier.CARRIER_NAME || r_c_type.CAPACITY_TYPE_NAME
  1276. like CONCAT('%',CONCAT(#{con},'%'))
  1277. </if>
  1278. </where>
  1279. )
  1280. </select>
  1281. <select id="selectByPriceId" parameterType="java.math.BigDecimal" resultType="java.util.LinkedHashMap">
  1282. select a_t_price.SHIPPER_ID "shipperId",
  1283. a_t_price.CARRIER_ID "carrierId",
  1284. a_t_price.LINE_ID "lineId",
  1285. a_t_price.CAPACITY_ID "capacityId",
  1286. a_t_price.MATERIAL_ID "materialId",
  1287. a_t_price.PLACE_ID "placeId",
  1288. a_t_price.PRICE_VALUE "priceValue",
  1289. a_t_price.PRICE_DATE "priceDate"
  1290. from AMS_CONTRACT_TRANSPORT_PRICE a_t_price
  1291. where a_t_price.PRICE_ID = #{priceId}
  1292. </select>
  1293. <select id="getOriginAndNowOilPrice" resultType="java.util.LinkedHashMap">
  1294. select rownum "rownum",
  1295. r_o_price.PRICE_VALUE "priceValue"
  1296. from RMS_OIL_PRICE r_o_price where r_o_price.PRICE_OIL_NAME='0号柴油'
  1297. order by r_o_price.PRICE_DATE desc
  1298. </select>
  1299. <update id="batchUpdateTransportPriceByOilPrice" parameterType="double">
  1300. update AMS_CONTRACT_TRANSPORT_PRICE
  1301. set PRICE_VALUE = ROUND(PRICE_VALUE * 0.65 + PRICE_VALUE * 0.35 * (1 + #{updateOilPrice}),2)
  1302. </update>
  1303. <select id="getLinePathLength" parameterType="java.math.BigDecimal" resultType="java.math.BigDecimal">
  1304. select LINE_PATH_LENGTH "linePathLength" from RMS_LINE where LINE_ID = #{lineId}
  1305. </select>
  1306. <select id="getPriceValueList" resultType="java.util.Map">
  1307. select a_t_price.PRICE_ID "priceId",
  1308. a_t_price.PRICE_VALUE "priceValue",
  1309. a_t_price.OILPRICE_BASE "oilpriceBase",
  1310. a_t_price.OILPRICE_CHANGE_THRESHOLD "oilpriceChangeThreshold",
  1311. a_t_price.CARGONAME_ID "cargonameId",
  1312. a_t_price.haul_distance "haulDistance",
  1313. a_t_price.REFERENCE_HT "referenceHt",
  1314. a_t_price.inventory "inventory",
  1315. a_t_price.place_id "placeId"
  1316. from AMS_CONTRACT_TRANSPORT_PRICE a_t_price
  1317. where a_t_price.OIL_TYPE_ID = #{oilTypeId} and a_t_price.DELETED = 0
  1318. order by reference_ht desc
  1319. </select>
  1320. <select id="getPriceValueAndPriceTonKilometer" resultType="java.util.LinkedHashMap">
  1321. select a_t_price.PRICE_ID "priceId",
  1322. a_t_price.PRICE_VALUE "priceValue",
  1323. a_t_price.PRICE_TON_KILOMETER "priceTonKilometer"
  1324. from AMS_CONTRACT_TRANSPORT_PRICE a_t_price
  1325. </select>
  1326. <update id="updatePriceTonKilometer" parameterType="java.math.BigDecimal">
  1327. update AMS_CONTRACT_TRANSPORT_PRICE set PRICE_TON_KILOMETER = #{priceTonKilometer}
  1328. where PRICE_ID = #{priceId}
  1329. </update>
  1330. <select id="getTruckFormula" parameterType="DECIMAL" resultType="java.lang.String">
  1331. SELECT FORMULA_STRING
  1332. FROM BMSTRUCK_FORMULA
  1333. WHERE FORMULA_ID = #{formulaId}
  1334. </select>
  1335. <select id="getCargonameValue" parameterType="java.math.BigDecimal" resultType="java.lang.String">
  1336. select CARGONAME_VALUE "cargonameValue"
  1337. from RMS_CARGONAME where CARGONAME_ID = #{cargonameId}
  1338. </select>
  1339. <select id="getCargoName" resultType="java.util.LinkedHashMap">
  1340. select
  1341. CARGONAME_ID "id",
  1342. CARGONAME_ID "value",
  1343. CARGONAME_VALUE "label"
  1344. from RMS_CARGONAME
  1345. </select>
  1346. <select id="getOilTypeName" resultType="java.util.LinkedHashMap">
  1347. select
  1348. OIL_TYPE_ID "id",
  1349. OIL_TYPE_ID "value",
  1350. OIL_TYPE_NAME "label"
  1351. from RMS_OIL_TYPE
  1352. </select>
  1353. <select id="getRealAddressByLike" parameterType="java.util.Map" resultType="java.util.Map">
  1354. SELECT
  1355. RRP.PLACE_ID AS "placeId",
  1356. RRP.ADDRESS_DELIVERY_ADDRESS AS "value",
  1357. RRP.ADDRESS_DELIVERY_ADDRESS AS "placeName"
  1358. FROM RMS_RECEIVE_PLACE RRP
  1359. WHERE RRP.ADDRESS_ID = #{addressId}
  1360. <if test="index != null">
  1361. AND RRP.ADDRESS_DELIVERY_ADDRESS LIKE #{index}
  1362. </if>
  1363. </select>
  1364. <select id="selectFormulaId" parameterType="DECIMAL" resultType="DECIMAL" >
  1365. SELECT ACTP.CARGONAME_ID AS "formulaId"
  1366. FROM AMS_CONTRACT_TRANSPORT_PRICE ACTP
  1367. WHERE ACTP.PRICE_ID = #{priceId}
  1368. </select>
  1369. <select id="getInwardContractPrice" resultType="java.util.Map" parameterType="java.util.Map">
  1370. SELECT *
  1371. FROM (SELECT a_t_price.PRICE_ID "priceId",
  1372. r_o_type.OIL_TYPE_NAME "oilTypeName",
  1373. r_c_type.CAPACITY_TYPE_NAME "capacityTypeName",
  1374. a_t_price.PRICE_VALUE "priceValue",
  1375. a_t_price.PRICE_DATE "priceDate",
  1376. a_t_price.OILPRICE_BASE "oilpriceBase",
  1377. a_t_price.INSERT_TIME "insertTime",
  1378. a_t_price.OILPRICE_CHANGE_THRESHOLD "oilpriceChangeThreshold",
  1379. RGR.TRANS_RANGE_VALUE "transRange",
  1380. a_t_price.TYPE "type"
  1381. FROM AMS_CONTRACT_TRANSPORT_PRICE a_t_price
  1382. LEFT JOIN RMS_RECEIVE_PLACE rrp
  1383. ON a_t_price.PLACE_ID = rrp.PLACE_ID
  1384. LEFT JOIN RMS_RECEIVE_ADDRESS r_r_address
  1385. ON rrp.ADDRESS_ID = r_r_address.ADDRESS_ID
  1386. LEFT JOIN RMS_CAPACITY_TYPE r_c_type
  1387. ON a_t_price.CAPACITY_TYPE_ID = r_c_type.CAPACITY_TYPE_ID
  1388. LEFT JOIN RMS_CARRIER r_carrier
  1389. ON a_t_price.CARRIER_ID = r_carrier.CARRIER_ID
  1390. LEFT JOIN RMS_TRANS_RANGE RGR
  1391. ON a_t_price.LINE_ID = RGR.TRANS_RANGE_ID
  1392. LEFT JOIN RMS_OIL_TYPE r_o_type
  1393. ON a_t_price.OIL_TYPE_ID = r_o_type.OIL_TYPE_ID
  1394. where TYPE in (2,5,6)
  1395. <if test="deleted != null">
  1396. and a_t_price.DELETED = #{deleted}
  1397. </if>
  1398. <if test="con != null" >
  1399. and RGR.TRANS_RANGE_VALUE LIKE #{con} or r_c_type.CAPACITY_TYPE_NAME LIKE #{con}
  1400. </if>)
  1401. <include refid="whereLikeForeach"/>
  1402. <include refid="orderBy"></include>
  1403. </select>
  1404. <select id="selectInwardPrice" resultType="java.util.LinkedHashMap" parameterType="java.util.LinkedHashMap">
  1405. select * from (select
  1406. distinct
  1407. actp.price_id "priceId", actp.price_value "priceValue" ,rop.PRICE_DATE "priceDate"
  1408. from ams_contract_transport_price actp
  1409. left join ams_contaact_price_material acpm
  1410. on acpm.price_id = actp.price_id
  1411. left join RMS_OIL_PRICE ROP
  1412. on rop.PRICE_OIL_TYPE_ID = actp.OIL_TYPE_ID
  1413. left join rms_trans_range rtr
  1414. on rtr.trans_range_id = actp.line_id
  1415. where type = #{type}
  1416. and actp.DELETED = 0
  1417. <if test="type==2">
  1418. and acpm.DELETED = 0
  1419. </if>
  1420. <if test="rangeId != null">
  1421. and actp.LINE_ID = #{rangeId}
  1422. </if>
  1423. <if test="materialId != null">
  1424. and acpm.MATERIAL_ID = #{materialTypeId}
  1425. </if>
  1426. <if test="capacityTypeId != null">
  1427. and actp.CAPACITY_TYPE_ID = #{capacityTypeId}
  1428. </if>
  1429. )
  1430. Order by "priceDate" desc
  1431. </select>
  1432. <select id="getRangePoint" resultType="java.util.Map" parameterType="java.util.Map">
  1433. SELECT * FROM
  1434. (SELECT RTR.TRANS_RANGE_VALUE "transRangeValue" ,
  1435. RLNP.LOAD_POINT_NAME "loadPointName" ,
  1436. RLNP.UNLOAD_POINT_NAME "unloadPointName",
  1437. RTR.TRANS_RANGE_ID "transRangeId",
  1438. RLNP.LINE_NODE_ID "lineNodeId" FROM RMS_TRANS_RANGE RTR
  1439. LEFT JOIN RMS_LINE_NODE_POINT RLNP on RTR.TRANS_RANGE_ID = RLNP.TRANS_RANGE_ID
  1440. where RLNP.DELETED = 0
  1441. <if test="con != null">
  1442. AND
  1443. RTR.TRANS_RANGE_VALUE||RLNP.LOAD_POINT_NAME||RLNP.UNLOAD_POINT_NAME like #{con}
  1444. </if>
  1445. )
  1446. <where>
  1447. <if test="transRangeValue != null">
  1448. and
  1449. <foreach collection="transRangeValue" item="item" open="(" separator="or" close=")">
  1450. "transRangeValue" like '%${item}%'
  1451. </foreach>
  1452. </if>
  1453. <if test="loadPointName != null">
  1454. and
  1455. <foreach collection="loadPointName" item="item" open="(" separator="or" close=")">
  1456. "loadPointName" like '%${item}%'
  1457. </foreach>
  1458. </if>
  1459. <if test="loadPointName != null">
  1460. and
  1461. <foreach collection="loadPointName" item="item" open="(" separator="or" close=")">
  1462. "loadPointName" like '%${item}%'
  1463. </foreach>
  1464. </if>
  1465. </where>
  1466. </select>
  1467. <select id="selectwz" resultType="java.util.Map">
  1468. select
  1469. RMT.MATERIAL_TYPE_NAME "materialName",
  1470. RMT.MATERIAL_TYPE_ID "materialId"
  1471. from AMS_CONTAACT_PRICE_MATERIAL acpr
  1472. left join RMS_MATERIAL_TYPE RMT
  1473. on RMT.MATERIAL_TYPE_ID = acpr.MATERIAL_ID
  1474. where
  1475. RMT.MATERIAL_ISINWARD = 1
  1476. AND
  1477. PRICE_ID = #{priceId}
  1478. AND ACPR.DELETED = 0
  1479. </select>
  1480. <select id="getcargonameId" resultType="java.util.Map">
  1481. select
  1482. BF.FORMULA_ID AS "formulaId",
  1483. BF.FORMULA_NAME AS "formulaName",
  1484. BF.FORMULA_STRING AS "formulaString"
  1485. from AMS_CONTRACT_TRANSPORT_PRICE t
  1486. left join BMSTRUCK_FORMULA bf on t.cargoname_id=bf.formula_id
  1487. where price_id=#{priceId}
  1488. </select>
  1489. <update id="updateDCodd">
  1490. update AMS_CONTRACT_TRANSPORT_PRICE set deleted =1 where capacity_type_id in (20,21,22,23,24,25,26,27,28,41,42,40) and deleted =0
  1491. </update>
  1492. <update id="updateDCnew">
  1493. update AMS_CONTRACT_TRANSPORT_PRICE set deleted =0 where capacity_type_id in (20,21,22,23,24,25,26,27,28,41,42,40) and price_date = to_date('2022-09-26', 'yyyy-mm-dd');
  1494. </update>
  1495. <select id="selectByPlaceId" resultType="java.util.Map">
  1496. select price_id "priceId",
  1497. haul_distance "haulDistance",
  1498. reference_ht "referenceHt",
  1499. price_value "priceValue"
  1500. from AMS_CONTRACT_TRANSPORT_PRICE
  1501. where place_id in (select place_id from RMS_RECEIVE_PLACE t where address_id =
  1502. (select address_id from RMS_RECEIVE_PLACE t where place_id=#{placeId} )) and reference_ht is not null
  1503. AND DELETED = 0
  1504. ORDER BY PRICE_DATE DESC
  1505. FETCH FIRST 1 ROW ONLY
  1506. </select>
  1507. <update id="updateByPriceId" parameterType="map">
  1508. update AMS_CONTRACT_TRANSPORT_PRICE set price_value=#{priceValue} where price_id=#{priceId}
  1509. </update>
  1510. <update id="updateDelectByPlaceId" parameterType="map">
  1511. update AMS_CONTRACT_TRANSPORT_PRICE set deleted =1 where place_id =#{placeId}
  1512. </update>
  1513. <select id="selectshdz" resultType="java.lang.String">
  1514. select t.address_id "addressId" from RMS_RECEIVE_ADDRESS t where address_province =#{addressProvince} and address_district =#{addressDistrict}
  1515. <if test="addressTown!=null">
  1516. and address_town =#{addressTown}
  1517. </if>
  1518. <if test="addressTown==null">
  1519. and address_town is null
  1520. </if>
  1521. </select>
  1522. <select id="selectxxdz" resultType="java.util.Map">
  1523. select t.place_id "placeId" from RMS_RECEIVE_PLACE t
  1524. where
  1525. <if test="addressDeliveryAddress!=null">
  1526. t.address_delivery_address =#{addressDeliveryAddress}
  1527. </if>
  1528. <if test="addressDeliveryAddress!=null and addressId!=null">
  1529. and
  1530. </if>
  1531. <if test="addressId!=null ">
  1532. t.address_id in
  1533. <foreach collection="addressId" item="item" open="(" separator="," close=")">
  1534. #{item}
  1535. </foreach>
  1536. </if>
  1537. fetch next 1 rows only
  1538. </select>
  1539. <insert id="insertxxdz" parameterType="map">
  1540. insert into RMS_RECEIVE_PLACE (PLACE_ID, ADDRESS_ID
  1541. <if test="addressDeliveryAddress!=null">
  1542. , ADDRESS_DELIVERY_ADDRESS
  1543. </if>)
  1544. values (#{placeId},#{addressId}
  1545. <if test="addressDeliveryAddress!=null">
  1546. ,#{addressDeliveryAddress}
  1547. </if>)
  1548. </insert>
  1549. <select id="selectcys" resultType="map">
  1550. select t.carrier_id "carrierId" from RMS_CARRIER t where carrier_abbreviation like #{carrierAbbreviation}
  1551. </select>
  1552. <select id="selectMaxIdrrp" resultType="int">
  1553. select max(PLACE_ID) from RMS_RECEIVE_PLACE
  1554. </select>
  1555. <select id="selectMaxIdrra" resultType="int">
  1556. select max(address_id) from RMS_RECEIVE_ADDRESS
  1557. </select>
  1558. <insert id="insertshdz" parameterType="map">
  1559. insert into RMS_RECEIVE_ADDRESS (ADDRESS_ID, ADDRESS_PROVINCE, ADDRESS_DISTRICT
  1560. <if test="addressTown!=null">
  1561. ,ADDRESS_TOWN
  1562. </if>
  1563. )
  1564. values (#{addressId},#{addressProvince} , #{addressDistrict}
  1565. <if test="addressTown!=null">
  1566. , #{addressTown}
  1567. </if>
  1568. );
  1569. </insert>
  1570. </mapper>