|
@@ -1,8 +1,10 @@
|
|
package com.zhongzheng.modules.bank.service.impl;
|
|
package com.zhongzheng.modules.bank.service.impl;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
+import cn.hutool.core.lang.Validator;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
+import com.zhongzheng.common.exception.CustomException;
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
import com.zhongzheng.common.utils.ServletUtils;
|
|
import com.zhongzheng.common.utils.ServletUtils;
|
|
import com.zhongzheng.modules.bank.bo.*;
|
|
import com.zhongzheng.modules.bank.bo.*;
|
|
@@ -13,6 +15,7 @@ import com.zhongzheng.modules.bank.service.IExamQuestionService;
|
|
import com.zhongzheng.modules.bank.service.IQuestionBusinessService;
|
|
import com.zhongzheng.modules.bank.service.IQuestionBusinessService;
|
|
import com.zhongzheng.modules.bank.service.IQuestionService;
|
|
import com.zhongzheng.modules.bank.service.IQuestionService;
|
|
import com.zhongzheng.modules.bank.vo.QuestionVo;
|
|
import com.zhongzheng.modules.bank.vo.QuestionVo;
|
|
|
|
+import com.zhongzheng.modules.base.domain.ApplyAreas;
|
|
import com.zhongzheng.modules.course.bo.CourseChapterSectionListAddBo;
|
|
import com.zhongzheng.modules.course.bo.CourseChapterSectionListAddBo;
|
|
import com.zhongzheng.modules.course.domain.CourseChapterSection;
|
|
import com.zhongzheng.modules.course.domain.CourseChapterSection;
|
|
import com.zhongzheng.modules.course.service.ICourseChapterSectionService;
|
|
import com.zhongzheng.modules.course.service.ICourseChapterSectionService;
|
|
@@ -153,6 +156,9 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
*/
|
|
*/
|
|
private void validEntityBeforeSave(Question entity){
|
|
private void validEntityBeforeSave(Question entity){
|
|
//TODO 做一些数据校验,如唯一约束
|
|
//TODO 做一些数据校验,如唯一约束
|
|
|
|
+ if(checkNameUnique(entity)&&Validator.isEmpty(entity.getQuestionId())){
|
|
|
|
+ throw new CustomException("名称重复");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -162,4 +168,19 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
}
|
|
}
|
|
return this.removeByIds(ids);
|
|
return this.removeByIds(ids);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ private boolean checkNameUnique(Question entity) {
|
|
|
|
+ Question info = getOne(new LambdaQueryWrapper<Question>()
|
|
|
|
+ .eq(Question::getPrefixName,entity.getPrefixName()).ne(Question::getContent,entity.getContent()).last("limit 1"));
|
|
|
|
+ if (Validator.isNotNull(info)) {
|
|
|
|
+ if(Validator.isNotEmpty(entity.getQuestionId())){
|
|
|
|
+ if(entity.getQuestionId() != info.getQuestionId()){
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
}
|
|
}
|