You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tianze-pro/web/src/main/java/com/ibeetl/jlw/entity/TeacherOpenCourseScheduleSe...

175 lines
6.1 KiB
Java

package com.ibeetl.jlw.entity;
2 years ago
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONUtil;
import com.ibeetl.admin.core.annotation.Dict;
2 years ago
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;
3 years ago
import org.beetl.sql.annotation.entity.AssignID;
2 years ago
import org.beetl.sql.annotation.entity.InsertIgnore;
import org.beetl.sql.annotation.entity.UpdateIgnore;
3 years ago
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;
3 years ago
import java.util.List;
2 years ago
import java.util.Map;
2 years ago
import java.util.stream.Collectors;
import static cn.hutool.core.collection.CollUtil.join;
/*
* --
* gen by Spring Boot2 Admin 2022-09-11
*/
3 years ago
@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删除
2 years ago
@Dict(type="global_open_status")
private Integer teacherOpenCourseScheduleSessionStatus ;
//课程开课ID
3 years ago
@Dict(type="teacher_open_course.teacher_open_course_title.teacher_open_course_status=1")
private Long teacherOpenCourseId ;
//教师ID
3 years ago
@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;
2 years ago
@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;
3 years ago
//组织ID
private Long orgId ;
//用户ID
private Long userId ;
2 years ago
@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 " )
2 years ago
@UpdateIgnore
@InsertIgnore
2 years ago
@DictDeep
3 years ago
private List<TeacherOpenCourseScheduleSessionSnap> sessionTagList;
2 years ago
@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<Map<String, String>> sessionTags;
2 years ago
// 上课班级名称集合
2 years ago
2 years ago
@UpdateIgnore
@InsertIgnore
private String sessionClassListText;
public void setSessionTagList(List<TeacherOpenCourseScheduleSessionSnap> 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<String> 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);
}
}
}