| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.template.mapper.WelcomeStudentMapper">
- <resultMap type="com.template.model.vo.StudentPageVo" id="studentPageMap">
- <result property="id" column="id"/>
- <result property="sex" column="sex"/>
- <result property="admissNum" column="admiss_num"/>
- <result property="name" column="name"/>
- <result property="cardId" column="card_id"/>
- <result property="college" column="college"/>
- <result property="major" column="major"/>
- <result property="classstr" column="classstr"/>
- <result property="trafficMethod" column="traffic_method"/>
- <result property="arrive" column="arrive"/>
- <result property="accompanyNum" column="accompanyNum"/>
- <result property="fillStatus" column="fill_status"/>
- <result property="amountPayable" column="amount_payable"/>
- <result property="payAmount" column="pay_amount"/>
- <result property="dormitory" column="dormitory"/>
- <result property="isRegistered" column="isRegistered"/>
- <result property="carNumber" column="carNumber"/>
- <result property="phone" column="phone"/>
- <result property="familyName" column="familyName"/>
- <result property="familyPhone" column="familyPhone"/>
- <result property="arrvieDate" column="arrvieDate"/>
- <result property="isPay" column="is_pay"/>
- <result property="collegeId" column="college_id"/>
- <result property="majorId" column="major_id"/>
- <result property="batchValue" column="batch_value"/>
- <result property="remark" column="remark"/>
- </resultMap>
- <select id="queryStudentPageList" resultType="com.template.model.vo.StudentPageVo" resultMap="studentPageMap">
- select (select count(id) from welcome_accompany where student_card = ws.card_id and deleted = 0) as accompanyNum,
- ws.id,ws.admiss_num,ws.name,ws.card_id,ws.college,ws.major,ws.classstr,
- ws.traffic_method,ws.arrive,ws.amount_payable,ws.pay_amount,ws.fill_status,
- CONCAT(wsd.build, '-', wsd.dormitory, '-', wsd.number) as dormitory,ws.sex,ws.is_registered as isRegistered,wv.car_number as carNumber,ws.phone,wf.`name` as familyName,
- wf.phone as familyPhone,ws.arrvie_date as arrvieDate,ws.is_pay,ws.college_id,ws.major_id,ws.batch_value,ws.remark
- from welcome_student ws
- left join welcome_bed wsd on wsd.deleted =0 and wsd.student_card = ws.card_id
- left join welcome_visitor wv on wv.deleted =0 and wv.student_card = ws.card_id
- left join (SELECT
- f.*
- FROM
- welcome_family f
- WHERE f.deleted=0
- GROUP BY
- f.student_card ) wf ON wf.deleted = 0
- AND wf.student_card = ws.card_id
- where ws.deleted = 0
- <if test="collegeIds != null and collegeIds.size() > 0">
- and ws.college_id in
- <foreach collection="collegeIds" item="collegeId" index="index" open="(" close=")" separator=",">
- ${collegeId}
- </foreach>
- </if>
- <if test="majorId != null and majorId != ''">
- and ws.major_id = #{majorId}
- </if>
- <if test="classstrId != null and classstrId != ''">
- and ws.classstr_id = #{classstrId}
- </if>
- <if test="trafficMethod != null and trafficMethod != ''">
- and ws.traffic_method = #{trafficMethod}
- </if>
- <if test="name != null and name != ''">
- and ws.name like '%' #{name} '%'
- </if>
- <if test="fillStatus != null and fillStatus != ''">
- and ws.fill_status = #{fillStatus}
- </if>
- <if test="isRegistered != null and isRegistered != ''">
- <if test="isRegistered == 1">
- and ws.is_registered = #{isRegistered}
- </if>
- <if test="isRegistered == 2">
- and (ws.is_registered =2 or ws.is_registered is NULL)
- </if>
- </if>
- <if test="isPay != null">
- and ws.is_pay = #{isPay}
- </if>
- <if test="isCheck != null">
- <if test="isCheck == 1">
- and wsd.is_check = #{isCheck}
- </if>
- <if test="isCheck == 0">
- and wsd.is_check is null
- </if>
- </if>
- <if test="school != null and school != ''">
- and ws.school = #{school}
- </if>
- <if test="batchValue != null and batchValue != ''">
- and ws.batch_value = #{batchValue}
- </if>
- <if test="carNumber != null">
- <if test="carNumber == 1">
- and wv.car_number is not null
- </if>
- <if test="carNumber == 0">
- and wv.car_number is null
- </if>
- </if>
- and ws.iden_type != 2
- AND ws.create_time between #{startTime} and #{endTime}
- order by ws.update_time desc
- </select>
- <select id="studentRegister" resultType="com.template.model.vo.StudentRegisterVo">
- SELECT
- SUM(1) AS totalCount,
- SUM(CASE WHEN ws.is_registered = 1 THEN 1 ELSE 0 END) AS count,
- ROUND(
- SUM(CASE WHEN ws.is_registered = 1 THEN 1 ELSE 0 END) * 100.0 / NULLIF(SUM(1), 0),
- 2
- ) AS rate,
- wo.`name`
- FROM
- `welcome_student` ws
- LEFT JOIN welcome_org wo
- ON ws.college_id = wo.id AND wo.deleted = 0
- WHERE
- ws.deleted = 0
- AND ws.iden_type=1
- AND ws.create_time between #{startTime} and #{endTime}
- GROUP BY
- college_id
- </select>
- <select id="studentTraffic" resultType="com.template.model.vo.StudentTrafficVo">
- SELECT count(ws.id) AS count,
- ws.traffic_method as trafficMethod
- FROM
- `welcome_student` ws
- WHERE
- ws.deleted = 0
- AND ws.iden_type=1
- AND ws.fill_status = '已填报'
- <if test="collegeId != null">
- and ws.college_id = #{collegeId}
- </if>
- AND ws.create_time between #{startTime} and #{endTime}
- GROUP BY
- traffic_method
- </select>
- <select id="studentSexRatio" resultType="com.template.model.vo.StudentSexRatioVo">
- SELECT
- wo.`name` AS collegeName,
- new.count AS manCount,
- new2.count AS girlCount
- FROM
- `welcome_student` w
- LEFT JOIN (
- SELECT
- ws.college_id AS collegeId,
- count( ws.id ) AS count
- FROM
- `welcome_student` ws
- WHERE
- ws.deleted = 0
- AND ws.sex = '男'
- AND ws.iden_type = 1
- AND ws.fill_status = "已填报"
- AND ws.create_time between #{startTime} and #{endTime}
- GROUP BY
- college_id
- ) new ON w.college_id = new.collegeId
- LEFT JOIN (
- SELECT
- ws.college_id AS collegeId,
- count( ws.id ) AS count
- FROM
- `welcome_student` ws
- WHERE
- ws.deleted = 0
- AND ws.sex = '女'
- AND ws.iden_type = 1
- AND ws.fill_status = "已填报"
- AND ws.create_time between #{startTime} and #{endTime}
- GROUP BY
- college_id
- ) new2 ON w.college_id = new2.collegeId
- LEFT JOIN welcome_org wo ON w.college_id = wo.id
- AND wo.deleted = 0
- WHERE
- w.deleted = 0
- AND w.iden_type = 1
- AND w.fill_status = "已填报"
- GROUP BY
- w.college_id
- </select>
- <resultMap type="com.template.model.vo.StudentTotalVo" id="queryStudentTotalMap">
- <result property="total" column="total"/>
- <result property="college" column="college"/>
- <result property="sex" column="sex"/>
- </resultMap>
- <select id="queryStudentTotal" resultType="com.template.model.vo.StudentTotalVo" resultMap="queryStudentTotalMap">
- select sum(1) as total,college,sex from welcome_student
- where deleted = 0 and iden_type = 1
- AND create_time between #{startTime} and #{endTime}
- group by college,sex
- </select>
- <select id="studentMajorRegister" resultType="com.template.model.vo.StudentRegisterVo">
- SELECT
- SUM(1) AS totalCount,
- SUM(CASE WHEN ws.is_registered = 1 THEN 1 ELSE 0 END) AS count,
- ROUND(
- SUM(CASE WHEN ws.is_registered = 1 THEN 1 ELSE 0 END) * 100.0 / NULLIF(SUM(1), 0),
- 2
- ) AS rate,
- wo.`name`
- FROM
- `welcome_student` ws
- LEFT JOIN welcome_org wo
- ON ws.major_id = wo.id AND wo.deleted = 0
- WHERE
- ws.deleted = 0
- AND ws.iden_type=1
- AND ws.college_id= #{collegeId}
- AND ws.create_time between #{startTime} and #{endTime}
- GROUP BY
- ws.major_id
- </select>
- <select id="levelRegister" resultType="com.template.model.vo.StudentRegisterVo">
- SELECT count(ws.id) AS count,
- ws.batch_value as name
- FROM
- `welcome_student` ws
- LEFT JOIN welcome_org wo
- ON ws.college_id = wo.id AND wo.deleted = 0
- WHERE
- ws.deleted = 0
- AND ws.iden_type=1
- AND ws.is_registered = 1
- <if test="collegeId != null">
- and ws.college_id = #{collegeId}
- </if>
- AND ws.create_time between #{startTime} and #{endTime}
- GROUP BY
- ws.batch_value
- </select>
- </mapper>
|