| | |
| | | import org.springblade.core.tool.constant.BladeConstant; |
| | | import org.springblade.core.tool.utils.DateUtil; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.core.tool.utils.StringUtil; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.sxkj.gd.common.GenericConverter; |
| | | import org.sxkj.gd.common.IdParam; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 设备信息 新增或修改 |
| | | * 设备信息 新增或修改(对外) |
| | | */ |
| | | @PostMapping("/submit") |
| | | @PostMapping("/submitExternal") |
| | | @ApiOperationSupport(order = 6) |
| | | @ApiOperation(value = "新增或修改", notes = "传入gdManageDevice") |
| | | public R submit(@Valid @RequestBody GdManageDeviceDTO gdManageDevice) throws Exception { |
| | | @ApiOperation(value = "新增或修改", notes = "传入gdManageDevice,设备编码相同则修改") |
| | | public R submitExternal(@Valid @RequestBody GdManageDeviceDTO gdManageDevice) throws Exception { |
| | | |
| | | if (StringUtil.isBlank(gdManageDevice.getDeviceSn())) { |
| | | return R.fail("设备编码不能为空"); |
| | | } |
| | | |
| | | QueryWrapper<GdManageDeviceEntity> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.lambda().eq(GdManageDeviceEntity::getDeviceSn, gdManageDevice.getDeviceSn()); |
| | | |
| | | GdManageDeviceEntity detail = gdManageDeviceService.getOne(queryWrapper); |
| | | if (detail != null) { |
| | | gdManageDevice.setId(detail.getId()); |
| | | } |
| | | |
| | | |
| | | return R.status(gdManageDeviceService.saveOrUpdateDevice(GdManageDeviceWrapper.build().entityDTO(gdManageDevice))); |
| | | } |
| | | |