use of com.ruoyi.system.api.domain.SysDictData in project RuoYi-Cloud by yangzongzhuan.
the class SysDictDataServiceImpl method deleteDictDataByIds.
/**
* 批量删除字典数据信息
*
* @param dictCodes 需要删除的字典数据ID
*/
@Override
public void deleteDictDataByIds(Long[] dictCodes) {
for (Long dictCode : dictCodes) {
SysDictData data = selectDictDataById(dictCode);
dictDataMapper.deleteDictDataById(dictCode);
List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(data.getDictType());
DictUtils.setDictCache(data.getDictType(), dictDatas);
}
}
use of com.ruoyi.system.api.domain.SysDictData in project RuoYi-Cloud by yangzongzhuan.
the class SysDictTypeServiceImpl method loadingDictCache.
/**
* 加载字典缓存数据
*/
@Override
public void loadingDictCache() {
SysDictData dictData = new SysDictData();
dictData.setStatus("0");
Map<String, List<SysDictData>> dictDataMap = dictDataMapper.selectDictDataList(dictData).stream().collect(Collectors.groupingBy(SysDictData::getDictType));
for (Map.Entry<String, List<SysDictData>> entry : dictDataMap.entrySet()) {
DictUtils.setDictCache(entry.getKey(), entry.getValue().stream().sorted(Comparator.comparing(SysDictData::getDictSort)).collect(Collectors.toList()));
}
}
use of com.ruoyi.system.api.domain.SysDictData in project RuoYi-Cloud-Plus by JavaLionLi.
the class SysDictTypeServiceImpl method updateDictType.
/**
* 修改保存字典类型信息
*
* @param dict 字典类型信息
* @return 结果
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int updateDictType(SysDictType dict) {
SysDictType oldDict = baseMapper.selectById(dict.getDictId());
dictDataMapper.update(null, new LambdaUpdateWrapper<SysDictData>().set(SysDictData::getDictType, dict.getDictType()).eq(SysDictData::getDictType, oldDict.getDictType()));
int row = baseMapper.updateById(dict);
if (row > 0) {
List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(dict.getDictType());
DictUtils.setDictCache(dict.getDictType(), dictDatas);
}
return row;
}
use of com.ruoyi.system.api.domain.SysDictData in project RuoYi-Cloud-Plus by JavaLionLi.
the class RemoteDictServiceImpl method getDictLabel.
@Override
public String getDictLabel(String dictType, String dictValue, String separator) {
StringBuilder propertyString = new StringBuilder();
List<SysDictData> datas = sysDictTypeService.selectDictDataByType(dictType);
if (StringUtils.containsAny(dictValue, separator) && CollUtil.isNotEmpty(datas)) {
for (SysDictData dict : datas) {
for (String value : dictValue.split(separator)) {
if (value.equals(dict.getDictValue())) {
propertyString.append(dict.getDictLabel() + separator);
break;
}
}
}
} else {
for (SysDictData dict : datas) {
if (dictValue.equals(dict.getDictValue())) {
return dict.getDictLabel();
}
}
}
return StringUtils.stripEnd(propertyString.toString(), separator);
}
use of com.ruoyi.system.api.domain.SysDictData in project RuoYi-Cloud-Plus by JavaLionLi.
the class RemoteDictServiceImpl method getDictValue.
@Override
public String getDictValue(String dictType, String dictLabel, String separator) {
StringBuilder propertyString = new StringBuilder();
List<SysDictData> datas = sysDictTypeService.selectDictDataByType(dictType);
if (StringUtils.containsAny(dictLabel, separator) && CollUtil.isNotEmpty(datas)) {
for (SysDictData dict : datas) {
for (String label : dictLabel.split(separator)) {
if (label.equals(dict.getDictLabel())) {
propertyString.append(dict.getDictValue() + separator);
break;
}
}
}
} else {
for (SysDictData dict : datas) {
if (dictLabel.equals(dict.getDictLabel())) {
return dict.getDictValue();
}
}
}
return StringUtils.stripEnd(propertyString.toString(), separator);
}
Aggregations