From 8c945d42c6610abd9ef17bc153114024175bec2a Mon Sep 17 00:00:00 2001
From: houshuai <17802598606@163.com>
Date: 星期四, 03 七月 2025 19:43:12 +0800
Subject: [PATCH] 线边库和订单 基本搭建

---
 src/main/java/org/jeecg/modules/qms/controller/SamplingRulesController.java |  194 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 194 insertions(+), 0 deletions(-)

diff --git a/src/main/java/org/jeecg/modules/qms/controller/SamplingRulesController.java b/src/main/java/org/jeecg/modules/qms/controller/SamplingRulesController.java
new file mode 100644
index 0000000..35a1780
--- /dev/null
+++ b/src/main/java/org/jeecg/modules/qms/controller/SamplingRulesController.java
@@ -0,0 +1,194 @@
+package org.jeecg.modules.qms.controller;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.constant.CommonConstant;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.modules.qms.entity.InspectionItem;
+import org.jeecg.modules.qms.entity.SamplingRules;
+import org.jeecg.modules.qms.service.ISamplingRulesService;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import lombok.extern.slf4j.Slf4j;
+
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+import org.jeecg.common.system.base.controller.JeecgController;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+import com.alibaba.fastjson.JSON;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.jeecg.common.aspect.annotation.AutoLog;
+
+ /**
+ * @Description: 鎶芥牱瑙勫垯
+ * @Author: jeecg-boot
+ * @Date:   2025-07-02
+ * @Version: V1.0
+ */
+@Api(tags="鎶芥牱瑙勫垯")
+@RestController
+@RequestMapping("/qms/samplingRules")
+@Slf4j
+public class SamplingRulesController extends JeecgController<SamplingRules, ISamplingRulesService> {
+	@Autowired
+	private ISamplingRulesService samplingRulesService;
+	
+	/**
+	 * 鍒嗛〉鍒楄〃鏌ヨ
+	 *
+	 * @param samplingRules
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	//@AutoLog(value = "鎶芥牱瑙勫垯-鍒嗛〉鍒楄〃鏌ヨ")
+	@ApiOperation(value="鎶芥牱瑙勫垯-鍒嗛〉鍒楄〃鏌ヨ", notes="鎶芥牱瑙勫垯-鍒嗛〉鍒楄〃鏌ヨ")
+	@GetMapping(value = "/list")
+	public Result<IPage<SamplingRules>> queryPageList(SamplingRules samplingRules,
+								   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+								   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+								   HttpServletRequest req) {
+		QueryWrapper<SamplingRules> queryWrapper = QueryGenerator.initQueryWrapper(samplingRules, req.getParameterMap());
+		Page<SamplingRules> page = new Page<SamplingRules>(pageNo, pageSize);
+		IPage<SamplingRules> pageList = samplingRulesService.page(page, queryWrapper);
+		return Result.OK(pageList);
+	}
+	
+	/**
+	 *   娣诲姞
+	 *
+	 * @param samplingRules
+	 * @return
+	 */
+	@AutoLog(value = "鎶芥牱瑙勫垯-娣诲姞")
+	@ApiOperation(value="鎶芥牱瑙勫垯-娣诲姞", notes="鎶芥牱瑙勫垯-娣诲姞")
+	//@RequiresPermissions("org.jeecg.modules:qms_sampling_rules:add")
+	@PostMapping(value = "/add")
+	public Result<String> add(@RequestBody SamplingRules samplingRules) {
+		samplingRules.setRuleStatus(CommonConstant.STATUS_1);
+		samplingRulesService.save(samplingRules);
+		return Result.OK("娣诲姞鎴愬姛锛�");
+	}
+	
+	/**
+	 *  缂栬緫
+	 *
+	 * @param samplingRules
+	 * @return
+	 */
+	@AutoLog(value = "鎶芥牱瑙勫垯-缂栬緫")
+	@ApiOperation(value="鎶芥牱瑙勫垯-缂栬緫", notes="鎶芥牱瑙勫垯-缂栬緫")
+	//@RequiresPermissions("org.jeecg.modules:qms_sampling_rules:edit")
+	@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
+	public Result<String> edit(@RequestBody SamplingRules samplingRules) {
+		samplingRulesService.updateById(samplingRules);
+		return Result.OK("缂栬緫鎴愬姛!");
+	}
+	
+	/**
+	 *   閫氳繃id鍒犻櫎
+	 *
+	 * @param id
+	 * @return
+	 */
+	@AutoLog(value = "鎶芥牱瑙勫垯-閫氳繃id鍒犻櫎")
+	@ApiOperation(value="鎶芥牱瑙勫垯-閫氳繃id鍒犻櫎", notes="鎶芥牱瑙勫垯-閫氳繃id鍒犻櫎")
+	//@RequiresPermissions("org.jeecg.modules:qms_sampling_rules:delete")
+	@DeleteMapping(value = "/delete")
+	public Result<String> delete(@RequestParam(name="id",required=true) String id) {
+		samplingRulesService.removeById(id);
+		return Result.OK("鍒犻櫎鎴愬姛!");
+	}
+	
+	/**
+	 *  鎵归噺鍒犻櫎
+	 *
+	 * @param ids
+	 * @return
+	 */
+	@AutoLog(value = "鎶芥牱瑙勫垯-鎵归噺鍒犻櫎")
+	@ApiOperation(value="鎶芥牱瑙勫垯-鎵归噺鍒犻櫎", notes="鎶芥牱瑙勫垯-鎵归噺鍒犻櫎")
+	//@RequiresPermissions("org.jeecg.modules:qms_sampling_rules:deleteBatch")
+	@DeleteMapping(value = "/deleteBatch")
+	public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+		this.samplingRulesService.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<SamplingRules> queryById(@RequestParam(name="id",required=true) String id) {
+		SamplingRules samplingRules = samplingRulesService.getById(id);
+		if(samplingRules==null) {
+			return Result.error("鏈壘鍒板搴旀暟鎹�");
+		}
+		return Result.OK(samplingRules);
+	}
+
+    /**
+    * 瀵煎嚭excel
+    *
+    * @param request
+    * @param samplingRules
+    */
+    //@RequiresPermissions("org.jeecg.modules:qms_sampling_rules:exportXls")
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, SamplingRules samplingRules) {
+        return super.exportXls(request, samplingRules, SamplingRules.class, "鎶芥牱瑙勫垯");
+    }
+
+    /**
+      * 閫氳繃excel瀵煎叆鏁版嵁
+    *
+    * @param request
+    * @param response
+    * @return
+    */
+    //@RequiresPermissions("qms_sampling_rules:importExcel")
+    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+        return super.importExcel(request, response, SamplingRules.class);
+    }
+
+	 @AutoLog(value = "鎶芥牱瑙勫垯-鍚敤&绂佺敤")
+	 @ApiOperation(value = "鎶芥牱瑙勫垯-鍚敤&绂佺敤", notes = "鎶芥牱瑙勫垯-鍚敤&绂佺敤")
+	 @PutMapping(value = "/active")
+	 public Result<?> active(@RequestParam(name = "id", required = true) String id) {
+		 SamplingRules samplingRules = samplingRulesService.getById(id);
+		 if (CommonConstant.STATUS_1.equals(samplingRules.getRuleStatus())) {
+			 samplingRules.setRuleStatus(CommonConstant.STATUS_0);
+		 } else {
+			 samplingRules.setRuleStatus(CommonConstant.STATUS_1);
+		 }
+		 samplingRulesService.updateById(samplingRules);
+		 return Result.ok("鎿嶄綔鎴愬姛锛�");
+	 }
+
+}

--
Gitblit v1.9.3