|
@@ -1,6 +1,7 @@
|
|
|
package cn.tr.module.sys.user.service.impl;
|
|
package cn.tr.module.sys.user.service.impl;
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import cn.tr.core.exception.ServiceException;
|
|
import cn.tr.core.exception.ServiceException;
|
|
|
import cn.tr.core.exception.TRExcCode;
|
|
import cn.tr.core.exception.TRExcCode;
|
|
@@ -101,11 +102,16 @@ public class SysPortalServiceImpl implements ISysPortalService {
|
|
|
|
|
|
|
|
|
|
|
|
|
private void validatePortalSource(SysPortalPO source){
|
|
private void validatePortalSource(SysPortalPO source){
|
|
|
- SysPortalPO role = portalRepository.selectOne(new LambdaQueryWrapper<SysPortalPO>()
|
|
|
|
|
- .eq(SysPortalPO::getCode, source.getCode())
|
|
|
|
|
|
|
+ SysPortalPO portalPO = portalRepository.selectOne(new LambdaQueryWrapper<SysPortalPO>()
|
|
|
|
|
+ .ne(StrUtil.isNotBlank(source.getId()),SysPortalPO::getId,source.getId())
|
|
|
|
|
+ .nested(t->
|
|
|
|
|
+ t.eq(SysPortalPO::getCode, source.getCode())
|
|
|
|
|
+ .or()
|
|
|
|
|
+ .eq(SysPortalPO::getName,source.getName())
|
|
|
|
|
+ )
|
|
|
.last("limit 1"));
|
|
.last("limit 1"));
|
|
|
- if(role!=null&& !StrUtil.equals(role.getId(),source.getId())){
|
|
|
|
|
- throw new ServiceException(TRExcCode.SYSTEM_ERROR_B0001,String.format("门户编码{%s}不能重复",source.getCode()));
|
|
|
|
|
|
|
+ if(ObjectUtil.isNotNull(portalPO)){
|
|
|
|
|
+ throw new ServiceException(TRExcCode.SYSTEM_ERROR_B0001,"门户编码及名称不能重复");
|
|
|
}
|
|
}
|
|
|
if(StrUtil.equals(source.getType(), CreateEnum.sys.name())){
|
|
if(StrUtil.equals(source.getType(), CreateEnum.sys.name())){
|
|
|
throw new ServiceException(TRExcCode.SYSTEM_ERROR_B0001,"无法对系统级门户进行操作");
|
|
throw new ServiceException(TRExcCode.SYSTEM_ERROR_B0001,"无法对系统级门户进行操作");
|