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..35573fd9f 100644 --- a/src/main/java/club/joylink/rtss/controller/paper/PagerQuestionBankController.java +++ b/src/main/java/club/joylink/rtss/controller/paper/PagerQuestionBankController.java @@ -92,8 +92,8 @@ public class PagerQuestionBankController { * */ @GetMapping(path = "/org/lable") - public Collection findAllLable(@RequestAttribute LoginUserInfoVO loginInfo) { - return this.questionBankService.findAllLable(loginInfo.getTopOrgId()); + public Collection findAllLable(@RequestAttribute LoginUserInfoVO loginInfo,@RequestParam(name="type",required = false) String type) { + return this.questionBankService.findAllLable(loginInfo.getTopOrgId() ,type); } /** 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 fd3ef748b..79bf9f5ee 100644 --- a/src/main/java/club/joylink/rtss/services/paper/PagerQuestionService.java +++ b/src/main/java/club/joylink/rtss/services/paper/PagerQuestionService.java @@ -39,13 +39,13 @@ public class PagerQuestionService { /** * 创建对应的查询example - * @param queryVO - * @param isPaging - * @param companyIdCanNull - * @return + * @param queryVO 查询对象 + * @param isPaging 是否分页 + * @param orgIdCanNull orgId是否可以为空 + * @return 查询example */ - private PaperQuestionExample createQueryExample(QuestionQueryVO queryVO, boolean isPaging,boolean companyIdCanNull){ - if(Objects.equals(false,companyIdCanNull)){ + private PaperQuestionExample createQueryExample(QuestionQueryVO queryVO, boolean isPaging,boolean orgIdCanNull){ + if(Objects.equals(false,orgIdCanNull)){ BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(queryVO.getOrgId()),"用户组织信息不能为空"); } if(isPaging){ @@ -65,6 +65,7 @@ public class PagerQuestionService { } if(Objects.nonNull(queryVO.getLabels())){ + List tmpLableList = Splitter.on(",").omitEmptyStrings().splitToList(queryVO.getLabels()); if(Objects.equals(false,CollectionUtils.isEmpty(tmpLableList))){ StringBuilder sqlBuilder = new StringBuilder("("); @@ -83,7 +84,7 @@ public class PagerQuestionService { addCriterion.setAccessible(true); addCriterion.invoke(criteria, sqlBuilder.toString()); }catch (Exception e){ - + log.error("拼写查询标签错误 msg:" + e.getMessage(),e); } } } @@ -190,16 +191,17 @@ public class PagerQuestionService { * 获取所有公司组织下的标签 * */ - public Collection findAllLable(Long companyId){ - BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(companyId),"组织id不能为空"); + public Collection findAllLable(Long orgId,String type){ + BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(orgId),"组织id不能为空"); PaperQuestionExample example = new PaperQuestionExample(); PaperQuestionExample.Criteria criteria = example.createCriteria(); - /*boolean isDefault = Project.isDefault(projectCode); - if(Objects.equals(false,isDefault)){ - List ids = this.queryFromProjectCode(projectCode); - criteria.andCompanyIdIn(ids); - }*/ - criteria.andOrgIdEqualTo(companyId); + if(Objects.nonNull(type)){ + BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.equals(type,BusinessConsts.TheoryType.select.name()) + ||Objects.equals(type,BusinessConsts.TheoryType.multi.name()) + ||Objects.equals(type,BusinessConsts.TheoryType.judge.name()),"查询类型只支持单选,多选,选择"); + criteria.andTypeEqualTo(type); + } + criteria.andOrgIdEqualTo(orgId); criteria.andIsDelEqualTo(BusinessConsts.DBLogicDelete.NORMAL.ordinal()); List lableList = this.questionDAO.selectByExample(example); if(CollectionUtils.isEmpty(lableList)){