WelcomeStudentMapper.xml 4.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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.template.mapper.WelcomeStudentMapper">
  4. <resultMap type="com.template.model.vo.StudentPageVo" id="studentPageMap">
  5. <result property="id" column="id"/>
  6. <result property="admissNum" column="admiss_num"/>
  7. <result property="name" column="name"/>
  8. <result property="cardId" column="card_id"/>
  9. <result property="college" column="college"/>
  10. <result property="major" column="major"/>
  11. <result property="classstr" column="classstr"/>
  12. <result property="trafficMethod" column="traffic_method"/>
  13. <result property="arrive" column="arrive"/>
  14. <result property="amountPayable" column="amount_payable"/>
  15. <result property="payAmount" column="pay_amount"/>
  16. <result property="dormitory" column="dormitory"/>
  17. <result property="accompanyNum" column="accompanyNum"/>
  18. </resultMap>
  19. <select id="queryStudentPageList" resultType="com.template.model.vo.StudentPageVo" resultMap="studentPageMap">
  20. select (select count(id) from welcome_accompany where student_card = ws.card_id) as accompanyNum,
  21. ws.id,ws.admiss_num,ws.name,ws.card_id,ws.college,ws.major,ws.classstr,
  22. ws.traffic_method,ws.arrive,ws.amount_payable,ws.pay_amount,
  23. CONCAT(wsd.building, '-', wsd.dormitory, '-', wsd.bed_num) as dormitory
  24. from welcome_student ws
  25. left join welcome_student_dormitory wsd on wsd.deleted =0 and wsd.student_card = ws.card_id
  26. where ws.deleted = 0
  27. <if test="collegeId != null and collegeId != ''">
  28. ws.college_id = #{collegeId}
  29. </if>
  30. <if test="majorId != null and majorId != ''">
  31. ws.major_id = #{majorId}
  32. </if>
  33. <if test="classstrId != null and classstrId != ''">
  34. ws.classstr_id = #{classstrId}
  35. </if>
  36. <if test="trafficMethod != null and trafficMethod != ''">
  37. ws.trafficMethod = #{trafficMethod}
  38. </if>
  39. <if test="name != null and name != ''">
  40. ws.name like '%' #{name} '%'
  41. </if>
  42. order by ws.update_time desc
  43. </select>
  44. <select id="studentRegister" resultType="com.template.model.vo.StudentRegisterVo">
  45. SELECT count(ws.id) AS count,
  46. wo.`name` AS collegeName
  47. FROM
  48. `welcome_student` ws
  49. LEFT JOIN welcome_org wo
  50. ON ws.college_id = wo.id AND wo.deleted = 0
  51. WHERE
  52. ws.deleted = 0
  53. AND ws.iden_type=1
  54. GROUP BY
  55. college_id
  56. </select>
  57. <select id="studentTraffic" resultType="com.template.model.vo.StudentTrafficVo">
  58. SELECT count(ws.id) AS count,
  59. ws.traffic_method as trafficMethod
  60. FROM
  61. `welcome_student` ws
  62. WHERE
  63. ws.deleted = 0
  64. AND ws.iden_type=1
  65. GROUP BY
  66. traffic_method
  67. </select>
  68. <select id="studentSexRatio" resultType="com.template.model.vo.StudentSexRatioVo">
  69. SELECT wo.`name` as collegeName,
  70. new.count AS manCount,
  71. new2.count AS girlCount
  72. FROM `welcome_student` w
  73. LEFT JOIN (SELECT ws.college_id AS collegeId,
  74. count(ws.id) AS count
  75. FROM
  76. `welcome_student` ws
  77. WHERE
  78. ws.deleted = 0
  79. AND ws.sex = '男'
  80. AND ws.iden_type=1
  81. GROUP BY
  82. college_id) new ON w.college_id = new.collegeId
  83. LEFT JOIN (SELECT ws.college_id AS collegeId,
  84. count(ws.id) AS count
  85. FROM
  86. `welcome_student` ws
  87. WHERE
  88. ws.deleted = 0
  89. AND ws.sex = '女'
  90. AND ws.iden_type=1
  91. GROUP BY
  92. college_id) new2 ON w.college_id = new2.collegeId
  93. LEFT JOIN welcome_org wo ON w.college_id = wo.id
  94. AND wo.deleted = 0
  95. GROUP BY w.college_id
  96. </select>
  97. </mapper>