|
|
@ -1,5 +1,7 @@ |
|
|
|
package com.iflytop.nuclear.service.impl; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
import com.iflytop.nuclear.mapper.CameraMapper; |
|
|
|
import com.iflytop.nuclear.model.Camera; |
|
|
@ -13,15 +15,37 @@ import org.springframework.stereotype.Service; |
|
|
|
@Service |
|
|
|
public class CameraServiceImpl extends ServiceImpl<CameraMapper, Camera> implements CameraService { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public boolean addNewRecord(String stationCoreId, String simulationBrightness, String exposure) { |
|
|
|
return false; |
|
|
|
Camera camera = this.getInfoByCoreId(stationCoreId); |
|
|
|
if (camera != null) { |
|
|
|
// 目前存在该记录则进行更新操作 |
|
|
|
UpdateWrapper update = new UpdateWrapper(); |
|
|
|
update.eq("nuclear_core_id", stationCoreId); |
|
|
|
Camera camera1 = new Camera(); |
|
|
|
camera1.setExposure(exposure); |
|
|
|
camera1.setSimulation_brightness(simulationBrightness); |
|
|
|
camera1.setNuclear_core_id(stationCoreId); |
|
|
|
boolean update1 = this.update(camera1, update); |
|
|
|
return update1; |
|
|
|
}else { |
|
|
|
// 不存在 则新增 |
|
|
|
Camera camera1 = Camera.builder() |
|
|
|
.exposure(exposure) |
|
|
|
.simulation_brightness(simulationBrightness) |
|
|
|
.nuclear_core_id(stationCoreId) |
|
|
|
.build(); |
|
|
|
boolean save = this.save(camera1); |
|
|
|
return save; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Camera getInfoByCoreId(String coreId) { |
|
|
|
return null; |
|
|
|
// 通过stationCoreId查询 |
|
|
|
QueryWrapper<Camera> cameraQueryWrapper = new QueryWrapper<>(); |
|
|
|
cameraQueryWrapper.eq("nuclear_core_id", coreId); |
|
|
|
Camera one = this.getOne(cameraQueryWrapper); |
|
|
|
return one; |
|
|
|
} |
|
|
|
} |