Blame view

ClassSubjectTaskMapper.xml 2.76 KB
涂亚平 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
<?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.ClassSubjectTaskMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.meishu.model.ClassSubjectTaskDO">
        <id column="id" property="id" />
        <result column="create_date" property="createDate" />
        <result column="update_date" property="updateDate" />
        <result column="subject_id" property="subjectId" />
        <result column="tree_id" property="treeId" />
        <result column="tree_name" property="treeName" />
        <result column="task_date" property="taskDate" />
        <result column="teacher_id" property="teacherId" />
        <result column="task_type" property="taskType" />
        <result column="class_id" property="classId" />
        <result column="subject_en" property="subjectEn" />
        <result column="grade" property="grade" />
        <result column="classes" property="classes" />
        <result column="session" property="session" />
        <result column="subject_type" property="subjectType" />
        <result column="class_name" property="className" />
        <result column="semester" property="semester" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        create_date,
        update_date,
        id, subject_id, tree_id, tree_name, task_date, teacher_id, task_type, class_id, subject_en, grade, classes, session, subject_type, class_name, semester
    </sql>


    <select id="queryAlreadyTasks"
            resultType="com.meishu.vo.task.GetTaskByIdVO">
        SELECT
        *
        FROM
        class_subject_task t
        WHERE
        class_id = #{classId}
        and subject_Id = #{subjectId}
        <if test="endDate!=null">
            AND DATE_FORMAT(task_date,'%Y-%m-%d %H:%i:%s')&lt;= DATE_FORMAT(#{endDate},'%Y-%m-%d %H:%i:%s')
        </if>
        <if test="startDate!=null">
            AND DATE_FORMAT(task_date,'%Y-%m-%d %H:%i:%s') >= DATE_FORMAT(#{startDate},'%Y-%m-%d %H:%i:%s')
        </if>

        <if test="taskType!=null and taskType!=''">
            and t.task_type = #{taskType}
        </if>
        order by task_date desc
    </select>

    <select id="getClassStudents" parameterType="com.meishu.dto.task.GetClassStudentsDTO" resultType="com.meishu.model.UserRoleDO">
        SELECT
            t2.*
        FROM
            classes_user_mapping t
            LEFT JOIN user_role t2 ON t.user_id = t2.id
            where t.classes_id in
        <foreach collection="ids" item="id" index="index" open="(" close=")" separator=",">
            #{id}
        </foreach>
        and t.delete_date is null and t2.delete_date is null
    </select>

</mapper>