| | |
| | | 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; |
| | |
| | | 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)); |
| | | } |
| | | |
| | | /** |
| | |
| | | import com.ruoyi.system.service.ISysDictDataService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | 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)); |
| | | } |
| | | |
| | | /** |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.PostConstruct; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | */ |
| | | @Service |
| | | public class SysDictTypeServiceImpl extends ServiceImpl<SysDictTypeMapper, SysDictType> implements ISysDictTypeService { |
| | | |
| | | @Autowired |
| | | private SysDictTypeMapper dictTypeMapper; |
| | | |
| | | @Autowired |
| | | private SysDictDataMapper dictDataMapper; |
| | |
| | | .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)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @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(","); |
| | | } |
| | |
| | | @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(","); |
| | | } |