| | |
| | | import java.io.ByteArrayOutputStream; |
| | | import java.io.IOException; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | |
| | | } |
| | | |
| | | @DeleteMapping("/{platformId}") |
| | | @ApiOperation(value = "删除平台") |
| | | public ResponseResult<Void> delete(@PathVariable Integer platformId) { |
| | | boolean success = platformService.removeById(platformId); |
| | | if (success) { |
| | |
| | | } |
| | | |
| | | @PutMapping |
| | | @ApiOperation(value = "更新平台") |
| | | public ResponseResult<Void> update(@RequestBody Platform platform) { |
| | | // 校验平台名称和域名不能为空 |
| | | if (!StringUtils.hasText(platform.getPlatform_name())) { |
| | |
| | | } |
| | | |
| | | @GetMapping("/{platformId}") |
| | | @ApiOperation("根据id获取平台") |
| | | public ResponseResult<Platform> getById(@PathVariable Integer platformId) { |
| | | Platform platform = platformService.getById(platformId); |
| | | if (platform != null) { |
| | |
| | | } |
| | | |
| | | @GetMapping("/list") |
| | | @ApiOperation("查询平台列表,不传页数和大小就查全部") |
| | | public ResponseResult<List<Platform>> list( |
| | | @RequestParam(required = false) Integer page, |
| | | @RequestParam(required = false) Integer pageSize) { |
| | |
| | | platform.setType_id(typeByName.getType_id()); |
| | | |
| | | // 设置创建时间(解决之前的数据库错误) |
| | | platform.setCreate_time(new Date()); |
| | | platform.setCreate_time(LocalDateTime.now()); |
| | | |
| | | platforms.add(platform); |
| | | } |