From 3b7250f1bcaeb5663e75ddf0cc14bbac6930a334 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期一, 11 九月 2023 14:50:12 +0800
Subject: [PATCH] a
---
server/service/src/main/java/com/doumee/dao/business/CateParamSelectMapper.java | 12 +
server/company/src/main/java/com/doumee/api/business/CateParamSelectController.java | 90 ++++++++
server/service/src/main/java/com/doumee/service/impl/CateParamSelectServiceImpl.java | 145 +++++++++++++
server/company/src/main/java/com/doumee/api/business/GoodsController.java | 8
server/platform/src/main/java/com/doumee/api/business/CateParamSelectController.java | 90 ++++++++
server/service/src/main/java/com/doumee/dao/business/model/CateParamSelect.java | 74 ++++++
server/service/src/main/java/com/doumee/service/CateParamSelectService.java | 98 ++++++++
server/db/cate_param_select.permissions.sql | 6
server/service/src/main/java/com/doumee/service/business/impl/GoodsServiceImpl.java | 60 +++++
server/service/src/main/java/com/doumee/dao/business/model/dto/GoodCreatePlatRequest.java | 29 ++
server/service/src/main/java/com/doumee/service/business/GoodsService.java | 3
server/service/src/main/java/com/doumee/dao/business/model/dto/PlatGoodsParam.java | 22 ++
12 files changed, 637 insertions(+), 0 deletions(-)
diff --git a/server/company/src/main/java/com/doumee/api/business/CateParamSelectController.java b/server/company/src/main/java/com/doumee/api/business/CateParamSelectController.java
new file mode 100644
index 0000000..6f31dc4
--- /dev/null
+++ b/server/company/src/main/java/com/doumee/api/business/CateParamSelectController.java
@@ -0,0 +1,90 @@
+package com.doumee.api.business;
+
+import com.doumee.api.BaseController;
+import com.doumee.core.annotation.excel.ExcelExporter;
+import com.doumee.core.annotation.pr.PreventRepeat;
+import com.doumee.core.model.ApiResponse;
+import com.doumee.core.model.PageData;
+import com.doumee.core.model.PageWrap;
+import com.doumee.dao.business.model.CateParamSelect;
+import com.doumee.service.CateParamSelectService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author 姹熻箘韫�
+ * @date 2023/09/11 14:45
+ */
+@Api(tags = "鍝佺被鍙傛暟绛涢�夐」淇℃伅琛�")
+@RestController
+@RequestMapping("/cateParamSelect")
+public class CateParamSelectController extends BaseController {
+
+ @Autowired
+ private CateParamSelectService cateParamSelectService;
+
+ @PreventRepeat
+ @ApiOperation("鏂板缓")
+ @PostMapping("/create")
+ @RequiresPermissions("cateparamselect:cateparamselect:create")
+ public ApiResponse create(@RequestBody CateParamSelect cateParamSelect) {
+ return ApiResponse.success(cateParamSelectService.create(cateParamSelect));
+ }
+
+ @ApiOperation("鏍规嵁ID鍒犻櫎")
+ @GetMapping("/delete/{id}")
+ @RequiresPermissions("cateparamselect:cateparamselect:delete")
+ public ApiResponse deleteById(@PathVariable Integer id) {
+ cateParamSelectService.deleteById(id);
+ return ApiResponse.success(null);
+ }
+
+ @ApiOperation("鎵归噺鍒犻櫎")
+ @GetMapping("/delete/batch")
+ @RequiresPermissions("cateparamselect:cateparamselect:delete")
+ public ApiResponse deleteByIdInBatch(@RequestParam String ids) {
+ String [] idArray = ids.split(",");
+ List<Integer> idList = new ArrayList<>();
+ for (String id : idArray) {
+ idList.add(Integer.valueOf(id));
+ }
+ cateParamSelectService.deleteByIdInBatch(idList);
+ return ApiResponse.success(null);
+ }
+
+ @ApiOperation("鏍规嵁ID淇敼")
+ @PostMapping("/updateById")
+ @RequiresPermissions("cateparamselect:cateparamselect:update")
+ public ApiResponse updateById(@RequestBody CateParamSelect cateParamSelect) {
+ cateParamSelectService.updateById(cateParamSelect);
+ return ApiResponse.success(null);
+ }
+
+ @ApiOperation("鍒嗛〉鏌ヨ")
+ @PostMapping("/page")
+ @RequiresPermissions("cateparamselect:cateparamselect:query")
+ public ApiResponse<PageData<CateParamSelect>> findPage (@RequestBody PageWrap<CateParamSelect> pageWrap) {
+ return ApiResponse.success(cateParamSelectService.findPage(pageWrap));
+ }
+
+ @ApiOperation("瀵煎嚭Excel")
+ @PostMapping("/exportExcel")
+ @RequiresPermissions("cateparamselect:cateparamselect:exportExcel")
+ public void exportExcel (@RequestBody PageWrap<CateParamSelect> pageWrap, HttpServletResponse response) {
+ ExcelExporter.build(CateParamSelect.class).export(cateParamSelectService.findPage(pageWrap).getRecords(), "鍝佺被鍙傛暟绛涢�夐」淇℃伅琛�", response);
+ }
+
+ @ApiOperation("鏍规嵁ID鏌ヨ")
+ @GetMapping("/{id}")
+ @RequiresPermissions("cateparamselect:cateparamselect:query")
+ public ApiResponse findById(@PathVariable Integer id) {
+ return ApiResponse.success(cateParamSelectService.findById(id));
+ }
+}
diff --git a/server/company/src/main/java/com/doumee/api/business/GoodsController.java b/server/company/src/main/java/com/doumee/api/business/GoodsController.java
index b6fdd44..50df5e6 100644
--- a/server/company/src/main/java/com/doumee/api/business/GoodsController.java
+++ b/server/company/src/main/java/com/doumee/api/business/GoodsController.java
@@ -6,6 +6,7 @@
import com.doumee.core.model.PageData;
import com.doumee.core.model.PageWrap;
import com.doumee.dao.business.model.Goods;
+import com.doumee.dao.business.model.dto.GoodCreatePlatRequest;
import com.doumee.dao.business.model.dto.GoodsRequest;
import com.doumee.service.business.GoodsService;
import io.swagger.annotations.*;
@@ -40,6 +41,13 @@
public ApiResponse create(@RequestBody Goods goods) {
return ApiResponse.success(goodsService.create(goods));
}
+ @PreventRepeat
+ @ApiOperation("浠庡钩鍙伴�夋嫨鍟嗗搧")
+ @PostMapping("/createPlat")
+ @RequiresPermissions("business:goods:create")
+ public ApiResponse createPlat(@RequestBody GoodCreatePlatRequest param) {
+ return ApiResponse.success(goodsService.createPlat(param));
+ }
@ApiOperation("鏍规嵁ID鍒犻櫎")
@GetMapping("/delete/{id}")
diff --git a/server/db/cate_param_select.permissions.sql b/server/db/cate_param_select.permissions.sql
new file mode 100644
index 0000000..5e2b430
--- /dev/null
+++ b/server/db/cate_param_select.permissions.sql
@@ -0,0 +1,6 @@
+INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('cateparamselect:cateparamselect:create', '鏂板缓鍝佺被鍙傛暟绛涢�夐」淇℃伅琛�', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
+INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('cateparamselect:cateparamselect:delete', '鍒犻櫎鍝佺被鍙傛暟绛涢�夐」淇℃伅琛�', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
+INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('cateparamselect:cateparamselect:update', '淇敼鍝佺被鍙傛暟绛涢�夐」淇℃伅琛�', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
+INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('cateparamselect:cateparamselect:query', '鏌ヨ鍝佺被鍙傛暟绛涢�夐」淇℃伅琛�', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
+INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('cateparamselect:cateparamselect:exportExcel', '瀵煎嚭鍝佺被鍙傛暟绛涢�夐」淇℃伅琛�(Excel)', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
+
diff --git a/server/platform/src/main/java/com/doumee/api/business/CateParamSelectController.java b/server/platform/src/main/java/com/doumee/api/business/CateParamSelectController.java
new file mode 100644
index 0000000..6f31dc4
--- /dev/null
+++ b/server/platform/src/main/java/com/doumee/api/business/CateParamSelectController.java
@@ -0,0 +1,90 @@
+package com.doumee.api.business;
+
+import com.doumee.api.BaseController;
+import com.doumee.core.annotation.excel.ExcelExporter;
+import com.doumee.core.annotation.pr.PreventRepeat;
+import com.doumee.core.model.ApiResponse;
+import com.doumee.core.model.PageData;
+import com.doumee.core.model.PageWrap;
+import com.doumee.dao.business.model.CateParamSelect;
+import com.doumee.service.CateParamSelectService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author 姹熻箘韫�
+ * @date 2023/09/11 14:45
+ */
+@Api(tags = "鍝佺被鍙傛暟绛涢�夐」淇℃伅琛�")
+@RestController
+@RequestMapping("/cateParamSelect")
+public class CateParamSelectController extends BaseController {
+
+ @Autowired
+ private CateParamSelectService cateParamSelectService;
+
+ @PreventRepeat
+ @ApiOperation("鏂板缓")
+ @PostMapping("/create")
+ @RequiresPermissions("cateparamselect:cateparamselect:create")
+ public ApiResponse create(@RequestBody CateParamSelect cateParamSelect) {
+ return ApiResponse.success(cateParamSelectService.create(cateParamSelect));
+ }
+
+ @ApiOperation("鏍规嵁ID鍒犻櫎")
+ @GetMapping("/delete/{id}")
+ @RequiresPermissions("cateparamselect:cateparamselect:delete")
+ public ApiResponse deleteById(@PathVariable Integer id) {
+ cateParamSelectService.deleteById(id);
+ return ApiResponse.success(null);
+ }
+
+ @ApiOperation("鎵归噺鍒犻櫎")
+ @GetMapping("/delete/batch")
+ @RequiresPermissions("cateparamselect:cateparamselect:delete")
+ public ApiResponse deleteByIdInBatch(@RequestParam String ids) {
+ String [] idArray = ids.split(",");
+ List<Integer> idList = new ArrayList<>();
+ for (String id : idArray) {
+ idList.add(Integer.valueOf(id));
+ }
+ cateParamSelectService.deleteByIdInBatch(idList);
+ return ApiResponse.success(null);
+ }
+
+ @ApiOperation("鏍规嵁ID淇敼")
+ @PostMapping("/updateById")
+ @RequiresPermissions("cateparamselect:cateparamselect:update")
+ public ApiResponse updateById(@RequestBody CateParamSelect cateParamSelect) {
+ cateParamSelectService.updateById(cateParamSelect);
+ return ApiResponse.success(null);
+ }
+
+ @ApiOperation("鍒嗛〉鏌ヨ")
+ @PostMapping("/page")
+ @RequiresPermissions("cateparamselect:cateparamselect:query")
+ public ApiResponse<PageData<CateParamSelect>> findPage (@RequestBody PageWrap<CateParamSelect> pageWrap) {
+ return ApiResponse.success(cateParamSelectService.findPage(pageWrap));
+ }
+
+ @ApiOperation("瀵煎嚭Excel")
+ @PostMapping("/exportExcel")
+ @RequiresPermissions("cateparamselect:cateparamselect:exportExcel")
+ public void exportExcel (@RequestBody PageWrap<CateParamSelect> pageWrap, HttpServletResponse response) {
+ ExcelExporter.build(CateParamSelect.class).export(cateParamSelectService.findPage(pageWrap).getRecords(), "鍝佺被鍙傛暟绛涢�夐」淇℃伅琛�", response);
+ }
+
+ @ApiOperation("鏍规嵁ID鏌ヨ")
+ @GetMapping("/{id}")
+ @RequiresPermissions("cateparamselect:cateparamselect:query")
+ public ApiResponse findById(@PathVariable Integer id) {
+ return ApiResponse.success(cateParamSelectService.findById(id));
+ }
+}
diff --git a/server/service/src/main/java/com/doumee/dao/business/CateParamSelectMapper.java b/server/service/src/main/java/com/doumee/dao/business/CateParamSelectMapper.java
new file mode 100644
index 0000000..1adabb6
--- /dev/null
+++ b/server/service/src/main/java/com/doumee/dao/business/CateParamSelectMapper.java
@@ -0,0 +1,12 @@
+package com.doumee.dao.business;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.doumee.dao.business.model.CateParamSelect;
+
+/**
+ * @author 姹熻箘韫�
+ * @date 2023/09/11 14:45
+ */
+public interface CateParamSelectMapper extends BaseMapper<CateParamSelect> {
+
+}
diff --git a/server/service/src/main/java/com/doumee/dao/business/model/CateParamSelect.java b/server/service/src/main/java/com/doumee/dao/business/model/CateParamSelect.java
new file mode 100644
index 0000000..b2dbc3a
--- /dev/null
+++ b/server/service/src/main/java/com/doumee/dao/business/model/CateParamSelect.java
@@ -0,0 +1,74 @@
+package com.doumee.dao.business.model;
+
+import com.doumee.core.annotation.excel.ExcelColumn;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import java.util.Date;
+
+/**
+ * 鍝佺被鍙傛暟绛涢�夐」淇℃伅琛�
+ * @author 姹熻箘韫�
+ * @date 2023/09/11 14:45
+ */
+@Data
+@ApiModel("鍝佺被鍙傛暟绛涢�夐」淇℃伅琛�")
+@TableName("`cate_param_select`")
+public class CateParamSelect {
+
+ @TableId(type = IdType.AUTO)
+ @ApiModelProperty(value = "涓婚敭", example = "1")
+ @ExcelColumn(name="涓婚敭")
+ private Integer id;
+
+ @ApiModelProperty(value = "鍒涘缓浜虹紪鐮�", example = "1")
+ @ExcelColumn(name="鍒涘缓浜虹紪鐮�")
+ private Integer creator;
+
+ @ApiModelProperty(value = "鍒涘缓鏃堕棿")
+ @ExcelColumn(name="鍒涘缓鏃堕棿")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ private Date createDate;
+
+ @ApiModelProperty(value = "鏇存柊浜虹紪鐮�", example = "1")
+ @ExcelColumn(name="鏇存柊浜虹紪鐮�")
+ private Integer editor;
+
+ @ApiModelProperty(value = "鏇存柊鏃堕棿")
+ @ExcelColumn(name="鏇存柊鏃堕棿")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ private Date editDate;
+
+ @ApiModelProperty(value = "鏄惁鍒犻櫎0鍚� 1鏄�", example = "1")
+ @ExcelColumn(name="鏄惁鍒犻櫎0鍚� 1鏄�")
+ private Integer isdeleted;
+
+ @ApiModelProperty(value = "澶囨敞")
+ @ExcelColumn(name="澶囨敞")
+ private String remark;
+
+ @ApiModelProperty(value = "灞炴�у��")
+ @ExcelColumn(name="灞炴�у��")
+ private String name;
+
+ @ApiModelProperty(value = "鎵�灞炲弬鏁伴厤缃紪鐮�(鍏宠仈cate_param琛�)", example = "1")
+ @ExcelColumn(name="鎵�灞炲弬鏁伴厤缃紪鐮�(鍏宠仈cate_param琛�)")
+ private Integer paramId;
+
+ @ApiModelProperty(value = "鎵�灞炲搧绫荤紪鐮�(鍏宠仈category琛�)", example = "1")
+ @ExcelColumn(name="鎵�灞炲搧绫荤紪鐮�(鍏宠仈category琛�)")
+ private Integer categoryId;
+
+ @ApiModelProperty(value = "鐘舵�� 0鍚敤 1绂佺敤", example = "1")
+ @ExcelColumn(name="鐘舵�� 0鍚敤 1绂佺敤")
+ private Integer status;
+
+ @ApiModelProperty(value = "鎺掑簭鐮�", example = "1")
+ @ExcelColumn(name="鎺掑簭鐮�")
+ private Integer sortnum;
+
+}
diff --git a/server/service/src/main/java/com/doumee/dao/business/model/dto/GoodCreatePlatRequest.java b/server/service/src/main/java/com/doumee/dao/business/model/dto/GoodCreatePlatRequest.java
new file mode 100644
index 0000000..f1c09cd
--- /dev/null
+++ b/server/service/src/main/java/com/doumee/dao/business/model/dto/GoodCreatePlatRequest.java
@@ -0,0 +1,29 @@
+package com.doumee.dao.business.model.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * Created by IntelliJ IDEA.
+ *
+ * @Author : JP
+ * @create 2023/6/7 15:09
+ */
+@Data
+public class GoodCreatePlatRequest {
+
+ @ApiModelProperty(value = "绫诲埆缂栫爜",example = "1")
+ private Integer categoryId;
+ @ApiModelProperty(value = "鍟嗗搧鑼冨洿 0鍏ㄩ儴 1閮ㄥ垎",example = "1")
+ private Integer type;
+
+ @ApiModelProperty(value = "鍔犱环绯绘暟",example = "1")
+ private BigDecimal rate;
+
+ @ApiModelProperty(value = "鍝佺墝涓婚敭")
+ private List<PlatGoodsParam> goodsParamList;
+
+}
diff --git a/server/service/src/main/java/com/doumee/dao/business/model/dto/PlatGoodsParam.java b/server/service/src/main/java/com/doumee/dao/business/model/dto/PlatGoodsParam.java
new file mode 100644
index 0000000..a1549b5
--- /dev/null
+++ b/server/service/src/main/java/com/doumee/dao/business/model/dto/PlatGoodsParam.java
@@ -0,0 +1,22 @@
+package com.doumee.dao.business.model.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * Created by IntelliJ IDEA.
+ *
+ * @Author : JP
+ * @create 2023/6/7 15:09
+ */
+@Data
+public class PlatGoodsParam {
+
+ @ApiModelProperty(value = "鍟嗗搧缂栫爜",example = "1")
+ private Integer goodsId;
+
+ @ApiModelProperty(value = "鍏ユ墜浠锋牸 鍏�",example = "1")
+ private BigDecimal price;
+}
diff --git a/server/service/src/main/java/com/doumee/service/CateParamSelectService.java b/server/service/src/main/java/com/doumee/service/CateParamSelectService.java
new file mode 100644
index 0000000..53ab071
--- /dev/null
+++ b/server/service/src/main/java/com/doumee/service/CateParamSelectService.java
@@ -0,0 +1,98 @@
+package com.doumee.service;
+
+import com.doumee.core.model.PageData;
+import com.doumee.core.model.PageWrap;
+import com.doumee.dao.business.model.CateParamSelect;
+
+import java.util.List;
+
+/**
+ * 鍝佺被鍙傛暟绛涢�夐」淇℃伅琛⊿ervice瀹氫箟
+ * @author 姹熻箘韫�
+ * @date 2023/09/11 14:45
+ */
+public interface CateParamSelectService {
+
+ /**
+ * 鍒涘缓
+ *
+ * @param cateParamSelect 瀹炰綋瀵硅薄
+ * @return Integer
+ */
+ Integer create(CateParamSelect cateParamSelect);
+
+ /**
+ * 涓婚敭鍒犻櫎
+ *
+ * @param id 涓婚敭
+ */
+ void deleteById(Integer id);
+
+ /**
+ * 鍒犻櫎
+ *
+ * @param cateParamSelect 瀹炰綋瀵硅薄
+ */
+ void delete(CateParamSelect cateParamSelect);
+
+ /**
+ * 鎵归噺涓婚敭鍒犻櫎
+ *
+ * @param ids 涓婚敭闆�
+ */
+ void deleteByIdInBatch(List<Integer> ids);
+
+ /**
+ * 涓婚敭鏇存柊
+ *
+ * @param cateParamSelect 瀹炰綋瀵硅薄
+ */
+ void updateById(CateParamSelect cateParamSelect);
+
+ /**
+ * 鎵归噺涓婚敭鏇存柊
+ *
+ * @param cateParamSelects 瀹炰綋闆�
+ */
+ void updateByIdInBatch(List<CateParamSelect> cateParamSelects);
+
+ /**
+ * 涓婚敭鏌ヨ
+ *
+ * @param id 涓婚敭
+ * @return CateParamSelect
+ */
+ CateParamSelect findById(Integer id);
+
+ /**
+ * 鏉′欢鏌ヨ鍗曟潯璁板綍
+ *
+ * @param cateParamSelect 瀹炰綋瀵硅薄
+ * @return CateParamSelect
+ */
+ CateParamSelect findOne(CateParamSelect cateParamSelect);
+
+ /**
+ * 鏉′欢鏌ヨ
+ *
+ * @param cateParamSelect 瀹炰綋瀵硅薄
+ * @return List<CateParamSelect>
+ */
+ List<CateParamSelect> findList(CateParamSelect cateParamSelect);
+
+ /**
+ * 鍒嗛〉鏌ヨ
+ *
+ * @param pageWrap 鍒嗛〉瀵硅薄
+ * @return PageData<CateParamSelect>
+ */
+ PageData<CateParamSelect> findPage(PageWrap<CateParamSelect> pageWrap);
+
+ /**
+ * 鏉′欢缁熻
+ *
+ * @param cateParamSelect 瀹炰綋瀵硅薄
+ * @return long
+ */
+ long count(CateParamSelect cateParamSelect);
+}
diff --git a/server/service/src/main/java/com/doumee/service/business/GoodsService.java b/server/service/src/main/java/com/doumee/service/business/GoodsService.java
index 386ef61..ffeab8e 100644
--- a/server/service/src/main/java/com/doumee/service/business/GoodsService.java
+++ b/server/service/src/main/java/com/doumee/service/business/GoodsService.java
@@ -4,6 +4,7 @@
import com.doumee.core.model.PageData;
import com.doumee.core.model.PageWrap;
import com.doumee.dao.business.model.Goods;
+import com.doumee.dao.business.model.dto.GoodCreatePlatRequest;
import com.doumee.dao.business.model.dto.GoodsRequest;
import org.springframework.web.multipart.MultipartFile;
@@ -114,4 +115,6 @@
PageData<Goods> getGoodsPage(PageWrap<GoodsRequest> pageWrap);
List<Goods> findListForH5(GoodsRequest goodsRequest);
+
+ Integer createPlat(GoodCreatePlatRequest param);
}
diff --git a/server/service/src/main/java/com/doumee/service/business/impl/GoodsServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/GoodsServiceImpl.java
index cd8eea3..0e5c1ad 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/GoodsServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/GoodsServiceImpl.java
@@ -17,6 +17,7 @@
import com.doumee.dao.business.*;
import com.doumee.dao.business.join.GoodsJoinMapper;
import com.doumee.dao.business.model.*;
+import com.doumee.dao.business.model.dto.GoodCreatePlatRequest;
import com.doumee.dao.business.model.dto.GoodsRequest;
import com.doumee.service.business.GoodsService;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
@@ -120,6 +121,65 @@
return goods.getId();
}
+ @Override
+ public Integer createPlat(GoodCreatePlatRequest param){
+ LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+ if(Constants.equalsInteger(user.getType(), Constants.UserType.COMPANY.getKey())){
+ //闈炰紒涓氱敤鎴蜂笉鑳芥搷浣�
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED);
+ }
+ if(param.getCategoryId() == null
+ || param.getType() == null
+ || param.getRate() == null
+ || (Constants.equalsInteger(param.getType(), Constants.ONE)
+ && (param.getGoodsParamList() == null
+ || param.getGoodsParamList().size()==0))){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST);
+ }
+ Goods goods = new Goods();
+
+ if(goodsMapper.selectCount(new QueryWrapper<Goods>().eq("ISDELETED",Constants.ZERO).eq("name",goods.getName()))>0){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"銆�"+goods.getName()+"銆戝凡瀛樺湪");
+ }
+ goods.setStatus(Constants.ZERO);
+ goods.setCreateDate(new Date());
+ goods.setCreator(user.getId());
+ goods.setIsdeleted(Constants.ZERO);
+ //澶勭悊鎷奸煶闂
+ goods.setPinyin(PinYinUtil.getFullSpell(goods.getName()));
+ goods.setShortPinyin(PinYinUtil.getFirstSpell(goods.getName()));
+ goodsMapper.insert(goods);
+
+ List<Multifile> multifileList = goods.getMultifileList();
+ if(!Objects.isNull(multifileList)&&multifileList.size()>Constants.ZERO){
+ for (int i = 0; i < multifileList.size(); i++) {
+ Multifile multifile = multifileList.get(i);
+ multifile.setCreator(user.getId());
+ multifile.setCreateDate(new Date());
+ multifile.setIsdeleted(Constants.ZERO);
+ multifile.setSortnum(i+Constants.ONE);
+ multifile.setObjId(goods.getId());
+ multifile.setType(Constants.ZERO);
+ multifile.setObjType(Constants.ZERO);
+ multifileMapper.insert(multifile);
+ }
+ }
+ List<GoodsParam> goodsParamList = goods.getGoodsParamList();
+ if(!Objects.isNull(goodsParamList)&&goodsParamList.size()>0){
+ for (int i = 0; i < goodsParamList.size(); i++) {
+ GoodsParam goodsParam = goodsParamList.get(i);
+ goodsParam.setCreator(user.getId());
+ goodsParam.setCreateDate(new Date());
+ goodsParam.setIsdeleted(Constants.ZERO);
+ goodsParam.setSortnum(i+Constants.ONE);
+ goodsParam.setStatus(Constants.ZERO);
+ goodsParam.setGoodsId(goods.getId());
+ goodsParamMapper.insert(goodsParam);
+ }
+ }
+
+ return goods.getId();
+ }
@Override
public void deleteById(Integer id) {
diff --git a/server/service/src/main/java/com/doumee/service/impl/CateParamSelectServiceImpl.java b/server/service/src/main/java/com/doumee/service/impl/CateParamSelectServiceImpl.java
new file mode 100644
index 0000000..ecca947
--- /dev/null
+++ b/server/service/src/main/java/com/doumee/service/impl/CateParamSelectServiceImpl.java
@@ -0,0 +1,145 @@
+package com.doumee.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.doumee.core.model.PageData;
+import com.doumee.core.model.PageWrap;
+import com.doumee.core.utils.Utils;
+import com.doumee.dao.business.CateParamSelectMapper;
+import com.doumee.dao.business.model.CateParamSelect;
+import com.doumee.service.CateParamSelectService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
+import java.util.List;
+
+/**
+ * 鍝佺被鍙傛暟绛涢�夐」淇℃伅琛⊿ervice瀹炵幇
+ * @author 姹熻箘韫�
+ * @date 2023/09/11 14:45
+ */
+@Service
+public class CateParamSelectServiceImpl implements CateParamSelectService {
+
+ @Autowired
+ private CateParamSelectMapper cateParamSelectMapper;
+
+ @Override
+ public Integer create(CateParamSelect cateParamSelect) {
+ cateParamSelectMapper.insert(cateParamSelect);
+ return cateParamSelect.getId();
+ }
+
+ @Override
+ public void deleteById(Integer id) {
+ cateParamSelectMapper.deleteById(id);
+ }
+
+ @Override
+ public void delete(CateParamSelect cateParamSelect) {
+ UpdateWrapper<CateParamSelect> deleteWrapper = new UpdateWrapper<>(cateParamSelect);
+ cateParamSelectMapper.delete(deleteWrapper);
+ }
+
+ @Override
+ public void deleteByIdInBatch(List<Integer> ids) {
+ if (CollectionUtils.isEmpty(ids)) {
+ return;
+ }
+ cateParamSelectMapper.deleteBatchIds(ids);
+ }
+
+ @Override
+ public void updateById(CateParamSelect cateParamSelect) {
+ cateParamSelectMapper.updateById(cateParamSelect);
+ }
+
+ @Override
+ public void updateByIdInBatch(List<CateParamSelect> cateParamSelects) {
+ if (CollectionUtils.isEmpty(cateParamSelects)) {
+ return;
+ }
+ for (CateParamSelect cateParamSelect: cateParamSelects) {
+ this.updateById(cateParamSelect);
+ }
+ }
+
+ @Override
+ public CateParamSelect findById(Integer id) {
+ return cateParamSelectMapper.selectById(id);
+ }
+
+ @Override
+ public CateParamSelect findOne(CateParamSelect cateParamSelect) {
+ QueryWrapper<CateParamSelect> wrapper = new QueryWrapper<>(cateParamSelect);
+ return cateParamSelectMapper.selectOne(wrapper);
+ }
+
+ @Override
+ public List<CateParamSelect> findList(CateParamSelect cateParamSelect) {
+ QueryWrapper<CateParamSelect> wrapper = new QueryWrapper<>(cateParamSelect);
+ return cateParamSelectMapper.selectList(wrapper);
+ }
+
+ @Override
+ public PageData<CateParamSelect> findPage(PageWrap<CateParamSelect> pageWrap) {
+ IPage<CateParamSelect> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity());
+ QueryWrapper<CateParamSelect> queryWrapper = new QueryWrapper<>();
+ Utils.MP.blankToNull(pageWrap.getModel());
+ if (pageWrap.getModel().getId() != null) {
+ queryWrapper.lambda().eq(CateParamSelect::getId, pageWrap.getModel().getId());
+ }
+ if (pageWrap.getModel().getCreator() != null) {
+ queryWrapper.lambda().eq(CateParamSelect::getCreator, pageWrap.getModel().getCreator());
+ }
+ if (pageWrap.getModel().getCreateDate() != null) {
+ queryWrapper.lambda().ge(CateParamSelect::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getCreateDate()));
+ queryWrapper.lambda().le(CateParamSelect::getCreateDate, Utils.Date.getEnd(pageWrap.getModel().getCreateDate()));
+ }
+ if (pageWrap.getModel().getEditor() != null) {
+ queryWrapper.lambda().eq(CateParamSelect::getEditor, pageWrap.getModel().getEditor());
+ }
+ if (pageWrap.getModel().getEditDate() != null) {
+ queryWrapper.lambda().ge(CateParamSelect::getEditDate, Utils.Date.getStart(pageWrap.getModel().getEditDate()));
+ queryWrapper.lambda().le(CateParamSelect::getEditDate, Utils.Date.getEnd(pageWrap.getModel().getEditDate()));
+ }
+ if (pageWrap.getModel().getIsdeleted() != null) {
+ queryWrapper.lambda().eq(CateParamSelect::getIsdeleted, pageWrap.getModel().getIsdeleted());
+ }
+ if (pageWrap.getModel().getRemark() != null) {
+ queryWrapper.lambda().eq(CateParamSelect::getRemark, pageWrap.getModel().getRemark());
+ }
+ if (pageWrap.getModel().getName() != null) {
+ queryWrapper.lambda().eq(CateParamSelect::getName, pageWrap.getModel().getName());
+ }
+ if (pageWrap.getModel().getParamId() != null) {
+ queryWrapper.lambda().eq(CateParamSelect::getParamId, pageWrap.getModel().getParamId());
+ }
+ if (pageWrap.getModel().getCategoryId() != null) {
+ queryWrapper.lambda().eq(CateParamSelect::getCategoryId, pageWrap.getModel().getCategoryId());
+ }
+ if (pageWrap.getModel().getStatus() != null) {
+ queryWrapper.lambda().eq(CateParamSelect::getStatus, pageWrap.getModel().getStatus());
+ }
+ if (pageWrap.getModel().getSortnum() != null) {
+ queryWrapper.lambda().eq(CateParamSelect::getSortnum, pageWrap.getModel().getSortnum());
+ }
+ for(PageWrap.SortData sortData: pageWrap.getSorts()) {
+ if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) {
+ queryWrapper.orderByDesc(sortData.getProperty());
+ } else {
+ queryWrapper.orderByAsc(sortData.getProperty());
+ }
+ }
+ return PageData.from(cateParamSelectMapper.selectPage(page, queryWrapper));
+ }
+
+ @Override
+ public long count(CateParamSelect cateParamSelect) {
+ QueryWrapper<CateParamSelect> wrapper = new QueryWrapper<>(cateParamSelect);
+ return cateParamSelectMapper.selectCount(wrapper);
+ }
+}
--
Gitblit v1.9.3