From ded0b4e722a6b18d31b50fd7ba401cc3b08f4912 Mon Sep 17 00:00:00 2001 From: weizhiqiang <598748873@qq.com> Date: Sat, 7 Sep 2024 11:52:01 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20=E5=95=86=E5=93=81=E4=B8=8A?= =?UTF-8?q?=E6=9E=B6=E5=95=86=E5=9F=8E=E4=BB=A3=E7=A0=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../classenum/MaterialNormsShelvesState.java | 53 ------------------- .../com/skyeye/material/entity/Material.java | 2 +- .../skyeye/material/entity/MaterialNorms.java | 4 -- .../material/service/MaterialService.java | 2 + .../impl/MaterialNormsServiceImpl.java | 8 --- .../service/impl/MaterialServiceImpl.java | 10 ++++ .../shopmaterial/entity/ShopMaterial.java | 4 +- .../entity/ShopMaterialNorms.java | 2 +- .../enums/ShopMaterialDeliveryMethod.java | 2 +- .../impl/ShopMaterialNormsServiceImpl.java | 2 + .../service/impl/ShopMaterialServiceImpl.java | 36 ++++++++++--- 11 files changed, 47 insertions(+), 78 deletions(-) delete mode 100644 skyeye-erp/erp-pro/src/main/java/com/skyeye/material/classenum/MaterialNormsShelvesState.java diff --git a/skyeye-erp/erp-pro/src/main/java/com/skyeye/material/classenum/MaterialNormsShelvesState.java b/skyeye-erp/erp-pro/src/main/java/com/skyeye/material/classenum/MaterialNormsShelvesState.java deleted file mode 100644 index 3760635a..00000000 --- a/skyeye-erp/erp-pro/src/main/java/com/skyeye/material/classenum/MaterialNormsShelvesState.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright 卫志强 QQ:598748873@qq.com Inc. All rights reserved. 开源地址:https://gitee.com/doc_wei01/skyeye - ******************************************************************************/ - -package com.skyeye.material.classenum; - -import cn.hutool.core.map.MapUtil; -import com.skyeye.common.base.classenum.SkyeyeEnumClass; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; - -import java.util.HashMap; -import java.util.Map; - -/** - * @ClassName: MaterialNormsShelvesState - * @Description: 商品规格上下架状态枚举类 - * @author: skyeye云系列--卫志强 - * @date: 2024/9/4 8:48 - * @Copyright: 2024 https://gitee.com/doc_wei01/skyeye Inc. All rights reserved. - * 注意:本内容仅限购买后使用.禁止私自外泄以及用于其他的商业目的 - */ -@Getter -@NoArgsConstructor -@AllArgsConstructor -public enum MaterialNormsShelvesState implements SkyeyeEnumClass { - NOT_ON_SHELVE(1, "未上架", "red", true, false), - ON_SHELVE(2, "已上架", "green", true, false); - - private Integer key; - - private String value; - - private String color; - - private Boolean show; - - private Boolean isDefault; - - public static Map getMation(Integer type) { - for (MaterialNormsShelvesState bean : MaterialNormsShelvesState.values()) { - if (type == bean.getKey()) { - Map result = new HashMap<>(); - result.put("id", bean.getKey()); - result.put("name", bean.getValue()); - return result; - } - } - return MapUtil.newHashMap(); - } - -} diff --git a/skyeye-erp/erp-pro/src/main/java/com/skyeye/material/entity/Material.java b/skyeye-erp/erp-pro/src/main/java/com/skyeye/material/entity/Material.java index 2e647407..514b9c1a 100644 --- a/skyeye-erp/erp-pro/src/main/java/com/skyeye/material/entity/Material.java +++ b/skyeye-erp/erp-pro/src/main/java/com/skyeye/material/entity/Material.java @@ -113,7 +113,7 @@ public class Material extends BaseGeneralInfo { private Integer isUsed; @TableField(value = "shelves_state") - @Property(value = "上下架状态") + @Property(value = "上下架状态,参考#MaterialShelvesState") private Integer shelvesState; @TableField(value = "brand_id") diff --git a/skyeye-erp/erp-pro/src/main/java/com/skyeye/material/entity/MaterialNorms.java b/skyeye-erp/erp-pro/src/main/java/com/skyeye/material/entity/MaterialNorms.java index bb002e06..3b6fd310 100644 --- a/skyeye-erp/erp-pro/src/main/java/com/skyeye/material/entity/MaterialNorms.java +++ b/skyeye-erp/erp-pro/src/main/java/com/skyeye/material/entity/MaterialNorms.java @@ -95,8 +95,4 @@ public class MaterialNorms extends OperatorUserInfo { @Property(value = "指定仓库的库存") private NormsCalcStock depotTock; - @TableField(value = "shelves_state") - @Property(value = "上下架状态") - private Integer shelvesState; - } diff --git a/skyeye-erp/erp-pro/src/main/java/com/skyeye/material/service/MaterialService.java b/skyeye-erp/erp-pro/src/main/java/com/skyeye/material/service/MaterialService.java index 9013db01..846c498b 100644 --- a/skyeye-erp/erp-pro/src/main/java/com/skyeye/material/service/MaterialService.java +++ b/skyeye-erp/erp-pro/src/main/java/com/skyeye/material/service/MaterialService.java @@ -35,4 +35,6 @@ public interface MaterialService extends SkyeyeBusinessService { * @param id */ void setUsed(String id); + + void setShelvesState(String id, Integer shelvesState); } diff --git a/skyeye-erp/erp-pro/src/main/java/com/skyeye/material/service/impl/MaterialNormsServiceImpl.java b/skyeye-erp/erp-pro/src/main/java/com/skyeye/material/service/impl/MaterialNormsServiceImpl.java index 52b18c87..3ce8a07b 100644 --- a/skyeye-erp/erp-pro/src/main/java/com/skyeye/material/service/impl/MaterialNormsServiceImpl.java +++ b/skyeye-erp/erp-pro/src/main/java/com/skyeye/material/service/impl/MaterialNormsServiceImpl.java @@ -16,7 +16,6 @@ import com.skyeye.common.object.InputObject; import com.skyeye.common.object.OutputObject; import com.skyeye.common.util.mybatisplus.MybatisPlusUtil; import com.skyeye.exception.CustomException; -import com.skyeye.material.classenum.MaterialNormsShelvesState; import com.skyeye.material.classenum.MaterialNormsStockType; import com.skyeye.material.dao.MaterialNormsDao; import com.skyeye.material.entity.Material; @@ -147,13 +146,6 @@ public class MaterialNormsServiceImpl extends SkyeyeBusinessServiceImpl entity) { - entity.forEach(item -> { - item.setShelvesState(MaterialNormsShelvesState.NOT_ON_SHELVE.getKey()); - }); - } - /** * 根据商品id删除规格信息 * diff --git a/skyeye-erp/erp-pro/src/main/java/com/skyeye/material/service/impl/MaterialServiceImpl.java b/skyeye-erp/erp-pro/src/main/java/com/skyeye/material/service/impl/MaterialServiceImpl.java index 867ac532..8aaa02cf 100644 --- a/skyeye-erp/erp-pro/src/main/java/com/skyeye/material/service/impl/MaterialServiceImpl.java +++ b/skyeye-erp/erp-pro/src/main/java/com/skyeye/material/service/impl/MaterialServiceImpl.java @@ -369,4 +369,14 @@ public class MaterialServiceImpl extends SkyeyeBusinessServiceImpl updateWrapper = new UpdateWrapper<>(); + updateWrapper.eq(CommonConstants.ID, id); + updateWrapper.set(MybatisPlusUtil.toColumns(Material::getShelvesState), shelvesState); + updateWrapper.set(MybatisPlusUtil.toColumns(Material::getIsUsed), IsUsedEnum.IN_USE.getKey()); + update(updateWrapper); + refreshCache(id); + } + } diff --git a/skyeye-erp/erp-pro/src/main/java/com/skyeye/shopmaterial/entity/ShopMaterial.java b/skyeye-erp/erp-pro/src/main/java/com/skyeye/shopmaterial/entity/ShopMaterial.java index 305c0a4e..10c71f4e 100644 --- a/skyeye-erp/erp-pro/src/main/java/com/skyeye/shopmaterial/entity/ShopMaterial.java +++ b/skyeye-erp/erp-pro/src/main/java/com/skyeye/shopmaterial/entity/ShopMaterial.java @@ -58,7 +58,7 @@ public class ShopMaterial extends OperatorUserInfo { private String logo; @TableField(value = "carousel_img") - @ApiModelProperty(value = "商品轮播图,多个逗号隔开", required = "required") + @ApiModelProperty(value = "商品轮播图,多个逗号隔开") private String carouselImg; @TableField(value = "distribution_type") @@ -86,7 +86,7 @@ public class ShopMaterial extends OperatorUserInfo { private String realSales; @TableField(exist = false) - @ApiModelProperty(value = "上架的规格信息", required = "required,json") + @ApiModelProperty(value = "上架的规格信息", required = "json") private List shopMaterialNormsList; } diff --git a/skyeye-erp/erp-pro/src/main/java/com/skyeye/shopmaterial/entity/ShopMaterialNorms.java b/skyeye-erp/erp-pro/src/main/java/com/skyeye/shopmaterial/entity/ShopMaterialNorms.java index 93011aca..99a2bf50 100644 --- a/skyeye-erp/erp-pro/src/main/java/com/skyeye/shopmaterial/entity/ShopMaterialNorms.java +++ b/skyeye-erp/erp-pro/src/main/java/com/skyeye/shopmaterial/entity/ShopMaterialNorms.java @@ -69,7 +69,7 @@ public class ShopMaterialNorms extends OperatorUserInfo { private String logo; @TableField(value = "carousel_img") - @ApiModelProperty(value = "商品轮播图,多个逗号隔开", required = "required") + @ApiModelProperty(value = "商品轮播图,多个逗号隔开") private String carouselImg; @TableField(value = "real_sales") diff --git a/skyeye-erp/erp-pro/src/main/java/com/skyeye/shopmaterial/enums/ShopMaterialDeliveryMethod.java b/skyeye-erp/erp-pro/src/main/java/com/skyeye/shopmaterial/enums/ShopMaterialDeliveryMethod.java index 8160b580..15600602 100644 --- a/skyeye-erp/erp-pro/src/main/java/com/skyeye/shopmaterial/enums/ShopMaterialDeliveryMethod.java +++ b/skyeye-erp/erp-pro/src/main/java/com/skyeye/shopmaterial/enums/ShopMaterialDeliveryMethod.java @@ -22,7 +22,7 @@ import lombok.NoArgsConstructor; @AllArgsConstructor public enum ShopMaterialDeliveryMethod implements SkyeyeEnumClass { - DEFAULT_SET(1, "快递发货", true, true), + DEFAULT_SET(1, "快递发货", true, false), SINGLE_SET(2, "用户自提", true, false), LOCAL_SET(3, "同城配送", true, false); diff --git a/skyeye-erp/erp-pro/src/main/java/com/skyeye/shopmaterial/service/impl/ShopMaterialNormsServiceImpl.java b/skyeye-erp/erp-pro/src/main/java/com/skyeye/shopmaterial/service/impl/ShopMaterialNormsServiceImpl.java index 433330eb..f2aef45e 100644 --- a/skyeye-erp/erp-pro/src/main/java/com/skyeye/shopmaterial/service/impl/ShopMaterialNormsServiceImpl.java +++ b/skyeye-erp/erp-pro/src/main/java/com/skyeye/shopmaterial/service/impl/ShopMaterialNormsServiceImpl.java @@ -10,6 +10,7 @@ import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.skyeye.annotation.service.SkyeyeService; import com.skyeye.base.business.service.impl.SkyeyeBusinessServiceImpl; +import com.skyeye.common.constans.CommonNumConstants; import com.skyeye.common.util.mybatisplus.MybatisPlusUtil; import com.skyeye.shopmaterial.dao.ShopMaterialNormsDao; import com.skyeye.shopmaterial.entity.ShopMaterialNorms; @@ -65,6 +66,7 @@ public class ShopMaterialNormsServiceImpl extends SkyeyeBusinessServiceImpl shopMaterialNormsList = entity.getShopMaterialNormsList(); - shopMaterialNormsList.forEach(shopMaterialNorms -> { - shopMaterialNorms.setRealSales(CommonNumConstants.NUM_ZERO.toString()); - }); - shopMaterialNormsService.saveList(entity.getMaterialId(), shopMaterialNormsList); + public void writePostpose(ShopMaterial entity, String userId) { + // 保存商城商品规格 + shopMaterialNormsService.saveList(entity.getMaterialId(), entity.getShopMaterialNormsList()); + + // 更新商品的上架状态 + Material material = materialService.selectById(entity.getMaterialId()); + if (CollectionUtil.isEmpty(entity.getShopMaterialNormsList())) { + materialService.setShelvesState(material.getId(), MaterialShelvesState.NOT_ON_SHELVE.getKey()); + } else if (material.getMaterialNorms().size() > entity.getShopMaterialNormsList().size()) { + materialService.setShelvesState(material.getId(), MaterialShelvesState.PART_ON_SHELVE.getKey()); + } else if (material.getMaterialNorms().size() == entity.getShopMaterialNormsList().size()) { + materialService.setShelvesState(material.getId(), MaterialShelvesState.ON_SHELVE.getKey()); + } } @Override public void queryTransMaterialById(InputObject inputObject, OutputObject outputObject) { String materialId = inputObject.getParams().get("id").toString(); - ShopMaterial shopMaterial = selectById(materialId); + ShopMaterial shopMaterial = selectByMaterialId(materialId); if (ObjectUtil.isEmpty(shopMaterial) || StrUtil.isEmpty(shopMaterial.getId())) { shopMaterial = new ShopMaterial(); Material material = materialService.selectById(materialId); @@ -78,11 +88,21 @@ public class ShopMaterialServiceImpl extends SkyeyeBusinessServiceImpl shopMaterialNormsList = shopMaterialNormsService.selectByMaterialId(id); + List shopMaterialNormsList = shopMaterialNormsService.selectByMaterialId(shopMaterial.getMaterialId()); shopMaterial.setShopMaterialNormsList(shopMaterialNormsList); return shopMaterial; } + private ShopMaterial selectByMaterialId(String materialId) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq(MybatisPlusUtil.toColumns(ShopMaterial::getMaterialId), materialId); + ShopMaterial shopMaterial = super.getOne(queryWrapper); + if (ObjectUtil.isEmpty(shopMaterial)) { + return null; + } + return selectById(shopMaterial.getId()); + } + @Override public ShopMaterial selectById(String id) { ShopMaterial shopMaterial = super.selectById(id); From d9115e977c0983e4820170e5b6344f0b96250f56 Mon Sep 17 00:00:00 2001 From: weizhiqiang <598748873@qq.com> Date: Sat, 7 Sep 2024 20:10:19 +0800 Subject: [PATCH 2/3] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E5=95=86=E5=9F=8E=E5=95=86=E5=93=81=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E7=9A=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ShopMaterialController.java | 16 ++++++++++++ .../service/ShopMaterialService.java | 1 + .../service/impl/ShopMaterialServiceImpl.java | 26 +++++++++++++++++++ .../db/config/BaseDataSourceConfig.java | 6 +++++ 4 files changed, 49 insertions(+) diff --git a/skyeye-erp/erp-pro/src/main/java/com/skyeye/shopmaterial/controller/ShopMaterialController.java b/skyeye-erp/erp-pro/src/main/java/com/skyeye/shopmaterial/controller/ShopMaterialController.java index 12769594..1274c350 100644 --- a/skyeye-erp/erp-pro/src/main/java/com/skyeye/shopmaterial/controller/ShopMaterialController.java +++ b/skyeye-erp/erp-pro/src/main/java/com/skyeye/shopmaterial/controller/ShopMaterialController.java @@ -8,6 +8,7 @@ import com.skyeye.annotation.api.Api; import com.skyeye.annotation.api.ApiImplicitParam; import com.skyeye.annotation.api.ApiImplicitParams; import com.skyeye.annotation.api.ApiOperation; +import com.skyeye.common.entity.search.CommonPageInfo; import com.skyeye.common.object.InputObject; import com.skyeye.common.object.OutputObject; import com.skyeye.shopmaterial.entity.ShopMaterial; @@ -46,4 +47,19 @@ public class ShopMaterialController { shopMaterialService.saveOrUpdateEntity(inputObject, outputObject); } + @ApiOperation(id = "queryShopMaterialById", value = "根据id获取商城商品信息", method = "GET", allUse = "0") + @ApiImplicitParams(value = { + @ApiImplicitParam(id = "id", name = "id", value = "主键id", required = "required")}) + @RequestMapping("/post/ShopMaterialController/queryShopMaterialById") + public void queryShopMaterialById(InputObject inputObject, OutputObject outputObject) { + shopMaterialService.selectById(inputObject, outputObject); + } + + @ApiOperation(id = "queryShopMaterialList", value = "获取商城商品信息列表", method = "POST", allUse = "0") + @ApiImplicitParams(classBean = CommonPageInfo.class) + @RequestMapping("/post/ShopMaterialController/queryShopMaterialList") + public void queryShopMaterialList(InputObject inputObject, OutputObject outputObject) { + shopMaterialService.queryShopMaterialList(inputObject, outputObject); + } + } diff --git a/skyeye-erp/erp-pro/src/main/java/com/skyeye/shopmaterial/service/ShopMaterialService.java b/skyeye-erp/erp-pro/src/main/java/com/skyeye/shopmaterial/service/ShopMaterialService.java index 9acec020..5301e42a 100644 --- a/skyeye-erp/erp-pro/src/main/java/com/skyeye/shopmaterial/service/ShopMaterialService.java +++ b/skyeye-erp/erp-pro/src/main/java/com/skyeye/shopmaterial/service/ShopMaterialService.java @@ -21,4 +21,5 @@ public interface ShopMaterialService extends SkyeyeBusinessService void queryTransMaterialById(InputObject inputObject, OutputObject outputObject); + void queryShopMaterialList(InputObject inputObject, OutputObject outputObject); } diff --git a/skyeye-erp/erp-pro/src/main/java/com/skyeye/shopmaterial/service/impl/ShopMaterialServiceImpl.java b/skyeye-erp/erp-pro/src/main/java/com/skyeye/shopmaterial/service/impl/ShopMaterialServiceImpl.java index 2b6c6eb2..2fe8ad37 100644 --- a/skyeye-erp/erp-pro/src/main/java/com/skyeye/shopmaterial/service/impl/ShopMaterialServiceImpl.java +++ b/skyeye-erp/erp-pro/src/main/java/com/skyeye/shopmaterial/service/impl/ShopMaterialServiceImpl.java @@ -8,9 +8,13 @@ import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.github.pagehelper.Page; +import com.github.pagehelper.PageHelper; +import com.github.yulichang.wrapper.MPJLambdaWrapper; import com.skyeye.annotation.service.SkyeyeService; import com.skyeye.base.business.service.impl.SkyeyeBusinessServiceImpl; import com.skyeye.common.constans.CommonNumConstants; +import com.skyeye.common.entity.search.CommonPageInfo; import com.skyeye.common.object.InputObject; import com.skyeye.common.object.OutputObject; import com.skyeye.common.util.mybatisplus.MybatisPlusUtil; @@ -127,4 +131,26 @@ public class ShopMaterialServiceImpl extends SkyeyeBusinessServiceImpl selectByIds(String... ids) { + List shopMaterialList = super.selectByIds(ids); + materialService.setDataMation(shopMaterialList, ShopMaterial::getMaterialId); + return shopMaterialList; + } + + @Override + public void queryShopMaterialList(InputObject inputObject, OutputObject outputObject) { + CommonPageInfo commonPageInfo = inputObject.getParams(CommonPageInfo.class); + Page pages = PageHelper.startPage(commonPageInfo.getPage(), commonPageInfo.getLimit()); + MPJLambdaWrapper wrapper = new MPJLambdaWrapper() + .innerJoin(Material.class, Material::getId, ShopMaterial::getMaterialId) + .like(StrUtil.isNotBlank(commonPageInfo.getKeyword()), Material::getName, commonPageInfo.getKeyword()); + + List shopMaterialList = skyeyeBaseMapper.selectJoinList(ShopMaterial.class, wrapper); + List idList = shopMaterialList.stream().map(ShopMaterial::getId).collect(Collectors.toList()); + List shopMaterials = selectByIds(idList.toArray(new String[]{})); + outputObject.setBeans(shopMaterials); + outputObject.settotal(pages.getTotal()); + } + } diff --git a/skyeye-erp/erp-web/src/main/java/com/skyeye/db/config/BaseDataSourceConfig.java b/skyeye-erp/erp-web/src/main/java/com/skyeye/db/config/BaseDataSourceConfig.java index f8d5cdd8..3a124917 100644 --- a/skyeye-erp/erp-web/src/main/java/com/skyeye/db/config/BaseDataSourceConfig.java +++ b/skyeye-erp/erp-web/src/main/java/com/skyeye/db/config/BaseDataSourceConfig.java @@ -4,7 +4,9 @@ package com.skyeye.db.config; +import com.baomidou.mybatisplus.core.config.GlobalConfig; import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean; +import com.github.yulichang.injector.MPJSqlInjector; import com.skyeye.common.constans.CommonConstants; import com.skyeye.exception.CustomException; import org.apache.commons.collections.CollectionUtils; @@ -77,6 +79,10 @@ public class BaseDataSourceConfig { public SqlSessionFactory baseSqlSessionFactory(@Qualifier("baseDataSource") DataSource dataSource) { MybatisSqlSessionFactoryBean mybatisSqlSessionFactoryBean = new MybatisSqlSessionFactoryBean(); + GlobalConfig globalConfig = new GlobalConfig(); + globalConfig.setSqlInjector(new MPJSqlInjector()); + mybatisSqlSessionFactoryBean.setGlobalConfig(globalConfig); + mybatisSqlSessionFactoryBean.setDataSource(dataSource); String databaseType = this.initDatabaseType(dataSource); if (databaseType == null) { From 285fdd56d842c1908fe56cbc3f1f93d9cfc57a19 Mon Sep 17 00:00:00 2001 From: weizhiqiang <598748873@qq.com> Date: Sun, 8 Sep 2024 17:02:34 +0800 Subject: [PATCH 3/3] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E6=A0=B9?= =?UTF-8?q?=E6=8D=AE=E8=A7=84=E6=A0=BCid=E8=8E=B7=E5=8F=96=E5=95=86?= =?UTF-8?q?=E5=9F=8E=E5=95=86=E5=93=81=E4=BF=A1=E6=81=AF=E7=9A=84=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ShopMaterialController.java | 8 ++++++++ .../service/ShopMaterialNormsService.java | 2 ++ .../shopmaterial/service/ShopMaterialService.java | 2 ++ .../service/impl/ShopMaterialNormsServiceImpl.java | 11 +++++++++++ .../service/impl/ShopMaterialServiceImpl.java | 9 +++++++++ 5 files changed, 32 insertions(+) diff --git a/skyeye-erp/erp-pro/src/main/java/com/skyeye/shopmaterial/controller/ShopMaterialController.java b/skyeye-erp/erp-pro/src/main/java/com/skyeye/shopmaterial/controller/ShopMaterialController.java index 1274c350..bb4133bf 100644 --- a/skyeye-erp/erp-pro/src/main/java/com/skyeye/shopmaterial/controller/ShopMaterialController.java +++ b/skyeye-erp/erp-pro/src/main/java/com/skyeye/shopmaterial/controller/ShopMaterialController.java @@ -62,4 +62,12 @@ public class ShopMaterialController { shopMaterialService.queryShopMaterialList(inputObject, outputObject); } + @ApiOperation(id = "queryShopMaterialByNormsIdList", value = "根据规格id获取商城商品信息", method = "POST", allUse = "0") + @ApiImplicitParams(value = { + @ApiImplicitParam(id = "normsIds", name = "normsIds", value = "规格id,多个逗号隔开", required = "required")}) + @RequestMapping("/post/ShopMaterialController/queryShopMaterialByNormsIdList") + public void queryShopMaterialByNormsIdList(InputObject inputObject, OutputObject outputObject) { + shopMaterialService.queryShopMaterialByNormsIdList(inputObject, outputObject); + } + } diff --git a/skyeye-erp/erp-pro/src/main/java/com/skyeye/shopmaterial/service/ShopMaterialNormsService.java b/skyeye-erp/erp-pro/src/main/java/com/skyeye/shopmaterial/service/ShopMaterialNormsService.java index 992da81b..c868e1b1 100644 --- a/skyeye-erp/erp-pro/src/main/java/com/skyeye/shopmaterial/service/ShopMaterialNormsService.java +++ b/skyeye-erp/erp-pro/src/main/java/com/skyeye/shopmaterial/service/ShopMaterialNormsService.java @@ -28,4 +28,6 @@ public interface ShopMaterialNormsService extends SkyeyeBusinessService shopMaterialNormsList); + List queryShopMaterialByNormsIdList(List normsIdList); + } diff --git a/skyeye-erp/erp-pro/src/main/java/com/skyeye/shopmaterial/service/ShopMaterialService.java b/skyeye-erp/erp-pro/src/main/java/com/skyeye/shopmaterial/service/ShopMaterialService.java index 5301e42a..2bb7a485 100644 --- a/skyeye-erp/erp-pro/src/main/java/com/skyeye/shopmaterial/service/ShopMaterialService.java +++ b/skyeye-erp/erp-pro/src/main/java/com/skyeye/shopmaterial/service/ShopMaterialService.java @@ -22,4 +22,6 @@ public interface ShopMaterialService extends SkyeyeBusinessService void queryTransMaterialById(InputObject inputObject, OutputObject outputObject); void queryShopMaterialList(InputObject inputObject, OutputObject outputObject); + + void queryShopMaterialByNormsIdList(InputObject inputObject, OutputObject outputObject); } diff --git a/skyeye-erp/erp-pro/src/main/java/com/skyeye/shopmaterial/service/impl/ShopMaterialNormsServiceImpl.java b/skyeye-erp/erp-pro/src/main/java/com/skyeye/shopmaterial/service/impl/ShopMaterialNormsServiceImpl.java index f2aef45e..fe4ac5d3 100644 --- a/skyeye-erp/erp-pro/src/main/java/com/skyeye/shopmaterial/service/impl/ShopMaterialNormsServiceImpl.java +++ b/skyeye-erp/erp-pro/src/main/java/com/skyeye/shopmaterial/service/impl/ShopMaterialNormsServiceImpl.java @@ -71,4 +71,15 @@ public class ShopMaterialNormsServiceImpl extends SkyeyeBusinessServiceImpl queryShopMaterialByNormsIdList(List normsIdList) { + if (CollectionUtil.isEmpty(normsIdList)) { + return CollectionUtil.newArrayList(); + } + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.in(MybatisPlusUtil.toColumns(ShopMaterialNorms::getNormsId), normsIdList); + List shopMaterialNormsList = list(queryWrapper); + return shopMaterialNormsList; + } } diff --git a/skyeye-erp/erp-pro/src/main/java/com/skyeye/shopmaterial/service/impl/ShopMaterialServiceImpl.java b/skyeye-erp/erp-pro/src/main/java/com/skyeye/shopmaterial/service/impl/ShopMaterialServiceImpl.java index 2fe8ad37..3a9d84ab 100644 --- a/skyeye-erp/erp-pro/src/main/java/com/skyeye/shopmaterial/service/impl/ShopMaterialServiceImpl.java +++ b/skyeye-erp/erp-pro/src/main/java/com/skyeye/shopmaterial/service/impl/ShopMaterialServiceImpl.java @@ -7,6 +7,7 @@ package com.skyeye.shopmaterial.service.impl; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; @@ -153,4 +154,12 @@ public class ShopMaterialServiceImpl extends SkyeyeBusinessServiceImpl normsIdList = JSONUtil.toList(inputObject.getParams().get("normsIds").toString(), null); + List shopMaterialNormsList = shopMaterialNormsService.queryShopMaterialByNormsIdList(normsIdList); + outputObject.setBeans(shopMaterialNormsList); + outputObject.settotal(shopMaterialNormsList.size()); + } + }