<?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.basic.mapper.QuestionRuleMapper">
    <resultMap id="BaseResultMap" type="com.ruoyi.basic.domain.question.QuestionRule">
        <id column="id" property="id"/>
        <result column="survey_id" property="surveyId"/>
        <result column="rule_name" property="ruleName"/>
        <result column="target_type" property="targetType"/>
        <result column="target_constitution_id" property="targetConstitutionId"/>
        <result column="min_score" property="minScore"/>
        <result column="max_score" property="maxScore"/>
        <result column="require_other_max_score" property="requireOtherMaxScore"/>
        <result column="require_other_min_score" property="requireOtherMinScore"/>
        <result column="condition_json" property="conditionJson"/>
        <result column="priority" property="priority"/>
        <result column="status" property="status"/>
        <result column="result_text" property="resultText"/>
        <result column="create_time" property="createTime"/>
        <result column="update_time" property="updateTime"/>
    </resultMap>

    <select id="selectEnabledBySurveyId" resultMap="BaseResultMap">
        SELECT *
        FROM question_rule
        WHERE survey_id = #{surveyId}
          AND status = 1
        ORDER BY priority ASC, id ASC
    </select>

</mapper>
