diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyMethodService.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyMethodService.java index ded6d25..dfadc26 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyMethodService.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyMethodService.java @@ -31,4 +31,13 @@ public interface IStudyMethodService extends IService /** 阅读 */ void read(StudyMethodReadForm form); + + /** + * 判断用户是否全部已读试验/学科下的试验方法 + * @param userId 用户id + * @param studyId 试验id + * @param studySubjectId 试验科学id + * @return true 表示全部已读 false 表示有未读的 + */ + Boolean getReadAllMethodStatus(Long userId, Long studyId, Long studySubjectId); } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyMethodServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyMethodServiceImpl.java index 1f65091..cf60a19 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyMethodServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyMethodServiceImpl.java @@ -127,4 +127,26 @@ public class StudyMethodServiceImpl extends ServiceImpl 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 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; + } + }