feat:核设施相关接口,监测器相关接口
This commit is contained in:
parent
c4e35f99e0
commit
149e364eb0
|
@ -0,0 +1,48 @@
|
|||
package org.jeecg.modules.system.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.jeecg.common.api.QueryRequest;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.system.entity.GardsDetectors;
|
||||
import org.jeecg.modules.system.service.IGardsDetectorsService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("gardsDetectors")
|
||||
public class GardsDetectorsController {
|
||||
|
||||
@Autowired
|
||||
private IGardsDetectorsService gardsDetectorsService;
|
||||
|
||||
@GetMapping("findPage")
|
||||
public Result<IPage<GardsDetectors>> findPage(QueryRequest queryRequest, GardsDetectors gardsDetectors){
|
||||
Result<IPage<GardsDetectors>> result = gardsDetectorsService.findPage(queryRequest, gardsDetectors);
|
||||
return result;
|
||||
}
|
||||
|
||||
@GetMapping("findInfo")
|
||||
public GardsDetectors findInfo(Integer id){
|
||||
GardsDetectors result = gardsDetectorsService.findInfo(id);
|
||||
return result;
|
||||
}
|
||||
|
||||
@PostMapping("create")
|
||||
public Result create(@RequestBody GardsDetectors gardsDetectors){
|
||||
Result result = gardsDetectorsService.create(gardsDetectors);
|
||||
return result;
|
||||
}
|
||||
|
||||
@PutMapping("update")
|
||||
public Result update(@RequestBody GardsDetectors gardsDetectors){
|
||||
Result result = gardsDetectorsService.update(gardsDetectors);
|
||||
return result;
|
||||
}
|
||||
|
||||
@DeleteMapping("deleteById")
|
||||
public Result deleteById(Integer id){
|
||||
Result result = gardsDetectorsService.deleteById(id);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package org.jeecg.modules.system.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.jeecg.common.api.QueryRequest;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.system.entity.GardsNuclearfacility;
|
||||
import org.jeecg.modules.system.service.IGardsNuclearfacilityService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("gardsNuclearfacility")
|
||||
public class GardsNuclearfacilityController {
|
||||
|
||||
@Autowired
|
||||
private IGardsNuclearfacilityService gardsNuclearfacilityService;
|
||||
|
||||
@GetMapping("findPage")
|
||||
public Result<IPage<GardsNuclearfacility>> findPage(QueryRequest queryRequest, GardsNuclearfacility gardsNuclearfacility){
|
||||
Result<IPage<GardsNuclearfacility>> result = gardsNuclearfacilityService.findPage(queryRequest, gardsNuclearfacility);
|
||||
return result;
|
||||
}
|
||||
|
||||
@GetMapping("findInfo")
|
||||
public GardsNuclearfacility findInfo(Integer id){
|
||||
GardsNuclearfacility result = gardsNuclearfacilityService.findInfo(id);
|
||||
return result;
|
||||
}
|
||||
|
||||
@PostMapping("create")
|
||||
public Result create(@RequestBody GardsNuclearfacility gardsNuclearfacility){
|
||||
Result result = gardsNuclearfacilityService.create(gardsNuclearfacility);
|
||||
return result;
|
||||
}
|
||||
|
||||
@PutMapping("update")
|
||||
public Result update(@RequestBody GardsNuclearfacility gardsNuclearfacility){
|
||||
Result result = gardsNuclearfacilityService.update(gardsNuclearfacility);
|
||||
return result;
|
||||
}
|
||||
|
||||
@DeleteMapping("deleteById")
|
||||
public Result deleteById(Integer id){
|
||||
Result result = gardsNuclearfacilityService.deleteById(id);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
package org.jeecg.modules.system.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@TableName("GARDS_DETECTORS")
|
||||
public class GardsDetectors implements Serializable {
|
||||
|
||||
@TableField(value = "DETECTOR_ID")
|
||||
private Integer detectorId;
|
||||
|
||||
@TableField(value = "DETECTOR_CODE")
|
||||
private String detectorCode;
|
||||
|
||||
@TableField(value = "LON")
|
||||
private Double lon;
|
||||
|
||||
@TableField(value = "LAT")
|
||||
private Double lat;
|
||||
|
||||
@TableField(value = "TYPE")
|
||||
private String type;
|
||||
|
||||
@TableField(value = "CHANNELS")
|
||||
private Double channels;
|
||||
|
||||
@TableField(value = "RATED_EFFICIENCY")
|
||||
private Double ratedEfficiency;
|
||||
|
||||
@TableField(value = "RATED_RESOLUTION")
|
||||
private Double ratedResolution;
|
||||
|
||||
@TableField(value = "ECAL_RANGE_MAX")
|
||||
private Double ecalRangeMax;
|
||||
|
||||
@TableField(value = "DATE_BEGIN")
|
||||
private Date dateBegin;
|
||||
|
||||
@TableField(value = "DATE_END")
|
||||
private Date dateEnd;
|
||||
|
||||
@TableField(value = "STATUS")
|
||||
private String status;
|
||||
|
||||
@TableField(value = "DESCRIPTION")
|
||||
private String description;
|
||||
|
||||
@TableField(value = "MODDATE")
|
||||
private Date moddate;
|
||||
|
||||
@TableField(value = "STATION_ID")
|
||||
private Integer stationId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String stationName;
|
||||
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
package org.jeecg.modules.system.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@TableName("GARDS_NUCLEARFACILITY")
|
||||
public class GardsNuclearfacility implements Serializable {
|
||||
|
||||
@TableField(value = "FACILITY_ID")
|
||||
private Integer facilityId;
|
||||
|
||||
@TableField(value = "FACILITY_NAME")
|
||||
private String facilityName;
|
||||
|
||||
@TableField(value = "TYPE")
|
||||
private String type;
|
||||
|
||||
@TableField(value = "LOCATION")
|
||||
private String location;
|
||||
|
||||
@TableField(value = "LONGITUDE")
|
||||
private String longitude;
|
||||
|
||||
@TableField(value = "LATITUDE")
|
||||
private String latitude;
|
||||
|
||||
@TableField(value = "STATUS")
|
||||
private String status;
|
||||
|
||||
@TableField(value = "BUILDDATE")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date buildDate;
|
||||
|
||||
@TableField(value = "CRITICALITYDATE")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date criticalityDate;
|
||||
|
||||
@TableField(value = "RETIREDATE")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date retireDate;
|
||||
|
||||
@TableField(value = "GRIDCONEETIONDATE")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date gridconeetionDate;
|
||||
|
||||
@TableField(value = "VENDOR")
|
||||
private String vendor;
|
||||
|
||||
@TableField(value = "OWNER")
|
||||
private String owner;
|
||||
|
||||
@TableField(value = "OPERARTOR")
|
||||
private String operartor;
|
||||
|
||||
@TableField(value = "CAPACITYGROSS")
|
||||
private Integer capacitygross;
|
||||
|
||||
@TableField(value = "CAPACITYNET")
|
||||
private Integer capacitynet;
|
||||
|
||||
@TableField(value = "CAPACITYTHERMAL")
|
||||
private Integer capacitythermal;
|
||||
|
||||
@TableField(value = "ACTIVITY_DAY")
|
||||
private Integer activityDay;
|
||||
|
||||
@TableField(value = "ACTIVITY_YEAR")
|
||||
private Integer activityYear;
|
||||
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package org.jeecg.modules.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.system.entity.GardsDetectors;
|
||||
|
||||
public interface GardsDetectorsMapper extends BaseMapper<GardsDetectors> {
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package org.jeecg.modules.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.system.entity.GardsNuclearfacility;
|
||||
|
||||
public interface GardsNuclearfacilityMapper extends BaseMapper<GardsNuclearfacility> {
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
package org.jeecg.modules.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.common.api.QueryRequest;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.system.entity.GardsDetectors;
|
||||
|
||||
public interface IGardsDetectorsService extends IService<GardsDetectors> {
|
||||
|
||||
/**
|
||||
* 分页查询监测器信息
|
||||
* @param gardsDetectors
|
||||
* @return
|
||||
*/
|
||||
Result<IPage<GardsDetectors>> findPage(QueryRequest queryRequest, GardsDetectors gardsDetectors);
|
||||
|
||||
/**
|
||||
* 查询监测器详情信息
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
GardsDetectors findInfo(Integer id);
|
||||
|
||||
/**
|
||||
* 新增监测器信息
|
||||
* @param gardsDetectors
|
||||
* @return
|
||||
*/
|
||||
Result create(GardsDetectors gardsDetectors);
|
||||
|
||||
/**
|
||||
* 修改监测器信息
|
||||
* @param gardsDetectors
|
||||
* @return
|
||||
*/
|
||||
Result update(GardsDetectors gardsDetectors);
|
||||
|
||||
/**
|
||||
* 删除监测器信息
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
Result deleteById(Integer id);
|
||||
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
package org.jeecg.modules.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.common.api.QueryRequest;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.system.entity.GardsNuclearfacility;
|
||||
|
||||
public interface IGardsNuclearfacilityService extends IService<GardsNuclearfacility> {
|
||||
|
||||
/**
|
||||
* 分页查询核设施信息
|
||||
* @param queryRequest
|
||||
* @param gardsNuclearfacility
|
||||
* @return
|
||||
*/
|
||||
Result<IPage<GardsNuclearfacility>> findPage(QueryRequest queryRequest, GardsNuclearfacility gardsNuclearfacility);
|
||||
|
||||
/**
|
||||
* 查询核设施详情信息
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
GardsNuclearfacility findInfo(Integer id);
|
||||
|
||||
/**
|
||||
* 新增核设施信息
|
||||
* @param gardsNuclearfacility
|
||||
* @return
|
||||
*/
|
||||
Result create(GardsNuclearfacility gardsNuclearfacility);
|
||||
|
||||
/**
|
||||
* 修改核设施信息
|
||||
* @param gardsNuclearfacility
|
||||
* @return
|
||||
*/
|
||||
Result update(GardsNuclearfacility gardsNuclearfacility);
|
||||
|
||||
/**
|
||||
* 删除核设施信息
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
Result deleteById(Integer id);
|
||||
|
||||
}
|
|
@ -8,14 +8,40 @@ import org.jeecg.modules.system.entity.GardsSelfbuiltStations;
|
|||
|
||||
public interface IGardsSelfbuiltService extends IService<GardsSelfbuiltStations> {
|
||||
|
||||
/**
|
||||
* 分页查询自建台站信息
|
||||
* @param queryRequest
|
||||
* @param gardsSelfbuiltStations
|
||||
* @return
|
||||
*/
|
||||
Result<IPage<GardsSelfbuiltStations>> findPage(QueryRequest queryRequest, GardsSelfbuiltStations gardsSelfbuiltStations);
|
||||
|
||||
/**
|
||||
* 查询自建台站详情信息
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
GardsSelfbuiltStations findInfo(Integer id);
|
||||
|
||||
/**
|
||||
* 新增自建台站信息
|
||||
* @param gardsSelfbuiltStations
|
||||
* @return
|
||||
*/
|
||||
Result create(GardsSelfbuiltStations gardsSelfbuiltStations);
|
||||
|
||||
/**
|
||||
* 修改自建台站信息
|
||||
* @param gardsSelfbuiltStations
|
||||
* @return
|
||||
*/
|
||||
Result update(GardsSelfbuiltStations gardsSelfbuiltStations);
|
||||
|
||||
/**
|
||||
* 删除自建台站信息
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
Result deleteById(Integer id);
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,115 @@
|
|||
package org.jeecg.modules.system.service.impl;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.jeecg.common.api.QueryRequest;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.system.entity.GardsDetectors;
|
||||
import org.jeecg.modules.system.entity.GardsStations;
|
||||
import org.jeecg.modules.system.mapper.GardsDetectorsMapper;
|
||||
import org.jeecg.modules.system.service.IGardsDetectorsService;
|
||||
import org.jeecg.modules.system.service.IGardsStationsService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Service("gardsDetectorsService")
|
||||
@DS("ora")
|
||||
public class GardsDetectorsServiceImpl extends ServiceImpl<GardsDetectorsMapper, GardsDetectors> implements IGardsDetectorsService {
|
||||
|
||||
@Autowired
|
||||
private IGardsStationsService gardsStationsService;
|
||||
|
||||
@Override
|
||||
public Result<IPage<GardsDetectors>> findPage(QueryRequest queryRequest, GardsDetectors gardsDetectors) {
|
||||
Result<IPage<GardsDetectors>> result = new Result<>();
|
||||
//查询台站信息接口
|
||||
List<GardsStations> gardsStations = gardsStationsService.getGardsStations();
|
||||
//分页查询
|
||||
Page<GardsDetectors> page = new Page<>(queryRequest.getPageNo(), queryRequest.getPageSize());
|
||||
LambdaQueryWrapper<GardsDetectors> queryWrapper = new LambdaQueryWrapper<>();
|
||||
Page<GardsDetectors> detectorsPage = this.baseMapper.selectPage(page, queryWrapper);
|
||||
detectorsPage.getRecords().forEach(item->{
|
||||
for (GardsStations gardsStation:gardsStations) {
|
||||
if (gardsStation.getStationId().equals(item.getStationId())){
|
||||
item.setStationName(gardsStation.getStationCode());
|
||||
}
|
||||
}
|
||||
});
|
||||
result.setSuccess(true);
|
||||
result.setResult(detectorsPage);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GardsDetectors findInfo(Integer id) {
|
||||
//查询台站信息接口
|
||||
List<GardsStations> gardsStations = gardsStationsService.getGardsStations();
|
||||
LambdaQueryWrapper<GardsDetectors> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(GardsDetectors::getDetectorId, id);
|
||||
GardsDetectors gardsDetectors = this.baseMapper.selectOne(queryWrapper);
|
||||
if (Objects.isNull(gardsDetectors)) {
|
||||
throw new RuntimeException("当前数据不存在");
|
||||
}
|
||||
for (GardsStations gardsStation:gardsStations) {
|
||||
if (gardsStation.getStationId().equals(gardsDetectors.getStationId())) {
|
||||
gardsDetectors.setStationName(gardsStation.getStationCode());
|
||||
}
|
||||
}
|
||||
return gardsDetectors;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result create(GardsDetectors gardsDetectors) {
|
||||
Result result = new Result();
|
||||
LambdaQueryWrapper<GardsDetectors> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(GardsDetectors::getDetectorCode, gardsDetectors.getDetectorCode());
|
||||
GardsDetectors detectors = this.baseMapper.selectOne(queryWrapper);
|
||||
if (Objects.nonNull(detectors)) {
|
||||
throw new RuntimeException("当前数据已存在,新增失败!");
|
||||
}
|
||||
Long id = IdWorker.getId();
|
||||
gardsDetectors.setDetectorId(id.intValue());
|
||||
this.baseMapper.insert(gardsDetectors);
|
||||
result.success("新增成功");
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result update(GardsDetectors gardsDetectors) {
|
||||
Result result = new Result();
|
||||
LambdaQueryWrapper<GardsDetectors> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(GardsDetectors::getDetectorId, gardsDetectors.getDetectorId());
|
||||
GardsDetectors stations = this.baseMapper.selectOne(wrapper);
|
||||
if (Objects.isNull(stations)) {
|
||||
throw new RuntimeException("当前数据不存在,修改失败");
|
||||
}
|
||||
LambdaQueryWrapper<GardsDetectors> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(GardsDetectors::getDetectorCode, gardsDetectors.getDetectorCode());
|
||||
GardsDetectors detectors = this.baseMapper.selectOne(queryWrapper);
|
||||
if (Objects.nonNull(detectors) && !detectors.getDetectorId().equals(gardsDetectors.getDetectorId())) {
|
||||
throw new RuntimeException("当前数据已存在,修改失败!");
|
||||
}
|
||||
LambdaQueryWrapper<GardsDetectors> detectorsQueryWrapper = new LambdaQueryWrapper<>();
|
||||
detectorsQueryWrapper.eq(GardsDetectors::getDetectorId, gardsDetectors.getDetectorId());
|
||||
this.baseMapper.update(gardsDetectors, detectorsQueryWrapper);
|
||||
result.success("修改成功");
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result deleteById(Integer id) {
|
||||
Result result = new Result();
|
||||
LambdaQueryWrapper<GardsDetectors> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(GardsDetectors::getDetectorId, id);
|
||||
this.baseMapper.delete(queryWrapper);
|
||||
result.success("删除成功");
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,96 @@
|
|||
package org.jeecg.modules.system.service.impl;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.jeecg.common.api.QueryRequest;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.system.entity.GardsNuclearfacility;
|
||||
import org.jeecg.modules.system.mapper.GardsNuclearfacilityMapper;
|
||||
import org.jeecg.modules.system.service.IGardsNuclearfacilityService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Service("gardsNuclearfacilityService")
|
||||
@DS("ora")
|
||||
public class GardsNuclearfacilityServiceImpl extends ServiceImpl<GardsNuclearfacilityMapper, GardsNuclearfacility> implements IGardsNuclearfacilityService {
|
||||
|
||||
@Override
|
||||
public Result<IPage<GardsNuclearfacility>> findPage(QueryRequest queryRequest, GardsNuclearfacility gardsNuclearfacility) {
|
||||
Result<IPage<GardsNuclearfacility>> result = new Result<>();
|
||||
Page<GardsNuclearfacility> page = new Page<>(queryRequest.getPageNo(), queryRequest.getPageSize());
|
||||
LambdaQueryWrapper<GardsNuclearfacility> queryWrapper = new LambdaQueryWrapper<>();
|
||||
Page<GardsNuclearfacility> gardsNuclearfacilityPage = this.baseMapper.selectPage(page, queryWrapper);
|
||||
result.setSuccess(true);
|
||||
result.setResult(gardsNuclearfacilityPage);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GardsNuclearfacility findInfo(Integer id) {
|
||||
LambdaQueryWrapper<GardsNuclearfacility> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(GardsNuclearfacility::getFacilityId, id);
|
||||
GardsNuclearfacility gardsNuclearfacility = this.baseMapper.selectOne(queryWrapper);
|
||||
if (Objects.isNull(gardsNuclearfacility)) {
|
||||
throw new RuntimeException("当前数据不存在");
|
||||
}
|
||||
return gardsNuclearfacility;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Result create(GardsNuclearfacility gardsNuclearfacility) {
|
||||
Result result = new Result();
|
||||
LambdaQueryWrapper<GardsNuclearfacility> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(GardsNuclearfacility::getFacilityName, gardsNuclearfacility.getFacilityName());
|
||||
GardsNuclearfacility nuclearfacility = this.baseMapper.selectOne(queryWrapper);
|
||||
if (Objects.nonNull(nuclearfacility)){
|
||||
throw new RuntimeException("当前同名称的核设施已存在,新增失败");
|
||||
}
|
||||
Long id = IdWorker.getId();
|
||||
gardsNuclearfacility.setFacilityId(id.intValue());
|
||||
this.baseMapper.insert(gardsNuclearfacility);
|
||||
result.success("新增成功");
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Result update(GardsNuclearfacility gardsNuclearfacility) {
|
||||
Result result = new Result();
|
||||
LambdaQueryWrapper<GardsNuclearfacility> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(GardsNuclearfacility::getFacilityId,gardsNuclearfacility.getFacilityId());
|
||||
GardsNuclearfacility stations = this.baseMapper.selectOne(wrapper);
|
||||
if (Objects.isNull(stations)){
|
||||
throw new RuntimeException("修改失败,当前数据不存在!");
|
||||
}
|
||||
LambdaQueryWrapper<GardsNuclearfacility> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(GardsNuclearfacility::getFacilityName, gardsNuclearfacility.getFacilityName());
|
||||
GardsNuclearfacility nuclearfacility = this.baseMapper.selectOne(queryWrapper);
|
||||
if (Objects.nonNull(nuclearfacility) && !nuclearfacility.getFacilityId().equals(gardsNuclearfacility.getFacilityId())){
|
||||
throw new RuntimeException("当前同名称的核设施已存在,修改失败");
|
||||
}
|
||||
LambdaQueryWrapper<GardsNuclearfacility> nuclearfacilityQueryWrapper = new LambdaQueryWrapper<>();
|
||||
nuclearfacilityQueryWrapper.eq(GardsNuclearfacility::getFacilityId, gardsNuclearfacility.getFacilityId());
|
||||
this.baseMapper.update(gardsNuclearfacility, nuclearfacilityQueryWrapper);
|
||||
result.success("修改成功");
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Result deleteById(Integer id) {
|
||||
Result result = new Result();
|
||||
LambdaQueryWrapper<GardsNuclearfacility> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(GardsNuclearfacility::getFacilityId, id);
|
||||
this.baseMapper.delete(queryWrapper);
|
||||
result.success("删除成功");
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
|
@ -53,7 +53,7 @@ public class GardsSelfbuiltServiceImpl extends ServiceImpl<GardsSelfbuiltStation
|
|||
queryWrapper.eq(GardsSelfbuiltStations::getCode, gardsSelfbuiltStations.getCode());
|
||||
GardsSelfbuiltStations selfbuiltStations = this.baseMapper.selectOne(queryWrapper);
|
||||
if (Objects.nonNull(selfbuiltStations)) {
|
||||
throw new RuntimeException("当前数据已存在!");
|
||||
throw new RuntimeException("当前数据已存在,新增失败!");
|
||||
}
|
||||
//获取request
|
||||
HttpServletRequest request = SpringContextUtils.getHttpServletRequest();
|
||||
|
@ -76,11 +76,17 @@ public class GardsSelfbuiltServiceImpl extends ServiceImpl<GardsSelfbuiltStation
|
|||
@Transactional
|
||||
public Result update(GardsSelfbuiltStations gardsSelfbuiltStations) {
|
||||
Result result = new Result();
|
||||
LambdaQueryWrapper<GardsSelfbuiltStations> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(GardsSelfbuiltStations::getId,gardsSelfbuiltStations.getId());
|
||||
GardsSelfbuiltStations stations = this.baseMapper.selectOne(wrapper);
|
||||
if (Objects.isNull(stations)){
|
||||
throw new RuntimeException("修改失败,当前数据不存在!");
|
||||
}
|
||||
LambdaQueryWrapper<GardsSelfbuiltStations> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(GardsSelfbuiltStations::getCode, gardsSelfbuiltStations.getCode());
|
||||
GardsSelfbuiltStations selfbuiltStations = this.baseMapper.selectOne(queryWrapper);
|
||||
if (Objects.nonNull(selfbuiltStations) && !selfbuiltStations.getId().equals(gardsSelfbuiltStations.getId())) {
|
||||
throw new RuntimeException("当前数据已存在!");
|
||||
throw new RuntimeException("当前数据已存在,修改失败!");
|
||||
}
|
||||
//获取request
|
||||
HttpServletRequest request = SpringContextUtils.getHttpServletRequest();
|
||||
|
|
Loading…
Reference in New Issue
Block a user