You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
3.5 KiB

<?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.ScClaTimeRuleMapper">
<select id="selectByCondition" resultType="com.ruoyi.school.course.domain.resp.time.RespClaTimeRule">
select b.*,
(select dept_name from sys_dept where sys_dept.dept_id=b.dept_id ) as deptName,
fcn_dict_name_list(b.week_day,'week_day') as week_day_name,
c.course_name,
d.nick_name staff_name
from
sc_cla_time_rule b,
sc_course c,
sys_user d
where b.course_id=c.course_id
and b.teacher_id=d.user_id
and c.tenant_id=#{reqSearchScClaTimeRule.tenantId}
<if test="reqSearchScClaTimeRule.deptId != null">
and b.dept_id=#{reqSearchScClaTimeRule.deptId}
</if>
<if test="reqSearchScClaTimeRule.teacherId != null">
and b.teacher_id=#{reqSearchScClaTimeRule.teacherId}
</if>
<if test="reqSearchScClaTimeRule.filterHoliday != null and reqSearchScClaTimeRule.filterHoliday == true">
and b.filter_holiday='1'
</if>
<if test="reqSearchScClaTimeRule.filterHoliday != null and reqSearchScClaTimeRule.filterHoliday == false">
and b.filter_holiday='0'
</if>
<if test="reqSearchScClaTimeRule.beginDate != null and reqSearchScClaTimeRule.beginDate != ''">
and (#{reqSearchScClaTimeRule.beginDate} between b.begin_date and b.end_date
or #{reqSearchScClaTimeRule.endDate} between b.begin_date and b.end_date
or b.begin_date between #{reqSearchScClaTimeRule.beginDate} and #{reqSearchScClaTimeRule.endDate}
or exists(select 1 from sc_cla_time ct where b.rule_id=ct.rule_id and ct.source='1' and ct.cla_date between #{reqSearchScClaTimeRule.beginDate} and #{reqSearchScClaTimeRule.endDate} ))
</if>
order by b.create_time desc
</select>
<select id="selectByDay" resultType="com.ruoyi.school.course.domain.resp.time.RespClaTimeRule">
select b.*,
c.course_name,
d.nick_name as staff_name
from sc_cla_time_rule b,
sc_course c,
sys_user d
where b.course_id=c.course_id
and b.teacher_id=d.user_id
and b.course_id=#{courseId}
and b.dept_id=#{deptId}
and #{day} between b.begin_date and b.end_date
</select>
<select id="selectByRuleId" resultType="com.ruoyi.school.course.domain.resp.time.RespClaTimeRule">
select b.*,
c.course_name,
d.nick_name as staff_name
from
sc_cla_time_rule b,
sc_course c,
sys_user d
where b.course_id=c.course_id and b.teacher_id=d.user_id
and b.rule_id=#{ruleId}
</select>
<select id="selectClaTimeInfo" resultType="java.lang.String">
select concat(fcn_dict_name_list(a.week_day,'week_day'),' ',substr(a.start_time,1,5),'~',substr(a.end_time,1,5),' (',a.begin_date,'~',a.end_date,')') as cla_time
from sc_cla_time_rule a
where a.course_id=#{courseId}
and a.dept_id=#{deptId}
and a.rule_type='1'
and repeat_type in ('1','3')
and (date_format(now(),'%Y-%m-%d') between a.begin_date and a.end_date or date_format(now(),'%Y-%m-%d') <![CDATA[ < ]]> a.begin_date)
order by a.begin_date
</select>
</mapper>