fix: 增加条件查询学生评价条件项为空白字符串时不计入条件的接口健壮性

11111
winter 1 year ago
parent c34e87ca0d
commit a09d61b020

@ -34,6 +34,7 @@ public interface AppraiseRecordRepository extends CosmosRepository<AppraiseRecor
@Query("select value n from Student as c join n in c.nodes where " +
"(IS_NULL(@targetId) or c.targetId = @targetId) and " +
"(IS_NULL(@targetType) or c.targetType = @targetType) and " +
"(IS_NULL(@classId) or c.classId = @classId) and " +
"(IS_NULL(@creatorId) or n.creatorId = @creatorId) and " +
"(IS_NULL(@academicYearId) or c.academicYearId = @academicYearId) and " +
"c.code = @code")

@ -13,7 +13,7 @@ import javax.validation.constraints.NotNull;
public class FindVoteRecordDto {
@NotNull
@ApiModelProperty(value = "必要参数,用于获取学年")
@ApiModelProperty(value = "必要参数,用于获取学年", required = true)
private String periodId;
@ApiModelProperty(value = "班级或学生 id, 注意: 无参则默认获取登录老师在该学年下评价的所有记录")

@ -96,7 +96,7 @@ public class EvaluationServiceImpl implements EvaluationService {
}
/**
* id
* id ()
*/
private void refreshAppraiseTree(List<AppraiseTreeNode> nodes) {
List<AppraiseTreeNode> children = nodes.stream().filter(item -> item.getPid() != null).collect(Collectors.toList());
@ -308,10 +308,10 @@ public class EvaluationServiceImpl implements EvaluationService {
@Override
public List<AppraiseRecordItem> findVoteRecord(FindVoteRecordDto findVoteRecordDto) {
String periodId = findVoteRecordDto.getTargetId();
String targetId = findVoteRecordDto.getTargetId();
String targetType = findVoteRecordDto.getTargetType();
String classId = findVoteRecordDto.getClassId();
String periodId = findVoteRecordDto.getPeriodId();
String targetId = StringUtils.isBlank(findVoteRecordDto.getTargetId()) ? null : findVoteRecordDto.getTargetId();
String targetType = StringUtils.isBlank(findVoteRecordDto.getTargetType()) ? null : findVoteRecordDto.getTargetType();
String classId = StringUtils.isBlank(findVoteRecordDto.getClassId()) ? null : findVoteRecordDto.getClassId();
User loginUser = SecurityUtil.getLoginUser();
String teacherId = loginUser.getId();
String schoolId = loginUser.getSchoolId();

@ -86,7 +86,7 @@ class TeamModelExtensionApplicationTests {
//List<AppraiseTreeNode> nodeById = appraiseRepository.findNodeById("habook", "default", "Appraise", "43e23f03-288c-4012-b5f3-4d5c022739a2");
//System.out.println(nodeById);
System.out.println(schoolRepository.findSemestersById("hbcn", "be32942d-97a9-52ba-45d6-2e5b722583f5"));
System.out.println(schoolRepository.findSemestersById("habook", "50fdecdb-6cbd-4c9a-8dc2-a627f4d6b312"));
// 评价记录
//List<AppraiseRecord> record = appraiseRecordRepository.findScoreAndPraise("fakeStudentId1",
// "2023-71fbd0bd-9a46-0490-f6b3-7d16cba4c017",

Loading…
Cancel
Save