修改小班评分列表顺序

This commit is contained in:
wuchunlei
2025-05-21 14:16:19 +08:00
parent b1b3a9531c
commit e989ebeacf
3 changed files with 20 additions and 18 deletions

View File

@@ -48,4 +48,6 @@ public class ClassTask {
private boolean isReply;
@TableField(exist = false)
private Object otherInfo;
@TableField(exist = false)
private int flag;
}

View File

@@ -42,4 +42,6 @@ public class ClassTaskAndQuesReply {
@TableField(exist = false)
private Object createUser;
@TableField(exist = false)
private int flag;
}

View File

@@ -876,11 +876,13 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
public Page getClassTaskList(Map<String, Object> params) {
Integer limit = Integer.valueOf(params.get("limit").toString());
Integer page = Integer.valueOf(params.get("page").toString());
LambdaQueryWrapper<ClassTask> wrapper = new LambdaQueryWrapper<>();
MPJLambdaWrapper<ClassTask> wrapper = new MPJLambdaWrapper<>();
wrapper.eq(ClassTask::getClassId,params.get("classId"));
if (StringUtils.isNotEmpty(params.get("type").toString())){
if ("2".equals(params.get("type").toString())){
wrapper.orderByAsc(ClassTask::getScoreSuccess);
wrapper.selectAll(ClassTask.class);
wrapper.select("IF(LOCATE('"+"\""+ShiroUtils.getUId()+"\""+"', score_info)>0,1,0) as flag");
wrapper.orderByAsc("flag");
}
wrapper.eq(ClassTask::getType,params.get("type"));
}
@@ -1006,11 +1008,13 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
public Page getReplyListByTaskId(Map<String, Object> params) {
Integer limit = Integer.valueOf(params.get("limit").toString());
Integer page = Integer.valueOf(params.get("page").toString());
LambdaQueryWrapper<ClassTaskAndQuesReply> wrapper = new LambdaQueryWrapper<>();
MPJLambdaWrapper<ClassTaskAndQuesReply> wrapper = new MPJLambdaWrapper<>();
wrapper.eq(ClassTaskAndQuesReply::getType,0);
wrapper.eq(ClassTaskAndQuesReply::getRelationId,params.get("taskId"));
wrapper.orderByAsc(ClassTaskAndQuesReply::getScoreSuccess);
wrapper.orderByDesc(ClassTaskAndQuesReply::getCreateTime);
wrapper.selectAll(ClassTaskAndQuesReply.class);
wrapper.select("IF(LOCATE('"+"\""+ShiroUtils.getUId()+"\""+"', score_info)>0,1,0) as flag");
wrapper.orderByAsc("flag");
wrapper.orderByAsc(ClassTaskAndQuesReply::getCreateTime);
Page<ClassTaskAndQuesReply> TaskAndQuesReplyPage = classTaskAndQuesReplyDao.selectPage(new Page<>(page, limit), wrapper);
for (ClassTaskAndQuesReply classTaskAndQuesReply :TaskAndQuesReplyPage.getRecords()){
classTaskAndQuesReply.setCreateUser(myUserDao.selectById(classTaskAndQuesReply.getUserId()));
@@ -1225,8 +1229,10 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
replyWrap.leftJoin(ClassCourse.class,ClassCourse::getCourseId,CourseCatalogueChapterEntity::getCourseId);
replyWrap.leftJoin(CourseEntity.class,CourseEntity::getId,ClassCourse::getCourseId);
replyWrap.leftJoin(ClassEntity.class,ClassEntity::getModelId,ClassCourse::getModelId);
replyWrap.eq(ClassEntity::getId,params.get("classId"));
replyWrap.distinct();
replyWrap.eq(ClassTaskAndQuesReply::getClassId,params.get("classId"));
replyWrap.eq(ClassTaskAndQuesReply::getType,"1");
replyWrap.select("IF(LOCATE('"+"\""+ShiroUtils.getUId()+"\""+"', score_info)>0,1,0) as flag");
replyWrap.selectAs(ClassTaskAndQuesReply::getId,"replyId");
replyWrap.selectAs(ClassTaskAndQuesReply::getContent,"content");
replyWrap.selectAs(ClassTaskAndQuesReply::getImg,"img");
@@ -1237,20 +1243,12 @@ public class ClassEntityServiceImpl extends ServiceImpl<ClassEntityDao, ClassEnt
replyWrap.selectAs(CourseCatalogueChapterEntity::getTitle,"chapterTitle");
replyWrap.selectAs(CourseEntity::getTitle,"courseTitle");
replyWrap.selectAs(CourseCatalogueChapterEntity::getQuestions,"questions");
replyWrap.orderByAsc(ClassTaskAndQuesReply::getScoreSuccess);
replyWrap.selectAs(ClassTaskAndQuesReply::getCreateTime,"createTime");
replyWrap.orderByAsc("flag");
replyWrap.orderByAsc("createTime");
Page<Map<String,Object>> replyPage = classTaskAndQuesReplyDao.selectMapsPage(new Page<>(page, limit), replyWrap);
for (Map<String,Object> map:replyPage.getRecords()){
int alreadyReply = classTaskAndQuesReplyDao.selectCount(new LambdaQueryWrapper<ClassTaskAndQuesReply>()
.eq(ClassTaskAndQuesReply::getType,1)
.eq(ClassTaskAndQuesReply::getRelationId,params.get("classId")));
int userNoCount = classTaskAndQuesReplyDao.selectCount(new LambdaQueryWrapper<ClassTaskAndQuesReply>()
.eq(ClassTaskAndQuesReply::getType,1)
.eq(ClassTaskAndQuesReply::getRelationId,params.get("classId"))
.notLike(ClassTaskAndQuesReply::getScoreInfo,"\""+ShiroUtils.getUId()+"\""));
Map<String,Object> result = new HashMap<>();
result.put("setGiveHomeWorkNumber",alreadyReply);
result.put("userNoCount",userNoCount);
map.put("otherInfo",result);
map.put("otherInfo","");
}
return replyPage;
}