From 716ba91c2e9b547fd7d0cce6022030793f717412 Mon Sep 17 00:00:00 2001 From: yangxinyu Date: Thu, 4 Dec 2025 13:14:03 +0800 Subject: [PATCH] =?UTF-8?q?feat=E8=B5=84=E6=BA=90=E5=AD=A6=E4=B9=A0?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=96=B0=E5=A2=9Econtent=5Fid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/xboe/school/study/dao/CourseStatDao.java | 10 +++++++--- .../xboe/school/study/dto/CourseFinishCountDto.java | 8 ++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/servers/boe-server-all/src/main/java/com/xboe/school/study/dao/CourseStatDao.java b/servers/boe-server-all/src/main/java/com/xboe/school/study/dao/CourseStatDao.java index 99f8a73a..af78bfb7 100644 --- a/servers/boe-server-all/src/main/java/com/xboe/school/study/dao/CourseStatDao.java +++ b/servers/boe-server-all/src/main/java/com/xboe/school/study/dao/CourseStatDao.java @@ -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 { public List 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 { 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; diff --git a/servers/boe-server-all/src/main/java/com/xboe/school/study/dto/CourseFinishCountDto.java b/servers/boe-server-all/src/main/java/com/xboe/school/study/dto/CourseFinishCountDto.java index c2f81fba..eeb52552 100644 --- a/servers/boe-server-all/src/main/java/com/xboe/school/study/dto/CourseFinishCountDto.java +++ b/servers/boe-server-all/src/main/java/com/xboe/school/study/dto/CourseFinishCountDto.java @@ -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; + }