| | |
| | | import com.ruoyi.system.service.ISysDictDataService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Service |
| | | public class SysDictDataServiceImpl extends ServiceImpl<SysDictDataMapper, SysDictData> implements ISysDictDataService { |
| | | |
| | | @Autowired |
| | | private SysDictDataMapper dictDataMapper; |
| | | |
| | | @Override |
| | | public TableDataInfo<SysDictData> selectPageDictDataList(SysDictData dictData) { |
| | |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public void deleteDictDataByIds(Long[] dictCodes) |
| | | { |
| | | for (Long dictCode : dictCodes) |
| | | { |
| | | public void deleteDictDataByIds(Long[] dictCodes) { |
| | | for (Long dictCode : dictCodes) { |
| | | SysDictData data = selectDictDataById(dictCode); |
| | | dictDataMapper.deleteDictDataById(dictCode); |
| | | List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(data.getDictType()); |
| | | baseMapper.deleteById(dictCode); |
| | | List<SysDictData> dictDatas = baseMapper.selectDictDataByType(data.getDictType()); |
| | | DictUtils.setDictCache(data.getDictType(), dictDatas); |
| | | } |
| | | } |
| | |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int insertDictData(SysDictData data) |
| | | { |
| | | public int insertDictData(SysDictData data) { |
| | | int row = baseMapper.insert(data); |
| | | if (row > 0) |
| | | { |
| | | List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(data.getDictType()); |
| | | if (row > 0) { |
| | | List<SysDictData> dictDatas = baseMapper.selectDictDataByType(data.getDictType()); |
| | | DictUtils.setDictCache(data.getDictType(), dictDatas); |
| | | } |
| | | return row; |
| | |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int updateDictData(SysDictData data) |
| | | { |
| | | public int updateDictData(SysDictData data) { |
| | | int row = baseMapper.updateById(data); |
| | | if (row > 0) |
| | | { |
| | | List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(data.getDictType()); |
| | | if (row > 0) { |
| | | List<SysDictData> dictDatas = baseMapper.selectDictDataByType(data.getDictType()); |
| | | DictUtils.setDictCache(data.getDictType(), dictDatas); |
| | | } |
| | | return row; |