Search in sources :

Example 1 with SysDictData

use of com.ruoyi.system.api.domain.SysDictData in project RuoYi-Cloud by yangzongzhuan.

the class SysDictTypeServiceImpl method updateDictType.

/**
 * 修改保存字典类型信息
 *
 * @param dict 字典类型信息
 * @return 结果
 */
@Override
@Transactional(rollbackFor = Exception.class)
public int updateDictType(SysDictType dict) {
    SysDictType oldDict = dictTypeMapper.selectDictTypeById(dict.getDictId());
    dictDataMapper.updateDictDataType(oldDict.getDictType(), dict.getDictType());
    int row = dictTypeMapper.updateDictType(dict);
    if (row > 0) {
        List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(dict.getDictType());
        DictUtils.setDictCache(dict.getDictType(), dictDatas);
    }
    return row;
}
Also used : SysDictData(com.ruoyi.system.api.domain.SysDictData) SysDictType(com.ruoyi.system.api.domain.SysDictType) Transactional(org.springframework.transaction.annotation.Transactional)

Example 2 with SysDictData

use of com.ruoyi.system.api.domain.SysDictData in project RuoYi-Cloud-Oracle 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);
    }
}
Also used : SysDictData(com.ruoyi.system.api.domain.SysDictData)

Example 3 with SysDictData

use of com.ruoyi.system.api.domain.SysDictData in project RuoYi-Cloud-Oracle by yangzongzhuan.

the class SysDictTypeServiceImpl method updateDictType.

/**
 * 修改保存字典类型信息
 *
 * @param dict 字典类型信息
 * @return 结果
 */
@Override
@Transactional(rollbackFor = Exception.class)
public int updateDictType(SysDictType dict) {
    SysDictType oldDict = dictTypeMapper.selectDictTypeById(dict.getDictId());
    dictDataMapper.updateDictDataType(oldDict.getDictType(), dict.getDictType());
    int row = dictTypeMapper.updateDictType(dict);
    if (row > 0) {
        List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(dict.getDictType());
        DictUtils.setDictCache(dict.getDictType(), dictDatas);
    }
    return row;
}
Also used : SysDictData(com.ruoyi.system.api.domain.SysDictData) SysDictType(com.ruoyi.system.api.domain.SysDictType) Transactional(org.springframework.transaction.annotation.Transactional)

Example 4 with SysDictData

use of com.ruoyi.system.api.domain.SysDictData in project RuoYi-Cloud-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());
        DictUtils.setDictCache(data.getDictType(), dictDatas);
    }
}
Also used : SysDictData(com.ruoyi.system.api.domain.SysDictData)

Example 5 with SysDictData

use of com.ruoyi.system.api.domain.SysDictData in project RuoYi-Cloud-Oracle 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()));
    }
}
Also used : SysDictData(com.ruoyi.system.api.domain.SysDictData) List(java.util.List) Map(java.util.Map)

Aggregations

SysDictData (com.ruoyi.system.api.domain.SysDictData)10 SysDictType (com.ruoyi.system.api.domain.SysDictType)3 Transactional (org.springframework.transaction.annotation.Transactional)3 List (java.util.List)2 Map (java.util.Map)2