package com.gk.hotwork.Service.ServiceImpl; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.gk.hotwork.Domain.Enum.Etype; import com.gk.hotwork.Domain.Exception.BusinessException; import com.gk.hotwork.Domain.FourColorMap2; import com.gk.hotwork.Domain.UserInfo; import com.gk.hotwork.Domain.Utils.StringUtils; import com.gk.hotwork.Mapper.FourColorMap2Mapper; import com.gk.hotwork.Service.FourColorMap2Service; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.Date; import java.util.List; import java.util.Map; @Service("fourColorMap2Service") public class FourColorMap2ServiceImpl extends ServiceImpl implements FourColorMap2Service { @Autowired FourColorMap2Mapper fourColorMap2Mapper; @Override public void addOne(JSONObject mapJson, UserInfo userInfo) { String type = mapJson.getString("type"); String geometry = mapJson.getString("geometry"); String properties = mapJson.getString("properties"); Integer etype = mapJson.getInteger("etype"); if (etype == null || StringUtils.isBlank(type) || StringUtils.isBlank(geometry) || StringUtils.isBlank(properties)) { throw new BusinessException("参数不能为空"); } //检验 Etype.parse(etype); FourColorMap2 fourColorMap2 = new FourColorMap2(); fourColorMap2.setEtype(etype); fourColorMap2.setGeometry(geometry); fourColorMap2.setProperties(properties); fourColorMap2.setType(type); Date now = new Date(); fourColorMap2.setCreateTime(now); fourColorMap2.setCreateBy(userInfo.getRealname()); fourColorMap2.setUpdateTime(now); fourColorMap2.setValidFlag(true); this.save(fourColorMap2); } @Override public List getList2(Integer eType) { Etype.parse(eType); return fourColorMap2Mapper.selectList(new LambdaQueryWrapper(). eq(FourColorMap2::getEtype, eType) .eq(FourColorMap2::getValidFlag, Boolean.TRUE)); } @Override public void delOne(Long id) { if (id == null) throw new BusinessException("参数为空"); FourColorMap2 byId = this.getById(id); if (byId == null) throw new BusinessException("数据不存在"); FourColorMap2 delOne = new FourColorMap2(); delOne.setValidFlag(Boolean.FALSE); delOne.setUpdateTime(new Date()); delOne.setId(byId.getId()); this.updateById(delOne); } }