Blame view

LaboratoryUserMappingMapper.xml 3.58 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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
<?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.LaboratoryUserMappingMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.meishu.model.LaboratoryUserMappingDO">
        <id column="id" property="id" />
        <result column="create_date" property="createDate" />
        <result column="update_date" property="updateDate" />
        <result column="delete_date" property="deleteDate" />
        <result column="laboratory_session_id" property="laboratorySessionId" />
        <result column="user_role_id" property="userRoleId" />
    </resultMap>

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

    <select id="getLaboratoryUserPage" resultType="com.meishu.vo.laboratoryUser.LaboratoryUserPageVO">
        select
            lum.*,
            ur.user_name as userName,
            ur.study_code as studyCode,
            cd.class_name as classes,
            sd.time_slot as timeSlot
        from laboratory_user_mapping lum
            left join laboratory_session_mapping lsm on lsm.id = lum.laboratory_session_id
            left join user_role ur on ur.id = lum.user_role_id
            left join sessions_dict sd on sd.id = lsm.sessions_dict_id
            left join classes_user_mapping cum on cum.user_id = ur.id
            left join classes_dict cd on cd.id = cum.classes_id
        where lsm.laboratory_dict_id = #{laboratorySessionId}
            and lsm.start_date = #{startDate}
            and lum.delete_date is null
            and lsm.delete_date is null
            and ur.delete_date is null
            and cum.delete_date is null
            and cd.delete_date is NULL
            and sd.delete_date is null
        group by lum.user_role_id
        order by sd.id asc
    </select>

    <select id="getLaboratoryUserList" resultType="com.meishu.vo.laboratoryUser.LaboratoryUserPageVO">
        select
            lum.*,
            lsm.sessions_dict_id as sessionsDictId,
            ur.user_name as userName,
            ur.study_code as studyCode,
            cd.class_name as classes
        from laboratory_user_mapping lum
            left join laboratory_session_mapping lsm on lsm.id = lum.laboratory_session_id
            left join user_role ur on ur.id = lum.user_role_id
            left join classes_user_mapping cum on cum.user_id = ur.id
            left join classes_dict cd on cd.id = cum.classes_id
        where lsm.laboratory_dict_id = #{laboratorySessionId}
            and lsm.start_date = #{startDate}
            and lum.delete_date is null
            and lsm.delete_date is null
            and ur.delete_date is null
            and cd.delete_date is NULL
            and cum.delete_date is NULL
        group by lum.user_role_id,lum.laboratory_session_id
    </select>

    <select id="getLaboratoryUserMapping" resultType="com.meishu.model.LaboratoryUserMappingDO">
        select
            lum.*
        from laboratory_user_mapping lum
        left join laboratory_session_mapping lsm on lsm.id = lum.laboratory_session_id
        left join laboratory_dict ld on ld.id = lsm.laboratory_dict_id
        where lum.user_role_id = #{userRoleId}
            and lsm.start_date = #{startDate}
            and lsm.sessions_dict_id = #{sessionsDictId}
            and lum.delete_date is null
            and ld.delete_date is null
            and lsm.delete_date is null
    </select>

</mapper>