|
|
@@ -12,7 +12,6 @@ import com.jzg.commons.entity.dto.SysSystemEditParam;
|
|
|
import com.jzg.commons.entity.dto.SysSystemParam;
|
|
|
import com.jzg.commons.entity.enums.YesNoEnum;
|
|
|
import com.jzg.commons.entity.po.*;
|
|
|
-import com.jzg.commons.entity.vo.SysConfigVo;
|
|
|
import com.jzg.commons.entity.vo.SysSystemPermsVo;
|
|
|
import com.jzg.commons.entity.vo.SysSystemVo;
|
|
|
import com.jzg.commons.entity.vo.UpAndDownVo;
|
|
|
@@ -66,7 +65,7 @@ public class SysSystemServiceImpl extends ServiceImpl<SysSystemMapper, SysSystem
|
|
|
public boolean updatePerms(SysSystemPermsVo sysSystemPermsVo) {
|
|
|
// 保存勾选菜单配置
|
|
|
String permsStr = sysSystemPermsVo.getPermsStr();
|
|
|
- this.saveConfig(permsStr, 1, sysSystemPermsVo.getSystemCode());
|
|
|
+ this.saveConfig(permsStr, sysSystemPermsVo.getSystemCode());
|
|
|
|
|
|
// 获取租户管理员角色id
|
|
|
LambdaQueryWrapper<SysRole> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
@@ -85,17 +84,15 @@ public class SysSystemServiceImpl extends ServiceImpl<SysSystemMapper, SysSystem
|
|
|
/**
|
|
|
* 保存配置信息
|
|
|
* @param configStr 配置json
|
|
|
- * @param type 1.全部菜单
|
|
|
* @param sysCode 系统code
|
|
|
*/
|
|
|
- public void saveConfig(String configStr, Integer type, String sysCode){
|
|
|
+ public void saveConfig(String configStr, String sysCode){
|
|
|
List<SysConfig> checkConfigs = sysConfigMapper.selectList(new LambdaQueryWrapper<SysConfig>()
|
|
|
- .eq(SysConfig::getType, type).eq(SysConfig::getSystemCode,sysCode));
|
|
|
+ .eq(SysConfig::getSystemCode,sysCode));
|
|
|
SysConfig config;
|
|
|
if(CollUtil.isEmpty(checkConfigs)){
|
|
|
config = new SysConfig();
|
|
|
config.setSysConfig(configStr);
|
|
|
- config.setType(2);
|
|
|
config.setSystemCode(sysCode);
|
|
|
sysConfigMapper.insert(config);
|
|
|
}else{
|
|
|
@@ -137,10 +134,8 @@ public class SysSystemServiceImpl extends ServiceImpl<SysSystemMapper, SysSystem
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public boolean updateConfig(SysConfig config) {
|
|
|
List<SysConfig> configs = sysConfigMapper.selectList(new LambdaQueryWrapper<SysConfig>()
|
|
|
- .eq(SysConfig::getType, 0)
|
|
|
.eq(SysConfig::getSystemCode, SystemConstants.SYSTEM_PLATFORM.getCode()));
|
|
|
if(CollUtil.isEmpty(configs)){
|
|
|
- config.setType(0);
|
|
|
config.setSystemCode(SystemConstants.SYSTEM_PLATFORM.getCode());
|
|
|
sysConfigMapper.insert(config);
|
|
|
}else{
|
|
|
@@ -151,10 +146,9 @@ public class SysSystemServiceImpl extends ServiceImpl<SysSystemMapper, SysSystem
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public SysConfig getSystemConfig(SysConfigVo sysConfigVo) {
|
|
|
+ public SysConfig getSystemConfig(String systemCode) {
|
|
|
List<SysConfig> configs = sysConfigMapper.selectList(new LambdaQueryWrapper<SysConfig>()
|
|
|
- .eq(SysConfig::getType, sysConfigVo.getType())
|
|
|
- .eq(StringUtils.isNotEmpty(sysConfigVo.getSystemCode()),SysConfig::getSystemCode, sysConfigVo.getSystemCode()));
|
|
|
+ .eq(StringUtils.isNotEmpty(systemCode),SysConfig::getSystemCode, systemCode));
|
|
|
if(CollUtil.isEmpty(configs)){
|
|
|
return null;
|
|
|
}
|
|
|
@@ -287,9 +281,8 @@ public class SysSystemServiceImpl extends ServiceImpl<SysSystemMapper, SysSystem
|
|
|
// 初始化权限信息
|
|
|
// 1.初始化配置的保存
|
|
|
List<SysConfig> configs = sysConfigMapper.selectList(new LambdaQueryWrapper<SysConfig>()
|
|
|
- .eq(SysConfig::getType, 0)
|
|
|
.eq(SysConfig::getSystemCode, SystemConstants.SYSTEM_PLATFORM.getCode()));
|
|
|
- this.saveConfig(configs.get(0).getSysConfig(), 0, SystemConstants.SYSTEM_PLATFORM.getCode());
|
|
|
+ this.saveConfig(configs.get(0).getSysConfig(), SystemConstants.SYSTEM_PLATFORM.getCode());
|
|
|
|
|
|
List<SysSystemPermsVo.PermsVo> permsList = JSON.parseArray(configs.get(0).getSysConfig(),SysSystemPermsVo.PermsVo.class);;
|
|
|
|
|
|
@@ -306,12 +299,11 @@ public class SysSystemServiceImpl extends ServiceImpl<SysSystemMapper, SysSystem
|
|
|
*/
|
|
|
public boolean savePerms(List<SysSystemPermsVo.PermsVo> permsList, String roleId){
|
|
|
List<SysSystemPermsVo.PermsVo> all = new ArrayList<>();
|
|
|
- for (SysSystemPermsVo.PermsVo permsVo : permsList) {
|
|
|
+ permsList.forEach(permsVo -> {
|
|
|
List<SysSystemPermsVo.PermsVo> result = new ArrayList<>();
|
|
|
this.recursionTreeToList(result, permsVo);
|
|
|
all.addAll(result);
|
|
|
- }
|
|
|
-
|
|
|
+ });
|
|
|
List<SysRolePerms> perms = new ArrayList<>();
|
|
|
all.forEach(per->{
|
|
|
SysRolePerms sysSystemPerms = new SysRolePerms();
|