12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- <?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.ssj.service.mapper.LibVipMapper">
- <select id="findManageStudentList" resultType="com.ssj.service.weixin.library.dto.StudentDTO">
- select tb_lib_vip.id vipId,
- tb_lib_vip.child_name studentName,
- tb_lib_vip.img_url,
- service.service_sort,
- service.end_time,
- service.correct_type,
- service.type
- from tb_lib_vip
- join (select tb_lib_vip_service.vip_id,
- ifnull(tb_lib_vip_service.service_sort, 0) service_sort,
- tb_lib_vip_service.end_time,
- tb_lib_vip_service.correct_type,
- tb_lib_vip_service.type
- from (select vip_id
- from (select class_id
- from tb_class_teacher
- where lib_id = #{libId}
- and teacher_id = #{teacherId}
- and status = 1) classTeacher
- join tb_class_student
- on classTeacher.class_id = tb_class_student.class_id and
- tb_class_student.status = 1) classStudent
- join tb_lib_vip_service
- on classStudent.vip_id = tb_lib_vip_service.vip_id and
- tb_lib_vip_service.stat = 1 and
- now() between start_time and end_time) service
- on service.vip_id = tb_lib_vip.id and tb_lib_vip.lib_id = #{libId}
- </select>
- <select id="findGradeAndSchoolById" resultType="com.ssj.bean.weixin.libmy.domain.LibVip">
- SELECT v.school,v.grade from tb_lib_vip v where v.id=#{vipId}
- </select>
- <select id="findGradeAndSchoolAndSubjectByHomeworkId" resultType="com.ssj.bean.weixin.libmy.domain.LibVip">
- SELECT v.school,v.grade, h.subject course_name from tb_lib_vip v left join scon_homework h on v.id=h.vip_id where h.id=#{homeworkId}
- </select>
- <select id="findSignInStudentList" resultType="com.ssj.service.conch.teacher.library.dto.StudentDto">
- select t.id vipId,
- t.child_name studentName,
- t.school,
- t.grade,
- t.img_url imgUrl
- from tb_lib_vip t
- where t.lib_id = #{libId} and t.user_id is not null
- <!--and t.stat='1'-->
- and t.id not in
- (select vip_id
- from tb_lib_subscribe
- where lib_id = #{libId}
- and flow_stat = '3'
- and stat = '1'
- and to_days(ryke_time) = to_days(now())
- )
- <!--当前有服务且不在节假日中间-->
- and exists(
- select 1
- from (select s.*
- from (select *
- from tb_lib_vip_service
- where stat = 1
- and species in ('S003', 'S999')
- and to_days(start_time) <= to_days(now())
- and to_days(end_time) >= to_days(now())
- order by service_sort) s
- group by s.vip_id) s1
- where s1.vip_id = t.id
- and (s1.lib_id is null
- or not exists(
- select 1
- from tb_vacation_limit s2
- where s2.set_state = 2
- and to_days(s2.start_date) <= to_days(now())
- and to_days(s2.end_date) >= to_days(now())
- and s1.lib_id = s2.lib_id
- )
- )
- )
- <if test="studentName != null and studentName != '' ">
- and t.child_name regexp #{studentName}
- </if>
- </select>
- </mapper>
|