AccessTokenMapper.xml 2.79 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.AccessTokenMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.meishu.model.AccessTokenDO">
        <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="access_token" property="accessToken" />
    </resultMap>

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

    <select id="getAllTeachers" parameterType="com.meishu.dto.token.GetAllTeachersDTO" resultType="com.meishu.vo.accesstoken.GetAllTeachersVO">
        SELECT
            id,
            telephone,
            user_name,
            intro
        FROM
            administer t
        where t.delete_date is null
        <if test="telephone != null and telephone != ''">
            and t.telephone = #{telephone}
        </if>
        <if test="userName != null and userName != ''">
            and t.user_name like concat('%', #{userName} ,'%')
        </if>
    </select>

    <select id="getAllStudents" parameterType="com.meishu.dto.token.GetAllStudentsDTO" resultType="com.meishu.vo.accesstoken.GetAllStudentsVO">
        SELECT
        t.id,
        t.user_name,
        t.gender,
        t.img_url,
        t.user_status,
        t.role_type,
        t.SESSION,
        t.phone,
        t.id_card,
        t.study_code,
        t3.class_name,
        t.password
        FROM
        user_role t
        LEFT JOIN classes_user_mapping t2 ON t.id = t2.user_id
        LEFT JOIN classes_dict t3 ON t2.classes_id = t3.id
        WHERE
        t.delete_date IS NULL
--         AND t2.`status` = 1
        AND t2.delete_date IS NULL
        AND t3.delete_date IS NULL
        <if test="userName != null and userName !=''">
            and t.user_name like concat('%',#{userName} ,'%')
        </if>
        <if test="idCard != null and idCard != ''">
            and t.id_card like concat('%',#{idCard} ,'%')
        </if>
        <if test="phone != null and phone !=''">
            and t.phone like concat('%',#{phone} ,'%')
        </if>
        <if test="gender != null and gender != ''">
            and t.gender = #{gender}
        </if>
        <if test="studyCode != null and studyCode !='' ">
            and t.study_code  like concat('%',#{studyCode} ,'%')
        </if>
<!--        <if test="className != null and className !=''">-->
<!--            and t.class_name like concat('%',#{className} ,'%')-->
<!--        </if>-->
    </select>
</mapper>