123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198 |
- <?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.integral.mapper.IntegralRuleMapper">
- <resultMap type="IntegralRule" id="IntegralRuleResult">
- <result property="id" column="id" />
- <result property="stationId" column="station_id" />
- <result property="stationName" column="station_name" />
- <result property="ruleType" column="rule_type" />
- <result property="termDateManage" column="term_date_manage" />
- <result property="emptyDate" column="empty_date" />
- <result property="integralActivity" column="integral_activity" />
- <result property="datePicker" column="date_picker" />
- <result property="integralProportion" column="integral_proportion" />
- <result property="datePickerTime" column="date_picker_time" />
- <result property="integralTermSetting" column="integral_term_setting" />
- <result property="integralEmptyTime" column="integral_empty_time" />
- <result property="ruleTerms" column="rule_terms" />
- <result property="grade" column="grade" />
- <result property="gradeName" column="grade_name" />
- <result property="oilName" column="oil_name" />
- <result property="saleAmt" column="sale_amt" />
- <result property="integral" column="integral" />
- <result property="oilType" column="oil_type" />
- <result property="integralFlag" column="integral_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" />
- <result property="integralFlag" column="integral_flag" />
- <result property="image1" column="image1" />
- <result property="image2" column="image2" />
- <result property="image3" column="image3" />
- <result property="image4" column="image4" />
- <result property="image5" column="image5" />
- </resultMap>
- <sql id="selectIntegralRuleVo">
- select id, station_id,d.dept_name as station_name, term_date_manage, empty_date, integral_activity,
- date_picker, integral_proportion,date_picker_time,integral_term_setting,r.create_by,r.create_time,
- r.update_by,r.update_time,d.integral_flag,r.image1,r.image2,r.image3,r.image4,r.image5,r.integral_empty_time
- from integral_rule r join sys_dept d on r.station_id =d.dept_id
- </sql>
- <select id="selectIntegralRuleList" parameterType="IntegralRule" resultMap="IntegralRuleResult">
- <include refid="selectIntegralRuleVo"/>
- <where>
- <if test="stationId != null "> and station_id = #{stationId}</if>
- <if test="stationName != null and stationName != ''"> and d.dept_name like concat('%', #{stationName}, '%')</if>
- <if test="termDateManage != null and termDateManage != ''"> and term_date_manage = #{termDateManage}</if>
- <if test="emptyDate != null "> and empty_date = #{emptyDate}</if>
- <if test="integralActivity != null and integralActivity != ''"> and integral_activity = #{integralActivity}</if>
- <if test="datePicker != null"> and date_picker = #{datePicker}</if>
- <if test="integralProportion != null "> and integral_proportion = #{integralProportion}</if>
- <if test="datePickerTime != null "> and date_picker_time = #{datePickerTime}</if>
- <if test="integralTermSetting != null and integralTermSetting != ''"> and integral_term_setting = #{integralTermSetting}</if>
- <if test="stationIdList != null ">
- and station_id in
- <foreach item="item" index="index" collection="stationIdList"
- open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </where>
- order by id desc
- </select>
- <select id="selectIntegralRuleById" parameterType="Long" resultMap="IntegralRuleResult">
- <include refid="selectIntegralRuleVo"/>
- where id = #{id}
- </select>
- <insert id="insertIntegralRule" parameterType="IntegralRule" useGeneratedKeys="true" keyProperty="id">
- insert into integral_rule
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="stationId != null">station_id,</if>
- <if test="termDateManage != null">term_date_manage,</if>
- <if test="emptyDate != null">empty_date,</if>
- <if test="integralActivity != null">integral_activity,</if>
- <if test="datePicker != null">date_picker,</if>
- <if test="integralProportion != null">integral_proportion,</if>
- <if test="datePickerTime != null">date_picker_time,</if>
- <if test="integralTermSetting != null">integral_term_setting,</if>
- <if test="integralEmptyTime != null">integral_empty_time,</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>
- <if test="image1 != null">image1,</if>
- <if test="image2 != null">image2,</if>
- <if test="image3 != null">image3,</if>
- <if test="image4 != null">image4,</if>
- <if test="image5 != null">image5,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="stationId != null">#{stationId},</if>
- <if test="termDateManage != null">#{termDateManage},</if>
- <if test="emptyDate != null">#{emptyDate},</if>
- <if test="integralActivity != null">#{integralActivity},</if>
- <if test="datePicker != null">#{datePicker},</if>
- <if test="integralProportion != null">#{integralProportion},</if>
- <if test="datePickerTime != null">#{datePickerTime},</if>
- <if test="integralTermSetting != null">#{integralTermSetting},</if>
- <if test="integralEmptyTime != null">#{integralEmptyTime},</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>
- <if test="image1 != null">#{image1},</if>
- <if test="image2 != null">#{image2},</if>
- <if test="image3 != null">#{image3},</if>
- <if test="image4 != null">#{image4},</if>
- <if test="image5 != null">#{image5},</if>
- </trim>
- </insert>
- <update id="updateIntegralRule" parameterType="IntegralRule">
- update integral_rule
- <trim prefix="SET" suffixOverrides=",">
- <if test="stationId != null">station_id = #{stationId},</if>
- <if test="termDateManage != null">term_date_manage = #{termDateManage},</if>
- <if test="emptyDate != null">empty_date = #{emptyDate},</if>
- <if test="integralActivity != null">integral_activity = #{integralActivity},</if>
- <if test="datePicker != null">date_picker = #{datePicker},</if>
- <if test="integralProportion != null">integral_proportion = #{integralProportion},</if>
- <if test="datePickerTime != null "> date_picker_time = #{datePickerTime},</if>
- <if test="integralTermSetting != null "> integral_term_setting = #{integralTermSetting},</if>
- <if test="integralEmptyTime != null"> integral_empty_time=#{integralEmptyTime},</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>
- <if test="image1 != null">image1=#{image1},</if>
- <if test="image2 != null">image2=#{image2},</if>
- <if test="image3 != null">image3=#{image3},</if>
- <if test="image4 != null">image4=#{image4},</if>
- <if test="image5 != null">image5=#{image5},</if>
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteIntegralRuleById" parameterType="Long">
- delete from integral_rule where id = #{id}
- </delete>
- <delete id="deleteIntegralRuleByIds" parameterType="String">
- delete from integral_rule where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- <select id="selectIntegralRule" parameterType="IntegralRule" resultMap="IntegralRuleResult">
- <include refid="selectIntegralRuleVo"/>
- <where>
- <if test="stationId != null "> and station_id = #{stationId}</if>
- <if test="stationName != null and stationName != ''"> and dept_name like concat('%', #{stationName}, '%')</if>
- <if test="termDateManage != null and termDateManage != ''"> and term_date_manage = #{termDateManage}</if>
- <if test="emptyDate != null "> and empty_date = #{emptyDate}</if>
- <if test="integralActivity != null and integralActivity != ''"> and integral_activity = #{integralActivity}</if>
- <if test="datePicker != null and datePicker != ''"> and date_picker = #{datePicker}</if>
- <if test="integralProportion != null and integralProportion != ''"> and integral_proportion = #{integralProportion}</if>
- <if test="datePickerTime != null and datePickerTime != ''"> and date_picker_time = #{datePickerTime}</if>
- <if test="integralTermSetting != null and integralTermSetting != ''"> and integral_term_setting = #{integralTermSetting}</if>
- <if test="integralEmptyTime != null and integralEmptyTime != ''"> and integral_empty_time = #{integralEmptyTime}</if>
- <if test="stationIdList != null ">
- and station_id in
- <foreach item="item" index="index" collection="stationIdList"
- open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </where>
- order by id desc limit 1
- </select>
- <select id="listRuleInfo" parameterType="IntegralRule" resultMap="IntegralRuleResult">
- SELECT a.station_id,d.dept_name as station_name,a.term_date_manage,a.integral_activity,empty_date,date_picker,integral_proportion,s.grade as grade_name,
- b.rule_type,rule_terms,b.grade,b.oil_name,b.sale_amt,b.integral,b.oil_type,d.integral_flag,a.integral_empty_time
- from integral_rule a
- join integral_rule_detail b on a.id =b.parent_id
- join sys_dept d on a.station_id =d.dept_id
- left join customer_grade_setting s on s.id = b.grade
- <where>
- <if test="stationId != null "> and a.station_id = #{stationId}</if>
- <if test="stationName != null and stationName != ''"> and d.dept_name like concat('%', #{stationName}, '%')</if>
- <if test="stationIdList != null ">
- and a.station_id in
- <foreach item="item" index="index" collection="stationIdList"
- open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </where>
- order by b.oil_name desc
- </select>
- </mapper>
|