From 34981c30a78e8bbd7791131059a9210f9928b62c Mon Sep 17 00:00:00 2001
From: 刘光辉 <347230014@qq.com>
Date: 星期四, 17 九月 2026 09:24:09 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master' into master
---
jnpf-lims/jnpf-lims-controller/src/main/java/jnpf/controller/ProductGoodsController.java | 168 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 168 insertions(+), 0 deletions(-)
diff --git a/jnpf-lims/jnpf-lims-controller/src/main/java/jnpf/controller/ProductGoodsController.java b/jnpf-lims/jnpf-lims-controller/src/main/java/jnpf/controller/ProductGoodsController.java
new file mode 100644
index 0000000..5021338
--- /dev/null
+++ b/jnpf-lims/jnpf-lims-controller/src/main/java/jnpf/controller/ProductGoodsController.java
@@ -0,0 +1,168 @@
+package jnpf.controller;
+
+import cn.dev33.satoken.annotation.SaCheckPermission;
+import io.swagger.v3.oas.annotations.Parameter;
+import jnpf.base.controller.SuperController;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.annotations.Operation;
+import jnpf.base.ActionResult;
+import jnpf.base.vo.ListVO;
+import jnpf.base.vo.PageListVO;
+import jnpf.base.vo.PaginationVO;
+import jnpf.constant.MsgCode;
+import jnpf.entity.ProductGoodsEntity;
+import jnpf.model.productgoods.*;
+import jnpf.service.ProductGoodsService;
+import jnpf.util.JsonUtil;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.*;
+
+import jakarta.validation.Valid;
+import java.util.List;
+
+/**
+ * 浜у搧鍟嗗搧
+ *
+ * @鐗堟湰锛� V3.1.0
+ * @鐗堟潈锛� 寮曡繄淇℃伅鎶�鏈湁闄愬叕鍙革紙https://www.jnpfsoft.com锛�
+ * @浣滆�咃細 JNPF寮�鍙戝钩鍙扮粍
+ * @鏃ユ湡锛� 2021-07-10 15:57:50
+ */
+@Slf4j
+@RestController
+@Tag(name = "浜у搧鍟嗗搧", description = "Goods")
+@RequestMapping("/saleOrder/Goods")
+@RequiredArgsConstructor
+public class ProductGoodsController extends SuperController<ProductGoodsService, ProductGoodsEntity> {
+
+ private final ProductGoodsService productgoodsService;
+
+ /**
+ * 鍒楄〃
+ *
+ * @param type 绫诲瀷
+ * @return
+ */
+ @GetMapping("/getGoodList")
+ @Operation(summary = "鍒楄〃")
+ @Parameter(name = "type", description = "绫诲瀷")
+ @SaCheckPermission("extend.orderDemo")
+ public ActionResult<ListVO<ProductGoodsListVO>> list(@RequestParam("type")String type) {
+ List<ProductGoodsEntity> list = productgoodsService.getGoodList(type);
+ List<ProductGoodsListVO> listVO = JsonUtil.getJsonToList(list, ProductGoodsListVO.class);
+ ListVO<ProductGoodsListVO> vo = new ListVO<>();
+ vo.setList(listVO);
+ return ActionResult.success(vo);
+ }
+
+ /**
+ * 鍒楄〃
+ *
+ * @param goodsPagination 鍒嗛〉妯″瀷
+ * @return
+ */
+ @GetMapping
+ @Operation(summary = "鍒楄〃")
+ @SaCheckPermission("extend.orderDemo")
+ public ActionResult<PageListVO<ProductGoodsListVO>> list(ProductGoodsPagination goodsPagination) {
+ List<ProductGoodsEntity> list = productgoodsService.getList(goodsPagination);
+ List<ProductGoodsListVO> listVO = JsonUtil.getJsonToList(list, ProductGoodsListVO.class);
+ PageListVO<ProductGoodsListVO> vo = new PageListVO<>();
+ vo.setList(listVO);
+ PaginationVO page = JsonUtil.getJsonToBean(goodsPagination, PaginationVO.class);
+ vo.setPagination(page);
+ return ActionResult.success(vo);
+ }
+
+ /**
+ * 鍒涘缓
+ *
+ * @param goodsCrForm 鍟嗗搧妯″瀷
+ * @return
+ */
+ @PostMapping
+ @Operation(summary = "鍒涘缓")
+ @Parameter(name = "goodsCrForm", description = "鍟嗗搧妯″瀷",required = true)
+ @SaCheckPermission("extend.orderDemo")
+ public ActionResult<Object> create(@RequestBody @Valid ProductGoodsCrForm goodsCrForm) {
+ ProductGoodsEntity entity = JsonUtil.getJsonToBean(goodsCrForm, ProductGoodsEntity.class);
+ productgoodsService.create(entity);
+ return ActionResult.success(MsgCode.SU001.get());
+ }
+
+ /**
+ * 淇℃伅
+ *
+ * @param id 涓婚敭
+ * @return
+ */
+ @Operation(summary = "淇℃伅")
+ @GetMapping("/{id}")
+ @Parameter(name = "id", description = "涓婚敭", required = true)
+ @SaCheckPermission("extend.orderDemo")
+ public ActionResult<ProductGoodsInfoVO> info(@PathVariable("id") String id) {
+ ProductGoodsEntity entity = productgoodsService.getInfo(id);
+ ProductGoodsInfoVO vo = JsonUtil.getJsonToBean(entity, ProductGoodsInfoVO.class);
+ return ActionResult.success(vo);
+ }
+
+ /**
+ * 鏇存柊
+ *
+ * @param id 涓婚敭
+ * @param goodsCrFormUpForm 鍟嗗搧妯″瀷
+ * @return
+ */
+ @PutMapping("/{id}")
+ @Operation(summary = "鏇存柊")
+ @Parameter(name = "id", description = "涓婚敭", required = true)
+ @Parameter(name = "goodsCrFormUpForm", description = "鍟嗗搧妯″瀷",required = true)
+ @SaCheckPermission("extend.orderDemo")
+ public ActionResult<Object> update(@PathVariable("id") String id, @RequestBody @Valid ProductGoodsUpForm goodsCrFormUpForm) {
+ ProductGoodsEntity entity = JsonUtil.getJsonToBean(goodsCrFormUpForm, ProductGoodsEntity.class);
+ boolean ok = productgoodsService.update(id, entity);
+ if (ok) {
+ return ActionResult.success(MsgCode.SU004.get());
+ }
+ return ActionResult.fail(MsgCode.FA002.get());
+ }
+
+ /**
+ * 鍒犻櫎
+ *
+ * @param id 涓婚敭
+ * @return
+ */
+ @DeleteMapping("/{id}")
+ @Operation(summary = "鍒犻櫎")
+ @Parameter(name = "id", description = "涓婚敭", required = true)
+ @SaCheckPermission("extend.orderDemo")
+ public ActionResult<Object> delete(@PathVariable("id") String id) {
+ ProductGoodsEntity entity = productgoodsService.getInfo(id);
+ if (entity != null) {
+ productgoodsService.delete(entity);
+ }
+ return ActionResult.success(MsgCode.SU003.get());
+ }
+
+ /**
+ * 涓嬫媺
+ *
+ * @param goodsPagination 涓嬫媺妯″瀷
+ * @return
+ */
+ @GetMapping("/Selector")
+ @Operation(summary = "涓嬫媺")
+ @SaCheckPermission("extend.orderDemo")
+ public ActionResult<ListVO<ProductGoodsListVO>> listSelect(ProductGoodsPagination goodsPagination) {
+ goodsPagination.setCurrentPage(1);
+ goodsPagination.setPageSize(50);
+ List<ProductGoodsEntity> list = productgoodsService.getList(goodsPagination);
+ List<ProductGoodsListVO> listVO = JsonUtil.getJsonToList(list, ProductGoodsListVO.class);
+ ListVO<ProductGoodsListVO> vo = new ListVO<>();
+ vo.setList(listVO);
+ return ActionResult.success(vo);
+ }
+
+}
--
Gitblit v1.8.0