SubjectTestGradeStarMappingMapper.xml 1.96 KB
<?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.meishu.mapper.SubjectTestGradeStarMappingMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.meishu.model.SubjectTestGradeStarMappingDO">
        <id column="id" property="id" />
        <result column="create_date" property="createTime" />
        <result column="update_date" property="updateTime" />
        <result column="delete_date" property="deleteTime" />
        <result column="grade_id" property="gradeId" />
        <result column="star_id" property="starId" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        create_date,
        update_date,
        delete_date,
        id, grade_id, star_id
    </sql>

    <select id="getGradeStar" parameterType="long" resultType="com.meishu.vo.grade.DimensionStarVO">
        SELECT
            t2.dimension_id,
            t3.dimension,
            t.star_id,
            t2.star,
            t2.description
        FROM
            subject_test_grade_star_mapping t
            LEFT JOIN subject_dimension_star_dict t2 ON t.star_id = t2.id
            LEFT JOIN subject_dimension_dict t3 ON t2.dimension_id = t3.id
        WHERE
            t.delete_date IS NULL
            AND t2.delete_date IS NULL
            AND t3.delete_date IS NULL
            AND t.grade_id = #{gradeId}
    </select>

    <select id="getRuleIdByPublishId" parameterType="long" resultType="com.meishu.model.SubjectRuleDO">
        SELECT
            t4.id
        FROM
             subject_test_publish_history t2
            LEFT JOIN subject_test_dict t3 ON t2.test_id = t3.id
            LEFT JOIN subject_rule t4 ON t3.rule_id = t4.id
        WHERE
             t2.delete_date IS NULL
            AND t3.delete_date IS NULL
            AND t4.delete_date IS NULL
            AND t2.id = #{id}
    </select>
</mapper>