From b9adf4c45f66bba456286610b20ed94eab7d074b Mon Sep 17 00:00:00 2001 From: zhaolongfei <2651195677@qq.com> Date: Fri, 2 Aug 2024 17:08:00 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=A4=9A=E6=AC=A1?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E6=8F=90=E4=BA=A4=E6=8A=A5=E9=94=99=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../school/study/service/impl/StudyHomeWorkServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/servers/boe-server-all/src/main/java/com/xboe/school/study/service/impl/StudyHomeWorkServiceImpl.java b/servers/boe-server-all/src/main/java/com/xboe/school/study/service/impl/StudyHomeWorkServiceImpl.java index 39463f2d..0ddb5e80 100644 --- a/servers/boe-server-all/src/main/java/com/xboe/school/study/service/impl/StudyHomeWorkServiceImpl.java +++ b/servers/boe-server-all/src/main/java/com/xboe/school/study/service/impl/StudyHomeWorkServiceImpl.java @@ -68,7 +68,7 @@ public class StudyHomeWorkServiceImpl implements IStudyHomeWorkService{ //dao.save(homework); //设置id。然后进行悠 homework.setId(obj.toString()); - String sql = "select id,content_id,course_id,hw_name,study_id,study_item_id from boe_study_homework where content_id = '"+homework.getContentId()+"' and study_id = '"+homework.getStudyId()+"' and course_id = '"+homework.getCourseId()+"'";; + String sql = "select id,content_id,course_id,hw_name,study_id,study_item_id from boe_study_homework where content_id = '"+homework.getContentId()+"' and study_id = '"+homework.getStudyId()+"' and course_id = '"+homework.getCourseId()+"' and hw.id = '"+homework.getHwId()+"' ";; if (!sql.isEmpty()) { List list = dao.sqlFindList(sql); for (Object[] objs : list) { From 28b58a73cf7494a65a1f268e8c32a9e982839ffb Mon Sep 17 00:00:00 2001 From: zhaolongfei <2651195677@qq.com> Date: Mon, 5 Aug 2024 10:29:36 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=9C=A8=E7=BA=BF=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=AE=8C=E6=88=90=E6=83=85=E5=86=B5=E5=90=8D?= =?UTF-8?q?=E7=A7=B0=E6=90=9C=E7=B4=A2=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../study/service/impl/StudyServiceImpl.java | 40 ++++--------------- 1 file changed, 8 insertions(+), 32 deletions(-) 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 0534e358..63859d72 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 @@ -193,16 +193,16 @@ public class StudyServiceImpl implements IStudyService{ }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 " + " 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+"' and bsc.id not in(" + + " where bsc.course_id = '"+courseId+"' and bsc.aname like '%"+name+"%' 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" + + " where item.course_id = '" + courseId + "' and item.content_id = '"+ contentId+"' and item.aname like '%"+name+"%' group by item.study_id" + " ) group by bsc.id limit "+ pageIndex2+","+ pageSize+";"; String sql2 = "select count(*) as total from (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 " + " 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+"' and bsc.id not in(" + + " where bsc.course_id = '"+courseId+"' and bsc.aname like '%"+name+"%' 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" + + " where item.course_id = '" + courseId + "' and item.content_id = '"+ contentId+"' and item.aname like '%"+name+"%' group by item.study_id" + " ) group by bsc.id) as total"; log.info("资源完成情况未开始sql"+sql); List list = scDao.sqlFindList(sql); @@ -224,46 +224,22 @@ public class StudyServiceImpl implements IStudyService{ return pageList; } } -// String sql = "select * from (select bsc.id,bsc.course_id,bsc.course_name,bsc.aname,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.`status` in (2,9) and bsc.course_id = '"+ courseId+"' group by bsc.id " + -// " UNION ALL " + -// " select bsc.id,bsc.course_id,bsc.course_name,bsc.aname,0 as progress,1 as status from boe_study_course bsc " + -// " LEFT JOIN boe_study_course_item item on item.course_id = bsc.course_id " + -// " where bsc.course_id = '"+courseId+"' and bsc.id not in (" + -// " select 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 + "' and item.content_id = '"+ contentId+"' group by bsc.id" + -// " )group by bsc.id) a group by a.id limit "+ pageIndex+","+ pageSize+";"; - -// String sql2 = "select count(*) from (select bsc.id,bsc.course_id,bsc.course_name,bsc.aname,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.`status` in (2,9) and bsc.course_id = '"+ courseId+"' group by bsc.id " + -// " UNION ALL " + -// " select bsc.id,bsc.course_id,bsc.course_name,bsc.aname,0 as progress,1 as status from boe_study_course bsc " + -// " LEFT JOIN boe_study_course_item item on item.course_id = bsc.course_id " + -// " where bsc.course_id = '"+courseId+"' and bsc.id not in (" + -// " select 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 + "' 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, 1) as status " + - "from (select id, course_id, course_name, aname, 0, 1 from boe_study_course where course_id = '" + courseId + "') a " + + "from (select id, course_id, course_name, aname, 0, 1 from boe_study_course where course_id = '" + courseId + "' and aname like '%"+name+"%') 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 " + + "where bsc.course_id = '" + courseId + "' and item.content_id = '" + contentId + "' and item.aname like '%"+name+"%' group by bsc.id) b " + "on a.course_id = b.course_id and a.id = b.id " + "group by a.id limit "+ pageIndex2+","+ pageSize+";"; String sql2 = "select count(*) as total from (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 " + + "from (select id, course_id, course_name, aname, 0, 1 from boe_study_course where course_id = '" + courseId + "'and aname like '%"+name+"%') 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 " + + "where bsc.course_id = '" + courseId + "' and item.content_id = '" + contentId + "' and item.aname like '%"+name+"% group by bsc.id) b " + "on a.course_id = b.course_id and a.id = b.id " + "group by a.id) as total"; log.info("资源完成情况全部sql"+sql);