LaboratoryUserMappingMapper.xml 3.58 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.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>