BaseStudentCadreMapper.xml 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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.student.mapper.BaseStudentCadreMapper">
  6. <select id="getListPage" parameterType="com.xjrsoft.module.student.dto.BaseStudentCadrePageDto"
  7. resultType="com.xjrsoft.module.student.vo.BaseStudentCadrePageVo">
  8. SELECT
  9. t.*,
  10. t1.name as userName,
  11. t2.student_id as studentId,
  12. t3.name as className,
  13. t4.post as post,
  14. t4.level as level,
  15. t5.name as cadreDeptIdCN
  16. FROM base_student_cadre t
  17. LEFT JOIN xjr_user t1 ON (t1.id = t.user_id)
  18. LEFT JOIN base_student t2 ON (t2.user_id = t.user_id)
  19. LEFT JOIN base_class t3 ON (t3.id = t.class_id)
  20. LEFT JOIN base_student_post t4 ON (t4.id = t.post_id)
  21. LEFT JOIN cadre_dept t5 ON (t5.id = t.cadre_dept_id)
  22. WHERE t.delete_mark = 0
  23. <if test="dto.userName != null and dto.userName != ''">
  24. and t1.name like concat('%',#{dto.userName},'%')
  25. </if>
  26. <if test="dto.studentId != null and dto.studentId > 0">
  27. and t2.student_id = #{dto.studentId}
  28. </if>
  29. <if test="dto.classId != null and dto.classId > 0">
  30. and t.class_id = #{dto.classId}
  31. </if>
  32. <if test="dto.className != null and dto.className != ''">
  33. and t3.name like concat('%',#{dto.className},'%')
  34. </if>
  35. <if test="dto.postId != null and dto.postId > 0">
  36. and t.post_id = #{dto.postId}
  37. </if>
  38. <if test="dto.post != null and dto.post != ''">
  39. and t4.post like concat('%',#{dto.post},'%')
  40. </if>
  41. <if test="dto.level != null and dto.level != ''">
  42. and t4.level = #{dto.level}
  43. </if>
  44. <if test="dto.cadreDeptId != null and dto.cadreDeptId > 0">
  45. and t.cadre_dept_id = #{dto.cadreDeptId}
  46. </if>
  47. <if test="dto.cadreDeptIdCN != null and dto.cadreDeptIdCN != ''">
  48. and t5.name like concat('%',#{dto.cadreDeptIdCN},'%')
  49. </if>
  50. order by t.id
  51. </select>
  52. <select id="getOneById"
  53. resultType="com.xjrsoft.module.student.vo.BaseStudentCadreVo">
  54. SELECT
  55. t.*,
  56. t1.name as userName,
  57. t2.student_id as studentId,
  58. t3.name as className,
  59. t4.post as post,
  60. t4.level as level,
  61. t5.name as cadreDeptIdCN
  62. FROM base_student_cadre t
  63. LEFT JOIN xjr_user t1 ON (t1.id = t.user_id)
  64. LEFT JOIN base_student t2 ON (t2.user_id = t.user_id)
  65. LEFT JOIN base_class t3 ON (t3.id = t.class_id)
  66. LEFT JOIN base_student_post t4 ON (t4.id = t.post_id)
  67. LEFT JOIN cadre_dept t5 ON (t5.id = t.cadre_dept_id)
  68. WHERE t.delete_mark = 0
  69. and t.id = #{id}
  70. </select>
  71. </mapper>