| | |
| | | @ApiModelProperty("运维单位") |
| | | private Integer unitId; |
| | | |
| | | @NotBlank(message = "运维状态不能为空", groups = {Add.class, Update.class}) |
| | | // @NotBlank(message = "运维状态不能为空", groups = {Add.class, Update.class}) |
| | | @ApiModelProperty("运维状态") |
| | | private String status; |
| | | |
| | | @NotBlank(message = "备注不能为空", groups = {Add.class, Update.class}) |
| | | @ApiModelProperty("备注") |
| | | private String remark; |
| | | // @NotBlank(message = "备注不能为空", groups = {Add.class, Update.class}) |
| | | // @ApiModelProperty("备注") |
| | | // private String remark; |
| | | |
| | | public static YwPoint getEntityByForm(@NonNull YwPointForm form, YwPoint entity) { |
| | | if(entity == null) { |
| | |
| | | return ywPointService.add(form); |
| | | } |
| | | |
| | | @PostMapping("/batch") |
| | | @ApiOperation(value = "批量添加", notes = "批量添加") |
| | | public Result batchAdd(@RequestBody @NotEmpty(message = "数据不能为空") List<YwPointForm> form) { |
| | | return ywPointService.batchAdd(form); |
| | | } |
| | | |
| | | @PutMapping |
| | | @ApiOperation(value = "修改", notes = "修改") |
| | | public Result update(@RequestBody @Validated(Update.class) YwPointForm form) { |
| | |
| | | * @return |
| | | */ |
| | | Result all(); |
| | | |
| | | /** |
| | | * 批量添加 |
| | | * @param form |
| | | * @return |
| | | */ |
| | | Result batchAdd(List<YwPointForm> form); |
| | | } |
| | |
| | | return Result.error("添加失败"); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Result batchAdd(List<YwPointForm> formList) { |
| | | formList.stream() |
| | | .forEach(form -> { |
| | | YwPoint entity = YwPointForm.getEntityByForm(form, null); |
| | | entity.setStatus("未开始"); |
| | | baseMapper.insert(entity); |
| | | }); |
| | | return Result.ok("添加成功"); |
| | | } |
| | | |
| | | /** |
| | | * 修改 |
| | | * @param form |