123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- <?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.ym.mec.biz.dal.mapper.SchoolStaffMapper">
-
- <select id="selectPage" resultType="com.ym.mec.biz.dal.wrapper.SchoolStaffWrapper$SchoolStaff">
- SELECT t1.id_
- , t1.organ_id_list_ as organId
- , t1.school_id_
- , co.name_ as schoolName
- , t1.user_id_
- , t1.user_type_
- , t1.tenant_id_
- , t1.organ_id_list_
- , IFNULL(t2.real_name_, t2.username_) AS username
- , t2.avatar_
- , t2.phone_ AS mobile
- , t1.status_
- , t1.create_time_
- FROM school_staff t1
- JOIN sys_user t2 ON (t1.user_id_ = t2.id_)
- left join cooperation_organ co on t1.school_id_ = co.id_
- <where>
- t1.status_ != -1
- <if test="param.schoolId != null">
- AND t1.school_id_ = #{param.schoolId}
- </if>
- <if test="param.schoolIds != null and param.schoolIds.size() != 0">
- and t1.school_id_ in
- <foreach collection="param.schoolIds" item="schoolId" open="(" separator="," close=")">
- #{schoolId}
- </foreach>
- </if>
- <if test="param.keyword != null and param.keyword != ''">
- and (t2.id_ like concat('%', #{param.keyword}, '%')
- or t2.username_ like concat('%', #{param.keyword}, '%')
- or t2.phone_ like concat('%', #{param.keyword}, '%')
- )
- </if>
- <if test="param.tenantId != null">
- and t1.tenant_id_ = #{param.tenantId}
- </if>
- <if test="param.organId != null and param.organId != ''">
- and find_in_set(t1.organ_id_list_,#{param.organId})
- </if>
- <if test="param.coopStatus != null">
- and co.is_enable_ = #{param.coopStatus}
- </if>
- </where>
- ORDER BY id_ DESC
- </select>
- <!--学校员工身份数统计-->
- <select id="selectUserTypeNumsStat" resultType="com.ym.mec.biz.dal.wrapper.StatGroupWrapper">
- SELECT t1.user_type_ AS gid, COUNT(t1.user_id_) AS total
- FROM school_staff t1 WHERE t1.school_id_ = #{schoolId} GROUP BY t1.user_type_
- </select>
- <update id="updateStatusAndRecoveryStatus">
- update school_staff ss left join sys_user su on su.id_ = ss.user_id_
- set ss.status_ = if(#{status},0,9),ss.recovery_status_ = if(#{status},0,1),su.lock_flag_ = if(#{status},0,9)
- where ss.school_id_ = #{cooperationOrganId} and ss.status_ in (0,9)
- <if test="status">
- and ss.recovery_status_ = 1
- </if>
- <if test="status == false ">
- and (ss.status_ = 0 or ss.status_ is null)
- </if>
- </update>
- <delete id="delUser">
- update sys_user set user_type_ = '' ,del_flag_ = 1 where id_ = #{userId}
- </delete>
- <!--学校员工身份数统计-->
- </mapper>
|