package com.yuanchu.mom.controller; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.yuanchu.mom.pojo.dto.TechnologyTemplateDto; import com.yuanchu.mom.vo.Result; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import com.yuanchu.mom.service.TechnologyTemplateService; import java.util.HashMap; import java.util.List; import java.util.Map; /** * 工艺模版表(TechnologyTemplate)表控制层 * * @author zss * @since 2023-08-09 11:20:20 */ @Api(tags = "基础数据-->工序") @RestController @RequestMapping("/technologyTemplate") public class TechnologyTemplateController { @Autowired private TechnologyTemplateService technologyTemplateService; @ApiOperation(value = "新增工序模版") @PostMapping("/addTech") public Result addTech(@RequestBody TechnologyTemplateDto technologyTemplateDto){ technologyTemplateService.addTech(technologyTemplateDto); return Result.success("新增成功!"); } @ApiOperation(value = "查询所有类型") @GetMapping("/seleType") public Result seleType(){ return Result.success(technologyTemplateService.seleType()); } @ApiOperation(value = "查询工序模版列表") @ApiImplicitParams(value = { @ApiImplicitParam(name = "pageSize", value = "页数", dataTypeClass = Integer.class, required = true), @ApiImplicitParam(name = "countSize", value = "条数/页", dataTypeClass = Integer.class, required = true), @ApiImplicitParam(name = "element", value = "元件", dataTypeClass = String.class), @ApiImplicitParam(name = "father", value = "工序(父类)", dataTypeClass = String.class), @ApiImplicitParam(name = "type", value = "类型", dataTypeClass = Integer.class,required = true) }) @GetMapping("/selTech") public Result selTech(Integer pageSize,Integer countSize,String element,String father,Integer type){ IPage> salePage = technologyTemplateService.selTech(new Page(pageSize, countSize), element, father, type); Map map = new HashMap<>(); map.put("total", salePage.getTotal()); map.put("row", salePage.getRecords()); return Result.success(map); } }