123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- <?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.customer.mapper.CustomerGradeSettingMapper">
- <resultMap type="CustomerGradeSetting" id="CustomerGradeSettingResult">
- <result property="id" column="id" />
- <result property="grade" column="grade" />
- <result property="oilName" column="oil_name" />
- <result property="memberConditStart" column="member_condit_start" />
- <result property="memberConditEnd" column="member_condit_end" />
- <result property="discountAmt" column="discount_amt"/>
- <result property="stationId" column="station_id"/>
- <result property="delFlag" column="del_flag"/>
- <result property="createBy" column="create_by" />
- <result property="createTime" column="create_time" />
- <result property="updateBy" column="update_by" />
- <result property="updateTime" column="update_time" />
- </resultMap>
- <sql id="selectCustomerGradeSettingVo">
- select s.id, s.grade, s.discount_amt, s.station_id, s.oil_name, s.member_condit_start, s.member_condit_end,s.create_by,
- s.create_time,s.update_by,s.update_time,s.del_flag,d.dept_name as station_name
- from customer_grade_setting s join sys_dept d on d.dept_id =s.station_id
- </sql>
- <select id="selectCustomerGradeSettingList" parameterType="CustomerGradeSetting" resultMap="CustomerGradeSettingResult">
- select s.id, s.grade, s.discount_amt, s.station_id, s.oil_name, s.member_condit_start, s.member_condit_end,s.create_by,
- s.create_time,s.update_by,s.update_time,s.del_flag,d.dept_name as station_name
- from customer_grade_setting s join sys_dept d on d.dept_id =s.station_id
- <where>
- <if test="grade != null and grade != ''"> and s.grade = #{grade}</if>
- <if test="discountAmt != null and discountAmt != ''"> and s.discount_amt = #{discountAmt}</if>
- <if test="stationId != null "> and s.station_id = #{stationId}</if>
- <if test="oilName != null and oilName != ''"> and s.oil_name like concat('%', #{oilName}, '%')</if>
- <if test="memberConditStart != null "> and s.member_condit_start = #{memberConditStart}</if>
- <if test="memberConditEnd != null "> and s.member_condit_end = #{memberConditEnd}</if>
- <if test="delFlag != null "> and s.del_flag = #{delFlag}</if>
- <if test="stationIdList != null ">
- and s.station_id in
- <foreach item="item" index="index" collection="stationIdList"
- open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </where>
- order by id desc
- </select>
- <select id="selectCustomerGradeSettingById" parameterType="Long" resultMap="CustomerGradeSettingResult">
- select s.id, s.grade, s.discount_amt, s.station_id, s.oil_name, s.member_condit_start, s.member_condit_end,s.create_by,
- s.create_time,s.update_by,s.update_time,s.del_Flag,d.dept_name as station_name
- from customer_grade_setting s join sys_dept d on d.dept_id =s.station_id
- where id = #{id}
- </select>
- <insert id="insertCustomerGradeSetting" parameterType="CustomerGradeSetting" useGeneratedKeys="true" keyProperty="id">
- insert into customer_grade_setting
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="grade != null">grade,</if>
- <if test="discountAmt != null">discount_amt,</if>
- <if test="stationId != null">station_id,</if>
- <if test="oilName != null">oil_name,</if>
- <if test="memberConditStart != null">member_condit_start,</if>
- <if test="memberConditEnd != null">member_condit_end,</if>
- <if test="delFlag != null">del_flag,</if>
- <if test="createBy != null">create_by,</if>
- <if test="createTime != null">create_time,</if>
- <if test="updateBy != null">update_by,</if>
- <if test="updateTime != null">update_time,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="grade != null">#{grade},</if>
- <if test="discountAmt != null">#{discountAmt},</if>
- <if test="stationId != null">#{stationId},</if>
- <if test="oilName != null">#{oilName},</if>
- <if test="memberConditStart != null">#{memberConditStart},</if>
- <if test="memberConditEnd != null">#{memberConditEnd},</if>
- <if test="delFlag != null">#{delFlag},</if>
- <if test="createBy != null">#{createBy},</if>
- <if test="createTime != null">#{createTime},</if>
- <if test="updateBy != null">#{updateBy},</if>
- <if test="updateTime != null">#{updateTime},</if>
- </trim>
- </insert>
- <update id="updateCustomerGradeSetting" parameterType="CustomerGradeSetting">
- update customer_grade_setting
- <trim prefix="SET" suffixOverrides=",">
- <if test="grade != null">grade = #{grade},</if>
- <if test="oilName != null">oil_name = #{oilName},</if>
- <if test="memberConditStart != null">member_condit_start = #{memberConditStart},</if>
- <if test="memberConditEnd != null">member_condit_end = #{memberConditEnd},</if>
- <if test="discountAmt != null">discount_amt = #{discountAmt},</if>
- <if test="stationId != null">station_id = #{stationId},</if>
- <if test="delFlag != null">del_flag=#{delFlag},</if>
- <if test="createBy != null">create_by = #{createBy},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- <if test="updateBy != null">update_by = #{updateBy},</if>
- <if test="updateTime != null">update_time = #{updateTime},</if>
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteCustomerGradeSettingById" parameterType="Long">
- delete from customer_grade_setting where id = #{id}
- </delete>
- <delete id="deleteCustomerGradeSettingByIds" parameterType="String">
- delete from customer_grade_setting where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- </mapper>
|