123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.steerinfo.dil.mapper.RmsOilPriceMapper">
- <resultMap id="BaseResultMap" type="com.steerinfo.dil.model.RmsOilPrice">
- <id column="PRICE_ID" jdbcType="DECIMAL" property="priceId" />
- <result column="PRICE_OIL_NAME" jdbcType="VARCHAR" property="priceOilName" />
- <result column="PRICE_VALUE" jdbcType="DECIMAL" property="priceValue" />
- <result column="PRICE_DATE" jdbcType="TIMESTAMP" property="priceDate" />
- <result column="INSERT_USERNAME" jdbcType="VARCHAR" property="insertUsername" />
- <result column="INSERT_TIME" jdbcType="TIMESTAMP" property="insertTime" />
- <result column="UPDATE_USERNAME" jdbcType="VARCHAR" property="updateUsername" />
- <result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime" />
- <result column="INSERT_UPDATE_REMARK" jdbcType="VARCHAR" property="insertUpdateRemark" />
- <result column="DELETED" jdbcType="DECIMAL" property="deleted" />
- <result column="PRICE_STATUS" jdbcType="DECIMAL" property="priceStatus" />
- <result column="FLOATING_SCALE" jdbcType="DECIMAL" property="floatingScale" />
- </resultMap>
- <sql id="columns">
- PRICE_ID, PRICE_OIL_NAME, PRICE_VALUE, PRICE_DATE, INSERT_USERNAME, INSERT_TIME,
- UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK, DELETED, PRICE_STATUS, FLOATING_SCALE
- </sql>
- <sql id="columns_alias">
- t.PRICE_ID, t.PRICE_OIL_NAME, t.PRICE_VALUE, t.PRICE_DATE, t.INSERT_USERNAME, t.INSERT_TIME,
- t.UPDATE_USERNAME, t.UPDATE_TIME, t.INSERT_UPDATE_REMARK, t.DELETED, t.PRICE_STATUS,
- t.FLOATING_SCALE
- </sql>
- <sql id="select">
- SELECT <include refid="columns" /> FROM RMS_OIL_PRICE
- </sql>
- <sql id="select_alias">
- SELECT <include refid="columns_alias" /> FROM RMS_OIL_PRICE t
- </sql>
- <sql id="where">
- <where>
- <if test="priceId != null">
- and PRICE_ID = #{priceId}
- </if>
- <if test="priceOilName != null and priceOilName != ''">
- and PRICE_OIL_NAME = #{priceOilName}
- </if>
- <if test="priceValue != null">
- and PRICE_VALUE = #{priceValue}
- </if>
- <if test="priceDate != null">
- and TO_CHAR(PRICE_DATE,'yyyy-MM-dd') = #{priceDate}
- </if>
- <if test="insertUsername != null and insertUsername != ''">
- and INSERT_USERNAME = #{insertUsername}
- </if>
- <if test="insertTime != null">
- and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
- </if>
- <if test="updateUsername != null and updateUsername != ''">
- and UPDATE_USERNAME = #{updateUsername}
- </if>
- <if test="updateTime != null">
- and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
- </if>
- <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
- and INSERT_UPDATE_REMARK = #{insertUpdateRemark}
- </if>
- <if test="deleted != null">
- and DELETED = #{deleted}
- </if>
- <if test="priceStatus != null">
- and PRICE_STATUS = #{priceStatus}
- </if>
- <if test="floatingScale != null">
- and FLOATING_SCALE = #{floatingScale}
- </if>
- </where>
- </sql>
- <sql id="whereLike">
- <where>
- <if test="priceId != null">
- and PRICE_ID = #{priceId}
- </if>
- <if test="priceOilName != null and priceOilName != ''">
- and PRICE_OIL_NAME LIKE '%${priceOilName}%'
- </if>
- <if test="priceValue != null">
- and PRICE_VALUE = #{priceValue}
- </if>
- <if test="priceDate != null">
- and TO_CHAR(PRICE_DATE,'yyyy-MM-dd') = #{priceDate}
- </if>
- <if test="insertUsername != null and insertUsername != ''">
- and INSERT_USERNAME LIKE '%${insertUsername}%'
- </if>
- <if test="insertTime != null">
- and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
- </if>
- <if test="updateUsername != null and updateUsername != ''">
- and UPDATE_USERNAME LIKE '%${updateUsername}%'
- </if>
- <if test="updateTime != null">
- and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
- </if>
- <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
- and INSERT_UPDATE_REMARK LIKE '%${insertUpdateRemark}%'
- </if>
- <if test="deleted != null">
- and DELETED = #{deleted}
- </if>
- <if test="priceStatus != null">
- and PRICE_STATUS = #{priceStatus}
- </if>
- <if test="floatingScale != null">
- and FLOATING_SCALE = #{floatingScale}
- </if>
- </where>
- </sql>
- <delete id="deleteByPrimaryKey" parameterType="java.lang.Short">
- delete from RMS_OIL_PRICE
- where PRICE_ID = #{priceId,jdbcType=DECIMAL}
- </delete>
- <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
- delete from RMS_OIL_PRICE
- where 1!=1
- <if test="priceOilName != null and priceOilName != ''">
- or PRICE_OIL_NAME = #{priceOilName}
- </if>
- <if test="priceValue != null">
- or PRICE_VALUE = #{priceValue}
- </if>
- <if test="priceDate != null">
- or TO_CHAR(PRICE_DATE,'yyyy-MM-dd') = '#{priceDate}'
- </if>
- <if test="insertUsername != null and insertUsername != ''">
- or INSERT_USERNAME = #{insertUsername}
- </if>
- <if test="insertTime != null">
- or TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = '#{insertTime}'
- </if>
- <if test="updateUsername != null and updateUsername != ''">
- or UPDATE_USERNAME = #{updateUsername}
- </if>
- <if test="updateTime != null">
- or TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = '#{updateTime}'
- </if>
- <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
- or INSERT_UPDATE_REMARK = #{insertUpdateRemark}
- </if>
- <if test="deleted != null">
- or DELETED = #{deleted}
- </if>
- <if test="priceStatus != null">
- or PRICE_STATUS = #{priceStatus}
- </if>
- <if test="floatingScale != null">
- or FLOATING_SCALE = #{floatingScale}
- </if>
- </delete>
- <insert id="insert" parameterType="com.steerinfo.dil.model.RmsOilPrice">
- insert into RMS_OIL_PRICE (PRICE_ID, PRICE_OIL_NAME, PRICE_VALUE,
- PRICE_DATE, INSERT_USERNAME, INSERT_TIME,
- UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK,
- DELETED, PRICE_STATUS, FLOATING_SCALE
- )
- values (#{priceId,jdbcType=DECIMAL}, #{priceOilName,jdbcType=VARCHAR}, #{priceValue,jdbcType=DECIMAL},
- #{priceDate,jdbcType=TIMESTAMP}, #{insertUsername,jdbcType=VARCHAR}, #{insertTime,jdbcType=TIMESTAMP},
- #{updateUsername,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{insertUpdateRemark,jdbcType=VARCHAR},
- #{deleted,jdbcType=DECIMAL}, #{priceStatus,jdbcType=DECIMAL}, #{floatingScale,jdbcType=DECIMAL}
- )
- </insert>
- <insert id="insertSelective" parameterType="com.steerinfo.dil.model.RmsOilPrice">
- insert into RMS_OIL_PRICE
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="priceId != null">
- PRICE_ID,
- </if>
- <if test="priceOilName != null">
- PRICE_OIL_NAME,
- </if>
- <if test="priceValue != null">
- PRICE_VALUE,
- </if>
- <if test="priceDate != null">
- PRICE_DATE,
- </if>
- <if test="insertUsername != null">
- INSERT_USERNAME,
- </if>
- <if test="insertTime != null">
- INSERT_TIME,
- </if>
- <if test="updateUsername != null">
- UPDATE_USERNAME,
- </if>
- <if test="updateTime != null">
- UPDATE_TIME,
- </if>
- <if test="insertUpdateRemark != null">
- INSERT_UPDATE_REMARK,
- </if>
- <if test="deleted != null">
- DELETED,
- </if>
- <if test="priceStatus != null">
- PRICE_STATUS,
- </if>
- <if test="floatingScale != null">
- FLOATING_SCALE,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="priceId != null">
- #{priceId,jdbcType=DECIMAL},
- </if>
- <if test="priceOilName != null">
- #{priceOilName,jdbcType=VARCHAR},
- </if>
- <if test="priceValue != null">
- #{priceValue,jdbcType=DECIMAL},
- </if>
- <if test="priceDate != null">
- #{priceDate,jdbcType=TIMESTAMP},
- </if>
- <if test="insertUsername != null">
- #{insertUsername,jdbcType=VARCHAR},
- </if>
- <if test="insertTime != null">
- #{insertTime,jdbcType=TIMESTAMP},
- </if>
- <if test="updateUsername != null">
- #{updateUsername,jdbcType=VARCHAR},
- </if>
- <if test="updateTime != null">
- #{updateTime,jdbcType=TIMESTAMP},
- </if>
- <if test="insertUpdateRemark != null">
- #{insertUpdateRemark,jdbcType=VARCHAR},
- </if>
- <if test="deleted != null">
- #{deleted,jdbcType=DECIMAL},
- </if>
- <if test="priceStatus != null">
- #{priceStatus,jdbcType=DECIMAL},
- </if>
- <if test="floatingScale != null">
- #{floatingScale,jdbcType=DECIMAL},
- </if>
- </trim>
- </insert>
- <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.RmsOilPrice">
- update RMS_OIL_PRICE
- set PRICE_OIL_NAME = #{priceOilName,jdbcType=VARCHAR},
- PRICE_VALUE = #{priceValue,jdbcType=DECIMAL},
- PRICE_DATE = #{priceDate,jdbcType=TIMESTAMP},
- INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
- INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
- UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
- UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
- INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
- DELETED = #{deleted,jdbcType=DECIMAL},
- PRICE_STATUS = #{priceStatus,jdbcType=DECIMAL},
- FLOATING_SCALE = #{floatingScale,jdbcType=DECIMAL}
- where PRICE_ID = #{priceId,jdbcType=DECIMAL}
- </update>
- <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.RmsOilPrice">
- update RMS_OIL_PRICE
- <set>
- <if test="priceOilName != null">
- PRICE_OIL_NAME = #{priceOilName,jdbcType=VARCHAR},
- </if>
- <if test="priceValue != null">
- PRICE_VALUE = #{priceValue,jdbcType=DECIMAL},
- </if>
- <if test="priceDate != null">
- PRICE_DATE = #{priceDate,jdbcType=TIMESTAMP},
- </if>
- <if test="insertUsername != null">
- INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
- </if>
- <if test="insertTime != null">
- INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
- </if>
- <if test="updateUsername != null">
- UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
- </if>
- <if test="updateTime != null">
- UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
- </if>
- <if test="insertUpdateRemark != null">
- INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
- </if>
- <if test="deleted != null">
- DELETED = #{deleted,jdbcType=DECIMAL},
- </if>
- <if test="priceStatus != null">
- PRICE_STATUS = #{priceStatus,jdbcType=DECIMAL},
- </if>
- <if test="floatingScale != null">
- FLOATING_SCALE = #{floatingScale,jdbcType=DECIMAL},
- </if>
- </set>
- where PRICE_ID = #{priceId,jdbcType=DECIMAL}
- </update>
- <select id="selectByPrimaryKey" parameterType="java.lang.Short" resultMap="BaseResultMap">
- <include refid="select" />
- where PRICE_ID = #{priceId,jdbcType=DECIMAL}
- </select>
- <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
- <include refid="select" />
- <include refid="where" />
- </select>
- <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
- <include refid="select" />
- <include refid="whereLike" />
- </select>
- <insert id="batchInsert" parameterType="java.util.List">
- insert into RMS_OIL_PRICE
- (PRICE_ID,
- PRICE_OIL_NAME, PRICE_VALUE, PRICE_DATE,
- INSERT_USERNAME, INSERT_TIME,
- UPDATE_USERNAME, UPDATE_TIME,
- INSERT_UPDATE_REMARK, DELETED,
- PRICE_STATUS, FLOATING_SCALE)
- ( <foreach collection="list" item="item" separator="union all">
- select
- #{item.priceId,jdbcType=DECIMAL},
- #{item.priceOilName,jdbcType=VARCHAR}, #{item.priceValue,jdbcType=DECIMAL}, #{item.priceDate,jdbcType=TIMESTAMP},
- #{item.insertUsername,jdbcType=VARCHAR}, #{item.insertTime,jdbcType=TIMESTAMP},
- #{item.updateUsername,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP},
- #{item.insertUpdateRemark,jdbcType=VARCHAR}, #{item.deleted,jdbcType=DECIMAL},
- #{item.priceStatus,jdbcType=DECIMAL}, #{item.floatingScale,jdbcType=DECIMAL} from dual
- </foreach> )
- </insert>
- <update id="batchUpdate" parameterType="java.util.List">
- update RMS_OIL_PRICE
- set
- PRICE_ID=
- <foreach close="end" collection="list" index="index" item="item" open="case PRICE_ID" separator=" ">
- when #{item.priceId,jdbcType=DECIMAL} then #{item.priceId,jdbcType=DECIMAL}
- </foreach>
- ,PRICE_OIL_NAME=
- <foreach close="end" collection="list" index="index" item="item" open="case PRICE_ID" separator=" ">
- when #{item.priceId,jdbcType=DECIMAL} then #{item.priceOilName,jdbcType=VARCHAR}
- </foreach>
- ,PRICE_VALUE=
- <foreach close="end" collection="list" index="index" item="item" open="case PRICE_ID" separator=" ">
- when #{item.priceId,jdbcType=DECIMAL} then #{item.priceValue,jdbcType=DECIMAL}
- </foreach>
- ,PRICE_DATE=
- <foreach close="end" collection="list" index="index" item="item" open="case PRICE_ID" separator=" ">
- when #{item.priceId,jdbcType=DECIMAL} then #{item.priceDate,jdbcType=TIMESTAMP}
- </foreach>
- ,INSERT_USERNAME=
- <foreach close="end" collection="list" index="index" item="item" open="case PRICE_ID" separator=" ">
- when #{item.priceId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
- </foreach>
- ,INSERT_TIME=
- <foreach close="end" collection="list" index="index" item="item" open="case PRICE_ID" separator=" ">
- when #{item.priceId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
- </foreach>
- ,UPDATE_USERNAME=
- <foreach close="end" collection="list" index="index" item="item" open="case PRICE_ID" separator=" ">
- when #{item.priceId,jdbcType=DECIMAL} then #{item.updateUsername,jdbcType=VARCHAR}
- </foreach>
- ,UPDATE_TIME=
- <foreach close="end" collection="list" index="index" item="item" open="case PRICE_ID" separator=" ">
- when #{item.priceId,jdbcType=DECIMAL} then #{item.updateTime,jdbcType=TIMESTAMP}
- </foreach>
- ,INSERT_UPDATE_REMARK=
- <foreach close="end" collection="list" index="index" item="item" open="case PRICE_ID" separator=" ">
- when #{item.priceId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
- </foreach>
- ,DELETED=
- <foreach close="end" collection="list" index="index" item="item" open="case PRICE_ID" separator=" ">
- when #{item.priceId,jdbcType=DECIMAL} then #{item.deleted,jdbcType=DECIMAL}
- </foreach>
- ,PRICE_STATUS=
- <foreach close="end" collection="list" index="index" item="item" open="case PRICE_ID" separator=" ">
- when #{item.priceId,jdbcType=DECIMAL} then #{item.priceStatus,jdbcType=DECIMAL}
- </foreach>
- ,FLOATING_SCALE=
- <foreach close="end" collection="list" index="index" item="item" open="case PRICE_ID" separator=" ">
- when #{item.priceId,jdbcType=DECIMAL} then #{item.floatingScale,jdbcType=DECIMAL}
- </foreach>
- where PRICE_ID in
- <foreach close=")" collection="list" index="index" item="item" open="(" separator=",">
- #{item.priceId,jdbcType=DECIMAL}
- </foreach>
- </update>
- <delete id="batchDelete" parameterType="java.util.List">
- delete from RMS_OIL_PRICE
- where PRICE_ID in
- <foreach close=")" collection="list" item="id" open="(" separator=",">
- #{id}
- </foreach>
- </delete>
- <!-- 友情提示!!!-->
- <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
- <!-- 油价列表 -->
- <select id="getOilPriceList" parameterType="java.util.Map" resultType="java.util.Map">
- SELECT * FROM
- (
- SELECT
- ROP.PRICE_ID AS "priceId",
- ROT.OIL_TYPE_NAME AS "priceOilName",
- ROP.PRICE_VALUE AS "priceValue",
- ROP.PRICE_DATE AS "priceDate",
- ROP.FLOATING_SCALE "floatingScale",
- (case when ROP.PRICE_STATUS = 0
- then '启用'
- when ROP.PRICE_STATUS = 1
- then '停用'
- end ) "priceStatus"
- FROM RMS_OIL_PRICE ROP
- left join RMS_OIL_TYPE ROT
- on ROP.PRICE_OIL_NAME = ROT.OIL_TYPE_ID
- WHERE ROP.DELETED = 0
- ORDER BY ROP.INSERT_TIME DESC
- )
- <where>
- <if test="priceId!= null">
- <foreach collection="priceId" item="item" open="(" separator="," close=")">
- "priceId" in #{item}
- </foreach>
- </if>
- <if test="priceOilName!= null">
- and
- <foreach collection="priceOilName" item="item" open="(" separator="," close=")">
- "priceOilName" in #{item}
- </foreach>
- </if>
- <if test="priceValue!= null">
- and
- <foreach collection="priceValue" item="item" open="(" separator="," close=")">
- "priceValue" in #{item}
- </foreach>
- </if>
- <if test="priceDate!= null">
- and
- <foreach collection="priceDate" item="item" open="(" separator="," close=")">
- "priceDate" in #{item}
- </foreach>
- </if>
- <if test="floatingScale!= null">
- and
- <foreach collection="floatingScale" item="item" open="(" separator="," close=")">
- "floatingScale" in #{item}
- </foreach>
- </if>
- <if test="priceStatus!= null">
- and
- <foreach collection="priceStatus" item="item" open="(" separator="," close=")">
- "priceStatus" in #{item}
- </foreach>
- </if>
- </where>
- <include refid="orderBy"></include>
- </select>
- <sql id="orderBy">
- <if test="orderField!=null and orderField !=''">
- order by "${orderField}"
- <if test="orderType !=null and orderType !=''">
- ${orderType}
- </if>
- </if>
- </sql>
- <!--根据Id查询油价-->
- <select id="getOilPriceById" resultType="java.util.LinkedHashMap" >
- SELECT
- ROP.PRICE_ID AS "priceId",
- ROP.PRICE_OIL_NAME AS "priceOilName",
- ROP.PRICE_VALUE AS "priceValue",
- ROP.PRICE_DATE AS "priceDate"
- FROM RMS_OIL_PRICE ROP
- WHERE ROP.PRICE_ID=#{id}
- </select>
- <!-- 通过油品ID获取上一次油品价格 -->
- <select id="getLastOilPrice" parameterType="java.math.BigDecimal" resultType="java.util.Map">
- select ROP.PRICE_VALUE "priceValue",
- ROP.PRICE_ID "priceId"
- from RMS_OIL_PRICE ROP
- where ROP.PRICE_OIL_NAME = #{oilNameId}
- and ROP.DELETED = 0
- and ROP.PRICE_STATUS = 0
- </select>
- </mapper>
|