package com.yuanchu.mom.controller; import com.yuanchu.mom.pojo.dto.TechnologyDto; import com.yuanchu.mom.service.TechnologyService; 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.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; /** *
* 前端控制器 *
* * @author 江苏鵷雏网络科技有限公司 * @since 2023-07-31 */ @Api(tags = "技术管理-->标准BOM-->工艺路线") @RestController @RequestMapping("/technology") public class TechnologyController { @Autowired private TechnologyService technologyService; @ApiOperation("右上角新增-->工艺路线-->选择设备组") @GetMapping("/chooseDevice") public Result> chooseDevice() { return Result.success(technologyService.chooseDevice()); } @ApiOperation("右上角新增-->工艺路线-->选择工序") @ApiImplicitParams(value = { @ApiImplicitParam(name = "specificationsId", value = "型号id", dataTypeClass = Integer.class, required = true) }) @GetMapping("/chooseFather") public Result> chooseFather(Integer specificationsId) { return Result.success(technologyService.chooseFather(specificationsId)); } @ApiOperation("右上角新增-->工艺路线") @ApiImplicitParams(value = { @ApiImplicitParam(name = "specificationsId", value = "型号id", dataTypeClass = Integer.class, required = true) }) @PostMapping("/add") public Result> addTechnology(Integer specificationsId, @Validated @RequestBody TechnologyDto technologyDto) { technologyService.addTechnology(specificationsId, technologyDto); return Result.success("添加工艺【" + technologyDto.getName() + "】成功"); } @ApiOperation("填写生产定额,鼠标移开保存") @ApiImplicitParams(value = { @ApiImplicitParam(name = "id", value = "工艺路线id", dataTypeClass = Integer.class, required = true), @ApiImplicitParam(name = "productionQuota", value = "生产定额(个/天)", dataTypeClass = Integer.class, required = true) }) @PostMapping("/write") public Result> write(Integer id, Integer productionQuota) { Integer write = technologyService.write(id, productionQuota); if (write >= 1) { return Result.success("更新成功"); } return Result.fail("更新失败"); } @ApiOperation(value = "删除") @ApiImplicitParams(value = { @ApiImplicitParam(name = "id", value = "工艺路线id", dataTypeClass = Integer.class,required = true) }) @PostMapping("/delTechById") public Result delTechById(Integer id) { technologyService.delTechById(id); return Result.success("删除"+id+"成功!"); } @ApiOperation(value = "批量删除") @ApiImplicitParams(value = { @ApiImplicitParam(name = "ids", value = "工艺路线id", dataTypeClass = String.class,required = true) }) @PostMapping("/delAllTech") public Result delAllTech(String ids) { technologyService.delAllTech(ids); return Result.success("批量删除成功!"); } }