fix: 修复查询结果多就出错的bug

11111
winter 1 year ago
parent edc79455cc
commit 38f5bf39ef

@ -18,7 +18,7 @@ import org.springframework.stereotype.Repository;
@Repository @Repository
public interface EvaluationRepository extends CosmosRepository<Appraise, String> { public interface EvaluationRepository extends CosmosRepository<Appraise, String> {
Appraise findBySchoolId(String schoolId, PartitionKey partitionKey); Appraise findBySchoolId(String schoolId, PartitionKey partitionKey);
Appraise findBySchoolIdAndPeriodId(String schoolId, String periodId, PartitionKey partitionKey); Appraise findAppraiseBySchoolIdAndPeriodIdAndCode(String schoolId, String periodId, String code);
} }

@ -47,7 +47,7 @@ public class EvaluationServiceImpl implements EvaluationService {
String schoolId = loginUser.getSchoolId(); String schoolId = loginUser.getSchoolId();
// 拿到要新增节点的原始数据 // 拿到要新增节点的原始数据
Appraise appraise = evaluationRepository.findBySchoolIdAndPeriodId(schoolId, periodId, PK.of(PK.PK_APPRAISE)); Appraise appraise = evaluationRepository.findAppraiseBySchoolIdAndPeriodIdAndCode(schoolId, periodId, PK.PK_APPRAISE);
if (appraise == null) { if (appraise == null) {
throw new ServiceException(ErrorCode.PARAMS_ERROR.getCode(), "学校评价数据不存在"); throw new ServiceException(ErrorCode.PARAMS_ERROR.getCode(), "学校评价数据不存在");
} }

Loading…
Cancel
Save