123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- <?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.label.mapper.LabelRuleDetailMapper">
-
- <resultMap type="LabelRuleDetail" id="LabelRuleDetailResult">
- <result property="id" column="id" />
- <result property="parentId" column="parent_id" />
- <result property="oilName" column="oil_name" />
- <result property="discountTerm" column="discount_term" />
- <result property="discountLitersAmt" column="discount_liters_amt" />
- <result property="discountAmt" column="discount_amt" />
- <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="delFlag" column="del_flag" />
- </resultMap>
- <sql id="selectLabelRuleDetailVo">
- select id, parent_id, oil_name, discount_term, discount_liters_amt, discount_amt, create_by, create_time, update_by, update_time, del_flag
- from label_rule_detail
- </sql>
- <select id="selectLabelRuleDetailList" parameterType="LabelRuleDetail" resultMap="LabelRuleDetailResult">
- <include refid="selectLabelRuleDetailVo"/>
- <where>
- <if test="parentId != null "> and parent_id = #{parentId}</if>
- <if test="oilName != null and oilName != ''"> and oil_name like concat('%', #{oilName}, '%')</if>
- <if test="discountTerm != null and discountTerm != ''"> and discount_term = #{discountTerm}</if>
- <if test="discountLitersAmt != null and discountLitersAmt != ''"> and discount_liters_amt = #{discountLitersAmt}</if>
- <if test="discountAmt != null and discountAmt != ''"> and discount_amt = #{discountAmt}</if>
- <if test="delFlag != null and delFlag != ''"> and del_flag = #{delFlag}</if>
- </where>
- </select>
- <select id="labelRuleDetailList" parameterType="LabelRuleDetail" resultMap="LabelRuleDetailResult">
- select d.*,dept_name as station_name,r.station_id from label_rule r join label_rule_detail d on r.id=d.parent_id
- join sys_dept p on r.station_id = p.dept_id
- <where>
- <if test="parentId != null "> and parent_id = #{parentId}</if>
- <if test="oilName != null and oilName != ''"> and oil_name like concat('%', #{oilName}, '%')</if>
- <if test="discountTerm != null and discountTerm != ''"> and discount_term = #{discountTerm}</if>
- <if test="discountLitersAmt != null and discountLitersAmt != ''"> and discount_liters_amt = #{discountLitersAmt}</if>
- <if test="discountAmt != null and discountAmt != ''"> and discount_amt = #{discountAmt}</if>
- </where>
- </select>
-
- <select id="selectLabelRuleDetailById" parameterType="Integer" resultMap="LabelRuleDetailResult">
- <include refid="selectLabelRuleDetailVo"/>
- where id = #{id}
- </select>
-
- <insert id="insertLabelRuleDetail" parameterType="LabelRuleDetail" useGeneratedKeys="true" keyProperty="id">
- insert into label_rule_detail
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="parentId != null">parent_id,</if>
- <if test="oilName != null">oil_name,</if>
- <if test="discountTerm != null">discount_term,</if>
- <if test="discountLitersAmt != null">discount_liters_amt,</if>
- <if test="discountAmt != null">discount_amt,</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="delFlag != null">del_flag,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="parentId != null">#{parentId},</if>
- <if test="oilName != null">#{oilName},</if>
- <if test="discountTerm != null">#{discountTerm},</if>
- <if test="discountLitersAmt != null">#{discountLitersAmt},</if>
- <if test="discountAmt != null">#{discountAmt},</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="delFlag != null">#{delFlag},</if>
- </trim>
- </insert>
- <update id="updateLabelRuleDetail" parameterType="LabelRuleDetail">
- update label_rule_detail
- <trim prefix="SET" suffixOverrides=",">
- <if test="parentId != null">parent_id = #{parentId},</if>
- <if test="oilName != null">oil_name = #{oilName},</if>
- <if test="discountTerm != null">discount_term = #{discountTerm},</if>
- <if test="discountLitersAmt != null">discount_liters_amt = #{discountLitersAmt},</if>
- <if test="discountAmt != null">discount_amt = #{discountAmt},</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="delFlag != null">del_flag = #{delFlag},</if>
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteLabelRuleDetailById" parameterType="Integer">
- delete from label_rule_detail where id = #{id}
- </delete>
- <delete id="deleteLabelRuleDetailByIds" parameterType="String">
- delete from label_rule_detail where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
-
- </mapper>
|