123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196 |
- <?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.xjrsoft.module.student.mapper.BaseStudentSchoolRollMapper">
- <select id="getMobilePage" parameterType="com.xjrsoft.module.student.dto.BaseStudentInfoPageDto" resultType="com.xjrsoft.module.student.vo.BaseStudentInfoPageVo">
- SELECT
- t2.id,
- t2.name AS student_name,
- t1.student_id,
- t2.mobile AS phone,
- t5.mobile AS teacher_phone,
- t5.name AS teacher_name,
- t4.name AS class_name,
- (SELECT mobile
- FROM base_student_family_member
- WHERE delete_mark = 0
- AND user_id = t2.id
- AND is_guardian = 1) AS guardian_phone,
- t7.name AS gender_cn,
- t8.name AS stduyStatus,
- t2.gender,
- t10.name AS genderCn,
- t2.birth_date,
- t6.name AS nation,
- t3.archives_status AS archivesStatusCode,
- t3.stduy_status AS stduyStatusCode,
- t3.roll_modality AS rollModalityCode,
- t12.name AS archives_status,
- t8.name AS stduy_status,
- t13.name AS roll_modality,
- t11.name AS student_form,
- CONCAT(t16.name, ' ', t15.room_name, ' ', t14.bed_number) AS bed_info
- FROM base_student t1
- INNER JOIN xjr_user t2 ON t1.user_id = t2.id
- INNER JOIN base_student_school_roll t3 ON t1.user_id = t3.user_id
- LEFT JOIN base_class t4 ON t3.class_id = t4.id
- LEFT JOIN xjr_user t5 ON t4.teacher_id = t5.id
- LEFT JOIN xjr_dictionary_detail t6 ON t6.code = t1.nation
- LEFT JOIN xjr_dictionary_detail t7 ON t7.code = t2.gender
- LEFT JOIN xjr_dictionary_detail t8 ON t8.code = t3.stduy_status
- LEFT JOIN xjr_dictionary_detail t11 ON t11.code = t3.student_type
- LEFT JOIN xjr_dictionary_detail t12 ON t12.code = t3.archives_status
- LEFT JOIN xjr_dictionary_detail t13 ON t13.code = t3.roll_modality
- LEFT JOIN xjr_dictionary_detail t10 ON t2.gender = t10.code
- LEFT JOIN room_bed t14 ON t14.student_user_id = t2.id
- LEFT JOIN room t15 ON t14.room_id = t15.id
- LEFT JOIN base_office_build t16 ON t15.office_build_id = t16.id
- WHERE t2.delete_mark = 0
- AND t1.delete_mark = 0
- AND t3.archives_status = 'FB2901'
- <if test="dto.gradeId != null">
- AND t4.grade_id = #{dto.gradeId}
- </if>
- <if test="dto.majorSetId != null">
- AND t3.major_set_id = #{dto.majorSetId}
- </if>
- <if test="dto.classId != null">
- AND t4.id = #{dto.classId}
- </if>
- <if test="dto.teacherId != null">
- AND t4.teacher_id = #{dto.teacherId}
- </if>
- <if test="dto.keyWord != null and dto.keyWord != ''">
- AND (t4.name LIKE concat('%', #{dto.keyWord}, '%')
- OR t2.name LIKE concat('%', #{dto.keyWord}, '%')
- OR t5.name LIKE concat('%', #{dto.keyWord}, '%')
- OR t1.student_id LIKE concat('%', #{dto.keyWord}, '%')
- OR t2.mobile LIKE concat('%', #{dto.keyWord}, '%')
- )
- </if>
- </select>
- <select id="getInfoById" parameterType="com.xjrsoft.module.student.dto.BaseStudentInfoDetailDto" resultType="com.xjrsoft.module.student.vo.BaseStudentInfoDetailVo">
- SELECT t2.id,
- t2.name AS student_name,
- t2.mobile AS phone,
- t2.gender,
- t11.name AS genderCn,
- t1.student_id,
- t5.name AS teacher_name,
- t5.mobile AS teacher_phone,
- t4.name AS class_name,
- (SELECT mobile
- FROM base_student_family_member
- WHERE delete_mark = 0
- AND user_id = t2.id
- AND is_guardian = 1) AS guardian_phone,
- t8.name AS archives_status,
- t7.name AS stduy_status,
- t9.name AS roll_modality,
- t2.birth_date,
- t2.gender,
- t2.avatar,
- t6.name AS nation,
- t10.name AS major_set_name,
- t3.archives_status as archivesStatusCode,
- t3.stduy_status as stduyStatusCode,
- t3.roll_modality as rollModalityCode,
- t12.name AS student_form,
- REPLACE(IFNULL((SELECT jfzt FROM pb_v_xsxxsfytb WHERE Studentcode = t2.credential_number AND feeitemcode LIKE '999010604%' AND jfzt = '未缴费' LIMIT 1),'已缴费'),'未缴费','欠费') AS jxf,
- REPLACE(IFNULL((SELECT jfzt FROM pb_v_xsxxsfytb WHERE Studentcode = t2.credential_number AND feeitemcode = 103042766003001 AND jfzt = '未缴费' LIMIT 1),'已缴费'),'未缴费','欠费') AS ssf,
- REPLACE(IFNULL((SELECT jfzt FROM pb_v_xsxxsfytb WHERE Studentcode = t2.credential_number AND feeitemcode LIKE '999010603%' AND jfzt = '未缴费' LIMIT 1),'已缴费'),'未缴费','欠费') AS jcf,
- CONCAT(t17.name, ' ', t16.room_name, ' ', t15.bed_number) AS bed_info
- FROM base_student t1
- INNER JOIN xjr_user t2 ON t1.user_id = t2.id
- INNER JOIN base_student_school_roll t3 ON t1.user_id = t3.user_id
- LEFT JOIN base_class t4 ON t3.class_id = t4.id
- LEFT JOIN xjr_user t5 ON t4.teacher_id = t5.id
- LEFT JOIN xjr_dictionary_detail t6 ON t6.code = t1.nation AND t6.item_id = 2023000000000000008
- LEFT JOIN xjr_dictionary_detail t7 ON t7.code = t3.stduy_status AND t7.item_id = 2023000000000000030
- LEFT JOIN xjr_dictionary_detail t8 ON t8.code = t3.archives_status AND t8.item_id = 2023000000000000029
- LEFT JOIN xjr_dictionary_detail t9 ON t9.code = t3.roll_modality AND t9.item_id = 1762024751192084482
- LEFT JOIN base_major_set t10 ON t3.major_set_id = t10.id
- LEFT JOIN xjr_dictionary_detail t11 ON t11.code = t2.gender
- LEFT JOIN xjr_dictionary_detail t12 ON t12.code = t3.student_type
- left join room_bed t15 on t15.student_user_id = t1.user_id
- left join room t16 on t16.id = t15.room_id
- left join base_office_build t17 on t17.id = t16.office_build_id
- WHERE t2.id = #{dto.id}
- </select>
- <update id="updateInfoByUserId" parameterType="com.xjrsoft.module.student.dto.UpdateBaseStudentInfoDto">
- UPDATE base_student_school_roll SET delete_mark = delete_mark
- <if test="dto.rollModality != null and dto.rollModality != ''">,roll_modality = #{dto.rollModality},learn_status = #{dto.rollModality} </if>
- <if test="dto.archivesStatus != null and dto.archivesStatus != ''">,archives_status = #{dto.archivesStatus} </if>
- <if test="dto.stduyStatus != null and dto.stduyStatus != ''">,stduy_status = #{dto.stduyStatus} </if>
- where user_id = #{id}
- </update>
- <select id="getGenderCount" parameterType="com.xjrsoft.module.student.dto.BaseStudentInfoPageDto" resultType="com.xjrsoft.module.student.vo.BaseStudentInfoCategoryVo">
- SELECT t2.gender as category,COUNT(*) as number FROM base_student t1
- INNER JOIN xjr_user t2 ON t1.user_id = t2.id
- INNER JOIN base_student_school_roll t3 ON t1.user_id = t3.user_id
- LEFT JOIN base_class t4 ON t3.class_id = t4.id
- LEFT JOIN xjr_user t5 ON t4.teacher_id = t5.id
- LEFT JOIN base_student_family_member t6 ON t6.user_id = t2.id AND t6.delete_mark = 0 AND t6.is_guardian = 1
- WHERE t2.delete_mark = 0
- AND t1.delete_mark = 0
- and t3.archives_status = 'FB2901'
- <if test="dto.gradeId != null">
- and t4.grade_id = #{dto.gradeId}
- </if>
- <if test="dto.majorSetId != null">
- and t3.major_set_id = #{dto.majorSetId}
- </if>
- <if test="dto.classId != null">
- and t4.id = #{dto.classId}
- </if>
- <if test="dto.teacherId != null">
- and t4.teacher_id = #{dto.teacherId}
- </if>
- <if test="dto.keyWord != null and dto.keyWord != ''">
- and (t4.name like concat('%', #{dto.keyWord}, '%')
- or t2.name like concat('%', #{dto.keyWord}, '%')
- or t5.name like concat('%', #{dto.keyWord}, '%')
- or t1.student_id like concat('%', #{dto.keyWord}, '%')
- or t2.mobile like concat('%', #{dto.keyWord}, '%')
- or t6.mobile LIKE concat('%', #{dto.keyWord}, '%')
- )
- </if>
- group by t2.gender
- </select>
- <select id="getStudyStatusCount" parameterType="com.xjrsoft.module.student.dto.BaseStudentInfoPageDto" resultType="com.xjrsoft.module.student.vo.BaseStudentInfoCategoryVo">
- SELECT t3.stduy_status as category,COUNT(*) as number,t2.gender FROM base_student t1
- INNER JOIN xjr_user t2 ON t1.user_id = t2.id
- INNER JOIN base_student_school_roll t3 ON t1.user_id = t3.user_id
- LEFT JOIN base_class t4 ON t3.class_id = t4.id
- LEFT JOIN xjr_user t5 ON t4.teacher_id = t5.id
- LEFT JOIN base_student_family_member t6 ON t6.user_id = t2.id AND t6.delete_mark = 0 AND t6.is_guardian = 1
- WHERE t2.delete_mark = 0
- AND t1.delete_mark = 0
- and t3.archives_status = 'FB2901'
- <if test="dto.gradeId != null">
- and t4.grade_id = #{dto.gradeId}
- </if>
- <if test="dto.majorSetId != null">
- and t3.major_set_id = #{dto.majorSetId}
- </if>
- <if test="dto.classId != null">
- and t4.id = #{dto.classId}
- </if>
- <if test="dto.teacherId != null">
- and t4.teacher_id = #{dto.teacherId}
- </if>
- <if test="dto.keyWord != null and dto.keyWord != ''">
- and (t4.name like concat('%', #{dto.keyWord}, '%')
- or t2.name like concat('%', #{dto.keyWord}, '%')
- or t5.name like concat('%', #{dto.keyWord}, '%')
- or t1.student_id like concat('%', #{dto.keyWord}, '%')
- or t2.mobile like concat('%', #{dto.keyWord}, '%')
- or t6.mobile LIKE concat('%', #{dto.keyWord}, '%')
- )
- </if>
- group by t3.stduy_status,t2.gender
- </select>
- </mapper>
|