|
@@ -1,9 +1,12 @@
|
|
|
package com.zhongzheng.modules.system.service.impl;
|
|
package com.zhongzheng.modules.system.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.zhongzheng.common.exception.CustomException;
|
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
|
import com.zhongzheng.common.utils.SnowflakeIdUtils;
|
|
import com.zhongzheng.common.utils.SnowflakeIdUtils;
|
|
|
|
|
+import com.zhongzheng.modules.course.domain.MajorCategory;
|
|
|
import com.zhongzheng.modules.system.bo.SysTenantAddBo;
|
|
import com.zhongzheng.modules.system.bo.SysTenantAddBo;
|
|
|
import com.zhongzheng.modules.system.bo.SysTenantEditBo;
|
|
import com.zhongzheng.modules.system.bo.SysTenantEditBo;
|
|
|
import com.zhongzheng.modules.system.bo.SysTenantQueryBo;
|
|
import com.zhongzheng.modules.system.bo.SysTenantQueryBo;
|
|
@@ -92,6 +95,9 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant
|
|
|
*/
|
|
*/
|
|
|
private void validEntityBeforeSave(SysTenant entity){
|
|
private void validEntityBeforeSave(SysTenant entity){
|
|
|
//TODO 做一些数据校验,如唯一约束
|
|
//TODO 做一些数据校验,如唯一约束
|
|
|
|
|
+ if(checkNameUnique(entity)){
|
|
|
|
|
+ throw new CustomException("公司名已存在");
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -101,4 +107,14 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant
|
|
|
}
|
|
}
|
|
|
return this.removeByIds(ids);
|
|
return this.removeByIds(ids);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ private boolean checkNameUnique(SysTenant entity) {
|
|
|
|
|
+ SysTenant info = getOne(new LambdaQueryWrapper<SysTenant>()
|
|
|
|
|
+ .eq(SysTenant::getTenantName,entity.getTenantName())
|
|
|
|
|
+ .last("limit 1"));
|
|
|
|
|
+ if (Validator.isNotNull(info)) {
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|