| | |
| | | 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; |
| | | |
| | | /** |
| | | * 字典 业务层处理 |
| | |
| | | @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) |
| | | { |
| | |
| | | @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) |
| | | { |