BaseClass.xml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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.base.mapper.BaseClassMapper">
  6. <select id="getPage" parameterType="com.xjrsoft.module.base.dto.BaseClassPageDto" resultType="com.xjrsoft.module.base.vo.BaseClassPageVo">
  7. SELECT t1.id,t1.name,t1.code,t4.name AS grade_name,t2.name AS teacher_name,t3.name AS enroll_type_cn,
  8. t5.name AS class_type_cn,t6.name AS classroomName,
  9. (SELECT COUNT(DISTINCT(a1.id)) FROM xjr_user a1
  10. LEFT JOIN base_student_school_roll a2 ON a1.id = a2.user_id
  11. WHERE a1.delete_mark = 0 AND a2.delete_mark = 0
  12. AND a1.gender = 'SB10001' AND a2.class_id = t1.id
  13. AND a2.archives_status = 'FB2901') AS male_cout,
  14. (SELECT COUNT(DISTINCT(a1.id)) FROM xjr_user a1
  15. LEFT JOIN base_student_school_roll a2 ON a1.id = a2.user_id
  16. WHERE a1.delete_mark = 0 AND a2.delete_mark = 0
  17. AND a1.gender = 'SB10002' AND a2.class_id = t1.id
  18. AND a2.archives_status = 'FB2901') AS female_count,
  19. (SELECT COUNT(DISTINCT(a1.id)) FROM xjr_user a1
  20. LEFT JOIN base_student_school_roll a2 ON a1.id = a2.user_id
  21. WHERE a1.delete_mark = 0 AND a2.delete_mark = 0
  22. AND a2.class_id = t1.id AND a2.stduy_status = 'FB3002'
  23. AND a2.archives_status = 'FB2901') AS stay_count,
  24. (SELECT COUNT(DISTINCT(a1.id)) FROM xjr_user a1
  25. LEFT JOIN base_student_school_roll a2 ON a1.id = a2.user_id
  26. WHERE a1.delete_mark = 0 AND a2.delete_mark = 0
  27. AND a2.class_id = t1.id AND a2.stduy_status = 'FB3001'
  28. AND a2.archives_status = 'FB2901') AS not_stay_count,t7.name AS org_name FROM base_class t1
  29. LEFT JOIN xjr_user t2 ON t1.teacher_id = t2.id
  30. LEFT JOIN xjr_dictionary_detail t3 ON t3.code = t1.enroll_type AND t3.item_id = 2023000000000000027
  31. LEFT JOIN xjr_dictionary_detail t5 ON t5.code = t1.class_type AND t5.item_id = 1784405535724978177
  32. LEFT JOIN base_grade t4 ON t1.grade_id = t4.id
  33. LEFT JOIN base_classroom t6 ON t1.classroom_id = t6.id
  34. LEFT JOIN xjr_department t7 ON t1.org_id = t7.id
  35. WHERE t1.delete_mark = 0
  36. <if test="dto.name != null and dto.name != ''">
  37. and t1.name like concat('%', #{dto.name}, '%')
  38. </if>
  39. <if test="dto.teacherName != null and dto.teacherName != ''">
  40. and t2.name like concat('%', #{dto.teacherName}, '%')
  41. </if>
  42. <if test="dto.gradeId != null">
  43. and t4.id = #{dto.gradeId}
  44. </if>
  45. <if test="dto.classroomName != null and dto.classroomName != ''">
  46. and t6.name like concat('%', #{dto.classroomName}, '%')
  47. </if>
  48. <if test="dto.classType != null and dto.classType != ''">
  49. and t1.class_type = #{dto.classType}
  50. </if>
  51. <if test="dto.isOrderClass != null">
  52. and t1.is_order_class = #{dto.isOrderClass}
  53. </if>
  54. <if test="dto.isGraduate != null">
  55. and t1.is_graduate = #{dto.isGraduate}
  56. </if>
  57. <if test="dto.teacherId != null">
  58. and t1.teacher_id = #{dto.teacherId}
  59. </if>
  60. <if test="dto.orgId != null">
  61. and t1.org_id = #{dto.orgId}
  62. </if>
  63. <if test="dto.classroomId != null">
  64. and t1.classroom_id = #{dto.classroomId}
  65. </if>
  66. <if test="dto.code != null and dto.code != ''">
  67. and t1.code like concat('%', #{dto.code}, '%')
  68. </if>
  69. <if test="dto.enrollType != null and dto.enrollType != ''">
  70. and t1.enroll_type = #{dto.enroll_type}
  71. </if>
  72. </select>
  73. <select id="getStudentClass" resultType="com.xjrsoft.module.base.vo.StudentClassVo">
  74. SELECT t2.user_id, t1.id, t1.name, t1.teacher_id FROM base_class t1
  75. INNER JOIN base_student_school_roll t2 ON t1.id = t2.class_id
  76. WHERE t1.delete_mark = 0 AND t2.delete_mark = 0
  77. </select>
  78. <select id="getAttendanceClass" resultType="com.xjrsoft.module.attendance.vo.ClassStatisticsVo">
  79. SELECT t1.id,t1.name,t2.name AS teacher_name,
  80. (SELECT COUNT(*) FROM base_student_school_roll c1
  81. INNER JOIN xjr_user c2 ON c1.user_id = c2.id
  82. WHERE c1.delete_mark = 0 AND c1.delete_mark = 0
  83. AND c1.class_id = t1.id AND c1.archives_status = 'FB2901') AS student_count,
  84. (SELECT COUNT(*) FROM base_student_school_roll c1
  85. INNER JOIN xjr_user c2 ON c1.user_id = c2.id
  86. WHERE c1.delete_mark = 0 AND c1.delete_mark = 0
  87. AND c1.class_id = t1.id AND c1.archives_status = 'FB2901' AND c1.stduy_status = 'FB3002') AS stay_count,
  88. (SELECT COUNT(*) FROM base_student_school_roll c1
  89. INNER JOIN xjr_user c2 ON c1.user_id = c2.id
  90. WHERE c1.delete_mark = 0 AND c1.delete_mark = 0
  91. AND c1.class_id = t1.id AND c1.archives_status = 'FB2901' AND c1.stduy_status = 'FB3001') AS not_stay_count FROM base_class t1
  92. LEFT JOIN xjr_user t2 ON t1.teacher_id = t2.id
  93. WHERE t1.delete_mark = 0
  94. <if test="dto.classId != null">
  95. and t1.id = #{dto.classId}
  96. </if>
  97. <if test="dto.gradeId != null">
  98. and t1.grade_id = #{dto.gradeId}
  99. </if>
  100. </select>
  101. </mapper>