diff --git a/servers/boe-server-all/src/main/java/com/xboe/school/study/service/impl/StudyServiceImpl.java b/servers/boe-server-all/src/main/java/com/xboe/school/study/service/impl/StudyServiceImpl.java index cf5b51e6..22a65aa2 100644 --- a/servers/boe-server-all/src/main/java/com/xboe/school/study/service/impl/StudyServiceImpl.java +++ b/servers/boe-server-all/src/main/java/com/xboe/school/study/service/impl/StudyServiceImpl.java @@ -196,7 +196,7 @@ public class StudyServiceImpl implements IStudyService{ " where bsc.course_id = '"+courseId+"' and bsc.id not in(" + " select item.study_id from boe_study_course_item item " + " where item.course_id = '" + courseId + "' and item.content_id = '"+ contentId+"' group by item.study_id" + - " ) group by bsc.id limit "+ pageIndex+","+ pageSize+";"; + " ) group by bsc.id"; String sql2 = "select count(*) 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" + @@ -243,18 +243,23 @@ public class StudyServiceImpl implements IStudyService{ // " 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 + "' and item.content_id = '"+ contentId+"' group by bsc.id" + // " )group by bsc.id) a group by a.id"; - 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,0) as status " + + 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 " + " from (select id,course_id,course_name,aname,0,1 from boe_study_course where course_id = ‘"+courseId+"')a " + " left join" + " (select bsc.id,bsc.course_id,bsc.course_name,bsc.aname,item.finish_time,item.progress,item.status" + " 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 +"' and item.content_id = '"+ contentId+"' group by bsc.id)b group by a.id"; + " where bsc.course_id = '"+courseId +"' and item.content_id = '"+contentId+"' group by bsc.id)b " + + " on a.course_id = b.course_id and a.id = b.id" + + " group by a.id"; String sql2 = "select count(*) as status " + " from (select id,course_id,course_name,aname,0,1 from boe_study_course where course_id = ‘"+courseId+"')a " + " left join" + " (select bsc.id,bsc.course_id,bsc.course_name,bsc.aname,item.finish_time,item.progress,item.status" + " 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 +"' and item.content_id = '"+ contentId+"' group by bsc.id)b group by a.id"; + " where bsc.course_id = '"+courseId +"' and item.content_id = '"+ contentId+"' group by bsc.id)b " + + " on a.course_id = b.course_id and a.id = b.id" + + " group by a.id"; log.info("资源完成情况全部sql"+sql); List list = scDao.sqlFindList(sql); log.info("资源完成情况人数"+list);