¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.project.system.service.impl; |
| | | |
| | | import java.util.List; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import com.ruoyi.common.constant.UserConstants; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.project.system.domain.SysDictType; |
| | | import com.ruoyi.project.system.mapper.SysDictDataMapper; |
| | | import com.ruoyi.project.system.mapper.SysDictTypeMapper; |
| | | import com.ruoyi.project.system.service.ISysDictTypeService; |
| | | |
| | | /** |
| | | * åå
¸ ä¸å¡å±å¤ç |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Service |
| | | public class SysDictTypeServiceImpl implements ISysDictTypeService |
| | | { |
| | | @Autowired |
| | | private SysDictTypeMapper dictTypeMapper; |
| | | |
| | | @Autowired |
| | | private SysDictDataMapper dictDataMapper; |
| | | |
| | | /** |
| | | * æ ¹æ®æ¡ä»¶å页æ¥è¯¢åå
¸ç±»å |
| | | * |
| | | * @param dictType åå
¸ç±»åä¿¡æ¯ |
| | | * @return åå
¸ç±»åéåä¿¡æ¯ |
| | | */ |
| | | @Override |
| | | public List<SysDictType> selectDictTypeList(SysDictType dictType) |
| | | { |
| | | return dictTypeMapper.selectDictTypeList(dictType); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®ææåå
¸ç±»å |
| | | * |
| | | * @return åå
¸ç±»åéåä¿¡æ¯ |
| | | */ |
| | | @Override |
| | | public List<SysDictType> selectDictTypeAll() |
| | | { |
| | | return dictTypeMapper.selectDictTypeAll(); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®åå
¸ç±»åIDæ¥è¯¢ä¿¡æ¯ |
| | | * |
| | | * @param dictId åå
¸ç±»åID |
| | | * @return åå
¸ç±»å |
| | | */ |
| | | @Override |
| | | public SysDictType selectDictTypeById(Long dictId) |
| | | { |
| | | return dictTypeMapper.selectDictTypeById(dictId); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®åå
¸ç±»åæ¥è¯¢ä¿¡æ¯ |
| | | * |
| | | * @param dictType åå
¸ç±»å |
| | | * @return åå
¸ç±»å |
| | | */ |
| | | public SysDictType selectDictTypeByType(String dictType) |
| | | { |
| | | return dictTypeMapper.selectDictTypeByType(dictType); |
| | | } |
| | | |
| | | /** |
| | | * éè¿åå
¸IDå é¤åå
¸ä¿¡æ¯ |
| | | * |
| | | * @param dictId åå
¸ID |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int deleteDictTypeById(Long dictId) |
| | | { |
| | | return dictTypeMapper.deleteDictTypeById(dictId); |
| | | } |
| | | |
| | | /** |
| | | * æ¹éå é¤åå
¸ç±»åä¿¡æ¯ |
| | | * |
| | | * @param dictIds éè¦å é¤çåå
¸ID |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteDictTypeByIds(Long[] dictIds) |
| | | { |
| | | return dictTypeMapper.deleteDictTypeByIds(dictIds); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢ä¿ååå
¸ç±»åä¿¡æ¯ |
| | | * |
| | | * @param dictType åå
¸ç±»åä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int insertDictType(SysDictType dictType) |
| | | { |
| | | return dictTypeMapper.insertDictType(dictType); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹ä¿ååå
¸ç±»åä¿¡æ¯ |
| | | * |
| | | * @param dictType åå
¸ç±»åä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public int updateDictType(SysDictType dictType) |
| | | { |
| | | SysDictType oldDict = dictTypeMapper.selectDictTypeById(dictType.getDictId()); |
| | | dictDataMapper.updateDictDataType(oldDict.getDictType(), dictType.getDictType()); |
| | | return dictTypeMapper.updateDictType(dictType); |
| | | } |
| | | |
| | | /** |
| | | * æ ¡éªåå
¸ç±»åç§°æ¯å¦å¯ä¸ |
| | | * |
| | | * @param dict åå
¸ç±»å |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public String checkDictTypeUnique(SysDictType dict) |
| | | { |
| | | Long dictId = StringUtils.isNull(dict.getDictId()) ? -1L : dict.getDictId(); |
| | | SysDictType dictType = dictTypeMapper.checkDictTypeUnique(dict.getDictType()); |
| | | if (StringUtils.isNotNull(dictType) && dictType.getDictId().longValue() != dictId.longValue()) |
| | | { |
| | | return UserConstants.NOT_UNIQUE; |
| | | } |
| | | return UserConstants.UNIQUE; |
| | | } |
| | | } |