<?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.willalp.yiqing.mapper.HsYiqingRuleMapper">

    <resultMap type="com.willalp.yiqing.domain.HsYiqingRule" id="HsYiqingRuleResult">
        <result property="ruleId" column="rule_id"/>
        <result property="ruleNo" column="rule_no"/>
        <result property="ruleName" column="rule_name"/>
        <result property="ruleOne" column="rule_one"/>
        <result property="ruleTow" column="rule_tow"/>
        <result property="pushTime" column="push_time"/>
        <result property="isDelete" column="is_delete"/>
        <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="remark" column="remark"/>
    </resultMap>

    <sql id="selectHsYiqingRuleVo">
        select rule_id, rule_no, rule_name, rule_one, rule_tow, push_time, is_delete, create_by, create_time, update_by, update_time, remark        from hs_yiqing_rule
    </sql>

    <select id="selectHsYiqingRuleList" parameterType="HsYiqingRule" resultMap="HsYiqingRuleResult">
        <include refid="selectHsYiqingRuleVo"/>
        <where>
            is_delete = 0
            <if test="ruleNo != null  and ruleNo != ''">
                and rule_no = #{ruleNo}
            </if>
            <if test="ruleName != null  and ruleName != ''">
                and rule_name like concat('%', #{ruleName}, '%')
            </if>
            <if test="ruleOne != null ">
                and rule_one = #{ruleOne}
            </if>
            <if test="ruleTow != null ">
                and rule_tow = #{ruleTow}
            </if>
            <if test="pushTime != null ">
                and push_time = #{pushTime}
            </if>
            <if test="isDelete != null ">
                and is_delete = #{isDelete}
            </if>
        </where>
    </select>
</mapper>
