| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 |
- <?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.BaseStudentPunishmentInfoMapper">
- <select id="getPage" parameterType="com.xjrsoft.module.student.dto.BaseStudentPunishmentInfoPageDto"
- resultType="com.xjrsoft.module.student.vo.BaseStudentPunishmentInfoPageVo">
- SELECT t.id,
- t1.name AS baseSemesterName,
- t2.punishment_type AS punishmentType,
- t.start_time,
- t.end_time,
- t.is_publicity,
- t.push_message_object,
- t.reason,
- t.class_name,
- t5.name,
- t5.credential_number,
- t6.name AS gender,
- t3.name AS teacher_name,
- t.class_id,ifnull((SELECT punishment_type_id FROM base_punishment_student_handle
- WHERE base_student_punishment_info_id = t.id
- ORDER BY adjust_date DESC,id desc LIMIT 1), t.punishment_type_id) as punishment_type_id,
- (SELECT IF(a1.adjust_type = 3, REPLACE(REPLACE(REPLACE(adjust_type,1,'升级'),2,'降级'),3,'撤销'),CONCAT(REPLACE(REPLACE(REPLACE(adjust_type,1,'升级'),2,'降级'),3,'撤销'),'(',a2.punishment_type,')')) FROM base_punishment_student_handle a1
- LEFT JOIN base_punishment_type a2 ON a1.punishment_type_id = a2.id
- WHERE base_student_punishment_info_id = t.id
- ORDER BY adjust_date DESC,a1.id DESC LIMIT 1) AS adjust_type,
- (SELECT adjust_date FROM base_punishment_student_handle
- WHERE base_student_punishment_info_id = t.id
- ORDER BY adjust_date DESC,id desc LIMIT 1) as adjust_date,
- (SELECT adjust_reason FROM base_punishment_student_handle
- WHERE base_student_punishment_info_id = t.id
- ORDER BY adjust_date DESC,id desc LIMIT 1) as adjust_reason,
- (SELECT COUNT(*) FROM base_punishment_student_handle
- WHERE base_student_punishment_info_id = t.id) as handle_count
- FROM base_student_punishment_info t
- INNER JOIN base_punishment_type t2 ON (t2.id = t.punishment_type_id)
- INNER JOIN xjr_user t5 ON (t.user_id = t5.id)
- LEFT JOIN base_semester t1 ON (t1.id = t.base_semester_id)
- LEFT JOIN xjr_user t3 ON (t3.id = t.teacher_id)
- LEFT JOIN xjr_dictionary_detail t6 ON (t6.code = t5.gender)
- WHERE t.delete_mark = 0
- <if test="dto.semesterId != null and dto.semesterId > 0">
- and t.base_semester_id = #{dto.semesterId}
- </if>
- <if test="dto.punishmentTypeId != null and dto.punishmentTypeId > 0">
- and t.punishment_type_id = #{dto.punishmentTypeId}
- </if>
- <if test="dto.startTime != null and dto.startTime != '' and dto.endTime != null and dto.endTime != ''">
- and t1.start_time between date_format(#{dto.startTime}, '%Y-%m-%d') and date_format(#{dto.endTime}, '%Y-%m-%d')
- </if>
- <if test="dto.credentialNumber != null and dto.credentialNumber != ''">
- and t5.credential_number = #{dto.credentialNumber}
- </if>
- <if test="dto.name != null and dto.name != ''">
- and t.name like concat('%', #{dto.name},'%')
- </if>
- ORDER BY t.id DESC;
- </select>
- <select id="getMobilePage" parameterType="com.xjrsoft.module.student.dto.BaseStudentPunishmentInfoMobilePageDto"
- resultType="com.xjrsoft.module.student.vo.BaseStudentPunishmentInfoMobilePageVo">
- SELECT t1.id,t3.name AS student_name,t3.gender,t3.credential_number,t4.punishment_type,t1.reason,t1.start_time
- FROM base_student_punishment_info t1
- INNER JOIN base_student_school_roll t2 ON t1.user_id = t2.user_id
- INNER JOIN xjr_user t3 ON t1.user_id = t3.id
- LEFT JOIN base_punishment_type t4 ON t1.punishment_type_id = t4.id
- LEFT JOIN base_class t5 ON t2.class_id = t5.id
- WHERE t1.delete_mark = 0 AND t3.delete_mark = 0 AND t2.delete_mark = 0
- AND t5.id IN (SELECT id FROM base_class WHERE teacher_id = #{dto.teacherId})
- <if test="dto.punishmentTypeIds != null and dto.punishmentTypeIds.size() > 0">
- AND t4.id in
- <foreach item="punishmentTypeId" index="index" collection="dto.punishmentTypeIds" open="(" close=")"
- separator=",">
- #{punishmentTypeId}
- </foreach>
- </if>
- <if test="dto.startDate != null and dto.startDate != '' and dto.endDate != null and dto.endDate != ''">
- and t1.start_time between date_format(#{dto.startDate}, '%Y-%m-%d') and date_format(#{dto.endDate}, '%Y-%m-%d')
- </if>
- <if test="dto.isHandle != null">
- and t1.adjust_type is not null
- </if>
- <if test="dto.studentName != null and dto.studentName != ''">
- and (t3.name like concat('%',#{dto.studentName},'%') or t3.credential_number like concat('%',#{dto.studentName},'%'))
- </if>
- </select>
- <select id="getMobileInfo" parameterType="com.xjrsoft.module.student.dto.BaseStudentPunishmentInfoMobileDetailDto"
- resultType="com.xjrsoft.module.student.vo.BaseStudentPunishmentInfoMobileDetailVo">
- SELECT t.id,
- t1.name AS baseSemesterName,
- t2.punishment_type AS punishmentType,
- t.start_time,
- t.end_time,
- t.is_publicity,
- t.push_message_object,
- t.reason,
- t.class_name,
- t5.name as student_name,
- t5.name,
- t5.credential_number,
- t6.name AS gender,
- t5.credential_number as student_id,
- t3.name AS teacher_name,
- t.class_id,
- t8.name as major,
- (SELECT IF(a1.adjust_type = 3, REPLACE(REPLACE(REPLACE(adjust_type,1,'升级'),2,'降级'),3,'撤销'),CONCAT(REPLACE(REPLACE(REPLACE(adjust_type,1,'升级'),2,'降级'),3,'撤销'),'(',a2.punishment_type,')')) FROM base_punishment_student_handle a1
- LEFT JOIN base_punishment_type a2 ON a1.punishment_type_id = a2.id
- WHERE base_student_punishment_info_id = t.id
- ORDER BY adjust_date DESC,a1.id DESC LIMIT 1) AS adjust_type,
- (SELECT adjust_date FROM base_punishment_student_handle
- WHERE base_student_punishment_info_id = t.id
- ORDER BY adjust_date DESC,id desc LIMIT 1) as adjust_date,
- (SELECT adjust_reason FROM base_punishment_student_handle
- WHERE base_student_punishment_info_id = t.id
- ORDER BY adjust_date DESC,id desc LIMIT 1) as adjust_reason,
- (SELECT COUNT(*) FROM base_punishment_student_handle
- WHERE base_student_punishment_info_id = t.id) as handle_count
- FROM base_student_punishment_info t
- INNER JOIN base_punishment_type t2 ON (t2.id = t.punishment_type_id)
- INNER JOIN xjr_user t5 ON (t.user_id = t5.id)
- LEFT JOIN base_semester t1 ON (t1.id = t.base_semester_id)
- LEFT JOIN xjr_user t3 ON (t3.id = t.teacher_id)
- LEFT JOIN xjr_dictionary_detail t6 ON (t6.code = t5.gender)
- left join base_student_school_roll t7 on t.user_id = t7.user_id
- left join base_major_set t8 on t7.major_set_id = t8.id
- WHERE t.delete_mark = 0
- and t.id = #{dto.id}
- </select>
- <select id="getInfo"
- resultType="com.xjrsoft.module.student.vo.BaseStudentPunishmentInfoDetailVo">
- SELECT t.id,
- t1.name AS baseSemesterName,
- t2.punishment_type AS punishmentType,
- t.start_time,
- t.end_time,
- t.is_publicity,
- t.push_message_object,
- t.reason,
- t.class_name,
- t5.name,
- t5.credential_number,
- t6.name AS gender,
- t3.name AS teacher_name,
- t.class_id,
- (SELECT adjust_type FROM base_punishment_student_handle
- WHERE base_student_punishment_info_id = t.id
- ORDER BY adjust_date DESC LIMIT 1) as adjust_type,
- (SELECT adjust_date FROM base_punishment_student_handle
- WHERE base_student_punishment_info_id = t.id
- ORDER BY adjust_date DESC LIMIT 1) as adjust_date,
- (SELECT adjust_reason FROM base_punishment_student_handle
- WHERE base_student_punishment_info_id = t.id
- ORDER BY adjust_date DESC LIMIT 1) as adjust_reason,
- (SELECT COUNT(*) FROM base_punishment_student_handle
- WHERE base_student_punishment_info_id = t.id) as handle_count,
- t.punishment_type_id,t.base_semester_id
- FROM base_student_punishment_info t
- INNER JOIN base_punishment_type t2 ON (t2.id = t.punishment_type_id)
- INNER JOIN xjr_user t5 ON (t.user_id = t5.id)
- LEFT JOIN base_semester t1 ON (t1.id = t.base_semester_id)
- LEFT JOIN xjr_user t3 ON (t3.id = t.teacher_id)
- LEFT JOIN xjr_dictionary_detail t6 ON (t6.code = t5.gender)
- WHERE t.delete_mark = 0 and t.id = #{id}
- </select>
- </mapper>
|