mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-11 03:46:50 +08:00
feat资源学习列表新增content_id
This commit is contained in:
@@ -6,6 +6,7 @@ import com.xboe.school.study.dto.CourseFinishCountDto;
|
||||
import com.xboe.school.study.entity.StudyCourse;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -24,8 +25,10 @@ public class CourseStatDao extends BaseDao<StudyCourse> {
|
||||
public List<CourseFinishCountDto> findFinishCountPage(int startIndex, int pageSize, String courseId, String contentName) {
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.append("SELECT ")
|
||||
// 课程名(和DTO字段对应)
|
||||
// 资源名
|
||||
.append("c.content_name AS contentName, ")
|
||||
// 资源ID
|
||||
.append("c.content_id AS contentId, ")
|
||||
// 完成人数(去重统计)
|
||||
.append("COUNT(DISTINCT c.aid) AS finishCount, ")
|
||||
//2025.11.27新增:资源类型
|
||||
@@ -65,8 +68,9 @@ public class CourseStatDao extends BaseDao<StudyCourse> {
|
||||
for (Object[] objs : resultList) {
|
||||
CourseFinishCountDto dto = new CourseFinishCountDto();
|
||||
dto.setContentName(objs[0] != null ? (String) objs[0] : "");
|
||||
dto.setFinishCount(objs[1] != null ? ((Number) objs[1]).intValue() : 0);
|
||||
dto.setContentType((Integer) objs[2]);
|
||||
dto.setContentId(((BigInteger) objs[1]).toString());
|
||||
dto.setFinishCount(objs[2] != null ? ((Number) objs[1]).intValue() : 0);
|
||||
dto.setContentType((Integer) objs[3]);
|
||||
dtoList.add(dto);
|
||||
}
|
||||
return dtoList;
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.xboe.school.study.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigInteger;
|
||||
|
||||
/**
|
||||
* 课程完成人数统计DTO
|
||||
*/
|
||||
@@ -13,6 +15,11 @@ public class CourseFinishCountDto {
|
||||
*/
|
||||
private String contentName;
|
||||
|
||||
/**
|
||||
* 内容ID
|
||||
*/
|
||||
private String contentId;
|
||||
|
||||
/**
|
||||
* 完成人数(数据库 count 统计得出)
|
||||
*/
|
||||
@@ -24,4 +31,5 @@ public class CourseFinishCountDto {
|
||||
*/
|
||||
private Integer contentType;
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user