You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
77 lines
3.1 KiB
77 lines
3.1 KiB
package jnpf.service.impl; |
|
|
|
import com.baomidou.dynamic.datasource.annotation.DS; |
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
import jnpf.entity.TSystemConfiguration; |
|
import jnpf.exception.DataException; |
|
import jnpf.mapper.TSystemConfigurationMapper; |
|
import jnpf.model.dto.TSystemConfigurationDto; |
|
import jnpf.service.TSystemConfigurationService; |
|
import jnpf.util.UserProvider; |
|
import org.apache.commons.lang3.StringUtils; |
|
import org.springframework.beans.BeanUtils; |
|
import org.springframework.stereotype.Service; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
|
|
/** |
|
* @author xbw |
|
*/ |
|
@Service("iTSystemConfigurationService") |
|
@DS("systemConfiguration") |
|
public class TSystemConfigurationServiceImpl extends ServiceImpl<TSystemConfigurationMapper, TSystemConfiguration> implements TSystemConfigurationService { |
|
|
|
|
|
@Override |
|
public void addOrUpdate(TSystemConfigurationDto.TSystemConfigurationDtoAdd tSystemConfigurationDtoAdd) { |
|
if (StringUtils.isBlank(tSystemConfigurationDtoAdd.getSystemParameter())) { |
|
throw new DataException("系统参数不能为空"); |
|
} |
|
if (StringUtils.isBlank(tSystemConfigurationDtoAdd.getSystemParameterValue())) { |
|
throw new DataException("系统参数值不能为空"); |
|
} |
|
if (StringUtils.isBlank(tSystemConfigurationDtoAdd.getSystemParameterRemark())) { |
|
throw new DataException("系统参数说明不能为空"); |
|
} |
|
|
|
TSystemConfiguration tSystemConfiguration = new TSystemConfiguration(); |
|
BeanUtils.copyProperties(tSystemConfigurationDtoAdd, tSystemConfiguration); |
|
if (tSystemConfigurationDtoAdd.getId() == null) { |
|
BeanUtils.copyProperties(tSystemConfigurationDtoAdd, tSystemConfiguration); |
|
tSystemConfiguration.setCreateTime(LocalDateTime.now()); |
|
tSystemConfiguration.setCreateName(UserProvider.getUser().getUserName()); |
|
tSystemConfiguration.setCreateBy(UserProvider.getUser().getUserId()); |
|
this.save(tSystemConfiguration); |
|
return; |
|
} |
|
|
|
tSystemConfiguration.setUpdateTime(LocalDateTime.now()); |
|
tSystemConfiguration.setUpdateBy(UserProvider.getUser().getUserName()); |
|
tSystemConfiguration.setUpdateName(UserProvider.getUser().getUserId()); |
|
this.updateById(tSystemConfiguration); |
|
|
|
} |
|
|
|
@Override |
|
public void del(TSystemConfigurationDto.TSystemConfigurationDtoDel configurationDtoDel) { |
|
if (configurationDtoDel.getId() == null) { |
|
throw new DataException("请传入系统参数id"); |
|
} |
|
|
|
TSystemConfiguration byId = this.getById(configurationDtoDel.getId()); |
|
if(byId==null||byId.getDelFlag()==1){ |
|
throw new DataException("不存在或已删除"); |
|
} |
|
|
|
byId.setDelFlag(1); |
|
this.updateById(byId); |
|
} |
|
|
|
@Override |
|
public IPage<TSystemConfiguration> selectList(TSystemConfigurationDto.TSystemConfigurationDtoParam param) { |
|
return this.baseMapper.selectList(new Page<>(param.getCurrent(), param.getSize()), param); |
|
} |
|
}
|
|
|