|
|
|
|
<?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.ruoyi.school.course.mapper.ScCourseClaMapper">
|
|
|
|
|
|
|
|
|
|
<select id="selectClaList" resultType="com.ruoyi.school.course.domain.resp.cla.RespCourseClaInfo">
|
|
|
|
|
select
|
|
|
|
|
a.cla_id,a.cla_name,
|
|
|
|
|
a.capacity,a.recruit_status,a.open_date,
|
|
|
|
|
b.course_id,b.course_name,
|
|
|
|
|
a.staff_id,a.teacher_name,
|
|
|
|
|
sd.dept_name,
|
|
|
|
|
(select group_concat(fcn_dict_name_list(r.week_day,'week_day'),' ',substr(r.start_time,1,5),'~',substr(r.end_time,1,5),' (',r.begin_date,'~',r.end_date,')' SEPARATOR ';')
|
|
|
|
|
from sc_cla_time_rule r
|
|
|
|
|
where r.cla_id=a.cla_id
|
|
|
|
|
and r.rule_type='1'
|
|
|
|
|
and r.repeat_type in ('1','3')
|
|
|
|
|
and (date_format(now(),'%Y-%m-%d') between r.begin_date and r.end_date or date_format(now(),'%Y-%m-%d') <![CDATA[ < ]]> r.begin_date)) as week_day
|
|
|
|
|
from sc_course_cla a
|
|
|
|
|
left join sc_course b on a.course_id=b.course_id
|
|
|
|
|
left join sys_dept sd on a.depart_id=sd.dept_id
|
|
|
|
|
where a.delete_flag='0' and a.tenant_id=#{reqSearchScCourseCla.tenantId}
|
|
|
|
|
<if test="reqSearchScCourseCla.courseId != null">
|
|
|
|
|
and a.course_id=#{reqSearchScCourseCla.courseId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="reqSearchScCourseCla.staffId != null">
|
|
|
|
|
and a.staff_id=#{reqSearchScCourseCla.staffId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="reqSearchScCourseCla.claName != null and reqSearchScCourseCla.claName != ''">
|
|
|
|
|
and a.cla_name like concat('%',#{reqSearchScCourseCla.claName},'%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="reqSearchScCourseCla.departId != null">
|
|
|
|
|
and a.depart_id=#{reqSearchScCourseCla.departId}
|
|
|
|
|
</if>
|
|
|
|
|
and a.delete_flag='0'
|
|
|
|
|
order by a.create_time desc
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectForSelect" resultType="com.ruoyi.school.course.domain.resp.cla.RespCourseClaSelectInfo">
|
|
|
|
|
select a.cla_id,a.cla_name,b.course_id,b.course_name,c.nick_name as staff_name,
|
|
|
|
|
dept.dept_id,
|
|
|
|
|
dept.dept_name
|
|
|
|
|
from sc_course_cla a
|
|
|
|
|
left join sc_course b on a.course_id=b.course_id
|
|
|
|
|
left join sys_user c on a.staff_id=c.user_id
|
|
|
|
|
left join sys_dept dept on a.depart_id=dept.dept_id
|
|
|
|
|
where a.delete_flag='0'
|
|
|
|
|
<if test="search != null and search != ''">
|
|
|
|
|
and (a.cla_name like concat('%',#{search},'%')
|
|
|
|
|
or b.course_name like concat('%',#{search},'%')
|
|
|
|
|
or c.nick_name like concat('%',#{search},'%')
|
|
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
order by a.create_time desc limit 0,#{maxRecord}
|
|
|
|
|
</select>
|
|
|
|
|
<select id="selectClaCount" resultType="java.lang.Integer">
|
|
|
|
|
select count(1) from sc_course_cla cc
|
|
|
|
|
where cc.delete_flag='0'
|
|
|
|
|
<if test="teacherId != null">
|
|
|
|
|
and cc.staff_id=#{teacherId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="deptId != null">
|
|
|
|
|
and cc.depart_id=#{deptId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="deptId == null and userId != null and userId != ''">
|
|
|
|
|
and exists(select 1 from sys_user_dept ud
|
|
|
|
|
where ud.user_id=#{userId}
|
|
|
|
|
and (ud.dept_id=cc.depart_id or ud.dept_id=-1))
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
<select id="selectTenantClaCount" resultType="java.lang.Integer">
|
|
|
|
|
select count(1) from sc_course_cla where tenant_id=#{tenantId} and delete_flag='0'
|
|
|
|
|
</select>
|
|
|
|
|
<select id="selectStudentCnt" resultType="java.lang.Integer">
|
|
|
|
|
|
|
|
|
|
select count(1) from sc_student_course sc where sc.cla_id=#{claId} and sc.status='1'
|
|
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectStudenForClaTime" resultType="RespCourseClaStudent">
|
|
|
|
|
SELECT
|
|
|
|
|
b.student_id,b.student_name,b.sex,b.phone,
|
|
|
|
|
a.course_time_id,
|
|
|
|
|
a.id as book_id,
|
|
|
|
|
a.card_no,
|
|
|
|
|
(select type.card_name from sc_member_card_types type where card.card_type_id=type.card_type_id) as card_type_name,
|
|
|
|
|
a.charge_type,
|
|
|
|
|
a.deduct_cnt,
|
|
|
|
|
a.deduct_fee,
|
|
|
|
|
card.remaining_count,
|
|
|
|
|
card.remaining_total_fee,
|
|
|
|
|
card.expiry_date,
|
|
|
|
|
a.book_status,
|
|
|
|
|
a.create_time,
|
|
|
|
|
a.check_in,
|
|
|
|
|
a.check_in_time,
|
|
|
|
|
c.count_before,
|
|
|
|
|
c.count_after,
|
|
|
|
|
c.fee_before,
|
|
|
|
|
c.fee_after
|
|
|
|
|
from sc_student b ,
|
|
|
|
|
sc_member_cards card,
|
|
|
|
|
sc_book_course a
|
|
|
|
|
LEFT JOIN sc_cla_time_attend c on a.id=c.book_id
|
|
|
|
|
WHERE
|
|
|
|
|
a.card_no=card.card_no
|
|
|
|
|
and a.student_id=b.student_id
|
|
|
|
|
and a.course_time_id=#{courseTimeId}
|
|
|
|
|
</select>
|
|
|
|
|
</mapper>
|