Browse Source

增加店铺关联

cangku
wangfukang 2 years ago
parent
commit
54f7e5c166
  1. 9
      hiver-admin/src/main/resources/application.yml
  2. 40
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/shoprelations/controller/ShopRelationsController.java
  3. 5
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/shoprelations/mapper/ShopRelationsMapper.java
  4. 5
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/shoprelations/service/ShopRelationsService.java
  5. 8
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/shoprelations/service/impl/ShopRelationsServiceImpl.java
  6. 16
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/shoprelations/vo/ShopRelationsVo.java

9
hiver-admin/src/main/resources/application.yml

@ -25,8 +25,8 @@ spring:
timeout-per-shutdown-phase: 10S timeout-per-shutdown-phase: 10S
# 数据源 # 数据源
datasource: datasource:
# url: jdbc:mysql://154.8.162.157:3306/hiver_shop?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true&allowMultiQueries=true url: jdbc:mysql://154.8.162.157:3306/hiver_shop?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true&allowMultiQueries=true
url: jdbc:mysql://8.140.198.243:3306/hiver_shop?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true&allowMultiQueries=true # url: jdbc:mysql://8.140.198.243:3306/hiver_shop?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true&allowMultiQueries=true
username: reddoor username: reddoor
# Jasypt加密 可到common-utils中找到JasyptUtil加解密工具类生成加密结果 格式为ENC(加密结果) 以下解密结果为123456 # Jasypt加密 可到common-utils中找到JasyptUtil加解密工具类生成加密结果 格式为ENC(加密结果) 以下解密结果为123456
password: ENC(Zla4U4+yRLPhicvuX2TmiEgxEpzP4dk8BHzFDEtiEhwLQIIaftZrrEUJZce6efoe) password: ENC(Zla4U4+yRLPhicvuX2TmiEgxEpzP4dk8BHzFDEtiEhwLQIIaftZrrEUJZce6efoe)
@ -67,8 +67,8 @@ spring:
ddl-auto: update ddl-auto: update
# Redis 若设有密码自行添加配置password # Redis 若设有密码自行添加配置password
redis: redis:
# host: 154.8.162.157 host: 154.8.162.157
host: 8.140.198.243 # host: 8.140.198.243
password: reddoor168 password: reddoor168
# 数据库索引 默认0 # 数据库索引 默认0
database: 1 database: 1
@ -338,6 +338,7 @@ ignored:
# # 临时增加 # # 临时增加
- /hiver/app/purchase/getPurchaseListOfSupplier - /hiver/app/purchase/getPurchaseListOfSupplier
- /hiver/app/purchase/cancelPurchase - /hiver/app/purchase/cancelPurchase
- /hiver/shopRelations/addShopRelations
# 限流及黑名单不拦截的路径 # 限流及黑名单不拦截的路径
limitUrls: limitUrls:
- /**/*.js - /**/*.js

40
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/shoprelations/controller/ShopRelationsController.java

@ -4,14 +4,19 @@ import cc.hiver.core.common.utils.ResultUtil;
import cc.hiver.core.common.vo.Result; import cc.hiver.core.common.vo.Result;
import cc.hiver.mall.shoprelations.entity.ShopRelations; import cc.hiver.mall.shoprelations.entity.ShopRelations;
import cc.hiver.mall.shoprelations.service.ShopRelationsService; import cc.hiver.mall.shoprelations.service.ShopRelationsService;
import cc.hiver.mall.shoprelations.vo.ShopRelationsVo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/** /**
* 店铺关联 * 店铺关联
* *
@ -29,7 +34,16 @@ public class ShopRelationsController {
@Autowired @Autowired
private ShopRelationsService shopRelationsService; private ShopRelationsService shopRelationsService;
// 新增店铺关联信息 /**
* 新增店铺关联信息
*
* @param shopRelations
* @return Result
* @author 王富康
* @date 2024/8/4
*/
@RequestMapping(value = "/addShopRelations", method = RequestMethod.POST)
@ApiOperation("新增店铺关联信息")
public Result addShopRelations(ShopRelations shopRelations) { public Result addShopRelations(ShopRelations shopRelations) {
if (StringUtils.isEmpty(shopRelations.getRelatedShopId())) { if (StringUtils.isEmpty(shopRelations.getRelatedShopId())) {
@ -47,5 +61,27 @@ public class ShopRelationsController {
} }
} }
// 根据店铺id获取关联的店铺信息 /**
* 根据店铺id获取关联的店铺信息
*
* @param shopId
* @return Result
* @author 王富康
* @date 2024/8/4
*/
@RequestMapping(value = "/getShopRelations", method = RequestMethod.POST)
@ApiOperation("根据店铺id获取关联的店铺信息")
public Result getShopRelations(String shopId) {
if (StringUtils.isEmpty(shopId)) {
return ResultUtil.error("店铺id不能为空");
}
try {
List<ShopRelationsVo> shopRelationsVoList = shopRelationsService.getShopRelations(shopId);
return new ResultUtil<List<ShopRelationsVo>>().setData(shopRelationsVoList);
} catch (Exception e) {
log.error(e.getMessage(), e);
return ResultUtil.error("获取店铺关联信息失败");
}
}
} }

5
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/shoprelations/mapper/ShopRelationsMapper.java

@ -1,7 +1,12 @@
package cc.hiver.mall.shoprelations.mapper; package cc.hiver.mall.shoprelations.mapper;
import cc.hiver.mall.shoprelations.entity.ShopRelations; import cc.hiver.mall.shoprelations.entity.ShopRelations;
import cc.hiver.mall.shoprelations.vo.ShopRelationsVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ShopRelationsMapper extends BaseMapper<ShopRelations> { public interface ShopRelationsMapper extends BaseMapper<ShopRelations> {
List<ShopRelationsVo> getShopRelations(@Param("shopId") String shopId);
} }

5
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/shoprelations/service/ShopRelationsService.java

@ -1,7 +1,12 @@
package cc.hiver.mall.shoprelations.service; package cc.hiver.mall.shoprelations.service;
import cc.hiver.mall.shoprelations.entity.ShopRelations; import cc.hiver.mall.shoprelations.entity.ShopRelations;
import cc.hiver.mall.shoprelations.vo.ShopRelationsVo;
import java.util.List;
public interface ShopRelationsService { public interface ShopRelationsService {
void addShopRelations(ShopRelations shopRelations); void addShopRelations(ShopRelations shopRelations);
List<ShopRelationsVo> getShopRelations(String shopId);
} }

8
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/shoprelations/service/impl/ShopRelationsServiceImpl.java

@ -3,9 +3,12 @@ package cc.hiver.mall.shoprelations.service.impl;
import cc.hiver.mall.shoprelations.entity.ShopRelations; import cc.hiver.mall.shoprelations.entity.ShopRelations;
import cc.hiver.mall.shoprelations.mapper.ShopRelationsMapper; import cc.hiver.mall.shoprelations.mapper.ShopRelationsMapper;
import cc.hiver.mall.shoprelations.service.ShopRelationsService; import cc.hiver.mall.shoprelations.service.ShopRelationsService;
import cc.hiver.mall.shoprelations.vo.ShopRelationsVo;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
@Service @Service
public class ShopRelationsServiceImpl implements ShopRelationsService { public class ShopRelationsServiceImpl implements ShopRelationsService {
@ -16,4 +19,9 @@ public class ShopRelationsServiceImpl implements ShopRelationsService {
public void addShopRelations(ShopRelations shopRelations) { public void addShopRelations(ShopRelations shopRelations) {
shopRelationsMapper.insert(shopRelations); shopRelationsMapper.insert(shopRelations);
} }
@Override
public List<ShopRelationsVo> getShopRelations(String shopId) {
return shopRelationsMapper.getShopRelations(shopId);
}
} }

16
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/shoprelations/vo/ShopRelationsVo.java

@ -0,0 +1,16 @@
package cc.hiver.mall.shoprelations.vo;
import io.swagger.annotations.ApiModelProperty;
public class ShopRelationsVo {
@ApiModelProperty(value = "关联id")
private String id;
@ApiModelProperty(value = "关联店铺名称")
private String shopName;
@ApiModelProperty(value = "被关联店铺id")
private String shopId;
}
Loading…
Cancel
Save