严智鑫
2024-07-25 8a76767b0a7ad271c8487a02063590b956deb5df
hangzhoumesParent/moduleService/GlassStorageModule/src/main/java/com/mes/storagetask/controller/StorageTaskController.java
@@ -1,5 +1,6 @@
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;
@@ -14,6 +15,8 @@
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;
/**
 *  
@@ -38,9 +41,9 @@
    @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);
    }
    /**
@@ -52,9 +55,9 @@
    @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);
    }
    /**
@@ -66,9 +69,9 @@
    @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);
    }
    /**
@@ -80,9 +83,9 @@
    @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);
    }
    /**
@@ -93,9 +96,19 @@
     */
    @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);
    }
}