fuliqi
2024-04-19 0c1f76c4a9c34a2adb05a94da4b20f3560374a29
ycl-server/src/main/resources/mapper/zgyw/CheckRuleMapper.xml
@@ -9,61 +9,59 @@
        <result property="ruleName"    column="rule_name"    />
        <result property="ruleIndex"    column="rule_index"    />
        <result property="ruleCategory"    column="rule_category"    />
        <result property="examineCategory"    column="examine_category"    />
        <result property="ruleCondition"    column="rule_condition"    />
        <result property="ruleDescription"    column="rule_description"    />
        <result property="state"    column="state"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
        <result property="state"    column="state"    />
        <result property="deleted"    column="deleted"    />
    </resultMap>
    <sql id="selectCheckRuleVo">
        select id, rule_name, rule_index, rule_category, examine_category, rule_description, state, create_time, update_time, deleted from t_check_rule
        select id, rule_name, rule_index, rule_category, rule_condition, rule_description, rule_object,
               update_time,  state, deleted
        from t_check_rule
    </sql>
    <select id="selectCheckRuleList" resultType="com.ycl.platform.domain.vo.CheckRuleVO">
        select tcr.id, tcr.rule_name, tcr.rule_index, tcr.rule_category, tcr.examine_category, tcr.rule_description,
               tctr.weight, tctr.audit_state,tctr.check_template_id as templateId,tct.template_name
        from t_check_template_rule tctr inner join t_check_rule tcr on tcr.id = tctr.check_rule_id
        inner join t_check_template tct on tctr.check_template_id = tct.id
        <where>
            state = 0
            <if test="ruleName != null  and ruleName != ''"> and tcr.rule_name like concat(#{ruleName}, '%')</if>
            <if test="ruleCategory != null "> and tcr.rule_category = #{ruleCategory}</if>
            <if test="examineCategory != null "> and tcr.examine_category = #{examineCategory}</if>
            <if test="auditState != null "> and tctr.audit_state = #{auditState}</if>
            <if test="templateId != null "> and tctr.check_template_id = #{templateId}</if>
    <select id="selectCheckRuleList" resultMap="CheckRuleResult">
        select cr.id, cr.rule_name, cr.rule_index, cr.rule_category, cr.rule_condition, cr.rule_description,
        cr.update_time, cr.state, cr.deleted
        from t_check_rule cr
        <where>
            <if test="ruleName != null  and ruleName != ''"> and rule_name like concat('%', #{ruleName}, '%')</if>
            <if test="ruleIndex != null  and ruleIndex != ''"> and rule_index = #{ruleIndex}</if>
            <if test="ruleCategory != null "> and rule_category = #{ruleCategory}</if>
            <if test="ruleCondition != null  and ruleCondition != ''"> and rule_condition = #{ruleCondition}</if>
            <if test="ruleDescription != null  and ruleDescription != ''"> and rule_description = #{ruleDescription}</if>
            <if test="state != null "> and state = #{state}</if>
            <if test="deleted != null  and deleted != ''"> and deleted = #{deleted}</if>
        </where>
    </select>
    
    <select id="selectCheckRuleById" resultType="com.ycl.platform.domain.vo.CheckRuleVO">
        select tcr.id, tcr.rule_name, tcr.rule_index, tcr.rule_category, tcr.examine_category, tcr.rule_description, tctr.weight, tctr.audit_state,tctr.check_template_id as templateId
        from t_check_rule tcr inner join t_check_template_rule tctr on tcr.id = tctr.check_rule_id
        where tcr.id = #{id} and tcr.state = 0
    <select id="selectCheckRuleById"  resultMap="CheckRuleResult">
        <include refid="selectCheckRuleVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertCheckRule" useGeneratedKeys="true" keyProperty="id">
        insert into t_check_rule
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="ruleName != null and ruleName != ''">rule_name,</if>
            <if test="ruleDetail != null">rule_detail,</if>
            <if test="ruleIndex != null">rule_index,</if>
            <if test="ruleCategory != null">rule_category,</if>
            <if test="examineCategory != null">examine_category,</if>
            <if test="ruleCondition != null">rule_condition,</if>
            <if test="ruleDescription != null">rule_description,</if>
            <if test="state != null">state,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="state != null">state,</if>
            <if test="deleted != null">deleted,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="ruleName != null and ruleName != ''">#{ruleName},</if>
            <if test="ruleIndex != null">#{ruleIndex},</if>
            <if test="ruleCategory != null">#{ruleCategory},</if>
            <if test="examineCategory != null">#{examineCategory},</if>
            <if test="ruleCondition != null">#{ruleCondition},</if>
            <if test="ruleDescription != null">#{ruleDescription},</if>
            <if test="state != null">#{state},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="state != null">#{state},</if>
            <if test="deleted != null">#{deleted},</if>
         </trim>
    </insert>
@@ -74,11 +72,10 @@
            <if test="ruleName != null and ruleName != ''">rule_name = #{ruleName},</if>
            <if test="ruleIndex != null">rule_index = #{ruleIndex},</if>
            <if test="ruleCategory != null">rule_category = #{ruleCategory},</if>
            <if test="examineCategory != null">examine_category = #{examineCategory},</if>
            <if test="ruleCondition != null">rule_condition = #{ruleCondition},</if>
            <if test="ruleDescription != null">rule_description = #{ruleDescription},</if>
            <if test="state != null">state = #{state},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="state != null">state = #{state},</if>
            <if test="deleted != null">deleted = #{deleted},</if>
        </trim>
        where id = #{id}