diff --git a/src/main/java/club/joylink/rtss/controller/paper/PagerQuestionBankController.java b/src/main/java/club/joylink/rtss/controller/paper/PagerQuestionBankController.java index 94f792db8..310033d51 100644 --- a/src/main/java/club/joylink/rtss/controller/paper/PagerQuestionBankController.java +++ b/src/main/java/club/joylink/rtss/controller/paper/PagerQuestionBankController.java @@ -44,6 +44,7 @@ public class PagerQuestionBankController { @GetMapping(path = "/org/paging") public PageVO pagingQueryQuestions(@RequestAttribute LoginUserInfoVO loginInfo, QuestionQueryVO queryVO) { queryVO.setOrgId(loginInfo.getTopOrgId()); + queryVO.setOrgId(173L); return questionBankService.pagingQueryQuestions(queryVO,false); } diff --git a/src/main/java/club/joylink/rtss/services/paper/PagerQuestionService.java b/src/main/java/club/joylink/rtss/services/paper/PagerQuestionService.java index df5969421..8925edd00 100644 --- a/src/main/java/club/joylink/rtss/services/paper/PagerQuestionService.java +++ b/src/main/java/club/joylink/rtss/services/paper/PagerQuestionService.java @@ -23,6 +23,7 @@ import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; import javax.annotation.Resource; +import java.lang.reflect.Method; import java.time.LocalDateTime; import java.util.Collection; import java.util.Collections; @@ -61,6 +62,36 @@ public class PagerQuestionService { if(Objects.nonNull(queryVO.getOrgId())){ criteria.andOrgIdEqualTo(queryVO.getOrgId()); + + } + + if(Objects.nonNull(queryVO.getLabels())){ + +// PaperQuestionExample.Criteria criteria2 = example.createCriteria(); +// example.getOredCriteria().add(criteria2); + List tmpLableList = Splitter.on(",").omitEmptyStrings().splitToList(queryVO.getLabels()); + if(Objects.equals(false,CollectionUtils.isEmpty(tmpLableList))){ + StringBuilder sqlBuilder = new StringBuilder("("); + for(var i = 0 ; i < tmpLableList.size();i++){ + String data = tmpLableList.get(i); + if(i != 0){ + sqlBuilder.append(" or "); + } + sqlBuilder.append(String.format(" find_in_set('%s',tags) > 0 ",data)); + } + sqlBuilder.append(")"); + Class criteriaCls = PaperQuestionExample.Criteria.class; + Class generatedCriteriaCls = criteriaCls.getSuperclass(); + try{ + Method addCriterion = generatedCriteriaCls.getDeclaredMethod("addCriterion", String.class); + addCriterion.setAccessible(true); + addCriterion.invoke(criteria, sqlBuilder.toString()); + }catch (Exception e){ + + } + } + + } criteria.andIsDelEqualTo(BusinessConsts.DBLogicDelete.NORMAL.ordinal()); return questionDAO.selectByExampleWithBLOBs(example); diff --git a/src/main/java/club/joylink/rtss/vo/client/pager/question/QuestionQueryVO.java b/src/main/java/club/joylink/rtss/vo/client/pager/question/QuestionQueryVO.java index 7c435724a..02dba78cf 100644 --- a/src/main/java/club/joylink/rtss/vo/client/pager/question/QuestionQueryVO.java +++ b/src/main/java/club/joylink/rtss/vo/client/pager/question/QuestionQueryVO.java @@ -4,6 +4,8 @@ import club.joylink.rtss.vo.client.PageQueryVO; import lombok.Getter; import lombok.Setter; +import java.util.List; + @Getter @Setter public class QuestionQueryVO extends PageQueryVO { @@ -14,5 +16,5 @@ public class QuestionQueryVO extends PageQueryVO { // private String projectCode; private Long orgId; - + private String labels; }