update 优化 system 模块 删除性能

feature/model
疯狂的狮子li 4 years ago
parent d7359122b4
commit 079dc12fe1

@ -20,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Map;
@ -157,9 +158,9 @@ public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper, SysConfig
if (StrUtil.equals(UserConstants.YES, config.getConfigType())) {
throw new CustomException(String.format("内置参数【%1$s】不能删除 ", config.getConfigKey()));
}
baseMapper.deleteById(configId);
redisCache.deleteObject(getCacheKey(config.getConfigKey()));
}
baseMapper.deleteBatchIds(Arrays.asList(configIds));
}
/**

@ -11,6 +11,7 @@ import com.ruoyi.system.mapper.SysDictDataMapper;
import com.ruoyi.system.service.ISysDictDataService;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.List;
/**
@ -83,10 +84,10 @@ public class SysDictDataServiceImpl extends ServiceImpl<SysDictDataMapper, SysDi
public void deleteDictDataByIds(Long[] dictCodes) {
for (Long dictCode : dictCodes) {
SysDictData data = selectDictDataById(dictCode);
baseMapper.deleteById(dictCode);
List<SysDictData> dictDatas = baseMapper.selectDictDataByType(data.getDictType());
DictUtils.setDictCache(data.getDictType(), dictDatas);
}
baseMapper.deleteBatchIds(Arrays.asList(dictCodes));
}
/**

@ -21,6 +21,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.PostConstruct;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@ -32,9 +33,6 @@ import java.util.Map;
@Service
public class SysDictTypeServiceImpl extends ServiceImpl<SysDictTypeMapper, SysDictType> implements ISysDictTypeService {
@Autowired
private SysDictTypeMapper dictTypeMapper;
@Autowired
private SysDictDataMapper dictDataMapper;
@ -149,9 +147,9 @@ public class SysDictTypeServiceImpl extends ServiceImpl<SysDictTypeMapper, SysDi
.eq(SysDictData::getDictType, dictType.getDictType())) > 0) {
throw new CustomException(String.format("%1$s已分配,不能删除", dictType.getDictName()));
}
dictTypeMapper.deleteById(dictId);
DictUtils.removeDictCache(dictType.getDictType());
}
baseMapper.deleteBatchIds(Arrays.asList(dictIds));
}
/**

@ -100,7 +100,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
@Override
public String selectUserRoleGroup(String userName) {
List<SysRole> list = roleMapper.selectRolesByUserName(userName);
StringBuffer idsStr = new StringBuffer();
StringBuilder idsStr = new StringBuilder();
for (SysRole role : list) {
idsStr.append(role.getRoleName()).append(",");
}
@ -119,7 +119,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
@Override
public String selectUserPostGroup(String userName) {
List<SysPost> list = postMapper.selectPostsByUserName(userName);
StringBuffer idsStr = new StringBuffer();
StringBuilder idsStr = new StringBuilder();
for (SysPost post : list) {
idsStr.append(post.getPostName()).append(",");
}

Loading…
Cancel
Save