¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.project.system.service.impl; |
| | | |
| | | import java.util.List; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import com.ruoyi.common.constant.UserConstants; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.project.system.domain.SysConfig; |
| | | import com.ruoyi.project.system.mapper.SysConfigMapper; |
| | | import com.ruoyi.project.system.service.ISysConfigService; |
| | | |
| | | /** |
| | | * åæ°é
ç½® æå¡å±å®ç° |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Service |
| | | public class SysConfigServiceImpl implements ISysConfigService |
| | | { |
| | | @Autowired |
| | | private SysConfigMapper configMapper; |
| | | |
| | | /** |
| | | * æ¥è¯¢åæ°é
ç½®ä¿¡æ¯ |
| | | * |
| | | * @param configId åæ°é
ç½®ID |
| | | * @return åæ°é
ç½®ä¿¡æ¯ |
| | | */ |
| | | @Override |
| | | public SysConfig selectConfigById(Long configId) |
| | | { |
| | | SysConfig config = new SysConfig(); |
| | | config.setConfigId(configId); |
| | | return configMapper.selectConfig(config); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®é®åæ¥è¯¢åæ°é
ç½®ä¿¡æ¯ |
| | | * |
| | | * @param configKey åæ°key |
| | | * @return åæ°é®å¼ |
| | | */ |
| | | @Override |
| | | public String selectConfigByKey(String configKey) |
| | | { |
| | | SysConfig config = new SysConfig(); |
| | | config.setConfigKey(configKey); |
| | | SysConfig retConfig = configMapper.selectConfig(config); |
| | | return StringUtils.isNotNull(retConfig) ? retConfig.getConfigValue() : ""; |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢åæ°é
ç½®å表 |
| | | * |
| | | * @param config åæ°é
ç½®ä¿¡æ¯ |
| | | * @return åæ°é
ç½®éå |
| | | */ |
| | | @Override |
| | | public List<SysConfig> selectConfigList(SysConfig config) |
| | | { |
| | | return configMapper.selectConfigList(config); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢åæ°é
ç½® |
| | | * |
| | | * @param config åæ°é
ç½®ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int insertConfig(SysConfig config) |
| | | { |
| | | return configMapper.insertConfig(config); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹åæ°é
ç½® |
| | | * |
| | | * @param config åæ°é
ç½®ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int updateConfig(SysConfig config) |
| | | { |
| | | return configMapper.updateConfig(config); |
| | | } |
| | | |
| | | /** |
| | | * å é¤åæ°é
ç½®ä¿¡æ¯ |
| | | * |
| | | * @param configId åæ°ID |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int deleteConfigById(Long configId) |
| | | { |
| | | return configMapper.deleteConfigById(configId); |
| | | } |
| | | |
| | | /** |
| | | * æ¹éå é¤åæ°ä¿¡æ¯ |
| | | * |
| | | * @param configIds éè¦å é¤çåæ°ID |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int deleteConfigByIds(Long[] configIds) |
| | | { |
| | | return configMapper.deleteConfigByIds(configIds); |
| | | } |
| | | |
| | | /** |
| | | * æ ¡éªåæ°é®åæ¯å¦å¯ä¸ |
| | | * |
| | | * @param config åæ°é
ç½®ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public String checkConfigKeyUnique(SysConfig config) |
| | | { |
| | | Long configId = StringUtils.isNull(config.getConfigId()) ? -1L : config.getConfigId(); |
| | | SysConfig info = configMapper.checkConfigKeyUnique(config.getConfigKey()); |
| | | if (StringUtils.isNotNull(info) && info.getConfigId().longValue() != configId.longValue()) |
| | | { |
| | | return UserConstants.NOT_UNIQUE; |
| | | } |
| | | return UserConstants.UNIQUE; |
| | | } |
| | | } |