Browse Source

feat:[试验管理][试验方法]已读未读判断

master
HanLong 3 months ago
parent
commit
f2ec9d9498
2 changed files with 31 additions and 0 deletions
  1. +9
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyMethodService.java
  2. +22
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyMethodServiceImpl.java

+ 9
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyMethodService.java View File

@ -31,4 +31,13 @@ public interface IStudyMethodService extends IService
/** 阅读 */ /** 阅读 */
void read(StudyMethodReadForm form); void read(StudyMethodReadForm form);
/**
* 判断用户是否全部已读试验/学科下的试验方法
* @param userId 用户id
* @param studyId 试验id
* @param studySubjectId 试验科学id
* @return true 表示全部已读 false 表示有未读的
*/
Boolean getReadAllMethodStatus(Long userId, Long studyId, Long studySubjectId);
} }

+ 22
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyMethodServiceImpl.java View File

@ -127,4 +127,26 @@ public class StudyMethodServiceImpl extends ServiceImpl
studyMethodReadService.save(studyMethodRead); studyMethodReadService.save(studyMethodRead);
} }
@Override
public Boolean getReadAllMethodStatus(Long userId, Long studyId, Long studySubjectId) {
LambdaQueryWrapper<StudyMethodRead> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(StudyMethodRead::getQmrId, userId)
.eq(StudyMethodRead::getStudyId, studyId);
if(studySubjectId != null) {
queryWrapper.eq(StudyMethodRead::getStudySubjectId, studySubjectId);
}
long readCount = studyMethodReadService.count(queryWrapper);
LambdaQueryWrapper<StudyMethod> studyMethodLambdaQueryWrapper = new LambdaQueryWrapper<>();
studyMethodLambdaQueryWrapper.eq(StudyMethod::getStudyId, studyId);
if(studySubjectId != null) {
studyMethodLambdaQueryWrapper.eq(StudyMethod::getStudySubjectId, studySubjectId);
}
long studyMethodCount = this.count(studyMethodLambdaQueryWrapper);
if(readCount == studyMethodCount) {
return true;
}
return false;
}
} }

Loading…
Cancel
Save