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