RmsOilPriceMapper.xml 15 KB

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