| | |
| | | package com.project.system.service.impl; |
| | | |
| | | import java.util.List; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import com.project.common.core.domain.entity.SysDictData; |
| | | import com.project.common.exception.base.BaseException; |
| | | import com.project.common.utils.DictUtils; |
| | | import com.project.system.mapper.SysDictDataMapper; |
| | | import com.project.system.service.ISysDictDataService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 字典 业务层处理 |
| | | * |
| | | * |
| | | * @author project |
| | | */ |
| | | @Service |
| | |
| | | |
| | | /** |
| | | * 根据条件分页查询字典数据 |
| | | * |
| | | * |
| | | * @param dictData 字典数据信息 |
| | | * @return 字典数据集合信息 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 根据字典类型和字典键值查询字典数据信息 |
| | | * |
| | | * |
| | | * @param dictType 字典类型 |
| | | * @param dictValue 字典键值 |
| | | * @return 字典标签 |
| | |
| | | |
| | | /** |
| | | * 根据字典数据ID查询信息 |
| | | * |
| | | * |
| | | * @param dictCode 字典数据ID |
| | | * @return 字典数据 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 批量删除字典数据信息 |
| | | * |
| | | * |
| | | * @param dictCodes 需要删除的字典数据ID |
| | | */ |
| | | @Override |
| | |
| | | |
| | | /** |
| | | * 新增保存字典数据信息 |
| | | * |
| | | * |
| | | * @param data 字典数据信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int insertDictData(SysDictData data) |
| | | { |
| | | int valueCount = dictDataMapper.countByDictTypeAndValue(data.getDictType(),data.getDictValue(), null); |
| | | if (valueCount>0) { |
| | | throw new BaseException("类型中字典值已存在!"); |
| | | } |
| | | int labelCount = dictDataMapper.countByDictTypeAndLabel(data.getDictType(),data.getDictLabel(), null); |
| | | if (labelCount>0) { |
| | | throw new BaseException("类型中字典标签已存在!"); |
| | | } |
| | | int row = dictDataMapper.insertDictData(data); |
| | | if (row > 0) |
| | | { |
| | |
| | | |
| | | /** |
| | | * 修改保存字典数据信息 |
| | | * |
| | | * |
| | | * @param data 字典数据信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int updateDictData(SysDictData data) |
| | | { |
| | | int valueCount = dictDataMapper.countByDictTypeAndValue(data.getDictType(),data.getDictValue(), data.getDictCode()); |
| | | if (valueCount>0) { |
| | | throw new BaseException("类型中字典值已存在!"); |
| | | } |
| | | int labelCount = dictDataMapper.countByDictTypeAndLabel(data.getDictType(),data.getDictLabel(), data.getDictCode()); |
| | | if (labelCount>0) { |
| | | throw new BaseException("类型中字典标签已存在!"); |
| | | } |
| | | int row = dictDataMapper.updateDictData(data); |
| | | if (row > 0) |
| | | { |