Merge branch 'test-training2' of https://git.code.tencent.com/lian-cbtc/rtss-server into test-training2-xzb1

This commit is contained in:
xzb 2022-10-14 17:51:41 +08:00
commit b3ecb6c1d2
2 changed files with 23 additions and 19 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);
}
}
}
@ -99,6 +100,7 @@ public class PagerQuestionService {
* @return
*/
public long queryCount(Long orgId,BusinessConsts.TheoryType type,String labels){
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(orgId),"组织信息不能为空");
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(type == BusinessConsts.TheoryType.select
|| type == BusinessConsts.TheoryType.multi
|| type == BusinessConsts.TheoryType.judge ,"查询类型只支持单选,多选,选择");
@ -146,9 +148,10 @@ public class PagerQuestionService {
*/
public PaperQuestionVO getQuestion(Long questionId,boolean doNotCheckDel,boolean random) {
PaperQuestionWithBLOBs question = questionDAO.selectByPrimaryKey(questionId);
boolean isDel = Objects.nonNull(question) || question.getIsDel() == BusinessConsts.DBLogicDelete.NORMAL.ordinal();
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(Objects.nonNull(question),"没有找到对应的数据");
boolean isDel = question.getIsDel() == BusinessConsts.DBLogicDelete.NORMAL.ordinal();
if(doNotCheckDel){
isDel = Objects.nonNull(question);
isDel = true;
}
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(isDel);
PaperQuestionVO questionVO = new PaperQuestionVO(question);
@ -188,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)){