|
@@ -67,7 +67,7 @@ public class ReportExtraDegreeController {
|
|
|
TimeType timeType = timeTypeMapper.selectById(user.getCompanyId());
|
|
|
if (info.getId() == null) {
|
|
|
info.setCompanyId(user.getCompanyId());
|
|
|
- int cut = reportExtraDegreeMapper.selectCount(new QueryWrapper<ReportExtraDegree>().eq("name",info.getName()));
|
|
|
+ int cut = reportExtraDegreeMapper.selectCount(new QueryWrapper<ReportExtraDegree>().eq("name",info.getName()).eq("company_id", user.getCompanyId()));
|
|
|
if(cut>0){
|
|
|
msg.setError(timeType.getCustomDegreeName()+"名称重复");
|
|
|
return msg;
|
|
@@ -75,40 +75,40 @@ public class ReportExtraDegreeController {
|
|
|
info.setCompanyId(user.getCompanyId());
|
|
|
reportExtraDegreeMapper.insert(info);
|
|
|
} else {
|
|
|
- int cut = reportExtraDegreeMapper.selectCount(new QueryWrapper<ReportExtraDegree>().eq("name",info.getName()).ne("id",info.getId()));
|
|
|
+ int cut = reportExtraDegreeMapper.selectCount(new QueryWrapper<ReportExtraDegree>().eq("name",info.getName()).ne("id",info.getId()).eq("company_id", user.getCompanyId()));
|
|
|
if(cut>0){
|
|
|
msg.setError(timeType.getCustomDegreeName()+"名称重复");
|
|
|
return msg;
|
|
|
}
|
|
|
//检查名字是否发生变化
|
|
|
- int id = info.getId();
|
|
|
- List<Project> existsProjects = projectMapper.selectList(new QueryWrapper<Project>()
|
|
|
- .eq("company_id", user.getCompanyId())
|
|
|
- .and(wrapper->wrapper.eq("associate_degrees", id)
|
|
|
- .or().likeRight("associate_degrees", id+",")
|
|
|
- .or().like("associate_degrees", ","+id+",")
|
|
|
- .or().likeLeft("associate_degrees", ","+id)));
|
|
|
- if (existsProjects.size() > 0) {
|
|
|
- List<Project> updateList = new ArrayList<>();
|
|
|
- for (Project p : existsProjects) {
|
|
|
- String associateDegrees = p.getAssociateDegrees();
|
|
|
- String[] split = associateDegrees.split("\\,");
|
|
|
- String[] names = p.getAssociateDegreeNames().split("\\,");
|
|
|
+ int id = info.getId();
|
|
|
+ List<Project> existsProjects = projectMapper.selectList(new QueryWrapper<Project>()
|
|
|
+ .eq("company_id", user.getCompanyId())
|
|
|
+ .and(wrapper->wrapper.eq("associate_degrees", id)
|
|
|
+ .or().likeRight("associate_degrees", id+",")
|
|
|
+ .or().like("associate_degrees", ","+id+",")
|
|
|
+ .or().likeLeft("associate_degrees", ","+id)));
|
|
|
+ if (existsProjects.size() > 0) {
|
|
|
+ List<Project> updateList = new ArrayList<>();
|
|
|
+ for (Project p : existsProjects) {
|
|
|
+ String associateDegrees = p.getAssociateDegrees();
|
|
|
+ String[] split = associateDegrees.split("\\,");
|
|
|
+ String[] names = p.getAssociateDegreeNames().split("\\,");
|
|
|
|
|
|
- for (int i=0;i<split.length; i++) {
|
|
|
- if (split[i].equals(id+"")) {
|
|
|
- names[i] = info.getName();//更换新名字
|
|
|
- }
|
|
|
+ for (int i=0;i<split.length; i++) {
|
|
|
+ if (split[i].equals(id+"")) {
|
|
|
+ names[i] = info.getName();//更换新名字
|
|
|
}
|
|
|
- String replaceNames = StringUtil.join(names, ",");
|
|
|
- Project newP = new Project();
|
|
|
- newP.setId(p.getId());
|
|
|
- newP.setAssociateDegreeNames(replaceNames);
|
|
|
- updateList.add(newP);
|
|
|
}
|
|
|
- projectService.updateBatchById(updateList);
|
|
|
+ String replaceNames = StringUtil.join(names, ",");
|
|
|
+ Project newP = new Project();
|
|
|
+ newP.setId(p.getId());
|
|
|
+ newP.setAssociateDegreeNames(replaceNames);
|
|
|
+ updateList.add(newP);
|
|
|
}
|
|
|
- reportExtraDegreeMapper.updateById(info);
|
|
|
+ projectService.updateBatchById(updateList);
|
|
|
+ }
|
|
|
+ reportExtraDegreeMapper.updateById(info);
|
|
|
}
|
|
|
return msg;
|
|
|
}
|