| | |
| | | package com.mes.storagetask.controller;
|
| | |
|
| | | import com.mes.utils.Result;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.http.ResponseEntity;
|
| | | import io.swagger.annotations.ApiOperation;
|
| | |
| | | import org.springframework.web.bind.annotation.PutMapping;
|
| | | import org.springframework.web.bind.annotation.GetMapping;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | | import java.util.Optional;
|
| | |
|
| | | /**
|
| | | *
|
| | |
| | | @ApiOperation(value = "列表查询",notes = "列表查询",produces = "application/json")
|
| | | @ApiResponses({@ApiResponse(code = 200, message = "查询成功")})
|
| | | @PostMapping("/findList")
|
| | | public ResponseEntity<List<StorageTask>> findList(@RequestBody StorageTask params) {
|
| | | public Result findList(@RequestBody StorageTask params) {
|
| | | List<StorageTask> result = storageTaskService.findList(params);
|
| | | return ResponseEntity.ok(result);
|
| | | return Result.success(result);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | @ApiOperation(value = "查询", notes = "查询详情")
|
| | | @ApiResponses({@ApiResponse(code = 200, message = "查询成功")})
|
| | | @GetMapping("/{id}")
|
| | | public ResponseEntity<StorageTask> findById(@PathVariable("id") Long id) {
|
| | | StorageTask storageTask = storageTaskService.findById(id);
|
| | | return ResponseEntity.ok(storageTask);
|
| | | public Result findById(@PathVariable("id") Long id) {
|
| | | StorageTask storageTask = storageTaskService.getBaseMapper().selectById(id);
|
| | | return Result.success(storageTask);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | @ApiOperation(value = "新增", notes = "新增数据")
|
| | | @ApiResponses({@ApiResponse(code = 200, message = "操作成功")})
|
| | | @PostMapping
|
| | | public ResponseEntity<Boolean> insert( @RequestBody StorageTask storageTask) {
|
| | | boolean result = storageTaskService.insert(storageTask);
|
| | | return ResponseEntity.ok(result);
|
| | | public Result insert( @RequestBody StorageTask storageTask) {
|
| | | boolean result = storageTaskService.save(storageTask);
|
| | | return Result.success(result);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | @ApiOperation(value = "修改", notes = "修改数据")
|
| | | @ApiResponses({@ApiResponse(code = 200, message = "操作成功")})
|
| | | @PutMapping
|
| | | public ResponseEntity<Boolean> update( @RequestBody StorageTask storageTask) {
|
| | | boolean result = storageTaskService.update(storageTask);
|
| | | return ResponseEntity.ok(result);
|
| | | public Result update( @RequestBody StorageTask storageTask) {
|
| | | boolean result = storageTaskService.updateById(storageTask);
|
| | | return Result.success(result);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | */
|
| | | @ApiOperation(value = "删除", notes = "删除数据")
|
| | | @DeleteMapping("/{id}")
|
| | | public ResponseEntity<Integer> delete(@PathVariable("id") Long id) {
|
| | | int result = storageTaskService.delete(id);
|
| | | return ResponseEntity.ok(result);
|
| | | public Result delete(@PathVariable("id") Long id) {
|
| | | int result = storageTaskService.getBaseMapper().deleteById(id);
|
| | | return Result.success(result);
|
| | | }
|
| | |
|
| | |
|
| | | @ApiOperation(value = "任务查询",notes = "任务查询",produces = "application/json")
|
| | | @ApiResponses({@ApiResponse(code = 200, message = "查询成功")})
|
| | | @GetMapping("/findTasks")
|
| | | public Result findLatestTasks() {
|
| | | List<Map<String, Object>> result = storageTaskService.Tasks();
|
| | | return Result.success(result);
|
| | | }
|
| | |
|
| | |
|
| | | } |