123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 |
- <?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="ruleTerms" column="rule_terms" />
- <result property="gread" column="gread" />
- <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" />
- </resultMap>
- <sql id="selectIntegralRuleVo">
- select id, station_id, station_name, rule_type, term_date_manage, empty_date, integral_activity, date_picker, integral_proportion,date_picker_time,integral_term_setting from integral_rule
- </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 station_name like concat('%', #{stationName}, '%')</if>
- <if test="ruleType != null and ruleType != ''"> and rule_type = #{ruleType}</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="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="stationName != null">station_name,</if>
- <if test="ruleType != null">rule_type,</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>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="stationId != null">#{stationId},</if>
- <if test="stationName != null">#{stationName},</if>
- <if test="ruleType != null">#{ruleType},</if>
- <if test="termDateManage != null">#{termDateManage},</if>
- <if test="emptyDate != null">#{emptyDate},</if>
- <if test="expirationReminder != null">#{expirationReminder},</if>
- <if test="remindDate != null">#{remindDate},</if>
- <if test="integralActivity != null">#{integralActivity},</if>
- <if test="datePicker != null">#{datePicker},</if>
- <if test="integralProportion != null">#{integralProportion},</if>
- <if test="integralDeductionOil != null">#{integralDeductionOil},</if>
- <if test="datePickerTime != null">#{datePickerTime},</if>
- <if test="integralEmptyTime != null">#{integralEmptyTime},</if>
- <if test="integralTermSetting != null">#{integralTermSetting},</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="stationName != null">station_name = #{stationName},</if>
- <if test="ruleType != null">rule_type = #{ruleType},</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>
- </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 station_name like concat('%', #{stationName}, '%')</if>
- <if test="ruleType != null and ruleType != ''"> and rule_type = #{ruleType}</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="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,a.station_name,a.term_date_manage,a.integral_activity,empty_date,date_picker,integral_proportion,b.rule_type,rule_terms,gread,oil_name,sale_amt,integral,oil_type,c.integral_flag
- from integral_rule a
- join integral_rule_detail b on a.id =b.parent_id
- join station_pay c on a.station_id =c.station_id
- <where>
- <if test="stationId != null "> and a.station_id = #{stationId}</if>
- <if test="stationName != null and stationName != ''"> and a.station_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>
- </select>
- </mapper>
|