【更新】修复新增资源时code为空的问题

pull/259/head
xuyuxiang 2025-05-15 22:51:12 +08:00 committed by 小诺
parent 36358d3c0c
commit a29112f699
6 changed files with 19 additions and 6 deletions

View File

@ -15,6 +15,7 @@ package vip.xiaonuo.mobile.modular.resource.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollStreamUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -85,7 +86,9 @@ public class MobileButtonServiceImpl extends ServiceImpl<MobileButtonMapper, Mob
if(repeatCode) {
throw new CommonException("存在重复的移动端按钮,编码为:{}", mobileButton.getCode());
}
mobileButton.setCategory(MobileResourceCategoryEnum.BUTTON.getValue());
if(ObjectUtil.isEmpty(mobileButton.getCode())) {
mobileButton.setCode(RandomUtil.randomString(10));
}
this.save(mobileButton);
}

View File

@ -99,7 +99,9 @@ public class MobileMenuServiceImpl extends ServiceImpl<MobileMenuMapper, MobileM
throw new CommonException("module与上级菜单不一致");
}
}
mobileMenu.setCode(RandomUtil.randomString(10));
if(ObjectUtil.isEmpty(mobileMenu.getCode())) {
mobileMenu.setCode(RandomUtil.randomString(10));
}
mobileMenu.setCategory(MobileResourceCategoryEnum.MENU.getValue());
this.save(mobileMenu);
}

View File

@ -88,7 +88,9 @@ public class MobileModuleServiceImpl extends ServiceImpl<MobileModuleMapper, Mob
if(ObjectUtil.isEmpty(mobileModule.getCode())){
mobileModule.setCode(RandomUtil.randomString(10));
}
mobileModule.setCode(RandomUtil.randomString(10));
if(ObjectUtil.isEmpty(mobileModule.getCode())) {
mobileModule.setCode(RandomUtil.randomString(10));
}
mobileModule.setCategory(MobileResourceCategoryEnum.MODULE.getValue());
this.save(mobileModule);
}

View File

@ -97,7 +97,9 @@ public class SysButtonServiceImpl extends ServiceImpl<SysButtonMapper, SysButton
if(repeatCode) {
throw new CommonException("存在重复的按钮,编码为:{}", sysButton.getCode());
}
sysButton.setCode(RandomUtil.randomString(10));
if(ObjectUtil.isEmpty(sysButton.getCode())) {
sysButton.setCode(RandomUtil.randomString(10));
}
sysButton.setCategory(SysResourceCategoryEnum.BUTTON.getValue());
this.save(sysButton);

View File

@ -165,7 +165,9 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
throw new CommonException("module与上级菜单不一致");
}
}
sysMenu.setCode(RandomUtil.randomString(10));
if(ObjectUtil.isEmpty(sysMenu.getCode())) {
sysMenu.setCode(RandomUtil.randomString(10));
}
sysMenu.setCategory(SysResourceCategoryEnum.MENU.getValue());
this.save(sysMenu);

View File

@ -92,7 +92,9 @@ public class SysModuleServiceImpl extends ServiceImpl<SysModuleMapper, SysModule
if(repeatTitle) {
throw new CommonException("存在重复的模块,名称为:{}", sysModule.getTitle());
}
sysModule.setCode(RandomUtil.randomString(10));
if(ObjectUtil.isEmpty(sysModule.getCode())) {
sysModule.setCode(RandomUtil.randomString(10));
}
sysModule.setCategory(SysResourceCategoryEnum.MODULE.getValue());
this.save(sysModule);
// 发布增加事件