<?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.ruoyi.ccdi.project.mapper.CcdiBankTagRuleMapper">

    <resultMap id="CcdiBankTagRuleResultMap" type="com.ruoyi.ccdi.project.domain.entity.CcdiBankTagRule">
        <id property="id" column="id"/>
        <result property="modelCode" column="model_code"/>
        <result property="modelName" column="model_name"/>
        <result property="ruleCode" column="rule_code"/>
        <result property="ruleName" column="rule_name"/>
        <result property="indicatorCode" column="indicator_code"/>
        <result property="resultType" column="result_type"/>
        <result property="riskLevel" column="risk_level"/>
        <result property="businessCaliber" column="business_caliber"/>
        <result property="enabled" column="enabled"/>
        <result property="sortOrder" column="sort_order"/>
        <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>

    <select id="selectEnabledRules" resultMap="CcdiBankTagRuleResultMap">
        select id, model_code, model_name, rule_code, rule_name, indicator_code, result_type,
               risk_level, business_caliber, enabled, sort_order, create_by, create_time,
               update_by, update_time, remark
        from ccdi_bank_tag_rule
        where enabled = 1
        <if test="modelCode != null and modelCode != ''">
            and model_code = #{modelCode}
        </if>
        order by sort_order asc, id asc
    </select>

</mapper>
