package com.ibeetl.jlw.entity; import cn.hutool.core.util.ObjectUtil; import cn.hutool.json.JSONUtil; import com.ibeetl.admin.core.annotation.Dict; import com.ibeetl.admin.core.annotation.DictDeep; import com.ibeetl.admin.core.entity.BaseEntity; import com.ibeetl.admin.core.util.ValidateConfig; import lombok.Data; import lombok.EqualsAndHashCode; import org.beetl.sql.annotation.entity.AssignID; import org.beetl.sql.annotation.entity.InsertIgnore; import org.beetl.sql.annotation.entity.UpdateIgnore; import org.beetl.sql.fetch.annotation.Fetch; import org.beetl.sql.fetch.annotation.FetchSql; import javax.validation.constraints.NotNull; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Map; import java.util.stream.Collectors; import static cn.hutool.core.collection.CollUtil.join; /* * 课程开课-排课管理-课表 * gen by Spring Boot2 Admin 2022-09-11 */ @Fetch @Data @EqualsAndHashCode(callSuper=false) public class TeacherOpenCourseScheduleSession extends BaseEntity{ //课程开课-排课位置ID @NotNull(message = "ID不能为空", groups =ValidateConfig.UPDATE.class) // @SeqID(name = ORACLE_CORE_SEQ_NAME) @AssignID(value = "maskAutoID",param = "com.ibeetl.jlw.entity.TeacherOpenCourseScheduleSession") private Long teacherOpenCourseScheduleSessionId ; //创建时间 private Date teacherOpenCourseScheduleSessionAddTime ; //状态(1正常 2删除) @Dict(type="global_open_status") private Integer teacherOpenCourseScheduleSessionStatus ; //课程开课ID @Dict(type="teacher_open_course.teacher_open_course_title.teacher_open_course_status=1") private Long teacherOpenCourseId ; //教师ID @Dict(type="teacher.teacher_name.teacher_status=1") private Long teacherId ; //班级ID集合 private String schoolClassIds ; /** * 开课星期 多个逗号隔开 * 例:T1,T2,T3 代表星期一,星期二,星期三 * * 对应 {@link TeacherOpenCourseScheduleSessionOptions.WeekDetailType} 的name */ private String teacherOpenCourseScheduleSessionStatusWeekDetail; @UpdateIgnore @InsertIgnore private String teacherOpenCourseScheduleSessionStatusWeekDetailText; @FetchSql("select GROUP_CONCAT(t.class_name) from school_class t where FIND_IN_SET(t.class_id, #schoolClassIds#)") @UpdateIgnore @InsertIgnore private String schoolClassIdsText ; // 开始日期 private String teacherOpenCourseScheduleSessionStartDate; // 结束日期 private String teacherOpenCourseScheduleSessionEndDate; // 周次 private Integer teacherOpenCourseScheduleSessionWeekNum; // 节假日是否排课 private Boolean teacherOpenCourseScheduleSessionOpenOnHolidays; // 开课节次和班级的组合JSON格式 // [{班级ID:[节次ID]}] private String teacherOpenCourseScheduleSessionClassList; // 判断是否是多个教室 @UpdateIgnore @InsertIgnore private boolean teacherOpenCourseScheduleSessionClassIsMultiple; //组织ID private Long orgId ; //用户ID private Long userId ; @FetchSql("select t.* from teacher_open_course_schedule_session_snap t where t.teacher_open_course_schedule_session_snap_status = 1 " + " and t.teacher_open_course_id = #teacherOpenCourseId# " + "order by t.teacher_open_course_schedule_session_day_time asc " ) @UpdateIgnore @InsertIgnore @DictDeep private List sessionTagList; @FetchSql("SELECT DISTINCT " + "t.teacher_open_course_schedule_session_tag_name as session_tag_name, " + "CONCAT( t.teacher_open_course_schedule_session_tag_start_time, '~', t.teacher_open_course_schedule_session_tag_end_time ) as session_tag_time, " + "t.teacher_open_course_schedule_session_class_name as session_class_name " + "FROM " + "teacher_open_course_schedule_session_snap t where t.teacher_open_course_schedule_session_snap_status = 1 " + " and t.teacher_open_course_id = #teacherOpenCourseId# " + " " ) @UpdateIgnore @InsertIgnore private List> sessionTags; // 上课班级名称集合 @UpdateIgnore @InsertIgnore private String sessionClassListText; public void setSessionTagList(List sessionTagList) { this.sessionTagList = sessionTagList; if (ObjectUtil.isNotEmpty(sessionTagList)) { this.sessionClassListText = sessionTagList.stream() .map(TeacherOpenCourseScheduleSessionSnap::getTeacherOpenCourseScheduleSessionClassName) .distinct().collect(Collectors.joining(",")); } } public void setTeacherOpenCourseScheduleSessionStatusWeekDetail(String teacherOpenCourseScheduleSessionStatusWeekDetail) { this.teacherOpenCourseScheduleSessionStatusWeekDetail = teacherOpenCourseScheduleSessionStatusWeekDetail; if (ObjectUtil.isNotEmpty(teacherOpenCourseScheduleSessionStatusWeekDetail)) { List weekDetailList = new ArrayList<>(); for (String weekName : teacherOpenCourseScheduleSessionStatusWeekDetail.split(",")) { TeacherOpenCourseScheduleSessionOptions.WeekDetailType value = TeacherOpenCourseScheduleSessionOptions.WeekDetailType.valueOf(weekName); if (value != null) { weekDetailList.add(value.getWeek()); } } this.setTeacherOpenCourseScheduleSessionStatusWeekDetailText(join(weekDetailList, ",")); } } public void setTeacherOpenCourseScheduleSessionClassList(String teacherOpenCourseScheduleSessionClassList) { this.teacherOpenCourseScheduleSessionClassList = teacherOpenCourseScheduleSessionClassList; // 不为空,且字符串是JSON数组 if(ObjectUtil.isNotEmpty(teacherOpenCourseScheduleSessionClassList) && JSONUtil.isTypeJSONArray(teacherOpenCourseScheduleSessionClassList)) { this.setTeacherOpenCourseScheduleSessionClassIsMultiple(JSONUtil.parseArray(teacherOpenCourseScheduleSessionClassList).size() > 1); } } }