From eeebc22772cbf7dc03ed4bc6f734e6de9f5c3e75 Mon Sep 17 00:00:00 2001 From: zhangherong <571457620@qq.com> Date: 星期三, 06 八月 2025 10:55:56 +0800 Subject: [PATCH] art: 订单BOM、物料工序 后端代码修改、优化 --- src/main/java/org/jeecg/modules/pms/controller/PmsProcessBillMaterialsDetailController.java | 179 ++++++----------------------------------------------------- 1 files changed, 18 insertions(+), 161 deletions(-) diff --git a/src/main/java/org/jeecg/modules/pms/controller/PmsProcessBillMaterialsDetailController.java b/src/main/java/org/jeecg/modules/pms/controller/PmsProcessBillMaterialsDetailController.java index 8f93da4..583065a 100644 --- a/src/main/java/org/jeecg/modules/pms/controller/PmsProcessBillMaterialsDetailController.java +++ b/src/main/java/org/jeecg/modules/pms/controller/PmsProcessBillMaterialsDetailController.java @@ -1,182 +1,39 @@ package org.jeecg.modules.pms.controller; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.jeecg.common.api.vo.Result; -import org.jeecg.common.aspect.annotation.AutoLog; import org.jeecg.common.system.base.controller.JeecgController; -import org.jeecg.common.system.query.QueryGenerator; -import org.jeecg.modules.pms.entity.PmsProcessBillMaterials; import org.jeecg.modules.pms.entity.PmsProcessBillMaterialsDetail; import org.jeecg.modules.pms.service.IPmsProcessBillMaterialsDetailService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.util.Arrays; -import java.util.Map; +import java.util.List; /** -* @Description: 鐗╂枡娓呭崟 -* @Author: jeecg-boot -* @Date: 2025-07-01 -* @Version: V1.0 -*/ -@Api(tags="鐗╂枡娓呭崟") + * @Description: 鐗╂枡娓呭崟 + * @Author: jeecg-boot + * @Date: 2025-07-01 + * @Version: V1.0 + */ +@Api(tags = "鐗╂枡娓呭崟") @RestController -@RequestMapping("/pms/pmsProcessBillMaterialsDetail") +@RequestMapping("/pms/processBillMaterialsDetail") @Slf4j public class PmsProcessBillMaterialsDetailController extends JeecgController<PmsProcessBillMaterialsDetail, IPmsProcessBillMaterialsDetailService> { - @Autowired - private IPmsProcessBillMaterialsDetailService pmsProcessBillMaterialsDetailService; + @Autowired + private IPmsProcessBillMaterialsDetailService pmsProcessBillMaterialsDetailService; - /** - * 鍒嗛〉鍒楄〃鏌ヨ - * - * @param pmsProcessBillMaterialsDetail - * @param pageNo - * @param pageSize - * @param req - * @return - */ - //@AutoLog(value = "鐗╂枡娓呭崟-鍒嗛〉鍒楄〃鏌ヨ") - @ApiOperation(value="鐗╂枡娓呭崟-鍒嗛〉鍒楄〃鏌ヨ", notes="鐗╂枡娓呭崟-鍒嗛〉鍒楄〃鏌ヨ") - @GetMapping(value = "/list") - public Result<IPage<PmsProcessBillMaterialsDetail>> queryPageList(PmsProcessBillMaterialsDetail pmsProcessBillMaterialsDetail, - @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, - @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, - HttpServletRequest req) { - QueryWrapper<PmsProcessBillMaterialsDetail> queryWrapper = QueryGenerator.initQueryWrapper(pmsProcessBillMaterialsDetail, req.getParameterMap()); - Page<PmsProcessBillMaterialsDetail> page = new Page<PmsProcessBillMaterialsDetail>(pageNo, pageSize); - IPage<PmsProcessBillMaterialsDetail> pageList = pmsProcessBillMaterialsDetailService.page(page, queryWrapper); - return Result.OK(pageList); - } - - /** - * 娣诲姞 - * - * @param pmsProcessBillMaterialsDetail - * @return - */ - @AutoLog(value = "鐗╂枡娓呭崟-娣诲姞") - @ApiOperation(value="鐗╂枡娓呭崟-娣诲姞", notes="鐗╂枡娓呭崟-娣诲姞") - //@RequiresPermissions("org.jeecg.modules:pms_process_bill_materials_detail:add") - @PostMapping(value = "/add") - public Result<String> add(@RequestBody PmsProcessBillMaterialsDetail pmsProcessBillMaterialsDetail) { - pmsProcessBillMaterialsDetailService.save(pmsProcessBillMaterialsDetail); - return Result.OK("娣诲姞鎴愬姛锛�"); - } - - /** - * 缂栬緫 - * - * @param pmsProcessBillMaterialsDetail - * @return - */ - @AutoLog(value = "鐗╂枡娓呭崟-缂栬緫") - @ApiOperation(value="鐗╂枡娓呭崟-缂栬緫", notes="鐗╂枡娓呭崟-缂栬緫") - //@RequiresPermissions("org.jeecg.modules:pms_process_bill_materials_detail:edit") - @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) - public Result<String> edit(@RequestBody PmsProcessBillMaterialsDetail pmsProcessBillMaterialsDetail) { - pmsProcessBillMaterialsDetailService.updateById(pmsProcessBillMaterialsDetail); - return Result.OK("缂栬緫鎴愬姛!"); - } - - /** - * 閫氳繃id鍒犻櫎 - * - * @param id - * @return - */ - @AutoLog(value = "鐗╂枡娓呭崟-閫氳繃id鍒犻櫎") - @ApiOperation(value="鐗╂枡娓呭崟-閫氳繃id鍒犻櫎", notes="鐗╂枡娓呭崟-閫氳繃id鍒犻櫎") - //@RequiresPermissions("org.jeecg.modules:pms_process_bill_materials_detail:delete") - @DeleteMapping(value = "/delete") - public Result<String> delete(@RequestParam(name="id",required=true) String id) { - pmsProcessBillMaterialsDetailService.removeById(id); - return Result.OK("鍒犻櫎鎴愬姛!"); - } - - /** - * 鎵归噺鍒犻櫎 - * - * @param ids - * @return - */ - @AutoLog(value = "鐗╂枡娓呭崟-鎵归噺鍒犻櫎") - @ApiOperation(value="鐗╂枡娓呭崟-鎵归噺鍒犻櫎", notes="鐗╂枡娓呭崟-鎵归噺鍒犻櫎") - //@RequiresPermissions("org.jeecg.modules:pms_process_bill_materials_detail:deleteBatch") - @DeleteMapping(value = "/deleteBatch") - public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { - this.pmsProcessBillMaterialsDetailService.removeByIds(Arrays.asList(ids.split(","))); - return Result.OK("鎵归噺鍒犻櫎鎴愬姛!"); - } - - /** - * 閫氳繃id鏌ヨ - * - * @param id - * @return - */ - //@AutoLog(value = "鐗╂枡娓呭崟-閫氳繃id鏌ヨ") - @ApiOperation(value="鐗╂枡娓呭崟-閫氳繃id鏌ヨ", notes="鐗╂枡娓呭崟-閫氳繃id鏌ヨ") - @GetMapping(value = "/queryById") - public Result<PmsProcessBillMaterialsDetail> queryById(@RequestParam(name="id",required=true) String id) { - PmsProcessBillMaterialsDetail pmsProcessBillMaterialsDetail = pmsProcessBillMaterialsDetailService.getById(id); - if(pmsProcessBillMaterialsDetail==null) { - return Result.error("鏈壘鍒板搴旀暟鎹�"); - } - return Result.OK(pmsProcessBillMaterialsDetail); - } - - /** - * 瀵煎嚭excel - * - * @param request - * @param pmsProcessBillMaterialsDetail - */ - //@RequiresPermissions("org.jeecg.modules:pms_process_bill_materials_detail:exportXls") - @RequestMapping(value = "/exportXls") - public ModelAndView exportXls(HttpServletRequest request, PmsProcessBillMaterialsDetail pmsProcessBillMaterialsDetail) { - return super.exportXls(request, pmsProcessBillMaterialsDetail, PmsProcessBillMaterialsDetail.class, "鐗╂枡娓呭崟"); - } - - /** - * 閫氳繃excel瀵煎叆鏁版嵁 - * - * @param request - * @param response - * @return - */ - //@RequiresPermissions("pms_process_bill_materials_detail:importExcel") - @RequestMapping(value = "/importExcel", method = RequestMethod.POST) - public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { - return super.importExcel(request, response, PmsProcessBillMaterialsDetail.class); - } - @ApiOperation(value="鐗╂枡娓呭崟-閫氳繃鐢熶骇鐗╂枡ID鏌ヨ", notes="鐗╂枡娓呭崟-閫氳繃id鏌ヨ") + @ApiOperation(value = "鐗╂枡娓呭崟-閫氳繃鐢熶骇鐗╂枡ID鏌ヨ", notes = "鐗╂枡娓呭崟-閫氳繃id鏌ヨ") @GetMapping(value = "/queryByMaterialId") - public Result<PmsProcessBillMaterialsDetail> queryByMaterialId(@RequestParam(name="materialId",required=true) String materialId) { - PmsProcessBillMaterialsDetail pmsProcessBillMaterialsDetail = pmsProcessBillMaterialsDetailService.queryByMaterialId(materialId); - if(pmsProcessBillMaterialsDetail==null) { - return Result.error("鏈壘鍒板搴旀暟鎹�"); - } - return Result.OK(pmsProcessBillMaterialsDetail); - } - - @GetMapping(value = "/searchlikeQuery") - public Result<?> searchlikeQuery(PmsProcessBillMaterialsDetail pmsProcessBillMaterialsDetail, - @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, - @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, - HttpServletRequest req){ - IPage<Map<String, Object>> pageList = pmsProcessBillMaterialsDetailService.getpmsProcessBillMaterialsDetailListData(pageNo,pageSize,req); - - return Result.OK(pageList); + public Result<?> queryByMaterialId(@RequestParam(name = "materialId", required = true) String materialId) { + List<PmsProcessBillMaterialsDetail> list = pmsProcessBillMaterialsDetailService.queryByMaterialId(materialId); + return Result.OK(list); } } -- Gitblit v1.9.3