mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-25 10:42:59 +08:00
fix:资源学习完成人数统计排除未报名人员
This commit is contained in:
@@ -6,7 +6,9 @@ import com.xboe.module.course.entity.CourseContent;
|
||||
import com.xboe.module.course.service.ICourseContentService;
|
||||
import com.xboe.school.study.dto.CourseFinishCountDto;
|
||||
import com.xboe.school.study.entity.StudyCourse;
|
||||
import com.xboe.school.study.entity.StudySignup;
|
||||
import com.xboe.school.study.service.IStudyService;
|
||||
import com.xboe.school.study.service.IStudySignupService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Repository;
|
||||
@@ -24,6 +26,9 @@ public class CourseStatDao extends BaseDao<StudyCourse> {
|
||||
@Autowired
|
||||
IStudyService studyService;
|
||||
|
||||
@Autowired
|
||||
IStudySignupService signupService;
|
||||
|
||||
@Autowired
|
||||
ICourseContentService courseContentService;
|
||||
/**
|
||||
@@ -47,8 +52,26 @@ public class CourseStatDao extends BaseDao<StudyCourse> {
|
||||
// 你的课程表名
|
||||
.append("FROM boe_course_content cc ")
|
||||
// 2025.11.27新增:连表 boe_course_content
|
||||
.append("LEFT JOIN boe_study_course_item c ON cc.id = c.content_id AND c.status = 9 ")
|
||||
.append("WHERE 1=1 ")
|
||||
.append("LEFT JOIN boe_study_course_item c ON cc.id = c.content_id AND c.status = 9 ");
|
||||
// 25.12.19新增逻辑:要求管理页面-报名记录,删除报名记录后,学习记录和资源学习情况需要删除,并可以恢复
|
||||
// 实现方案是仅查询已报名aid的学习记录信息
|
||||
// 查询报名记录
|
||||
StudySignup studySignup = new StudySignup();
|
||||
studySignup.setCourseId(courseId);
|
||||
List<StudySignup> signRecordList = signupService.findList(studySignup, null);
|
||||
if (signRecordList != null && !signRecordList.isEmpty()) {
|
||||
String aidList = signRecordList.stream().map(StudySignup::getAid).collect(Collectors.joining(","));
|
||||
if (StringUtils.isNotBlank(aidList)) {
|
||||
sql.append("AND c.aid IN (").append(aidList).append(") ");
|
||||
} else {
|
||||
// 报名人数为空,视为无人报名
|
||||
sql.append("AND 1=0 ");
|
||||
}
|
||||
} else {
|
||||
// 报名人数为空,视为无人报名
|
||||
sql.append("AND 1=0 ");
|
||||
}
|
||||
sql.append("WHERE 1=1 ")
|
||||
.append("AND cc.deleted=0 ");
|
||||
List<Object> params = new ArrayList<>();
|
||||
// courseId非空则过滤(参数化防注入)
|
||||
|
||||
Reference in New Issue
Block a user