AmsContractTrainPriceMapper.xml 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407
  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.AmsContractTrainPriceMapper">
  4. <resultMap id="BaseResultMap" type="com.steerinfo.dil.model.AmsContractTrainPrice">
  5. <id column="PRICE_ID" jdbcType="DECIMAL" property="priceId"/>
  6. <result column="TRAIN_TYPE" jdbcType="VARCHAR" property="trainType"/>
  7. <result column="TRAIN_PRICE_DATE" jdbcType="TIMESTAMP" property="trainPriceDate"/>
  8. <result column="TRAIN_PRICE" jdbcType="DECIMAL" property="trainPrice"/>
  9. <result column="INSERT_TIME" jdbcType="TIMESTAMP" property="insertTime"/>
  10. <result column="INSERT_USERNAME" jdbcType="VARCHAR" property="insertUsername"/>
  11. <result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime"/>
  12. <result column="UPDATE_USERNAME" jdbcType="VARCHAR" property="updateUsername"/>
  13. <result column="INSERT_UPDATE_REMARK" jdbcType="VARCHAR" property="insertUpdateRemark"/>
  14. <result column="DELETED" jdbcType="DECIMAL" property="deleted"/>
  15. </resultMap>
  16. <sql id="columns">
  17. PRICE_ID, TRAIN_TYPE, TRAIN_PRICE_DATE, TRAIN_PRICE, INSERT_TIME, INSERT_USERNAME,
  18. UPDATE_TIME, UPDATE_USERNAME, INSERT_UPDATE_REMARK, DELETED
  19. </sql>
  20. <sql id="columns_alias">
  21. t.PRICE_ID, t.TRAIN_TYPE, t.TRAIN_PRICE_DATE, t.TRAIN_PRICE, t.INSERT_TIME, t.INSERT_USERNAME,
  22. t.UPDATE_TIME, t.UPDATE_USERNAME, t.INSERT_UPDATE_REMARK, t.DELETED
  23. </sql>
  24. <sql id="select">
  25. SELECT
  26. <include refid="columns"/>
  27. FROM AMS_CONTRACT_TRAIN_PRICE
  28. </sql>
  29. <sql id="select_alias">
  30. SELECT
  31. <include refid="columns_alias"/>
  32. FROM AMS_CONTRACT_TRAIN_PRICE t
  33. </sql>
  34. <sql id="where">
  35. <where>
  36. <if test="priceId != null">
  37. and PRICE_ID = #{priceId}
  38. </if>
  39. <if test="trainType != null and trainType != ''">
  40. and TRAIN_TYPE = #{trainType}
  41. </if>
  42. <if test="trainPriceDate != null">
  43. and TO_CHAR(TRAIN_PRICE_DATE,'yyyy-MM-dd') = #{trainPriceDate}
  44. </if>
  45. <if test="trainPrice != null">
  46. and TRAIN_PRICE = #{trainPrice}
  47. </if>
  48. <if test="insertTime != null">
  49. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  50. </if>
  51. <if test="insertUsername != null and insertUsername != ''">
  52. and INSERT_USERNAME = #{insertUsername}
  53. </if>
  54. <if test="updateTime != null">
  55. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  56. </if>
  57. <if test="updateUsername != null and updateUsername != ''">
  58. and UPDATE_USERNAME = #{updateUsername}
  59. </if>
  60. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  61. and INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  62. </if>
  63. <if test="deleted != null">
  64. and DELETED = #{deleted}
  65. </if>
  66. </where>
  67. </sql>
  68. <sql id="whereLike">
  69. <where>
  70. <if test="priceId != null">
  71. and PRICE_ID = #{priceId}
  72. </if>
  73. <if test="trainType != null and trainType != ''">
  74. and TRAIN_TYPE LIKE '%${trainType}%'
  75. </if>
  76. <if test="trainPriceDate != null">
  77. and TO_CHAR(TRAIN_PRICE_DATE,'yyyy-MM-dd') = #{trainPriceDate}
  78. </if>
  79. <if test="trainPrice != null">
  80. and TRAIN_PRICE = #{trainPrice}
  81. </if>
  82. <if test="insertTime != null">
  83. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  84. </if>
  85. <if test="insertUsername != null and insertUsername != ''">
  86. and INSERT_USERNAME LIKE '%${insertUsername}%'
  87. </if>
  88. <if test="updateTime != null">
  89. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  90. </if>
  91. <if test="updateUsername != null and updateUsername != ''">
  92. and UPDATE_USERNAME LIKE '%${updateUsername}%'
  93. </if>
  94. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  95. and INSERT_UPDATE_REMARK LIKE '%${insertUpdateRemark}%'
  96. </if>
  97. <if test="deleted != null">
  98. and DELETED = #{deleted}
  99. </if>
  100. </where>
  101. </sql>
  102. <delete id="deleteByPrimaryKey" parameterType="DECIMAL">
  103. delete
  104. from AMS_CONTRACT_TRAIN_PRICE
  105. where PRICE_ID = #{priceId,jdbcType=DECIMAL}
  106. </delete>
  107. <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
  108. delete from AMS_CONTRACT_TRAIN_PRICE
  109. where 1!=1
  110. <if test="trainType != null and trainType != ''">
  111. or TRAIN_TYPE = #{trainType}
  112. </if>
  113. <if test="trainPriceDate != null">
  114. or TO_CHAR(TRAIN_PRICE_DATE,'yyyy-MM-dd') = '#{trainPriceDate}'
  115. </if>
  116. <if test="trainPrice != null">
  117. or TRAIN_PRICE = #{trainPrice}
  118. </if>
  119. <if test="insertTime != null">
  120. or TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = '#{insertTime}'
  121. </if>
  122. <if test="insertUsername != null and insertUsername != ''">
  123. or INSERT_USERNAME = #{insertUsername}
  124. </if>
  125. <if test="updateTime != null">
  126. or TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = '#{updateTime}'
  127. </if>
  128. <if test="updateUsername != null and updateUsername != ''">
  129. or UPDATE_USERNAME = #{updateUsername}
  130. </if>
  131. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  132. or INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  133. </if>
  134. <if test="deleted != null">
  135. or DELETED = #{deleted}
  136. </if>
  137. </delete>
  138. <insert id="insert" parameterType="com.steerinfo.dil.model.AmsContractTrainPrice">
  139. insert into AMS_CONTRACT_TRAIN_PRICE (PRICE_ID, TRAIN_TYPE, TRAIN_PRICE_DATE,
  140. TRAIN_PRICE, INSERT_TIME, INSERT_USERNAME,
  141. UPDATE_TIME, UPDATE_USERNAME, INSERT_UPDATE_REMARK,
  142. DELETED)
  143. values (#{priceId,jdbcType=DECIMAL}, #{trainType,jdbcType=VARCHAR}, #{trainPriceDate,jdbcType=TIMESTAMP},
  144. #{trainPrice,jdbcType=DECIMAL}, #{insertTime,jdbcType=TIMESTAMP}, #{insertUsername,jdbcType=VARCHAR},
  145. #{updateTime,jdbcType=TIMESTAMP}, #{updateUsername,jdbcType=VARCHAR},
  146. #{insertUpdateRemark,jdbcType=VARCHAR},
  147. #{deleted,jdbcType=DECIMAL})
  148. </insert>
  149. <insert id="insertSelective" parameterType="com.steerinfo.dil.model.AmsContractTrainPrice">
  150. insert into AMS_CONTRACT_TRAIN_PRICE
  151. <trim prefix="(" suffix=")" suffixOverrides=",">
  152. <if test="priceId != null">
  153. PRICE_ID,
  154. </if>
  155. <if test="trainType != null">
  156. TRAIN_TYPE,
  157. </if>
  158. <if test="trainPriceDate != null">
  159. TRAIN_PRICE_DATE,
  160. </if>
  161. <if test="trainPrice != null">
  162. TRAIN_PRICE,
  163. </if>
  164. <if test="insertTime != null">
  165. INSERT_TIME,
  166. </if>
  167. <if test="insertUsername != null">
  168. INSERT_USERNAME,
  169. </if>
  170. <if test="updateTime != null">
  171. UPDATE_TIME,
  172. </if>
  173. <if test="updateUsername != null">
  174. UPDATE_USERNAME,
  175. </if>
  176. <if test="insertUpdateRemark != null">
  177. INSERT_UPDATE_REMARK,
  178. </if>
  179. <if test="deleted != null">
  180. DELETED,
  181. </if>
  182. </trim>
  183. <trim prefix="values (" suffix=")" suffixOverrides=",">
  184. <if test="priceId != null">
  185. #{priceId,jdbcType=DECIMAL},
  186. </if>
  187. <if test="trainType != null">
  188. #{trainType,jdbcType=VARCHAR},
  189. </if>
  190. <if test="trainPriceDate != null">
  191. #{trainPriceDate,jdbcType=TIMESTAMP},
  192. </if>
  193. <if test="trainPrice != null">
  194. #{trainPrice,jdbcType=DECIMAL},
  195. </if>
  196. <if test="insertTime != null">
  197. #{insertTime,jdbcType=TIMESTAMP},
  198. </if>
  199. <if test="insertUsername != null">
  200. #{insertUsername,jdbcType=VARCHAR},
  201. </if>
  202. <if test="updateTime != null">
  203. #{updateTime,jdbcType=TIMESTAMP},
  204. </if>
  205. <if test="updateUsername != null">
  206. #{updateUsername,jdbcType=VARCHAR},
  207. </if>
  208. <if test="insertUpdateRemark != null">
  209. #{insertUpdateRemark,jdbcType=VARCHAR},
  210. </if>
  211. <if test="deleted != null">
  212. #{deleted,jdbcType=DECIMAL},
  213. </if>
  214. </trim>
  215. </insert>
  216. <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.AmsContractTrainPrice">
  217. update AMS_CONTRACT_TRAIN_PRICE
  218. set TRAIN_TYPE = #{trainType,jdbcType=VARCHAR},
  219. TRAIN_PRICE_DATE = #{trainPriceDate,jdbcType=TIMESTAMP},
  220. TRAIN_PRICE = #{trainPrice,jdbcType=DECIMAL},
  221. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  222. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  223. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  224. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  225. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  226. DELETED = #{deleted,jdbcType=DECIMAL}
  227. where PRICE_ID = #{priceId,jdbcType=DECIMAL}
  228. </update>
  229. <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.AmsContractTrainPrice">
  230. update AMS_CONTRACT_TRAIN_PRICE
  231. <set>
  232. <if test="trainType != null">
  233. TRAIN_TYPE = #{trainType,jdbcType=VARCHAR},
  234. </if>
  235. <if test="trainPriceDate != null">
  236. TRAIN_PRICE_DATE = #{trainPriceDate,jdbcType=TIMESTAMP},
  237. </if>
  238. <if test="trainPrice != null">
  239. TRAIN_PRICE = #{trainPrice,jdbcType=DECIMAL},
  240. </if>
  241. <if test="insertTime != null">
  242. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  243. </if>
  244. <if test="insertUsername != null">
  245. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  246. </if>
  247. <if test="updateTime != null">
  248. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  249. </if>
  250. <if test="updateUsername != null">
  251. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  252. </if>
  253. <if test="insertUpdateRemark != null">
  254. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  255. </if>
  256. <if test="deleted != null">
  257. DELETED = #{deleted,jdbcType=DECIMAL},
  258. </if>
  259. </set>
  260. where PRICE_ID = #{priceId,jdbcType=DECIMAL}
  261. </update>
  262. <select id="selectByPrimaryKey" parameterType="DECIMAL" resultMap="BaseResultMap">
  263. <include refid="select"/>
  264. where PRICE_ID = #{priceId,jdbcType=DECIMAL}
  265. </select>
  266. <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  267. <include refid="select"/>
  268. <include refid="where"/>
  269. </select>
  270. <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  271. <include refid="select"/>
  272. <include refid="whereLike"/>
  273. </select>
  274. <insert id="batchInsert" parameterType="java.util.List">
  275. insert into AMS_CONTRACT_TRAIN_PRICE
  276. (PRICE_ID,
  277. TRAIN_TYPE, TRAIN_PRICE_DATE,
  278. TRAIN_PRICE, INSERT_TIME, INSERT_USERNAME,
  279. UPDATE_TIME, UPDATE_USERNAME,
  280. INSERT_UPDATE_REMARK, DELETED)
  281. ( <foreach collection="list" item="item" separator="union all">
  282. select
  283. #{item.priceId,jdbcType=DECIMAL},
  284. #{item.trainType,jdbcType=VARCHAR}, #{item.trainPriceDate,jdbcType=TIMESTAMP},
  285. #{item.trainPrice,jdbcType=DECIMAL}, #{item.insertTime,jdbcType=TIMESTAMP},
  286. #{item.insertUsername,jdbcType=VARCHAR},
  287. #{item.updateTime,jdbcType=TIMESTAMP}, #{item.updateUsername,jdbcType=VARCHAR},
  288. #{item.insertUpdateRemark,jdbcType=VARCHAR}, #{item.deleted,jdbcType=DECIMAL} from dual
  289. </foreach> )
  290. </insert>
  291. <update id="batchUpdate" parameterType="java.util.List">
  292. update AMS_CONTRACT_TRAIN_PRICE
  293. set
  294. PRICE_ID=
  295. <foreach collection="list" item="item" index="index" separator=" " open="case PRICE_ID" close="end">
  296. when #{item.priceId,jdbcType=DECIMAL} then #{item.priceId,jdbcType=DECIMAL}
  297. </foreach>
  298. ,TRAIN_TYPE=
  299. <foreach collection="list" item="item" index="index" separator=" " open="case PRICE_ID" close="end">
  300. when #{item.priceId,jdbcType=DECIMAL} then #{item.trainType,jdbcType=VARCHAR}
  301. </foreach>
  302. ,TRAIN_PRICE_DATE=
  303. <foreach collection="list" item="item" index="index" separator=" " open="case PRICE_ID" close="end">
  304. when #{item.priceId,jdbcType=DECIMAL} then #{item.trainPriceDate,jdbcType=TIMESTAMP}
  305. </foreach>
  306. ,TRAIN_PRICE=
  307. <foreach collection="list" item="item" index="index" separator=" " open="case PRICE_ID" close="end">
  308. when #{item.priceId,jdbcType=DECIMAL} then #{item.trainPrice,jdbcType=DECIMAL}
  309. </foreach>
  310. ,INSERT_TIME=
  311. <foreach collection="list" item="item" index="index" separator=" " open="case PRICE_ID" close="end">
  312. when #{item.priceId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
  313. </foreach>
  314. ,INSERT_USERNAME=
  315. <foreach collection="list" item="item" index="index" separator=" " open="case PRICE_ID" close="end">
  316. when #{item.priceId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
  317. </foreach>
  318. ,UPDATE_TIME=
  319. <foreach collection="list" item="item" index="index" separator=" " open="case PRICE_ID" close="end">
  320. when #{item.priceId,jdbcType=DECIMAL} then #{item.updateTime,jdbcType=TIMESTAMP}
  321. </foreach>
  322. ,UPDATE_USERNAME=
  323. <foreach collection="list" item="item" index="index" separator=" " open="case PRICE_ID" close="end">
  324. when #{item.priceId,jdbcType=DECIMAL} then #{item.updateUsername,jdbcType=VARCHAR}
  325. </foreach>
  326. ,INSERT_UPDATE_REMARK=
  327. <foreach collection="list" item="item" index="index" separator=" " open="case PRICE_ID" close="end">
  328. when #{item.priceId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
  329. </foreach>
  330. ,DELETED=
  331. <foreach collection="list" item="item" index="index" separator=" " open="case PRICE_ID" close="end">
  332. when #{item.priceId,jdbcType=DECIMAL} then #{item.deleted,jdbcType=DECIMAL}
  333. </foreach>
  334. where PRICE_ID in
  335. <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
  336. #{item.priceId,jdbcType=DECIMAL}
  337. </foreach>
  338. </update>
  339. <delete id="batchDelete" parameterType="java.util.List">
  340. delete from AMS_CONTRACT_TRAIN_PRICE
  341. where PRICE_ID in
  342. <foreach collection="list" item="id" open="(" close=")" separator=",">
  343. #{id}
  344. </foreach>
  345. </delete>
  346. <!-- 友情提示!!!-->
  347. <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
  348. <select id="selectMaxId" resultType="DECIMAL">
  349. SELECT MAX(PRICE_ID) + 1
  350. FROM AMS_CONTRACT_TRAIN_PRICE
  351. </select>
  352. <sql id="orderByInsertTime">
  353. <if test="orderField != null and orderField != ''">
  354. order by "${orderField}"
  355. <if test="orderType != null and orderType != ''">
  356. ${orderType}
  357. </if>
  358. </if>
  359. <if test="orderField == null ">
  360. order by "insertTime" desc
  361. </if>
  362. </sql>
  363. <!-- 展示所有火运价格 -->
  364. <select id="getTrainPriceList" resultType="java.util.Map" parameterType="java.util.Map">
  365. SELECT * FROM(
  366. SELECT
  367. INSERT_TIME as "insertTime",
  368. TRAIN_PRICE as "trainPrice",
  369. PRICE_ID as "priceId",
  370. TRAIN_PRICE_DATE as "trainPriceDate",
  371. TRAIN_TYPE as "trainType"
  372. FROM AMS_CONTRACT_TRAIN_PRICE
  373. WHERE DELETED = 0
  374. )
  375. <where>
  376. <if test="trainPrice!= null">
  377. and
  378. <foreach collection="trainPrice" item="item" open="(" separator="," close=")">
  379. "trainPrice" in #{item}
  380. </foreach>
  381. </if>
  382. <if test="trainPriceDate!= null">
  383. and
  384. <foreach collection="trainPriceDate" item="item" open="(" separator="," close=")">
  385. "trainPriceDate" in to_date('${item}','yyyy-mm-dd hh24:mi:ss')
  386. </foreach>
  387. </if>
  388. <if test="trainType!= null">
  389. and
  390. <foreach collection="trainType" item="item" open="(" separator="," close=")">
  391. "trainType" in #{item}
  392. </foreach>
  393. </if>
  394. </where>
  395. <include refid="orderByInsertTime"></include>
  396. </select>
  397. <!-- 修改渲染 -->
  398. <select id="selectTrainPriceToUpdate" parameterType="DECIMAL" resultType="java.util.Map">
  399. SELECT TRAIN_PRICE as "trainPrice",
  400. TRAIN_PRICE_DATE as "trainPriceDate",
  401. TRAIN_TYPE as "trainType"
  402. FROM AMS_CONTRACT_TRAIN_PRICE
  403. WHERE PRICE_ID = #{priceId}
  404. </select>
  405. </mapper>