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.
72 lines
2.7 KiB
72 lines
2.7 KiB
package com.qyft.ms.app.controller;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.qyft.ms.app.model.dto.MatrixCraftDTO;
|
|
import com.qyft.ms.app.model.entity.MatrixCraft;
|
|
import com.qyft.ms.app.model.vo.MatrixCraftResult;
|
|
import com.qyft.ms.app.service.MatrixCraftService;
|
|
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 com.qyft.ms.system.model.entity.User;
|
|
import com.qyft.ms.system.service.IUserService;
|
|
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.*;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
@Tag(name = "基质工艺")
|
|
@RestController
|
|
@RequestMapping("/api/matrixCraft")
|
|
@RequiredArgsConstructor
|
|
@Slf4j
|
|
public class MatrixCraftController {
|
|
|
|
private final MatrixCraftService matrixCraftService;
|
|
private final IUserService iUserService;
|
|
|
|
@Operation(summary = "新增基质工艺")
|
|
@PostMapping("/add")
|
|
public Result<Integer> add(@RequestBody MatrixCraftDTO dto) {
|
|
User user = iUserService.currentUser();
|
|
if (user != null) {
|
|
dto.setCreateUser(user.getId());
|
|
}
|
|
return Result.success(matrixCraftService.add(dto));
|
|
}
|
|
|
|
@Operation(summary = "基质工艺详情")
|
|
@GetMapping("/{id}")
|
|
public Result<MatrixCraft> getCraftById(@PathVariable Long id) {
|
|
return Result.success(matrixCraftService.getCraftById(id));
|
|
}
|
|
|
|
@Operation(summary = "基质工艺列表")
|
|
@GetMapping("/getListByMatrixId/{matrixId}")
|
|
public Result<List<MatrixCraft>> getListByMatrixId(@PathVariable Long matrixId) {
|
|
return Result.success(matrixCraftService.getListByMatrixId(matrixId));
|
|
}
|
|
|
|
@Operation(summary = "所有工艺列表")
|
|
@GetMapping("/list")
|
|
public PageResult<MatrixCraftResult> getAll(BasePageQuery pageQuery) {
|
|
// IPage<MatrixCraft> result = matrixCraftService.page(new Page<>(pageQuery.getPageNum(), pageQuery.getPageSize()), null);
|
|
return PageResult.success(matrixCraftService.getAll(pageQuery));
|
|
}
|
|
|
|
@Operation(summary = "基质工艺更新")
|
|
@PutMapping
|
|
public Result<Boolean> update(@RequestBody MatrixCraft matrixCraft) {
|
|
return Result.success(matrixCraftService.updateMatrixCraft(matrixCraft));
|
|
}
|
|
|
|
@Operation(summary = "基质删除")
|
|
@DeleteMapping("/{ids}")
|
|
public Result<Boolean> deleteMatrixCraft(@PathVariable String ids) {
|
|
return Result.success(matrixCraftService.deleteMatrixCraft(ids));
|
|
}
|
|
}
|