SubjectTestDictMapper.xml 2.23 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.SubjectTestDictMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.meishu.model.SubjectTestDictDO">
        <id column="id" property="id" />
        <result column="create_date" property="createTime" />
        <result column="update_date" property="updateTime" />
        <result column="create_date" property="deleteTime" />
        <result column="test_name" property="testName" />
<!--        <result column="out_line" property="outline" />-->
<!--        <result column="test_time" property="testTime" />-->
    </resultMap>

    <sql id="Base_Column_List">
        create_date,
        update_date,
        create_date,
        id, test_name, out_line, test_time
    </sql>


    <!-- 通用查询结果列 -->
    <select id="getAllTest" parameterType="com.meishu.dto.test.GetAllTestDTO" resultType="com.meishu.vo.test.GetAllTestVO">
        SELECT
        t.id,
        t.test_name,
        t.examination,
        t2.id as rule_id,
        t2.rule_name,
        t2.status
        FROM
        subject_test_dict t
        LEFT JOIN subject_rule t2 ON t.rule_id = t2.id
        WHERE
        t.delete_date IS NULL
        AND t2.delete_date IS NULL
        <if test="ruleId!=null and ruleId !=''">
            AND t2.id = #{ruleId}
        </if>
        <if test="testName!=null and testName !=''">
            AND t.test_name LIKE  concat('%',#{testName} ,'%')
        </if>
    </select>

    <select id="getTest" parameterType="com.meishu.dto.test.GetAllTestDTO" resultType="com.meishu.vo.test.GetAllTestVO">
        SELECT
        t.id,
        t.test_name,
        t.examination,
        t2.id as rule_id,
        t2.rule_name
        FROM
        subject_test_dict t
        LEFT JOIN subject_rule t2 ON t.rule_id = t2.id
        WHERE
        t.delete_date IS NULL
        AND t2.delete_date IS NULL
        <if test="ruleId!=null and ruleId !=''">
            AND t2.id = #{ruleId}
        </if>
        <if test="testName!=null and testName !=''">
            AND t.test_name LIKE  concat('%',#{testName} ,'%')
        </if>
    </select>
</mapper>