mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-06 09:26:48 +08:00
feat:补全部分注释,去掉多余日志,补全手动写sql时缺失的item表联表字段(item表id),并赋值到查询数据集合的id字段中
This commit is contained in:
@@ -256,13 +256,16 @@ public class StudyServiceImpl implements IStudyService{
|
|||||||
int pageIndex2 = (pageIndex-1)*10;
|
int pageIndex2 = (pageIndex-1)*10;
|
||||||
if(status!=null) {
|
if(status!=null) {
|
||||||
if(status==3) {
|
if(status==3) {
|
||||||
|
// 进行中
|
||||||
query.addFilter(FieldFilters.eq("status", 2));
|
query.addFilter(FieldFilters.eq("status", 2));
|
||||||
return scItemDao.findPage(query.builder());
|
return scItemDao.findPage(query.builder());
|
||||||
}else if(status==2){
|
}else if(status==2){
|
||||||
|
// 已完成
|
||||||
query.addFilter(FieldFilters.eq("status",9));
|
query.addFilter(FieldFilters.eq("status",9));
|
||||||
return scItemDao.findPage(query.builder());
|
return scItemDao.findPage(query.builder());
|
||||||
}else if (status == 1) {
|
}else if (status == 1) {
|
||||||
String sql = "select bsc.id,bsc.course_id,bsc.course_name,bsc.aname,item.content_id,0 as progress,1 as status from boe_study_course bsc " +
|
// 25.11.27标注:这里是查询没有item联表数据的主表数据,等同于没有学习情况的资源
|
||||||
|
String sql = "select bsc.id,bsc.course_id,bsc.course_name,bsc.aname,item.content_id,0 as progress,1 as status,item.id as item_id from boe_study_course bsc " +
|
||||||
" left join boe_study_course_item item on bsc.course_id = item.course_id and bsc.id = item.study_id" +
|
" left join boe_study_course_item item on bsc.course_id = item.course_id and bsc.id = item.study_id" +
|
||||||
" where bsc.course_id = '" + courseId + "'" +
|
" where bsc.course_id = '" + courseId + "'" +
|
||||||
(StringUtils.isBlank(name) ? "" : "and bsc.aname like '%"+name+"%'") + "and bsc.id not in(" +
|
(StringUtils.isBlank(name) ? "" : "and bsc.aname like '%"+name+"%'") + "and bsc.id not in(" +
|
||||||
@@ -281,19 +284,21 @@ public class StudyServiceImpl implements IStudyService{
|
|||||||
(StringUtils.isBlank(contentId) ? "" : "and item.content_id = '" + contentId + "'") +
|
(StringUtils.isBlank(contentId) ? "" : "and item.content_id = '" + contentId + "'") +
|
||||||
(StringUtils.isBlank(name) ? "" : "and item.aname like '%" + name+"%'") + " group by item.study_id" +
|
(StringUtils.isBlank(name) ? "" : "and item.aname like '%" + name+"%'") + " group by item.study_id" +
|
||||||
" ) group by bsc.id) as total";
|
" ) group by bsc.id) as total";
|
||||||
log.info("资源完成情况未开始sql"+sql);
|
log.info("资源完成情况sql:{}", sql);
|
||||||
List<Object[]> list = scDao.sqlFindList(sql);
|
List<Object[]> list = scDao.sqlFindList(sql);
|
||||||
log.info("资源完成情况人数"+list);
|
|
||||||
int totalCount = scDao.sqlCount(sql2);
|
int totalCount = scDao.sqlCount(sql2);
|
||||||
List<StudyCourseItem> item = new ArrayList<>();
|
List<StudyCourseItem> item = new ArrayList<>();
|
||||||
for (Object[] objs : list) {
|
for (Object[] objs : list) {
|
||||||
StudyCourseItem sc = new StudyCourseItem();
|
StudyCourseItem sc = new StudyCourseItem();
|
||||||
|
// 25.11.27新增,如果有id,添加item表id供后续联表使用
|
||||||
|
if (objs[7] != null) {
|
||||||
|
sc.setId(String.valueOf(objs[7]));
|
||||||
|
}
|
||||||
sc.setProgress(Integer.valueOf(objs[5].toString()));
|
sc.setProgress(Integer.valueOf(objs[5].toString()));
|
||||||
sc.setStatus(Integer.valueOf(objs[6].toString()));
|
sc.setStatus(Integer.valueOf(objs[6].toString()));
|
||||||
sc.setAname(objs[3].toString());
|
sc.setAname(objs[3].toString());
|
||||||
item.add(sc);
|
item.add(sc);
|
||||||
}
|
}
|
||||||
log.info("资源完成情况人员"+item);
|
|
||||||
PageList<StudyCourseItem> pageList = new PageList<>(item);
|
PageList<StudyCourseItem> pageList = new PageList<>(item);
|
||||||
pageList.setCount(totalCount);
|
pageList.setCount(totalCount);
|
||||||
pageList.setPageSize(pageSize);
|
pageList.setPageSize(pageSize);
|
||||||
@@ -301,13 +306,8 @@ public class StudyServiceImpl implements IStudyService{
|
|||||||
return pageList;
|
return pageList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 未传输status的情况,查询所有资源学习情况数据
|
||||||
String sql = "select a.id, a.course_id, a.course_name, a.aname, " +
|
String sql = "select a.id, a.course_id, a.course_name, a.aname, " + "IFNULL(b.finish_time, '0') as finish_time, IFNULL(b.progress, 0) as progress, IFNULL(b.status, 1) as status,b.score,b.item_id " + "from (select id, course_id, course_name, aname, 0, 1 from boe_study_course where course_id = '" + courseId + "'" + (StringUtils.isBlank(name) ? "" : "and item.aname like '%" + name + "%'") + ") a " + "left join " + "(select bsc.id, bsc.course_id, bsc.course_name, bsc.aname, item.id as item_id,item.finish_time, item.progress, item.status,MAX(item.score) score " +
|
||||||
"IFNULL(b.finish_time, '0') as finish_time, IFNULL(b.progress, 0) as progress, IFNULL(b.status, 1) as status,b.score " +
|
|
||||||
"from (select id, course_id, course_name, aname, 0, 1 from boe_study_course where course_id = '" + courseId + "'" +
|
|
||||||
(StringUtils.isBlank(name) ? "" : "and item.aname like '%"+name+"%'") + ") a " +
|
|
||||||
"left join " +
|
|
||||||
"(select bsc.id, bsc.course_id, bsc.course_name, bsc.aname, item.finish_time, item.progress, item.status,MAX(item.score) score " +
|
|
||||||
"from boe_study_course bsc left join boe_study_course_item item on item.course_id = bsc.course_id and item.study_id = bsc.id " +
|
"from boe_study_course bsc left join boe_study_course_item item on item.course_id = bsc.course_id and item.study_id = bsc.id " +
|
||||||
"where bsc.course_id = '" + courseId + "'" +
|
"where bsc.course_id = '" + courseId + "'" +
|
||||||
(StringUtils.isBlank(contentId) ? "" : "and item.content_id = '" + contentId + "'") +
|
(StringUtils.isBlank(contentId) ? "" : "and item.content_id = '" + contentId + "'") +
|
||||||
@@ -323,13 +323,16 @@ public class StudyServiceImpl implements IStudyService{
|
|||||||
" group by bsc.id) b " +
|
" group by bsc.id) b " +
|
||||||
"on a.course_id = b.course_id and a.id = b.id " +
|
"on a.course_id = b.course_id and a.id = b.id " +
|
||||||
"group by a.id) as total";
|
"group by a.id) as total";
|
||||||
log.info("资源完成情况全部sql"+sql);
|
log.info("资源完成情况sql:{}", sql);
|
||||||
List<Object[]> list = scDao.sqlFindList(sql);
|
List<Object[]> list = scDao.sqlFindList(sql);
|
||||||
log.info("资源完成情况人数"+list);
|
|
||||||
int totalCount = scDao.sqlCount(sql2);
|
int totalCount = scDao.sqlCount(sql2);
|
||||||
List<StudyCourseItem> item = new ArrayList<>();
|
List<StudyCourseItem> item = new ArrayList<>();
|
||||||
for (Object[] objs : list) {
|
for (Object[] objs : list) {
|
||||||
StudyCourseItem sc = new StudyCourseItem();
|
StudyCourseItem sc = new StudyCourseItem();
|
||||||
|
// 25.11.27新增,如果有id,添加item表id供后续联表使用
|
||||||
|
if (objs[8] != null) {
|
||||||
|
sc.setId(String.valueOf(objs[8]));
|
||||||
|
}
|
||||||
if (!"0".equals(objs[4].toString())) {
|
if (!"0".equals(objs[4].toString())) {
|
||||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
LocalDateTime finishTime = LocalDateTime.parse(objs[4].toString(), formatter);
|
LocalDateTime finishTime = LocalDateTime.parse(objs[4].toString(), formatter);
|
||||||
@@ -343,7 +346,6 @@ public class StudyServiceImpl implements IStudyService{
|
|||||||
}
|
}
|
||||||
item.add(sc);
|
item.add(sc);
|
||||||
}
|
}
|
||||||
log.info("资源完成情况人员"+item);
|
|
||||||
PageList<StudyCourseItem> pageList = new PageList<>(item);
|
PageList<StudyCourseItem> pageList = new PageList<>(item);
|
||||||
pageList.setCount(totalCount);
|
pageList.setCount(totalCount);
|
||||||
pageList.setPageSize(pageSize);
|
pageList.setPageSize(pageSize);
|
||||||
|
|||||||
Reference in New Issue
Block a user