123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- <?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.yijia.station.mapper.StationOilPriceMapper">
- <resultMap type="StationOilPrice" id="StationOilPriceResult">
- <result property="oilPriceId" column="oil_price_id" />
- <result property="oilName" column="oil_name" />
- <result property="oilPrice" column="oil_price" />
- <result property="stationId" column="station_id" />
- <result property="stationName" column="station_name" />
- <result property="oilType" column="oil_type" />
- <result property="date" column="date" />
- </resultMap>
- <select id="selectStationOilPriceList" parameterType="StationOilPrice" resultMap="StationOilPriceResult">
- select oil_price_id, oil_name, oil_price, station_id, d.dept_name as station_name, date
- from station_oil_price p join sys_dept d
- on p.station_id = d.dept_id
- <where>
- <if test="oilName != null and oilName != ''"> and p.oil_name like concat('%', #{oilName}, '%')</if>
- <if test="oilPrice != null and oilPrice != ''"> and p.oil_price = #{oilPrice}</if>
- <if test="stationId != null "> and p.station_id = #{stationId}</if>
- <if test="stationIdList != null ">
- and p.station_id in
- <foreach item="item" index="index" collection="stationIdList"
- open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </where>
- </select>
- <select id="oilNameInfo" parameterType="StationOilPrice" resultMap="StationOilPriceResult">
- select oil_price_id, oil_name, oil_price, station_id, d.dept_name as station_name, date
- from station_oil_price p join sys_dept d
- on p.station_id = d.dept_id
- <where>
- <if test="oilName != null and oilName != ''"> and p.oil_name like concat('%', #{oilName}, '%')</if>
- <if test="oilPrice != null and oilPrice != ''"> and p.oil_price = #{oilPrice}</if>
- <if test="stationId != null "> and p.station_id = #{stationId}</if>
- <if test="stationIdList != null ">
- and p.station_id in
- <foreach item="item" index="index" collection="stationIdList"
- open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- and oil_name!="非油品"
- </where>
- </select>
- <select id="selectOilPriceList" parameterType="StationOilPrice" resultMap="StationOilPriceResult">
- -- select oil_price_id, oil_name, oil_price, station_id, d.dept_name as station_name, s.dict_value as oil_type
- -- from station_oil_price p
- -- join sys_dept d on p.station_id = d.dept_id
- -- join sys_dict_data s on s.dict_label = p.oil_name and s.dict_type = "oil_name"
- select DISTINCT oil_name,s.dict_value as oil_type
- from station_oil_price p
- join sys_dept d on p.station_id = d.dept_id
- join sys_dict_data s on s.dict_label = p.oil_name and s.dict_type = "oil_name"
- <where>
- <if test="oilName != null and oilName != ''"> and p.oil_name like concat('%', #{oilName}, '%')</if>
- <if test="oilPrice != null and oilPrice != ''"> and p.oil_price = #{oilPrice}</if>
- <if test="stationId != null "> and p.station_id = #{stationId}</if>
- <if test="stationIdList != null ">
- and p.station_id in
- <foreach item="item" index="index" collection="stationIdList"
- open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </where>
- </select>
- <select id="selectStationOilPriceById" parameterType="Long" resultMap="StationOilPriceResult">
- select oil_price_id, oil_name, oil_price, station_id, d.dept_name as station_name, date
- from station_oil_price p join sys_dept d
- on p.station_id = d.dept_id
- where p.oil_price_id = #{oilPriceId}
- </select>
- <insert id="insertStationOilPrice" parameterType="StationOilPrice" useGeneratedKeys="true" keyProperty="oilPriceId">
- insert into station_oil_price
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="oilName != null">oil_name,</if>
- <if test="oilPrice != null">oil_price,</if>
- <if test="stationId != null">station_id,</if>
- <if test="date != null">date,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="oilName != null">#{oilName},</if>
- <if test="oilPrice != null">#{oilPrice},</if>
- <if test="stationId != null">#{stationId},</if>
- <if test="date != null">#{date},</if>
- </trim>
- </insert>
- <update id="updateStationOilPrice" parameterType="StationOilPrice">
- update station_oil_price
- <trim prefix="SET" suffixOverrides=",">
- <if test="oilName != null">oil_name = #{oilName},</if>
- <if test="oilPrice != null">oil_price = #{oilPrice},</if>
- <if test="stationId != null">station_id = #{stationId},</if>
- <if test="date != null">date = #{date},</if>
- </trim>
- where oil_price_id = #{oilPriceId}
- </update>
- <delete id="deleteStationOilPriceById" parameterType="Long">
- delete from station_oil_price where oil_price_id = #{oilPriceId}
- </delete>
- <delete id="deleteStationOilPriceByIds" parameterType="String">
- delete from station_oil_price where oil_price_id in
- <foreach item="oilPriceId" collection="array" open="(" separator="," close=")">
- #{oilPriceId}
- </foreach>
- </delete>
- </mapper>
|