| | |
| | | package com.ruoyi.production.controller; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.production.dto.ProductionProductMainDto; |
| | | import com.ruoyi.production.pojo.ProductionProductMain; |
| | | import com.ruoyi.production.bean.dto.ProductionProductMainDto; |
| | | import com.ruoyi.production.service.ProductionProductMainService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | @RequestMapping("productionProductMain") |
| | | @RestController |
| | | @Api(value = "生产报工") |
| | | @Tag(name = "生产报工") |
| | | @AllArgsConstructor |
| | | public class ProductionProductMainController { |
| | | |
| | | @Autowired |
| | | private ProductionProductMainService productionProductMainService; |
| | | |
| | | /** |
| | | * 报工查询 |
| | | * @param page |
| | | * @param productionProductMainDto |
| | | * @return |
| | | */ |
| | | @GetMapping("listPage") |
| | | public R page(Page<ProductionProductMainDto> page, ProductionProductMainDto productionProductMainDto) { |
| | | return R.ok(productionProductMainService.listPageProductionProductMainDto(page, productionProductMainDto)); |
| | | } |
| | | |
| | | @GetMapping("addProductMain") |
| | | public R addProductMain(ProductionProductMainDto productionProductMainDto) { |
| | | @GetMapping("/page") |
| | | @Operation(summary = "生产报工分页查询") |
| | | public R pageProductionProductMain(Page<ProductionProductMainDto> page, ProductionProductMainDto productionProductMainDto) { |
| | | return R.ok(productionProductMainService.pageProductionProductMain(page, productionProductMainDto)); |
| | | } |
| | | |
| | | @GetMapping("/{id}") |
| | | @Operation(summary = "生产报工详情") |
| | | public R getInfo(@PathVariable("id") Long id) { |
| | | return R.ok(productionProductMainService.getProductionProductMainInfo(id)); |
| | | } |
| | | |
| | | /** |
| | | * 报工新增更新 |
| | | * @param productionProductMainDto |
| | | * @return |
| | | */ |
| | | @PostMapping("addProductMain") |
| | | public R addProductMain(@RequestBody ProductionProductMainDto productionProductMainDto) { |
| | | return R.ok(productionProductMainService.addProductMain(productionProductMainDto)); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Operation(summary = "新增生产报工") |
| | | public R add(@RequestBody ProductionProductMainDto productionProductMainDto) { |
| | | return R.ok(productionProductMainService.saveProductionProductMain(productionProductMainDto)); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Operation(summary = "修改生产报工") |
| | | public R edit(@RequestBody ProductionProductMainDto productionProductMainDto) { |
| | | return R.ok(productionProductMainService.saveProductionProductMain(productionProductMainDto)); |
| | | } |
| | | |
| | | @Operation(summary = "删除报工") |
| | | @DeleteMapping("/delete") |
| | | public R delete(@RequestBody ProductionProductMainDto productionProductMainDto) { |
| | | return R.ok(productionProductMainService.removeProductMain(productionProductMainDto.getId())); |
| | | } |
| | | |
| | | @DeleteMapping("/{id}") |
| | | @Operation(summary = "删除生产报工") |
| | | public R remove(@PathVariable("id") Long id) { |
| | | return R.ok(productionProductMainService.removeProductMain(id)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 导出 |
| | | */ |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, ProductionProductMainDto productionProductMainDto) { |
| | | List<ProductionProductMainDto> list; |
| | | list = productionProductMainService.listPageProductionProductMainDto(new Page<>(1, -1), productionProductMainDto).getRecords(); |
| | | ExcelUtil<ProductionProductMainDto> util = new ExcelUtil<ProductionProductMainDto>(ProductionProductMainDto.class); |
| | | util.exportExcel(response, list, "生产报工数据"); |
| | | } |
| | | } |