UserMapper.xml 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.xjrsoft.module.organization.mapper.UserMapper">
  6. <select id="getResetUserPage" parameterType="com.xjrsoft.module.organization.dto.UserPageDto" resultType="com.xjrsoft.module.organization.vo.ResetUserPageVo">
  7. SELECT DISTINCT t1.*,t3.name AS gender_cn FROM xjr_user t1
  8. INNER JOIN xjr_user_role_relation t2 ON t2.user_id = t1.id
  9. LEFT JOIN xjr_dictionary_detail t3 ON t1.gender = t3.code
  10. WHERE t1.delete_mark = 0
  11. <if test="dto.keyword != null and dto.keyword !=''">
  12. and (t1.name like concat('%', #{dto.keyword}, '%') or t1.mobile like concat('%', #{dto.keyword}, '%'))
  13. </if>
  14. <if test="dto.roleId != null">
  15. and t2.role_id = #{dto.roleId}
  16. </if>
  17. </select>
  18. <select id="getInfosByParam" parameterType="com.xjrsoft.module.student.dto.BaseStudentSimpleInfoDto" resultType="com.xjrsoft.module.student.vo.BaseStudentSompleInfoVo">
  19. SELECT t1.id, t1.name as student_name, t1.enabled_mark, t1.credential_number, t4.name AS class_name,t1.mobile,
  20. (SELECT name FROM base_student_family_member WHERE delete_mark = 0 AND user_id = t1.id ORDER BY create_date ASC LIMIT 0,1) as parent_name,
  21. (SELECT mobile FROM base_student_family_member WHERE delete_mark = 0 AND user_id = t1.id ORDER BY create_date ASC LIMIT 0,1) as parent_mobile,
  22. t1.gender,t4.id as class_id, t4.teacher_id,t6.name as teacher_name,t6.user_name as teacher_user_name,t6.mobile as teacher_mobile,t5.name as classroom_name
  23. FROM xjr_user t1
  24. INNER JOIN base_student t2 ON t1.id = t2.user_id
  25. INNER JOIN base_student_school_roll t3 ON t1.id = t3.user_id
  26. INNER JOIN base_class t4 ON t4.id = t3.class_id
  27. left join base_classroom t5 on t4.classroom_id = t5.id
  28. left join xjr_user t6 on t4.teacher_id = t6.id
  29. WHERE t1.delete_mark = 0
  30. <if test="dto.keyword != null and dto.keyword != ''">
  31. AND (t1.name like concat('%', #{dto.keyword}, '%') OR t1.credential_number like concat('%', #{dto.keyword}, '%'))
  32. </if>
  33. <if test="dto.userId != null">
  34. AND t1.id = #{dto.userId}
  35. </if>
  36. </select>
  37. </mapper>