package com.javaweb.geo.service.impl; import java.util.List; import cn.hutool.core.util.ObjectUtil; import com.javaweb.common.core.domain.AjaxResult; import com.javaweb.common.utils.IdGenerate; import com.javaweb.common.utils.StringUtils; import com.javaweb.geotdp.domain.ResponseResult; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.javaweb.geo.mapper.ExceptionConfigMapper; import com.javaweb.geo.domain.ExceptionConfig; import com.javaweb.geo.service.IExceptionConfigService; import com.javaweb.common.core.text.Convert; /** * 异常配置Service业务层处理 * * @author cxy * @date 2022-11-14 */ @Service public class ExceptionConfigServiceImpl implements IExceptionConfigService { @Autowired private ExceptionConfigMapper exceptionConfigMapper; /** * 查询异常配置 * * @param ids 异常配置ID * @return 异常配置 */ @Override public ExceptionConfig selectExceptionConfigById(Long ids) { return exceptionConfigMapper.selectExceptionConfigById(ids); } /** * 查询异常配置列表 * * @param exceptionConfig 异常配置 * @return 异常配置 */ @Override public List selectExceptionConfigList(ExceptionConfig exceptionConfig) { return exceptionConfigMapper.selectExceptionConfigList(exceptionConfig); } /** * 新增异常配置 * * @param exceptionConfig 异常配置 * @return 结果 */ @Override public AjaxResult insertExceptionConfig(ExceptionConfig exceptionConfig) { if (ObjectUtil.isEmpty(exceptionConfig.getIds())){ String id = IdGenerate.nextId(); exceptionConfig.setIds(id); exceptionConfigMapper.insertExceptionConfig(exceptionConfig); }else { exceptionConfigMapper.updateExceptionConfig(exceptionConfig); } return AjaxResult.success("数据保存成功"); } /** * 修改异常配置 * * @param exceptionConfig 异常配置 * @return 结果 */ @Override public int updateExceptionConfig(ExceptionConfig exceptionConfig) { return exceptionConfigMapper.updateExceptionConfig(exceptionConfig); } /** * 删除异常配置对象 * * @param ids 需要删除的数据ID * @return 结果 */ @Override public int deleteExceptionConfigByIds(String ids) { return exceptionConfigMapper.deleteExceptionConfigByIds(Convert.toStrArray(ids)); } /** * 删除异常配置信息 * * @param ids 异常配置ID * @return 结果 */ @Override public int deleteExceptionConfigById(Long ids) { return exceptionConfigMapper.deleteExceptionConfigById(ids); } @Override public ResponseResult configInfo() { ExceptionConfig data = exceptionConfigMapper.selectExceptionConfigById(1L); if (ObjectUtil.isNotEmpty(data)){ return ResponseResult.success("查询成功!",data); } return ResponseResult.error("查询失败!",null); } }