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

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")
public Collection<String> findAllLable(@RequestAttribute LoginUserInfoVO loginInfo) {
return this.questionBankService.findAllLable(loginInfo.getTopOrgId());
public Collection<String> findAllLable(@RequestAttribute LoginUserInfoVO loginInfo,@RequestParam(name="type",required = false) String type) {
return this.questionBankService.findAllLable(loginInfo.getTopOrgId() ,type);
}
/**

View File

@ -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<String> 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<String> findAllLable(Long companyId){
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(companyId),"组织id不能为空");
public Collection<String> 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<Long> 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<PaperQuestion> lableList = this.questionDAO.selectByExample(example);
if(CollectionUtils.isEmpty(lableList)){