Merge remote-tracking branch 'origin/beetlsql3-dev' into beetlsql3-dev

beetlsql3-dev
Mlxa0324 2 years ago
commit 39b97d8b5b

@ -26,6 +26,7 @@ public interface TeacherOpenCourseNoticeDao extends BaseMapper<TeacherOpenCourse
int updateGivenByIds(TeacherOpenCourseNoticeQuery teacherOpenCourseNoticeQuery);
List<TeacherOpenCourseNotice> getByIds(String ids);
List<TeacherOpenCourseNotice> getValuesByQuery(TeacherOpenCourseNoticeQuery teacherOpenCourseNoticeQuery);
List<TeacherOpenCourseNotice> getValuesByQueryNotWithPermission(TeacherOpenCourseNoticeQuery teacherOpenCourseNoticeQuery);
List<SchoolClass> getClassByOpenCourseId(TeacherOpenCourseNotice teacherOpenCourseNotice);

@ -1,6 +1,7 @@
package com.ibeetl.jlw.service;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.NumberUtil;
import cn.jlw.util.ToolUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
@ -29,6 +30,7 @@ import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
@ -218,4 +220,29 @@ public class TeacherOpenCourseNoticeService extends CoreBaseService<TeacherOpenC
}
}
public JsonResult<Integer> getUnreadNotice(Long teacherOpenCourseId, CoreUser coreUser) {
if (coreUser.isStudent()) {
Long id = coreUser.getId();
Student student = studentService.getByUserId(id);
if (student == null) {
return JsonResult.success(0);
}
Long classId = student.getClassId();
TeacherOpenCourseNoticeQuery noticeQuery = new TeacherOpenCourseNoticeQuery();
noticeQuery.setTeacherOpenCourseIds(teacherOpenCourseId+"");
noticeQuery.setSchoolClassIds(classId+"");
List<TeacherOpenCourseNotice> noticeList = teacherOpenCourseNoticeDao.getValuesByQueryNotWithPermission(noticeQuery);
if (CollectionUtil.isEmpty(noticeList)) {
return JsonResult.success(0);
}
Set<Long> collect = noticeList.stream().map(TeacherOpenCourseNotice::getTeacherOpenCourseNoticeId).collect(Collectors.toSet());
TeacherOpenCourseNoticeStudentQuery studentQuery = new TeacherOpenCourseNoticeStudentQuery();
studentQuery.setTeacherOpenCourseNoticeIdPlural(CollectionUtil.join(collect, ","));
studentQuery.setStudentId(student.getStudentId());
List<TeacherOpenCourseNoticeStudent> noticeStudents = noticeStudentService.getValuesByQueryNotWithPermission(studentQuery);
return JsonResult.success(NumberUtil.sub(collect.size() - noticeStudents.size()).intValue());
}
return JsonResult.success(0);
}
}

@ -223,6 +223,15 @@ public class TeacherOpenCourseNoticeController{
return JsonResult.success(list);
}
/**
*
* @return
*/
@GetMapping("/getUnreadNotice")
public JsonResult<Integer> getUnreadNotice(Long teacherOpenCourseId, @SCoreUser CoreUser coreUser) {
return teacherOpenCourseNoticeService.getUnreadNotice(teacherOpenCourseId, coreUser);
}
}

@ -17,10 +17,10 @@ queryByCondition
and find_in_set(t.teacher_open_course_notice_id,#teacherOpenCourseNoticeIdPlural#)
@}
@if(!isEmpty(schoolClassIds)){
and t.school_class_ids =#schoolClassIds#
and (find_in_set(#schoolClassIds#, t.school_class_ids) or t.school_class_ids = "ALL")
@}
@if(!isEmpty(teacherOpenCourseIds)){
and t.teacher_open_course_ids =#teacherOpenCourseIds#
and (find_in_set(#teacherOpenCourseIds#, t.teacher_open_course_ids) or t.teacher_open_course_ids = "ALL")
@}
@if(!isEmpty(noticeTitle)){
and t.notice_title =#noticeTitle#
@ -71,10 +71,10 @@ queryByConditionQuery
and find_in_set(t.teacher_open_course_notice_id,#teacherOpenCourseNoticeIdPlural#)
@}
@if(!isEmpty(schoolClassIds)){
and t.school_class_ids =#schoolClassIds#
and (find_in_set(#schoolClassIds#, t.school_class_ids) or t.school_class_ids = "ALL")
@}
@if(!isEmpty(teacherOpenCourseIds)){
and t.teacher_open_course_ids =#teacherOpenCourseIds#
and (find_in_set(#teacherOpenCourseIds#, t.teacher_open_course_ids) or t.teacher_open_course_ids = "ALL")
@}
@if(!isEmpty(noticeTitle)){
and t.notice_title =#noticeTitle#
@ -212,10 +212,10 @@ getTeacherOpenCourseNoticeValues
and t.teacher_open_course_notice_id =#teacherOpenCourseNoticeId#
@}
@if(!isEmpty(schoolClassIds)){
and t.school_class_ids =#schoolClassIds#
and (find_in_set(#schoolClassIds#, t.school_class_ids) or t.school_class_ids = "ALL")
@}
@if(!isEmpty(teacherOpenCourseIds)){
and t.teacher_open_course_ids =#teacherOpenCourseIds#
and (find_in_set(#teacherOpenCourseIds#, t.teacher_open_course_ids) or t.teacher_open_course_ids = "ALL")
@}
@if(!isEmpty(noticeTitle)){
and t.notice_title =#noticeTitle#
@ -255,10 +255,10 @@ getValuesByQuery
and find_in_set(t.teacher_open_course_notice_id,#teacherOpenCourseNoticeIdPlural#)
@}
@if(!isEmpty(schoolClassIds)){
and t.school_class_ids =#schoolClassIds#
and (find_in_set(#schoolClassIds#, t.school_class_ids) or t.school_class_ids = "ALL")
@}
@if(!isEmpty(teacherOpenCourseIds)){
and t.teacher_open_course_ids =#teacherOpenCourseIds#
and (find_in_set(#teacherOpenCourseIds#, t.teacher_open_course_ids) or t.teacher_open_course_ids = "ALL")
@}
@if(!isEmpty(noticeTitle)){
and t.notice_title =#noticeTitle#
@ -297,6 +297,62 @@ getValuesByQuery
@}
getValuesByQueryNotWithPermission
===
* 根据不为空的参数进行查询
select t.*
from teacher_open_course_notice t
where 1=1
@if(!isEmpty(teacherOpenCourseNoticeId)){
and t.teacher_open_course_notice_id =#teacherOpenCourseNoticeId#
@}
@if(!isEmpty(teacherOpenCourseNoticeIdPlural)){
and find_in_set(t.teacher_open_course_notice_id,#teacherOpenCourseNoticeIdPlural#)
@}
@if(!isEmpty(schoolClassIds)){
and (find_in_set(#schoolClassIds#, t.school_class_ids) or t.school_class_ids = "ALL")
@}
@if(!isEmpty(teacherOpenCourseIds)){
and (find_in_set(#teacherOpenCourseIds#, t.teacher_open_course_ids) or t.teacher_open_course_ids = "ALL")
@}
@if(!isEmpty(noticeTitle)){
and t.notice_title =#noticeTitle#
@}
@if(!isEmpty(noticeContent)){
and t.notice_content =#noticeContent#
@}
@if(!isEmpty(createTime)){
and t.create_time =#createTime#
@}
@if(!isEmpty(createByTeacherId)){
and t.create_by_teacher_id =#createByTeacherId#
@}
@if(!isEmpty(createByTeacherIdPlural)){
and find_in_set(t.create_by_teacher_id,#createByTeacherIdPlural#)
@}
@if(!isEmpty(orgId)){
and t.org_id =#orgId#
@}
@if(!isEmpty(orgIdPlural)){
and find_in_set(t.org_id,#orgIdPlural#)
@}
@if(!isEmpty(userId)){
and t.user_id =#userId#
@}
@if(!isEmpty(userIdPlural)){
and find_in_set(t.user_id,#userIdPlural#)
@}
@if(!isEmpty(delFlag)){
and t.del_flag =#delFlag#
@}
@if(!isEmpty(studentId)){
and find_in_set((select b.class_id
from student b left join school_class ba on ba.class_id = b.class_id
where b.student_status = 1 and ba.class_status = 1 and b.student_id = #studentId# ), t.school_class_ids)
@}
getClassByOpenCourseId
===

Loading…
Cancel
Save