ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/domain/dto/UpdateGoodsPriceDTO.java
@@ -11,7 +11,7 @@ private Long shopId; @ApiModelProperty(value = "商品id") private Long goodsId; private String goodsId; @ApiModelProperty(value = "商品绑定门店id") private Long bindShopId; @ApiModelProperty("修改价格") ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/mapper/goods/GoodsMapper.java
@@ -163,4 +163,6 @@ List<PageShopMgtGoodsVO> pageShopMgtGoods(Page<PageShopMgtGoodsVO> page,@Param("dto") PageShopMgtGoodsDTO dto); List<String> staticsShopMgtGoods(@Param("dto") PageShopMgtGoodsDTO pageShopMgtGoodsDTO); List<PageShopMgtGoodsVO> pageShopMgtGoodsBySingle(Page<PageShopMgtGoodsVO> page,@Param("dto") PageShopMgtGoodsDTO pageShopMgtGoodsDTO); } ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/goods/GoodsServiceImpl.java
@@ -717,18 +717,25 @@ return Collections.emptyList(); } List<Shop> shops = new ArrayList<>(); List<PageShopMgtGoodsVO> list = new ArrayList<>(); //2.判断门店是否经销商 if (shop.getShopType()==1){ //经销商 获取下级-加盟商ids shops = remoteShopService.getFranchiseeIdsBYDealerId(shop.getShopId()); } //将该门店加入 shops.add(shop); List<Long> shopIds = shops.stream().map(Shop::getShopId).collect(Collectors.toList()); //查询信息 pageShopMgtGoodsDTO.setShopIds(shopIds); //3.根据shopId查询商品信息 List<PageShopMgtGoodsVO> list= goodsMapper.pageShopMgtGoods(page,pageShopMgtGoodsDTO); list= goodsMapper.pageShopMgtGoods(page,pageShopMgtGoodsDTO); }else { //将该门店加入 shops.add(shop); //3.根据shopId查询商品信息 list= goodsMapper.pageShopMgtGoodsBySingle(page,pageShopMgtGoodsDTO); } if (list != null && !list.isEmpty()) { //4.商品分类 @@ -755,12 +762,15 @@ )); //5.门店信息 list.forEach(mgtGoodsPageVo -> { if(mgtGoodsPageVo.getBindShopId()==null){ mgtGoodsPageVo.setBindShopId(String.valueOf(pageShopMgtGoodsDTO.getShopId())); } // 获取门店信息 Shop shopInfo = shopMap.get(Long.valueOf(mgtGoodsPageVo.getBindShopId())); // 如果门店信息不为空,则设置门店信息 if (shopInfo != null) { mgtGoodsPageVo.setShopName(shopInfo.getShopName()); mgtGoodsPageVo.setModifyPricePermission(shop.getModifyPricePermission()); // mgtGoodsPageVo.setModifyPricePermission(shop.getModifyPricePermission()); } }); @@ -822,11 +832,15 @@ //修改门店内商品价格 ShopGoods shopGoods = shopGoodsService.getByShopIdAndGoodsId(updateGoodsPriceDTO.getBindShopId(), String.valueOf(updateGoodsPriceDTO.getGoodsId())); if (null == shopGoods || shopGoods.getDelFlag() != 0){ return R.fail("该门店不存在该商品"); shopGoods = new ShopGoods(); shopGoods.setGoodsId(String.valueOf(updateGoodsPriceDTO.getGoodsId())); shopGoods.setShopId(updateGoodsPriceDTO.getShopId()); shopGoods.setDelFlag(0); shopGoods.setServiceNum(0); } shopGoods.setUpdateUserId(sysUser.getUserId()); shopGoods.setSalesPrice(updateGoodsPriceDTO.getGoodsPrice()); shopGoodsService.updateById(shopGoods); shopGoodsService.saveOrUpdate(shopGoods); return R.ok(); } } ruoyi-modules/ruoyi-goods/src/main/resources/mapper/goods/GoodsMapper.xml
@@ -547,10 +547,19 @@ END goodsStatus, tg.create_time, tsg.shop_id bindShopId, tsg.sales_price shopPrice IFNULL(tsg.sales_price, tg.sales_price) AS shopPrice, 1 as modifyPricePermission from t_goods tg LEFT JOIN t_goods_file tgf ON tg.goods_id = tgf.goods_id AND tgf.del_flag = 0 AND tgf.file_type = 1 LEFT JOIN t_shop_goods tsg on tg.goods_id = tsg.goods_id and tsg.del_flag = 0 LEFT JOIN t_shop_goods tsg on tg.goods_id = tsg.goods_id <if test="dto.shopIds != null and dto.shopIds.size() > 0"> AND tsg.shop_id IN <foreach collection="dto.shopIds" item="item" open="(" separator="," close=")"> #{item} </foreach> </if> and tsg.del_flag = 0 WHERE tg.del_flag = 0 <if test="dto.goodsType != null and dto.goodsType != ''"> AND tg.goods_type = #{dto.goodsType} @@ -570,12 +579,12 @@ <if test="dto.goodsStatus != null and dto.goodsStatus != ''"> AND tg.goods_status = #{dto.goodsStatus} </if> <if test="dto.shopIds != null and dto.shopIds.size() > 0"> <!-- <if test="dto.shopIds != null and dto.shopIds.size() > 0"> AND tsg.shop_id IN <foreach collection="dto.shopIds" item="item" open="(" separator="," close=")"> #{item} </foreach> </if> </if>--> ORDER BY tg.create_time DESC </select> @@ -610,5 +619,54 @@ </foreach> </if> </select> <select id="pageShopMgtGoodsBySingle" resultType="com.ruoyi.goods.domain.vo.PageShopMgtGoodsVO"> select tg.goods_id, tg.goods_name, tg.goods_introduction, tg.goods_class_id goodsClass, tg.goods_tags, tgf.file_url goodsPicture, CASE tg.goods_type WHEN 1 THEN "周期" WHEN 2 THEN "服务" WHEN 3 THEN "体验" WHEN 4 THEN "单品" END goodsType, tg.sales_price suggestSalesPrice, CASE tg.goods_status WHEN 1 THEN "上架中" WHEN 2 THEN "下架中" ELSE "下架中" END goodsStatus, tg.create_time, tsg.shop_id bindShopId, IFNULL(tsg.sales_price, tg.sales_price) AS shopPrice, 1 as modifyPricePermission from t_goods tg LEFT JOIN t_goods_file tgf ON tg.goods_id = tgf.goods_id AND tgf.del_flag = 0 AND tgf.file_type = 1 LEFT JOIN t_shop_goods tsg on tg.goods_id = tsg.goods_id and tsg.shop_id=#{dto.shopId} and tsg.del_flag = 0 WHERE tg.del_flag = 0 <if test="dto.goodsType != null and dto.goodsType != ''"> AND tg.goods_type = #{dto.goodsType} </if> <if test="dto.goodsClassId != null and dto.goodsClassId != ''"> AND tg.goods_class_id = #{dto.goodsClassId} </if> <if test="dto.createStartTime!=null and dto.createStartTime != ''"> AND Date(tg.create_time) >= #{dto.createStartTime} </if> <if test="dto.createEndTime!=null and dto.createEndTime != ''"> AND Date(tg.create_time) <= #{dto.createEndTime} </if> <if test="dto.goodsName != null and dto.goodsName != ''"> AND tg.goods_name LIKE CONCAT('%',#{dto.goodsName},'%') </if> <if test="dto.goodsStatus != null and dto.goodsStatus != ''"> AND tg.goods_status = #{dto.goodsStatus} </if> ORDER BY tg.create_time DESC </select> </mapper>