You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
2.2 KiB
62 lines
2.2 KiB
package com.qyft.ms.app.controller;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.qyft.ms.app.model.dto.MatrixDTO;
|
|
import com.qyft.ms.app.model.entity.Matrix;
|
|
import com.qyft.ms.app.service.MatrixService;
|
|
import com.qyft.ms.device.model.entity.CtrlFuncStep;
|
|
import com.qyft.ms.system.common.base.BasePageQuery;
|
|
import com.qyft.ms.system.common.result.PageResult;
|
|
import com.qyft.ms.system.common.result.Result;
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
@Tag(name = "基质")
|
|
@RestController
|
|
@RequestMapping("/api/matrix")
|
|
@RequiredArgsConstructor
|
|
@Slf4j
|
|
public class MatrixController {
|
|
|
|
private final MatrixService matrixService;
|
|
|
|
@Operation(summary = "新增基质")
|
|
@PostMapping("/add")
|
|
public Result<Integer> add(@RequestBody Matrix matrix) {
|
|
return Result.success(matrixService.addMatrix(matrix));
|
|
|
|
}
|
|
|
|
@Operation(summary = "基质详情")
|
|
@GetMapping("/{id}")
|
|
public Result<Matrix> getMatrixById(@PathVariable Integer id) {
|
|
return Result.success(matrixService.getById(id));
|
|
}
|
|
|
|
@Operation(summary = "基质列表")
|
|
@PostMapping("/list")
|
|
public PageResult<Matrix> getAll(@RequestBody MatrixDTO dto) {
|
|
IPage<Matrix> result = matrixService.page(new Page<>(dto.getPageNum(), dto.getPageSize()), new LambdaQueryWrapper<Matrix>()
|
|
.like(dto.getMatrixName() != null, Matrix::getName, "%"+dto.getMatrixName()+"%"));
|
|
return PageResult.success(result);
|
|
}
|
|
|
|
@Operation(summary = "基质更新")
|
|
@PutMapping
|
|
public Result<Boolean> update(@RequestBody Matrix matrix) {
|
|
return Result.success(matrixService.updateMatrix(matrix));
|
|
}
|
|
|
|
@Operation(summary = "基质删除")
|
|
@DeleteMapping("/{ids}")
|
|
public Result<Boolean> deleteMatrix(@PathVariable String ids) {
|
|
return Result.success(matrixService.deleteMatrix(ids));
|
|
}
|
|
}
|