Browse Source

临时提交。

cangku
wangfukang 2 years ago
parent
commit
ef14a0052f
  1. 47
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/shoprelations/controller/ShopRelationsController.java
  2. 27
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/shoprelations/entity/ShopRelations.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. 17
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/shoprelations/service/impl/ShopRelationsServiceImpl.java

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

@ -1,4 +1,51 @@
package cc.hiver.mall.shoprelations.controller; package cc.hiver.mall.shoprelations.controller;
import cc.hiver.core.common.utils.ResultUtil;
import cc.hiver.core.common.vo.Result;
import cc.hiver.mall.shoprelations.entity.ShopRelations;
import cc.hiver.mall.shoprelations.service.ShopRelationsService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 店铺关联
*
* @author 王富康
* @date 2024/8/3
*/
@Slf4j
@RestController
@Api(tags = "店铺关联接口")
@RequestMapping("/hiver/shopRelations/")
@Transactional
public class ShopRelationsController { public class ShopRelationsController {
@Autowired
private ShopRelationsService shopRelationsService;
// 新增店铺关联信息
public Result addShopRelations(ShopRelations shopRelations) {
if (StringUtils.isEmpty(shopRelations.getRelatedShopId())) {
return ResultUtil.error("关联店铺id不能为空");
}
if (StringUtils.isEmpty(shopRelations.getAssociatedShopId())) {
return ResultUtil.error("被关联店铺id不能为空");
}
try {
shopRelationsService.addShopRelations(shopRelations);
return ResultUtil.success("新增店铺关联信息成功");
} catch (Exception e) {
log.error(e.getMessage(), e);
return ResultUtil.error("新增店铺关联信息失败");
}
}
// 根据店铺id获取关联的店铺信息
} }

27
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/shoprelations/entity/ShopRelations.java

@ -1,4 +1,29 @@
package cc.hiver.mall.shoprelations.entity; package cc.hiver.mall.shoprelations.entity;
public class ShopRelations { import cc.hiver.core.base.HiverBaseEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "店铺关联表")
@TableName(value = "t_shop_relations", autoResultMap = true)
public class ShopRelations extends HiverBaseEntity {
@ApiModelProperty(value = "关联店铺id")
private String associatedShopId;
@ApiModelProperty(value = "关联店铺名称")
private String associatedShopName;
@ApiModelProperty(value = "被关联店铺id")
private String relatedShopId;
@ApiModelProperty(value = "被关联店铺名称")
private String relatedShopName;
@ApiModelProperty(value = "店主id")
private String shopOwnerId;
} }

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

@ -1,4 +1,7 @@
package cc.hiver.mall.shoprelations.mapper; package cc.hiver.mall.shoprelations.mapper;
public interface ShopRelationsMapper { import cc.hiver.mall.shoprelations.entity.ShopRelations;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
public interface ShopRelationsMapper extends BaseMapper<ShopRelations> {
} }

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

@ -1,4 +1,7 @@
package cc.hiver.mall.shoprelations.service; package cc.hiver.mall.shoprelations.service;
public class ShopRelationsService { import cc.hiver.mall.shoprelations.entity.ShopRelations;
public interface ShopRelationsService {
void addShopRelations(ShopRelations shopRelations);
} }

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

@ -1,4 +1,19 @@
package cc.hiver.mall.shoprelations.service.impl; package cc.hiver.mall.shoprelations.service.impl;
public class ShopRelationsServiceImpl { import cc.hiver.mall.shoprelations.entity.ShopRelations;
import cc.hiver.mall.shoprelations.mapper.ShopRelationsMapper;
import cc.hiver.mall.shoprelations.service.ShopRelationsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class ShopRelationsServiceImpl implements ShopRelationsService {
@Autowired
private ShopRelationsMapper shopRelationsMapper;
@Override
public void addShopRelations(ShopRelations shopRelations) {
shopRelationsMapper.insert(shopRelations);
}
} }

Loading…
Cancel
Save