Compare commits

...

11 Commits

  1. 4
      hiver-admin/src/main/resources/application.yml
  2. 10
      hiver-admin/test-output/test-report.html
  3. 11
      hiver-modules/hiver-mall/pom.xml
  4. 63
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ShopController.java
  5. 2
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseocr/mapper/PurchaseOcrPictureMapper.java
  6. 146
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/shoprelations/controller/ShopRelationsController.java
  7. 32
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/shoprelations/entity/ShopRelations.java
  8. 30
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/shoprelations/mapper/ShopRelationsMapper.java
  9. 56
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/shoprelations/service/ShopRelationsService.java
  10. 117
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/shoprelations/service/impl/ShopRelationsServiceImpl.java
  11. 15
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/shoprelations/vo/ShopRelationsVo.java
  12. 100
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/utils/QRCodeUtils.java
  13. 20
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/warehouse/constant/WarehouseConstant.java
  14. 119
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/warehouse/controller/WarehouseController.java
  15. 101
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/warehouse/controller/WarehouseShopController.java
  16. 41
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/warehouse/entity/Warehouse.java
  17. 40
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/warehouse/entity/WarehouseShop.java
  18. 19
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/warehouse/mapper/WarehouseMappper.java
  19. 17
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/warehouse/mapper/WarehouseShopMapper.java
  20. 15
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/warehouse/service/WarehouseService.java
  21. 16
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/warehouse/service/WarehouseShopService.java
  22. 41
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/warehouse/service/impl/WarehouseServiceImpl.java
  23. 36
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/warehouse/service/impl/WarehouseShopServiceImpl.java
  24. 46
      hiver-modules/hiver-mall/src/main/resources/mapper/ShopRelationsMapper.xml
  25. 85
      hiver-modules/hiver-mall/src/main/resources/mapper/WarehouseMappper.xml
  26. 61
      hiver-modules/hiver-mall/src/main/resources/mapper/WarehouseShopMappper.xml

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

@ -336,6 +336,10 @@ ignored:
- /hiver/app/shop/getshopIconById - /hiver/app/shop/getshopIconById
# # 临时增加 # # 临时增加
- /hiver/app/purchase/getPurchaseListOfSupplier
- /hiver/app/purchase/cancelPurchase
- /hiver/shopRelations/addShopRelations
- /hiver/shopRelations/getShopRelations
# 限流及黑名单不拦截的路径 # 限流及黑名单不拦截的路径
limitUrls: limitUrls:
- /**/*.js - /**/*.js

10
hiver-admin/test-output/test-report.html

@ -5,7 +5,7 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Hiver测试报告</title> <title>Hiver���Ա���</title>
<link rel="apple-touch-icon" href="spark/logo.png"> <link rel="apple-touch-icon" href="spark/logo.png">
<link rel="shortcut icon" href="spark/logo.png"> <link rel="shortcut icon" href="spark/logo.png">
<link rel="stylesheet" href="spark/spark-style.css"> <link rel="stylesheet" href="spark/spark-style.css">
@ -35,7 +35,7 @@
<a href="#"><span class="badge badge-primary">Hiver</span></a> <a href="#"><span class="badge badge-primary">Hiver</span></a>
</li> </li>
<li class="m-r-10"> <li class="m-r-10">
<a href="#"><span class="badge badge-primary">八月 04, 2024 18:32:59</span></a> <a href="#"><span class="badge badge-primary">���� 04, 2024 18:32:59</span></a>
</li> </li>
</ul> </ul>
</div> </div>
@ -84,7 +84,7 @@
<div class="test-detail"> <div class="test-detail">
<span class="meta text-white badge badge-sm"></span> <span class="meta text-white badge badge-sm"></span>
<p class="name">passTest</p> <p class="name">passTest</p>
<p class="text-sm"><span>18:32:59 下午</span> / <span>0.026 secs</span></p> <p class="text-sm"><span>18:32:59 ����</span> / <span>0.026 secs</span></p>
</div> </div>
<div class="test-contents d-none"> <div class="test-contents d-none">
<div class="detail-head"> <div class="detail-head">
@ -128,13 +128,13 @@
<div class="col-md-3"> <div class="col-md-3">
<div class="card"><div class="card-body"> <div class="card"><div class="card-body">
<p class="m-b-0">Started</p> <p class="m-b-0">Started</p>
<h3>八月 04, 2024 18:32:59</h3> <h3>���� 04, 2024 18:32:59</h3>
</div></div> </div></div>
</div> </div>
<div class="col-md-3"> <div class="col-md-3">
<div class="card"><div class="card-body"> <div class="card"><div class="card-body">
<p class="m-b-0">Ended</p> <p class="m-b-0">Ended</p>
<h3>八月 04, 2024 18:32:59</h3> <h3>���� 04, 2024 18:32:59</h3>
</div></div> </div></div>
</div> </div>
<div class="col-md-3"> <div class="col-md-3">

11
hiver-modules/hiver-mall/pom.xml

@ -28,6 +28,17 @@
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<!-- Other dependencies -->
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>core</artifactId>
<version>3.4.1</version>
</dependency>
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>javase</artifactId>
<version>3.4.1</version>
</dependency>
</dependencies> </dependencies>
</project> </project>

63
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ShopController.java

@ -35,6 +35,11 @@ import cc.hiver.mall.pojo.vo.QueryShopRevenueVO;
import cc.hiver.mall.service.ShopAreaService; import cc.hiver.mall.service.ShopAreaService;
import cc.hiver.mall.service.ShopService; import cc.hiver.mall.service.ShopService;
import cc.hiver.mall.service.ShopUserService; import cc.hiver.mall.service.ShopUserService;
import cc.hiver.mall.warehouse.constant.WarehouseConstant;
import cc.hiver.mall.warehouse.entity.Warehouse;
import cc.hiver.mall.warehouse.entity.WarehouseShop;
import cc.hiver.mall.warehouse.service.WarehouseService;
import cc.hiver.mall.warehouse.service.WarehouseShopService;
import cn.hutool.core.text.CharSequenceUtil; import cn.hutool.core.text.CharSequenceUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -42,6 +47,7 @@ import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -76,6 +82,12 @@ public class ShopController {
@Autowired @Autowired
private InviteLogService inviteLogService; private InviteLogService inviteLogService;
@Autowired
private WarehouseService warehouseService;
@Autowired
private WarehouseShopService warehouseShopService;
@RequestMapping(value = "/getAll", method = RequestMethod.GET) @RequestMapping(value = "/getAll", method = RequestMethod.GET)
@ApiOperation("获取全部数据") @ApiOperation("获取全部数据")
public Result<List<Shop>> getAll() { public Result<List<Shop>> getAll() {
@ -206,11 +218,54 @@ public class ShopController {
@RequestMapping(value = "/enable", method = RequestMethod.POST) @RequestMapping(value = "/enable", method = RequestMethod.POST)
@ApiOperation("启用店铺") @ApiOperation("启用店铺")
@Transactional
public Result enable(@RequestParam String id) { public Result enable(@RequestParam String id) {
final Shop shop = shopService.get(id); if(StringUtils.isEmpty(id)){
shop.setStatus(ShopConstant.SHOP_STATUS_NORMAL); return ResultUtil.error("id不能为空");
shopService.update(shop); }
return ResultUtil.success("操作成功"); try{
final Shop shop = shopService.get(id);
shop.setStatus(ShopConstant.SHOP_STATUS_NORMAL);
shopService.update(shop);
// 20240803启用店铺,增加默认仓库。
// 根据店铺的ownerId查,有没有仓库,没有直接给一个“默认仓库”
if (StringUtils.isNotEmpty(shop.getShopOwnerId())) {
// 获取店主信息
final User loadUser = securityUtil.getCurrUser();
final User owner = userService.findById(shop.getShopOwnerId());
final List<Warehouse> warehouses = warehouseService.getWarehouseByShopOwnerId(shop.getShopOwnerId());
if (warehouses.isEmpty()) {
final Warehouse warehouse = new Warehouse();
warehouse.setCreateBy(loadUser.getId());
warehouse.setCreateByName(loadUser.getNickname());
warehouse.setShopOwnerId(shop.getShopOwnerId());
warehouse.setShopOwnerName(owner.getNickname());
warehouse.setWarehouseName("默认仓库");
// 默认为共用
warehouse.setWarehouseStatus(WarehouseConstant.WAREHOUSE_STATUS[0]);
// 默认为启用
warehouse.setIsUse(WarehouseConstant.IS_USE[0]);
warehouse.setSort(0);
warehouseService.addWarehouse(warehouse);
// 增加店铺与仓库的关联关系
final WarehouseShop warehouseShop = new WarehouseShop();
warehouseShop.setCreateBy(loadUser.getId());
warehouseShop.setCreateByName(loadUser.getNickname());
warehouseShop.setShopOwnerId(shop.getShopOwnerId());
warehouseShop.setShopOwnerName(owner.getNickname());
warehouseShop.setShopId(shop.getId());
warehouseShop.setShopName(shop.getShopName());
warehouseShop.setWarehouseId(warehouse.getId());
warehouseShop.setWarehouseName(warehouse.getWarehouseName());
warehouseShopService.addWarehouseShop(warehouseShop);
}
}
return ResultUtil.success("操作成功");
}catch (Exception e){
log.error(e.getMessage(),e);
return ResultUtil.error("启用失败");
}
} }
@RequestMapping(value = "/disable", method = RequestMethod.POST) @RequestMapping(value = "/disable", method = RequestMethod.POST)

2
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseocr/mapper/PurchaseOcrPictureMapper.java

@ -12,7 +12,7 @@ public interface PurchaseOcrPictureMapper extends BaseMapper<PurchaseOcrPicture>
void batchUpdate(@Param("purchaseOcrPictureList") List<PurchaseOcrPicture> purchaseOcrPictureAddList); void batchUpdate(@Param("purchaseOcrPictureList") List<PurchaseOcrPicture> purchaseOcrPictureAddList);
List<PurchaseOcrPicture> queryAllPictureStatus(@Param("purchaseId")String purchaseId); List<PurchaseOcrPicture> queryAllPictureStatus(@Param("purchaseId") String purchaseId);
List<PurchaseOcrCountVo> getOcrCount(String shopId); List<PurchaseOcrCountVo> getOcrCount(String shopId);
} }

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

@ -0,0 +1,146 @@
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 cc.hiver.mall.shoprelations.vo.ShopRelationsVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 店铺关联
*
* @author 王富康
* @date 2024/8/3
*/
@Slf4j
@RestController
@Api(tags = "店铺关联接口")
@RequestMapping("/hiver/shopRelations/")
@Transactional
public class ShopRelationsController {
@Autowired
private ShopRelationsService shopRelationsService;
/**
* 新增店铺关联信息
*
* @param shopRelations
* @return Result
* @author 王富康
* @date 2024/8/4
*/
@RequestMapping(value = "/addShopRelations", method = RequestMethod.POST)
@ApiOperation("新增店铺关联信息")
public Result addShopRelations(@RequestBody ShopRelations shopRelations) {
if (StringUtils.isEmpty(shopRelations.getShopOwnerId())) {
return ResultUtil.error("店主id不能为空");
}
if (StringUtils.isEmpty(shopRelations.getShopId())) {
return ResultUtil.error("店铺id不能为空");
}
try {
shopRelationsService.addShopRelations(shopRelations);
return ResultUtil.success("新增店铺关联信息成功");
} catch (Exception e) {
log.error(e.getMessage(), e);
return ResultUtil.error("新增店铺关联信息失败");
}
}
// 删除分组
@RequestMapping(value = "/deleteShopRelations", method = RequestMethod.POST)
@ApiOperation("删除店铺关联信息")
public Result deleteShopRelations(String id) {
if (StringUtils.isEmpty(id)) {
return ResultUtil.error("id不能为空");
}
try {
shopRelationsService.deleteShopRelations(id);
return ResultUtil.success("删除店铺关联信息成功");
} catch (Exception e) {
log.error(e.getMessage(), e);
return ResultUtil.error("删除店铺关联信息失败");
}
}
/**
* 根据店铺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("获取店铺关联信息失败");
}
}
/**
* 根据店主id查询分组
*
* @param shopOwnerId
* @return Result
* @author 王富康
* @date 2024/8/4
*/
@RequestMapping(value = "/getShopRelationsByShopOwnerId", method = RequestMethod.POST)
@ApiOperation("查询店主的分组")
public Result getShopRelationsByShopOwnerId(String shopOwnerId) {
if (StringUtils.isEmpty(shopOwnerId)) {
return ResultUtil.error("店主id不能为空");
}
try {
List<ShopRelations> shopRelationsVoList = shopRelationsService.getShopRelationsByShopOwnerId(shopOwnerId);
return new ResultUtil<List<ShopRelations>>().setData(shopRelationsVoList);
} catch (Exception e) {
log.error(e.getMessage(), e);
return ResultUtil.error("查询店主的分组失败");
}
}
// 修改分组店铺信息
@RequestMapping(value = "/updateShopRelations", method = RequestMethod.POST)
@ApiOperation("修改分组店铺信息")
public Result updateShopRelations(@RequestBody ShopRelations shopRelations) {
if (StringUtils.isEmpty(shopRelations.getId())) {
return ResultUtil.error("id不能为空");
}
try {
shopRelationsService.updateShopRelations(shopRelations);
return ResultUtil.success("修改分组店铺信息成功");
} catch (Exception e) {
log.error(e.getMessage(), e);
return ResultUtil.error("修改分组店铺信息失败");
}
}
}

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

@ -0,0 +1,32 @@
package cc.hiver.mall.shoprelations.entity;
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 = "创建人姓名")
private String createByName;
@ApiModelProperty(value = "分组名称")
private String groupName;
@ApiModelProperty(value = "关联店铺id")
private String shopId;
@ApiModelProperty(value = "关联店铺名称")
private String shopName;
@ApiModelProperty(value = "店主id")
private String shopOwnerId;
@ApiModelProperty(value = "店主id")
private String shopOwnerName;
}

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

@ -0,0 +1,30 @@
package cc.hiver.mall.shoprelations.mapper;
import cc.hiver.mall.shoprelations.entity.ShopRelations;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ShopRelationsMapper extends BaseMapper<ShopRelations> {
/**
* 根据店铺id获取关联的店铺信息
*
* @param shopId
* @return List<ShopRelations>
* @author 王富康
* @date 2024/8/4
*/
List<ShopRelations> getShopRelations(@Param("shopId") String shopId);
/**
* 根据店主id查询分组
*
* @param shopOwnerId
* @return List<ShopRelations>
* @author 王富康
* @date 2024/8/4
*/
List<ShopRelations> getShopRelationsByShopOwnerId(@Param("shopOwnerId") String shopOwnerId);
}

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

@ -0,0 +1,56 @@
package cc.hiver.mall.shoprelations.service;
import cc.hiver.mall.shoprelations.entity.ShopRelations;
import cc.hiver.mall.shoprelations.vo.ShopRelationsVo;
import java.util.List;
public interface ShopRelationsService {
/**
* 新增店铺关联信息
*
* @param shopRelations
* @author 王富康
* @date 2024/8/4
*/
void addShopRelations(ShopRelations shopRelations);
/**
* 根据店铺id获取关联的店铺信息
*
* @param shopId
* @return List<ShopRelationsVo>
* @author 王富康
* @date 2024/8/4
*/
List<ShopRelationsVo> getShopRelations(String shopId);
/**
* 删除店铺关联信息
*
* @param id
* @author 王富康
* @date 2024/8/4
*/
void deleteShopRelations(String id);
/**
* 根据店主id查询分组
*
* @param shopOwnerId
* @return List<ShopRelations>
* @author 王富康
* @date 2024/8/4
*/
List<ShopRelations> getShopRelationsByShopOwnerId(String shopOwnerId);
/**
* 修改分组店铺信息
*
* @param shopRelations
* @author 王富康
* @date 2024/8/4
*/
void updateShopRelations(ShopRelations shopRelations);
}

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

@ -0,0 +1,117 @@
package cc.hiver.mall.shoprelations.service.impl;
import cc.hiver.mall.shoprelations.entity.ShopRelations;
import cc.hiver.mall.shoprelations.mapper.ShopRelationsMapper;
import cc.hiver.mall.shoprelations.service.ShopRelationsService;
import cc.hiver.mall.shoprelations.vo.ShopRelationsVo;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
@Service
public class ShopRelationsServiceImpl implements ShopRelationsService {
@Autowired
private ShopRelationsMapper shopRelationsMapper;
/**
* 新增店铺关联信息
*
* @param shopRelations
* @author 王富康
* @date 2024/8/4
*/
@Override
public void addShopRelations(ShopRelations shopRelations) {
shopRelationsMapper.insert(shopRelations);
}
/**
* 根据店铺id获取关联的店铺信息
*
* @param shopId
* @return List<ShopRelationsVo>
* @author 王富康
* @date 2024/8/4
*/
@Override
public List<ShopRelationsVo> getShopRelations(String shopId) {
// 查询出来包含当前店铺的分组信息
final List<ShopRelations> shopRelations = shopRelationsMapper.getShopRelations(shopId);
// 需要返回的跟当前店铺有关联的店铺信息
final List<ShopRelationsVo> shopRelationsVo = new ArrayList<>();
// 存放已经添加过的店铺id,用于去重
final List<String> shopIds = new ArrayList<>();
if (shopRelations != null && !shopRelations.isEmpty()) {
for (ShopRelations shopRelation : shopRelations) {
final String groupShopId = shopRelation.getShopId();
final String shopName = shopRelation.getShopName();
if (StringUtils.isEmpty(groupShopId)) {
// 根据都好分隔
final String[] groupShopIdArray = groupShopId.split(",");
final String[] groupshopNameArray = shopName.split(",");
for (int i = 0; i < groupShopIdArray.length; i++) {
// 判断是否已经添加过
if (!shopIds.contains(groupShopIdArray[i])) {
// 没有添加过,放进集合
shopIds.add(groupShopIdArray[i]);
// 没有添加过,放回返回集合
final ShopRelationsVo relationsVo = new ShopRelationsVo();
relationsVo.setShopId(groupShopIdArray[i]);
relationsVo.setShopName(groupshopNameArray[i]);
shopRelationsVo.add(relationsVo);
}
}
}
}
}
return shopRelationsVo;
}
/**
* 删除店铺关联信息
*
* @param id
* @author 王富康
* @date 2024/8/4
*/
@Override
public void deleteShopRelations(String id) {
shopRelationsMapper.deleteById(id);
}
/**
* 根据店主id查询分组
*
* @param shopOwnerId
* @return List<ShopRelations>
* @author 王富康
* @date 2024/8/4
*/
@Override
public List<ShopRelations> getShopRelationsByShopOwnerId(String shopOwnerId) {
return shopRelationsMapper.getShopRelationsByShopOwnerId(shopOwnerId);
}
/**
* 修改分组店铺信息
*
* @param shopRelations
* @author 王富康
* @date 2024/8/4
*/
@Override
public void updateShopRelations(ShopRelations shopRelations) {
// 只能修改分组名称及店铺信息,这里不要动其他数据
// 获取到之前的数据
final ShopRelations oldShopRelations = shopRelationsMapper.selectById(shopRelations.getId());
oldShopRelations.setGroupName(shopRelations.getGroupName());
oldShopRelations.setShopId(shopRelations.getShopId());
oldShopRelations.setShopName(shopRelations.getShopName());
// 更新
shopRelationsMapper.updateById(oldShopRelations);
}
}

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

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

100
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/utils/QRCodeUtils.java

@ -0,0 +1,100 @@
package cc.hiver.mall.utils;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType;
import com.google.zxing.MultiFormatWriter;
import com.google.zxing.WriterException;
import com.google.zxing.client.j2se.MatrixToImageWriter;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
import lombok.extern.slf4j.Slf4j;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.nio.file.FileSystems;
import java.nio.file.Path;
import java.util.HashMap;
import java.util.Map;
@Slf4j
public class QRCodeUtils {
public static void main(String[] args) {
//type是1,生成活动详情、报名的二维码,type是2,生成活动签到的二维码
String content = "https://u.wechat.com/EOykWgVw3wwnB_JIawG96wY?1111111111112323232323231111112123132132111";
//获取一个二维码图片
try {
BitMatrix bitMatrix = createCode(content);
BufferedImage qrImage = MatrixToImageWriter.toBufferedImage(bitMatrix);
// 调整图像大小
BufferedImage resizedQrImage = new BufferedImage(250, 250, BufferedImage.TYPE_INT_RGB);
Graphics2D g2d = resizedQrImage.createGraphics();
g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
g2d.drawImage(qrImage, 0, 0, 250, 250, null);
g2d.dispose();
Path path = FileSystems.getDefault().getPath("测试");
ImageIO.write(resizedQrImage, "png", path.toFile());
}catch (Exception e){
log.error("生成二维码失败",e);
}
}
/**
* 生成二维码
* @param content 二维码的内容
* @return BitMatrix对象
* */
public static BitMatrix createCode(String content) throws IOException {
//二维码的宽高
int width = 200;
int height = 200;
//其他参数,如字符集编码
Map<EncodeHintType, Object> hints = new HashMap<EncodeHintType, Object>();
hints.put(EncodeHintType.CHARACTER_SET, "UTF-8");
//容错级别为H
hints.put(EncodeHintType.ERROR_CORRECTION , ErrorCorrectionLevel.H);
//白边的宽度,可取0~4
hints.put(EncodeHintType.MARGIN , 0);
BitMatrix bitMatrix = null;
try {
//生成矩阵,因为我的业务场景传来的是编码之后的URL,所以先解码
bitMatrix = new MultiFormatWriter().encode(content,
BarcodeFormat.QR_CODE, width, height, hints);
//bitMatrix = deleteWhite(bitMatrix);
} catch (WriterException e) {
e.printStackTrace();
}
return bitMatrix;
}
/**
* 删除生成的二维码周围的白边根据审美决定是否删除
* @param matrix BitMatrix对象
* @return BitMatrix对象
* */
private static BitMatrix deleteWhite(BitMatrix matrix) {
int[] rec = matrix.getEnclosingRectangle();
int resWidth = rec[2] + 1;
int resHeight = rec[3] + 1;
BitMatrix resMatrix = new BitMatrix(resWidth, resHeight);
resMatrix.clear();
for (int i = 0; i < resWidth; i++) {
for (int j = 0; j < resHeight; j++) {
if (matrix.get(i + rec[0], j + rec[1])) {
resMatrix.set(i, j);
}
}
}
return resMatrix;
}
}

20
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/warehouse/constant/WarehouseConstant.java

@ -0,0 +1,20 @@
package cc.hiver.mall.warehouse.constant;
/**
* 仓库常量
*
* @author 王富康
* @date 2024/8/3
*/
public interface WarehouseConstant {
/**
* 是否启用01
*/
int[] IS_USE = {0,1};
/**
* 店铺状态0共用1按需分配
*/
int[] WAREHOUSE_STATUS = {0,0};
}

119
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/warehouse/controller/WarehouseController.java

@ -0,0 +1,119 @@
package cc.hiver.mall.warehouse.controller;
import cc.hiver.core.common.utils.ResultUtil;
import cc.hiver.core.common.vo.Result;
import cc.hiver.mall.warehouse.entity.Warehouse;
import cc.hiver.mall.warehouse.service.WarehouseService;
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.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@Slf4j
@RestController
@Api(tags = "仓库接口")
@RequestMapping("/hiver/warehouse/")
@Transactional
public class WarehouseController {
@Autowired
private WarehouseService warehouseService;
/**
* 新增仓库
*
* @param warehouse
* @return Result
* @author 王富康
* @date 2024/8/3
*/
@RequestMapping(value = "/addWarehouse", method = RequestMethod.POST)
public Result addWarehouse(@RequestBody Warehouse warehouse) {
if (StringUtils.isEmpty(warehouse.getWarehouseName())) {
return ResultUtil.error("仓库名称不能为空");
}
if (StringUtils.isEmpty(warehouse.getShopOwnerId())) {
return ResultUtil.error("店主id不能为空");
}
try {
warehouse = warehouseService.addWarehouse(warehouse);
return new ResultUtil<Warehouse>().setData(warehouse, "新增仓库成功");
} catch (Exception e) {
log.error("新增仓库失败", e);
return ResultUtil.error("新增仓库失败");
}
}
/**
* 修改仓库信息
*
* @param warehouse
* @return Result
* @author 王富康
* @date 2024/8/3
*/
@RequestMapping(value = "/updateWarehouse", method = RequestMethod.POST)
public Result updateWarehouse(@RequestBody Warehouse warehouse) {
if (StringUtils.isEmpty(warehouse.getWarehouseName())) {
return ResultUtil.error("仓库名称不能为空");
}
if (StringUtils.isEmpty(warehouse.getShopOwnerId())) {
return ResultUtil.error("店主id不能为空");
}
try {
warehouse = warehouseService.updateWarehouse(warehouse);
return new ResultUtil<Warehouse>().setData(warehouse, "修改仓库成功");
} catch (Exception e) {
log.error("修改仓库失败", e);
return ResultUtil.error("修改仓库失败");
}
}
/**
* 删除仓库
*
* @param id
* @return Result
* @author 王富康
* @date 2024/8/3
*/
@RequestMapping(value = "/deleteWarehouse", method = RequestMethod.POST)
public Result deleteWarehouse(String id) {
try {
boolean b = warehouseService.deleteWarehouse(id);
if (b) {
return ResultUtil.success("删除仓库成功");
} else {
return ResultUtil.error("删除仓库失败");
}
} catch (Exception e) {
log.error("删除仓库失败", e);
return ResultUtil.error("删除仓库失败");
}
}
// 根据店主id查询仓库信息
@RequestMapping(value = "/getWarehouseByShopOwnerId", method = RequestMethod.POST)
public Result getWarehouseByShopOwnerId(String shopOwnerId) {
if (StringUtils.isEmpty(shopOwnerId)) {
return ResultUtil.error("店主id不能为空");
}
try {
List<Warehouse> warehouseList = warehouseService.getWarehouseByShopOwnerId(shopOwnerId);
return new ResultUtil<List<Warehouse>>().setData(warehouseList, "查询仓库信息成功");
} catch (Exception e) {
log.error("查询仓库信息失败", e);
return ResultUtil.error("查询仓库信息失败");
}
}
}

101
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/warehouse/controller/WarehouseShopController.java

@ -0,0 +1,101 @@
package cc.hiver.mall.warehouse.controller;
import cc.hiver.core.common.utils.ResultUtil;
import cc.hiver.core.common.vo.Result;
import cc.hiver.mall.warehouse.entity.WarehouseShop;
import cc.hiver.mall.warehouse.service.WarehouseShopService;
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.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@Slf4j
@RestController
@Api(tags = "仓库-店铺关联接口")
@RequestMapping("/hiver/warehouseShop/")
@Transactional
public class WarehouseShopController {
@Autowired
private WarehouseShopService warehouseShopService;
/**
* 添加仓库-店铺关联
*
* @param warehouseShop
* @return Result
* @author 王富康
* @date 2024/8/3
*/
@RequestMapping(value = "/addWarehouseShop", method = RequestMethod.POST)
public Result addWarehouseShop(@RequestBody WarehouseShop warehouseShop) {
// 仓库id不能为空
if (StringUtils.isEmpty(warehouseShop.getWarehouseId())) {
return ResultUtil.error("仓库id不能为空");
}
try {
warehouseShopService.addWarehouseShop(warehouseShop);
return ResultUtil.success("添加仓库-店铺关联成功");
} catch (Exception e) {
log.error("添加仓库-店铺关联失败", e);
return ResultUtil.error("添加仓库-店铺关联失败");
}
}
/**
* 删除仓库-店铺关联
*
* @param id
* @return Result
* @author 王富康
* @date 2024/8/3
*/
@RequestMapping(value = "/deleteWarehouseShop", method = RequestMethod.POST)
public Result deleteWarehouseShop(String id) {
try {
warehouseShopService.deleteWarehouseShop(id);
return ResultUtil.success("删除仓库-店铺关联成功");
} catch (Exception e) {
log.error("删除仓库-店铺关联失败", e);
return ResultUtil.error("删除仓库-店铺关联失败");
}
}
// 根据仓库id获取关联的店铺信息
@RequestMapping(value = "/getWarehouseShopByWarehouseId", method = RequestMethod.POST)
public Result getWarehouseShopByWarehouseId(String warehouseId) {
if(StringUtils.isEmpty(warehouseId)){
return ResultUtil.error("仓库id不能为空");
}
try {
List<WarehouseShop> warehouseShopList = warehouseShopService.getWarehouseShopByWarehouseId(warehouseId);
return new ResultUtil<List<WarehouseShop>>().setData(warehouseShopList);
} catch (Exception e) {
log.error("查询仓库-店铺关联失败", e);
return ResultUtil.error("查询仓库-店铺关联失败");
}
}
// 查询当前店铺下的仓库信息
@RequestMapping(value = "/getWarehouseShopByShopId", method = RequestMethod.POST)
public Result getWarehouseShopByShopId(String shopId) {
if(StringUtils.isEmpty(shopId)){
return ResultUtil.error("店铺id不能为空");
}
try {
List<WarehouseShop> warehouseShopList = warehouseShopService.getWarehouseShopByShopId(shopId);
return new ResultUtil<List<WarehouseShop>>().setData(warehouseShopList);
}catch (Exception e){
log.error("查询仓库-店铺关联失败", e);
return ResultUtil.error("查询仓库-店铺关联失败");
}
}
}

41
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/warehouse/entity/Warehouse.java

@ -0,0 +1,41 @@
package cc.hiver.mall.warehouse.entity;
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_warehouse", autoResultMap = true)
public class Warehouse extends HiverBaseEntity {
@ApiModelProperty(value = "创建人名称")
private String createByName;
@ApiModelProperty(value = "仓库名称")
private String warehouseName;
@ApiModelProperty(value = "仓库地址")
private String warehouseAddress;
@ApiModelProperty(value = "店铺状态:0:共用;1:按需分配")
private Integer warehouseStatus;
@ApiModelProperty(value = "是否启用:0:是;1:否")
private Integer isUse;
@ApiModelProperty(value = "店主id")
private String shopOwnerId;
@ApiModelProperty(value = "店主名称")
private String shopOwnerName;
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "排序")
private Integer sort;
}

40
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/warehouse/entity/WarehouseShop.java

@ -0,0 +1,40 @@
package cc.hiver.mall.warehouse.entity;
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_warehouse_shop", autoResultMap = true)
public class WarehouseShop extends HiverBaseEntity {
@ApiModelProperty(value = "创建人名称")
private String createByName;
@ApiModelProperty(value = "店主id")
private String shopOwnerId;
@ApiModelProperty(value = "店主名称")
private String shopOwnerName;
@ApiModelProperty(value = "仓库id")
private String warehouseId;
@ApiModelProperty(value = "仓库名称")
private String warehouseName;
@ApiModelProperty(value = "仓库地址")
private String warehouseAddress;
@ApiModelProperty(value = "店铺id")
private String shopId;
@ApiModelProperty(value = "店铺名称")
private String shopName;
@ApiModelProperty(value = "备注")
private String remark;
}

19
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/warehouse/mapper/WarehouseMappper.java

@ -0,0 +1,19 @@
package cc.hiver.mall.warehouse.mapper;
import cc.hiver.mall.warehouse.entity.Warehouse;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface WarehouseMappper extends BaseMapper<Warehouse> {
int addWarehouse(@Param("warehouse") Warehouse warehouse);
int updateWarehouse(@Param("warehouse") Warehouse warehouse);
int deleteWarehouse(@Param("id") String id);
List<Warehouse> getWarehouseByShopOwnerId(@Param("shopOwnerId") String shopOwnerId);
Warehouse getWarehouseById(@Param("id") String id);
}

17
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/warehouse/mapper/WarehouseShopMapper.java

@ -0,0 +1,17 @@
package cc.hiver.mall.warehouse.mapper;
import cc.hiver.mall.warehouse.entity.WarehouseShop;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface WarehouseShopMapper extends BaseMapper<WarehouseShop> {
void addWarehouseShop(@Param("warehouseShop") WarehouseShop warehouseShop);
void deleteWarehouseShop(@Param("id") String id);
List<WarehouseShop> getWarehouseShopByWarehouseId(@Param("warehouseId") String warehouseId);
List<WarehouseShop> getWarehouseShopByShopId(@Param("shopId") String shopId);
}

15
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/warehouse/service/WarehouseService.java

@ -0,0 +1,15 @@
package cc.hiver.mall.warehouse.service;
import cc.hiver.mall.warehouse.entity.Warehouse;
import java.util.List;
public interface WarehouseService {
Warehouse addWarehouse(Warehouse warehouse);
Warehouse updateWarehouse(Warehouse warehouse);
boolean deleteWarehouse(String id);
List<Warehouse> getWarehouseByShopOwnerId(String shopOwnerId);
}

16
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/warehouse/service/WarehouseShopService.java

@ -0,0 +1,16 @@
package cc.hiver.mall.warehouse.service;
import cc.hiver.mall.warehouse.entity.WarehouseShop;
import java.util.List;
public interface WarehouseShopService {
void addWarehouseShop(WarehouseShop warehouseShop);
void deleteWarehouseShop(String id);
List<WarehouseShop> getWarehouseShopByWarehouseId(String warehouseId);
List<WarehouseShop> getWarehouseShopByShopId(String shopId);
}

41
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/warehouse/service/impl/WarehouseServiceImpl.java

@ -0,0 +1,41 @@
package cc.hiver.mall.warehouse.service.impl;
import cc.hiver.mall.warehouse.entity.Warehouse;
import cc.hiver.mall.warehouse.mapper.WarehouseMappper;
import cc.hiver.mall.warehouse.service.WarehouseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class WarehouseServiceImpl implements WarehouseService {
@Autowired
private WarehouseMappper warehouseMappper;
@Override
public Warehouse addWarehouse(Warehouse warehouse) {
final String id = warehouse.getId();
warehouseMappper.insert(warehouse);
return warehouseMappper.getWarehouseById(id);
}
@Override
public Warehouse updateWarehouse(Warehouse warehouse) {
final String id = warehouse.getId();
warehouseMappper.updateById(warehouse);
return warehouseMappper.getWarehouseById(id);
}
@Override
public boolean deleteWarehouse(String id) {
final int i = warehouseMappper.deleteWarehouse(id);
return i > 0;
}
@Override
public List<Warehouse> getWarehouseByShopOwnerId(String shopOwnerId) {
return warehouseMappper.getWarehouseByShopOwnerId(shopOwnerId);
}
}

36
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/warehouse/service/impl/WarehouseShopServiceImpl.java

@ -0,0 +1,36 @@
package cc.hiver.mall.warehouse.service.impl;
import cc.hiver.mall.warehouse.entity.WarehouseShop;
import cc.hiver.mall.warehouse.mapper.WarehouseShopMapper;
import cc.hiver.mall.warehouse.service.WarehouseShopService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class WarehouseShopServiceImpl implements WarehouseShopService {
@Autowired
private WarehouseShopMapper warehouseShopMapper;
@Override
public void addWarehouseShop(WarehouseShop warehouseShop) {
warehouseShopMapper.insert(warehouseShop);
}
@Override
public void deleteWarehouseShop(String id) {
warehouseShopMapper.deleteWarehouseShop(id);
}
@Override
public List<WarehouseShop> getWarehouseShopByWarehouseId(String warehouseId) {
return warehouseShopMapper.getWarehouseShopByWarehouseId(warehouseId);
}
@Override
public List<WarehouseShop> getWarehouseShopByShopId(String shopId) {
return warehouseShopMapper.getWarehouseShopByShopId(shopId);
}
}

46
hiver-modules/hiver-mall/src/main/resources/mapper/ShopRelationsMapper.xml

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cc.hiver.mall.shoprelations.mapper.ShopRelationsMapper">
<resultMap id="BaseResultMap" type="cc.hiver.mall.shoprelations.entity.ShopRelations">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
<result column="create_by_name" jdbcType="VARCHAR" property="createByName" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="del_flag" jdbcType="INTEGER" property="delFlag" />
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="group_name" jdbcType="VARCHAR" property="groupName" />
<result column="shop_owner_id" jdbcType="VARCHAR" property="shopOwnerId" />
<result column="shop_owner_name" jdbcType="VARCHAR" property="shopOwnerName" />
<result column="shop_id" jdbcType="VARCHAR" property="shopId" />
<result column="shop_name" jdbcType="VARCHAR" property="shopName" />
</resultMap>
<sql id="Base_Column_List">
id, create_by,create_by_name, create_time, del_flag, update_by, update_time,
group_name,shop_owner_id, shop_owner_name,shop_id,shop_name
</sql>
<insert id="insert" parameterType="cc.hiver.mall.shoprelations.entity.ShopRelations">
insert into t_shop_relations (id, create_by, create_by_name, create_time, del_flag, update_by, update_time,
group_name,shop_owner_id, shop_owner_name,shop_id,shop_name)
values (#{id,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, #{createByName,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{delFlag,jdbcType=INTEGER}, #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
#{groupName,jdbcType=VARCHAR},#{shopOwnerId,jdbcType=VARCHAR},#{shopOwnerName,jdbcType=VARCHAR},
#{shopId,jdbcType=VARCHAR},#{shopName,jdbcType=VARCHAR})
</insert>
<select id="getShopRelations" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_shop_relations
where shop_id like concat('%',#{shopId},'%')
</select>
<select id="getShopRelationsByShopOwnerId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_shop_relations
where shop_owner_id = #{shopOwnerId}
</select>
</mapper>

85
hiver-modules/hiver-mall/src/main/resources/mapper/WarehouseMappper.xml

@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cc.hiver.mall.warehouse.mapper.WarehouseMappper">
<resultMap id="BaseResultMap" type="cc.hiver.mall.warehouse.entity.Warehouse">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
<result column="create_by_name" jdbcType="VARCHAR" property="createByName" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="del_flag" jdbcType="INTEGER" property="delFlag" />
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="warehouse_name" jdbcType="VARCHAR" property="warehouseName" />
<result column="warehouse_address" jdbcType="VARCHAR" property="warehouseAddress" />
<result column="warehouse_status" jdbcType="INTEGER" property="warehouseStatus" />
<result column="is_use" jdbcType="INTEGER" property="isUse" />
<result column="shop_owner_id" jdbcType="VARCHAR" property="shopOwnerId" />
<result column="shop_owner_name" jdbcType="VARCHAR" property="shopOwnerName" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="sort" jdbcType="INTEGER" property="sort" />
</resultMap>
<sql id="Base_Column_List">
id, create_by,create_by_name, create_time, del_flag, update_by, update_time,
warehouse_name, warehouse_address, warehouse_status, is_use, shop_owner_id,
shop_owner_name, remark, sort
</sql>
<insert id="addWarehouse" parameterType="cc.hiver.mall.warehouse.entity.Warehouse">
insert into t_warehouse
(id, create_by, create_by_name, create_time, del_flag, update_by, update_time,
warehouse_name, warehouse_address, warehouse_status, is_use, shop_owner_id,
shop_owner_name, remark, sort)
values (#{warehouse.id,jdbcType=VARCHAR}, #{warehouse.createBy,jdbcType=VARCHAR},#{warehouse.createByName,jdbcType=VARCHAR},
#{warehouse.createTime,jdbcType=TIMESTAMP}, #{warehouse.delFlag,jdbcType=INTEGER}, #{warehouse.updateBy,jdbcType=VARCHAR},
#{warehouse.updateTime,jdbcType=TIMESTAMP}, #{warehouse.warehouseName,jdbcType=VARCHAR}, #{warehouse.warehouseAddress,jdbcType=VARCHAR},
#{warehouse.warehouseStatus,jdbcType=INTEGER}, #{warehouse.isUse,jdbcType=INTEGER}, #{warehouse.shopOwnerId,jdbcType=VARCHAR},
#{warehouse.shopOwnerName,jdbcType=VARCHAR}, #{warehouse.remark,jdbcType=VARCHAR}, #{warehouse.sort,jdbcType=INTEGER})
</insert>
<update id="updateWarehouse" parameterType="cc.hiver.mall.warehouse.entity.Warehouse">
update t_warehouse
<set>
<if test="warehouse.delFlag != null">
del_flag = #{warehouse.delFlag},
</if>
<if test="warehouse.updateBy != null">
update_by = #{warehouse.updateBy},
</if>
<if test="warehouse.updateTime != null">
update_time = #{warehouse.updateTime},
</if>
<if test="warehouse.warehouseName != null">
warehouse_name = #{warehouse.warehouseName},
</if>
<if test="warehouse.warehouseAddress != null">
warehouse_address = #{warehouse.warehouseAddress},
</if>
<if test="warehouse.remark != null">
remark = #{warehouse.remark},
</if>
<if test="warehouse.sort != null">
sort = #{warehouse.sort},
</if>
</set>
where id = #{warehouse.id,jdbcType=VARCHAR}
</update>
<update id="deleteWarehouse" parameterType="java.lang.String">
update t_warehouse set del_flag = 1 where id = #{id}
</update>
<select id="getWarehouseByShopOwnerId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from t_warehouse
where shop_owner_id = #{shopOwnerId}
</select>
<!--根据主键id获取仓库信息-->
<select id="getWarehouseById" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from t_warehouse
where id = #{id}
</select>
</mapper>

61
hiver-modules/hiver-mall/src/main/resources/mapper/WarehouseShopMappper.xml

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cc.hiver.mall.warehouse.mapper.WarehouseShopMapper">
<resultMap id="BaseResultMap" type="cc.hiver.mall.warehouse.entity.WarehouseShop">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
<result column="create_by_name" jdbcType="VARCHAR" property="createByName" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="del_flag" jdbcType="INTEGER" property="delFlag" />
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="shop_owner_id" jdbcType="VARCHAR" property="shopOwnerId" />
<result column="shop_owner_name" jdbcType="VARCHAR" property="shopOwnerName" />
<result column="warehouse_id" jdbcType="VARCHAR" property="warehouseId" />
<result column="warehouse_name" jdbcType="VARCHAR" property="warehouseName" />
<result column="warehouse_address" jdbcType="VARCHAR" property="warehouseAddress" />
<result column="shop_id" jdbcType="VARCHAR" property="shopId" />
<result column="shop_name" jdbcType="VARCHAR" property="shopName" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
</resultMap>
<sql id="Base_Column_List">
id, create_by,create_by_name, create_time, del_flag, update_by, update_time,
shop_owner_id, shop_owner_name, warehouse_id, warehouse_name, warehouse_address,
shop_id, shop_name, remark
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_warehouse_shop
where id = #{id,jdbcType=VARCHAR}
</select>
<insert id="addWarehouseShop" parameterType="cc.hiver.mall.warehouse.entity.WarehouseShop">
insert into t_warehouse_shop (id, create_by, create_by_name, create_time, del_flag, update_by, update_time,
shop_owner_id, shop_owner_name, warehouse_id, warehouse_name, warehouse_address,
shop_id, shop_name, remark)
values (#{warehouseShop.id,jdbcType=VARCHAR}, #{warehouseShop.createBy,jdbcType=VARCHAR},#{warehouseShop.createByName,jdbcType=VARCHAR},
#{warehouseShop.createTime,jdbcType=TIMESTAMP}, #{warehouseShop.delFlag,jdbcType=INTEGER}, #{warehouseShop.updateBy,jdbcType=VARCHAR},
#{warehouseShop.updateTime,jdbcType=TIMESTAMP},#{warehouseShop.shopOwnerId,jdbcType=VARCHAR}, #{warehouseShop.shopOwnerName,jdbcType=VARCHAR},
#{warehouseShop.warehouseId,jdbcType=VARCHAR}, #{warehouseShop.warehouseName,jdbcType=VARCHAR}, #{warehouseShop.warehouseAddress,jdbcType=VARCHAR},
#{warehouseShop.shopId,jdbcType=VARCHAR}, #{warehouseShop.shopName,jdbcType=VARCHAR}, #{warehouseShop.remark,jdbcType=VARCHAR})
</insert>
<delete id="deleteWarehouseShop" parameterType="java.lang.String">
delete from t_warehouse_shop where id = #{id,jdbcType=VARCHAR}
</delete>
<select id="getWarehouseShopByShopId" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_warehouse_shop
where shop_id = #{shopId,jdbcType=VARCHAR}
</select>
<select id="getWarehouseShopByWarehouseId" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_warehouse_shop
where warehouse_id = #{warehouseId,jdbcType=VARCHAR}
</select>
</mapper>
Loading…
Cancel
Save