AttendancePersonnelMapper.xml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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.teacher.mapper.AttendancePersonnelMapper">
  6. <select id="getListPage" parameterType="com.xjrsoft.module.teacher.dto.AttendancePersonnelPageDto"
  7. resultType="com.xjrsoft.module.teacher.vo.AttendancePersonnelPageVo">
  8. SELECT
  9. t.id,
  10. t1.id as userId,
  11. t1.name as userName,
  12. t1.user_name as jobNumber,
  13. REPLACE(REPLACE(t1.gender,'SB10001','男'),'SB10002','女') AS gender,
  14. t1.mobile as mobile,
  15. t5.name as deptName,
  16. t4.name as postName
  17. FROM attendance_personnel t
  18. LEFT JOIN xjr_user t1 ON (t1.id = t.user_id)
  19. LEFT JOIN xjr_user_post_relation t2 ON (t2.user_id = t.user_id)
  20. LEFT JOIN xjr_user_dept_relation t3 ON (t3.user_id = t.user_id)
  21. LEFT JOIN xjr_post t4 ON (t4.id = t2.post_id)
  22. LEFT JOIN xjr_department t5 ON (t5.id = t3.dept_id)
  23. WHERE t1.delete_mark = 0
  24. <if test="dto.keyword != null and dto.keyword != ''">
  25. and (
  26. t1.name LIKE CONCAT('%',#{dto.keyword},'%')
  27. OR t1.gender LIKE CONCAT('%',REPLACE(REPLACE(#{dto.keyword},'男','SB10001'),'女','SB10002'),'%')
  28. OR t1.mobile LIKE CONCAT('%',#{dto.keyword},'%')
  29. OR t1.user_name LIKE CONCAT('%',#{dto.keyword},'%')
  30. OR t4.name LIKE CONCAT('%',#{dto.keyword},'%')
  31. OR t5.name LIKE CONCAT('%',#{dto.keyword},'%')
  32. )
  33. </if>
  34. order by t.id
  35. </select>
  36. <select id="selectPersonPage" parameterType="com.xjrsoft.module.teacher.dto.SelectPersonPageDto"
  37. resultType="com.xjrsoft.module.teacher.vo.SelectPersonPageVo">
  38. select
  39. t.id as userId,
  40. t.name as userName,
  41. REPLACE(REPLACE(t.gender,'SB10001','男'),'SB10002','女') AS gender,
  42. t.mobile as mobile,
  43. t.user_name as jobNumber,
  44. t3.name as deptName,
  45. t4.name as postName
  46. from xjr_user t
  47. left join xjr_user_role_relation t5 on t5.user_id = t.id
  48. left join xjr_user_post_relation t1 on t1.user_id = t.id
  49. left join xjr_user_dept_relation t2 on t2.user_id = t.id
  50. left join xjr_department t3 on t3.id = t2.dept_id
  51. left join xjr_post t4 on t4.id = t1.post_id
  52. left join attendance_personnel t6 on t6.id = t.id
  53. where t5.role_id = 2
  54. and t.id not in(select user_id from attendance_personnel)
  55. and t.delete_mark = 0
  56. and t.enabled_mark = 1
  57. and t3.delete_mark = 0
  58. and t3.enabled_mark = 1
  59. and t4.delete_mark = 0
  60. and t4.enabled_mark = 1
  61. and t.user_name not like 'D%' and t.user_name not like 'E%'
  62. <if test="dto.keyword != null and dto.keyword != ''">
  63. and (
  64. t.name LIKE CONCAT('%',#{dto.keyword},'%')
  65. OR t.gender LIKE CONCAT('%',REPLACE(REPLACE(#{dto.keyword},'男','SB10001'),'女','SB10002'),'%')
  66. OR t.mobile LIKE CONCAT('%',#{dto.keyword},'%')
  67. OR t.user_name LIKE CONCAT('%',#{dto.keyword},'%')
  68. OR t3.name LIKE CONCAT('%',#{dto.keyword},'%')
  69. OR t4.name LIKE CONCAT('%',#{dto.keyword},'%')
  70. )
  71. </if>
  72. order by t.id
  73. </select>
  74. </mapper>