SchoolStaffMapper.xml 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3. <mapper namespace="com.ym.mec.biz.dal.mapper.SchoolStaffMapper">
  4. <select id="selectPage" resultType="com.ym.mec.biz.dal.wrapper.SchoolStaffWrapper$SchoolStaff">
  5. SELECT t1.id_
  6. , t1.organ_id_list_ as organId
  7. , t1.school_id_
  8. , co.name_ as schoolName
  9. , t1.user_id_
  10. , t1.user_type_
  11. , t1.tenant_id_
  12. , t1.organ_id_list_
  13. , IFNULL(t2.real_name_, t2.username_) AS username
  14. , t2.avatar_
  15. , t2.phone_ AS mobile
  16. , t1.status_
  17. , t1.create_time_
  18. FROM school_staff t1
  19. JOIN sys_user t2 ON (t1.user_id_ = t2.id_)
  20. left join cooperation_organ co on t1.school_id_ = co.id_
  21. <where>
  22. t1.status_ != -1
  23. <if test="param.schoolId != null">
  24. AND t1.school_id_ = #{param.schoolId}
  25. </if>
  26. <if test="param.schoolIds != null and param.schoolIds.size() != 0">
  27. and t1.school_id_ in
  28. <foreach collection="param.schoolIds" item="schoolId" open="(" separator="," close=")">
  29. #{schoolId}
  30. </foreach>
  31. </if>
  32. <if test="param.keyword != null and param.keyword != ''">
  33. and (t2.id_ like concat('%', #{param.keyword}, '%')
  34. or t2.username_ like concat('%', #{param.keyword}, '%')
  35. or t2.phone_ like concat('%', #{param.keyword}, '%')
  36. )
  37. </if>
  38. <if test="param.tenantId != null">
  39. and t1.tenant_id_ = #{param.tenantId}
  40. </if>
  41. <if test="param.organId != null and param.organId != ''">
  42. and find_in_set(t1.organ_id_list_,#{param.organId})
  43. </if>
  44. <if test="param.coopStatus != null">
  45. and co.is_enable_ = #{param.coopStatus}
  46. </if>
  47. </where>
  48. ORDER BY id_ DESC
  49. </select>
  50. <!--学校员工身份数统计-->
  51. <select id="selectUserTypeNumsStat" resultType="com.ym.mec.biz.dal.wrapper.StatGroupWrapper">
  52. SELECT t1.user_type_ AS gid, COUNT(t1.user_id_) AS total
  53. FROM school_staff t1 WHERE t1.school_id_ = #{schoolId} GROUP BY t1.user_type_
  54. </select>
  55. <update id="updateStatusAndRecoveryStatus">
  56. update school_staff ss left join sys_user su on su.id_ = ss.user_id_
  57. set ss.status_ = if(#{status},0,9),ss.recovery_status_ = if(#{status},0,1),su.lock_flag_ = if(#{status},0,9)
  58. where ss.school_id_ = #{cooperationOrganId} and ss.status_ in (0,9)
  59. <if test="status">
  60. and ss.recovery_status_ = 1
  61. </if>
  62. <if test="status == false ">
  63. and (ss.status_ = 0 or ss.status_ is null)
  64. </if>
  65. </update>
  66. <delete id="delUser">
  67. update sys_user set user_type_ = '' ,del_flag_ = 1 where id_ = #{userId}
  68. </delete>
  69. <!--学校员工身份数统计-->
  70. </mapper>