Merge branch 'zcwy0731-llf' into master-0705

This commit is contained in:
nisen
2024-08-05 19:03:09 +08:00
3 changed files with 9 additions and 36 deletions

View File

@@ -12,13 +12,10 @@ import com.xboe.module.dict.entity.DictDto;
import com.xboe.module.exam.entity.ExamTest;
import com.xboe.school.study.entity.StudyCourse;
import com.xboe.system.user.dao.UserDao;
import com.xboe.system.user.entity.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Optional;

View File

@@ -67,7 +67,7 @@ public class StudyHomeWorkServiceImpl implements IStudyHomeWorkService{
//只是保留一条作业记录,不再保存多条记录了
//dao.save(homework);
//设置id。然后进行悠
homework.setId(obj.toString());
homework.setId(homework.getStudyItemId());
dao.update(homework);
}
}

View File

@@ -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<Object[]> 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);