use of com.ruoyi.common.core.domain.entity.SysDictData in project RuoYi-Flowable-Plus by KonBAI-Q.
the class SysDictDataServiceImpl method deleteDictDataByIds.
/**
* 批量删除字典数据信息
*
* @param dictCodes 需要删除的字典数据ID
*/
@Override
public void deleteDictDataByIds(Long[] dictCodes) {
for (Long dictCode : dictCodes) {
SysDictData data = selectDictDataById(dictCode);
baseMapper.deleteById(dictCode);
List<SysDictData> dictDatas = baseMapper.selectDictDataByType(data.getDictType());
RedisUtils.setCacheObject(getCacheKey(data.getDictType()), dictDatas);
}
}
use of com.ruoyi.common.core.domain.entity.SysDictData in project RuoYi-Flowable-Plus by KonBAI-Q.
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());
RedisUtils.setCacheObject(getCacheKey(dict.getDictType()), dictDatas);
}
return row;
}
use of com.ruoyi.common.core.domain.entity.SysDictData in project RuoYi-Vue-Plus by JavaLionLi.
the class SysDictDataServiceImpl method deleteDictDataByIds.
/**
* 批量删除字典数据信息
*
* @param dictCodes 需要删除的字典数据ID
*/
@Override
public void deleteDictDataByIds(Long[] dictCodes) {
for (Long dictCode : dictCodes) {
SysDictData data = selectDictDataById(dictCode);
baseMapper.deleteById(dictCode);
List<SysDictData> dictDatas = baseMapper.selectDictDataByType(data.getDictType());
RedisUtils.setCacheObject(getCacheKey(data.getDictType()), dictDatas);
}
}
use of com.ruoyi.common.core.domain.entity.SysDictData in project RuoYi-Vue-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());
RedisUtils.setCacheObject(getCacheKey(dict.getDictType()), dictDatas);
}
return row;
}
use of com.ruoyi.common.core.domain.entity.SysDictData in project RuoYi-Vue-Plus by JavaLionLi.
the class SysDictTypeServiceImpl method getDictLabel.
/**
* 根据字典类型和字典值获取字典标签
*
* @param dictType 字典类型
* @param dictValue 字典值
* @param separator 分隔符
* @return 字典标签
*/
@Override
public String getDictLabel(String dictType, String dictValue, String separator) {
StringBuilder propertyString = new StringBuilder();
List<SysDictData> datas = 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);
}
Aggregations