理论试题管理代码调整,查询标签支持单一的类型

This commit is contained in:
tiger_zhou 2022-10-14 16:44:48 +08:00
parent 016f6c8c48
commit 0c0cf91f2b
2 changed files with 19 additions and 17 deletions

View File

@ -92,8 +92,8 @@ public class PagerQuestionBankController {
* *
*/ */
@GetMapping(path = "/org/lable") @GetMapping(path = "/org/lable")
public Collection<String> findAllLable(@RequestAttribute LoginUserInfoVO loginInfo) { public Collection<String> findAllLable(@RequestAttribute LoginUserInfoVO loginInfo,@RequestParam(name="type",required = false) String type) {
return this.questionBankService.findAllLable(loginInfo.getTopOrgId()); return this.questionBankService.findAllLable(loginInfo.getTopOrgId() ,type);
} }
/** /**

View File

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