Browse Source

对接拼团数据

master
wangfukang 1 month ago
parent
commit
0dbefcedf5
  1. 2
      hiver-core/src/main/java/cc/hiver/core/common/constant/ProductConstant.java
  2. 60
      hiver-core/src/main/java/cc/hiver/core/common/utils/PageUtil.java
  3. 18
      hiver-core/src/main/java/cc/hiver/core/common/vo/PageVo.java
  4. 43
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ProductController.java
  5. 27
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ShopController.java
  6. 3
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/ProductGroupBuyPriceMapper.java
  7. 2
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/ShopMapper.java
  8. 13
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Product.java
  9. 17
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Shop.java
  10. 3
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/ShopArea.java
  11. 12
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/query/ProductPageQuery.java
  12. 17
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/ProductPageVO.java
  13. 13
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/ProductVo.java
  14. 7
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/ShopService.java
  15. 2
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/ProductGroupBuyPriceService.java
  16. 26
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/ProductShareServiceImpl.java
  17. 88
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/ShopServiceImpl.java
  18. 5
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/ProductGroupBuyPriceServiceImpl.java
  19. 16
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/ProductServiceImpl.java
  20. 32
      hiver-modules/hiver-mall/src/main/resources/mapper/ProductCategoryMapper.xml
  21. 10
      hiver-modules/hiver-mall/src/main/resources/mapper/ProductGroupBuyPriceMapper.xml
  22. 101
      hiver-modules/hiver-mall/src/main/resources/mapper/ProductMapper.xml
  23. 19
      hiver-modules/hiver-mall/src/main/resources/mapper/ShopAreaMapper.xml
  24. 52
      hiver-modules/hiver-mall/src/main/resources/mapper/ShopMapper.xml

2
hiver-core/src/main/java/cc/hiver/core/common/constant/ProductConstant.java

@ -11,4 +11,6 @@ public interface ProductConstant {
*/
Integer[] DEL_FLAG = {0, 1, 2};
String[] SERCHCATEGORY = {"bidian", "tuijian"};
}

60
hiver-core/src/main/java/cc/hiver/core/common/utils/PageUtil.java

@ -32,12 +32,10 @@ public class PageUtil {
* @return
*/
public static Pageable initPage(PageVo page) {
Pageable pageable = null;
int pageNumber = page.getPageNumber();
int pageSize = page.getPageSize();
String sort = page.getSort();
String order = page.getOrder();
// 1. 基础分页参数校验
if (pageNumber < 1) {
pageNumber = 1;
}
@ -47,19 +45,53 @@ public class PageUtil {
if (pageSize > 100) {
pageSize = 100;
}
if (StrUtil.isNotBlank(sort)) {
Sort.Direction d;
if (StrUtil.isBlank(order)) {
d = Sort.Direction.DESC;
} else {
d = Sort.Direction.valueOf(order.toUpperCase());
}
Sort s = Sort.by(d, sort);
pageable = PageRequest.of(pageNumber - 1, pageSize, s);
// 2. 构建排序对象 (Sort)
Sort sort = Sort.unsorted(); // 初始化为空排序
// --- 处理 sortOrder ---
if (StrUtil.isNotBlank(page.getSortOrder())) {
String orderStr = page.getOrderOrder();
Sort.Direction direction = StrUtil.isBlank(orderStr)
? Sort.Direction.DESC
: Sort.Direction.valueOf(orderStr.toUpperCase());
sort = sort.and(Sort.by(direction, page.getSortOrder()));
}
// --- 处理 sortScore ---
if (StrUtil.isNotBlank(page.getSortScore())) {
String orderStr = page.getOrderScore();
Sort.Direction direction = StrUtil.isBlank(orderStr)
? Sort.Direction.DESC
: Sort.Direction.valueOf(orderStr.toUpperCase());
sort = sort.and(Sort.by(direction, page.getSortScore()));
}
// --- 处理 sortSale ---
if (StrUtil.isNotBlank(page.getSortSale())) {
String orderStr = page.getOrderSale();
Sort.Direction direction = StrUtil.isBlank(orderStr)
? Sort.Direction.DESC
: Sort.Direction.valueOf(orderStr.toUpperCase());
sort = sort.and(Sort.by(direction, page.getSortSale()));
}
// --- 处理原有主排序 (sort + order) ---
if (StrUtil.isNotBlank(page.getSort())) {
String orderStr = page.getOrder();
Sort.Direction direction = StrUtil.isBlank(orderStr)
? Sort.Direction.DESC
: Sort.Direction.valueOf(orderStr.toUpperCase());
sort = sort.and(Sort.by(direction, page.getSort()));
}
// 3. 生成 Pageable
// 注意:PageRequest 的页码是从 0 开始的,所以 pageNumber - 1
if (sort.isSorted()) {
return PageRequest.of(pageNumber - 1, pageSize, sort);
} else {
pageable = PageRequest.of(pageNumber - 1, pageSize);
return PageRequest.of(pageNumber - 1, pageSize);
}
return pageable;
}
/**

18
hiver-core/src/main/java/cc/hiver/core/common/vo/PageVo.java

@ -25,4 +25,22 @@ public class PageVo implements Serializable {
@ApiModelProperty(value = "排序方式 asc/desc")
private String order;
@ApiModelProperty(value = "排序字段 评分")
private String sortScore;
@ApiModelProperty(value = "排序方式 asc/desc")
private String orderScore;
@ApiModelProperty(value = "排序字段 销量")
private String sortSale;
@ApiModelProperty(value = "排序方式 asc/desc")
private String orderSale;
@ApiModelProperty(value = "排序字段 排名")
private String sortOrder;
@ApiModelProperty(value = "排序方式 asc/desc")
private String orderOrder;
}

43
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ProductController.java

@ -80,6 +80,8 @@ public class ProductController {
//product.setShopId(shopId);
// 新增的默认为已上架
product.setDelFlag(CommonConstant.DEL_FLAG_TRUE);
product.setIsMust(CommonConstant.DATA_TYPE_ALL);
product.setIsPush(CommonConstant.DATA_TYPE_ALL);
// 处理前台的错误传参
if("[]".equals(product.getCustomerCategoryRule()) || "null".equals(product.getCustomerCategoryRule())){
product.setCustomerCategoryRule("");
@ -238,6 +240,34 @@ public class ProductController {
}
}
@RequestMapping(value = "/isPush", method = RequestMethod.POST)
@ApiOperation("根据货品id设为推荐货品")
public Result isPush(@RequestParam("id")String id, @RequestParam("isPush")Integer isPush) {
final UpdateWrapper<Product> updateWrapper = new UpdateWrapper<>();
updateWrapper.set("is_push", isPush);
updateWrapper.eq("id", id);
final boolean result = productService.update(updateWrapper);
if (result) {
return ResultUtil.success("设置成功");
} else {
return ResultUtil.error("设置失败");
}
}
@RequestMapping(value = "/isMust", method = RequestMethod.POST)
@ApiOperation("根据货品id设为必点货品")
public Result isMust(@RequestParam("id")String id, @RequestParam("isMust")Integer isMust) {
final UpdateWrapper<Product> updateWrapper = new UpdateWrapper<>();
updateWrapper.set("is_must", isMust);
updateWrapper.eq("id", id);
final boolean result = productService.update(updateWrapper);
if (result) {
return ResultUtil.success("设置成功");
} else {
return ResultUtil.error("设置失败");
}
}
/**
* 根据货品id批量下架货品
*
@ -356,8 +386,17 @@ public class ProductController {
@RateLimiter(name = "getShareList", ipLimit = true)
public Result<IPage<ProductPageVO>> getShareList(@RequestBody ProductPageQuery productPageQuery) {
// shopId从缓存中设置
final String shopId = securityUtil.getShopId();
productPageQuery.setShopId(shopId);
/*final String shopId = securityUtil.getShopId();
productPageQuery.setShopId(shopId);*/
if(productPageQuery.getCategoryId() != null){
if(productPageQuery.getCategoryId().equals(ProductConstant.SERCHCATEGORY[0])){
productPageQuery.setIsMust(ProductConstant.DEL_FLAG[1]);
productPageQuery.setCategoryId(null);
}else if(productPageQuery.getCategoryId().equals(ProductConstant.SERCHCATEGORY[1])){
productPageQuery.setIsPush(ProductConstant.DEL_FLAG[1]);
productPageQuery.setCategoryId(null);
}
}
final IPage<ProductPageVO> result = productService.getShareList(productPageQuery);
return new ResultUtil<IPage<ProductPageVO>>().setData(result);
}

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

@ -31,11 +31,14 @@ import cc.hiver.mall.entity.ShopArea;
import cc.hiver.mall.entity.ShopUser;
import cc.hiver.mall.invitelog.service.InviteLogService;
import cc.hiver.mall.pojo.dto.ShopRevenue;
import cc.hiver.mall.pojo.query.ProductPageQuery;
import cc.hiver.mall.pojo.vo.ProductPageVO;
import cc.hiver.mall.pojo.vo.QueryShopRevenueVO;
import cc.hiver.mall.service.ShopAreaService;
import cc.hiver.mall.service.ShopService;
import cc.hiver.mall.service.ShopUserService;
import cn.hutool.core.text.CharSequenceUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -45,6 +48,7 @@ import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@ -206,6 +210,29 @@ public class ShopController {
public Result<Page<Shop>> getByCondition(Shop shop,
PageVo pageVo) {
final Page<Shop> page = shopService.findByCondition(shop, PageUtil.initPage(pageVo));
final List<String> shopIdList = new ArrayList<>();
page.getContent().forEach(e -> {
shopIdList.add(e.getId());
});
//查询推荐商品
final ProductPageQuery productPageQuery = new ProductPageQuery();
productPageQuery.setShopIdList(shopIdList);
productPageQuery.setIsPush(ShopUserConstant.SHOP_ADMIN_COST[1]);
IPage<ProductPageVO> productList = shopService.getShareList(productPageQuery);
page.getContent().forEach(e -> {
final List<ProductPageVO> products = new ArrayList<>();
if(productList.getRecords().size() > 0){
productList.getRecords().forEach(productPageVO -> {
if (e.getId().equals(productPageVO.getShopId())) {
products.add(productPageVO);
}
});
}
e.setProducts(products);
});
return new ResultUtil<Page<Shop>>().setData(page);
}

3
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/ProductGroupBuyPriceMapper.java

@ -2,6 +2,7 @@ package cc.hiver.mall.dao.mapper;
import cc.hiver.mall.entity.ProductGroupBuyPrice;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@ -15,4 +16,6 @@ public interface ProductGroupBuyPriceMapper extends BaseMapper<ProductGroupBuyPr
void deleteByProductId(String productId);
List<ProductGroupBuyPrice> getByProductIds(@Param("productIds") List<String> productIds);
}

2
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/ShopMapper.java

@ -16,4 +16,6 @@ public interface ShopMapper extends BaseMapper<Shop> {
* @return
*/
List<Shop> findByUserId(@Param("userId") String userId);
List<Shop> getShopSaleCounts(@Param("shopIdList") List<String> shopIdList);
}

13
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Product.java

@ -123,10 +123,10 @@ public class Product implements Serializable {
private Date salesWeek;
@ApiModelProperty(value = "开始售卖时间")
private Date sellBeginTime;
private String sellBeginTime;
@ApiModelProperty(value = "结束售卖时间")
private Date sellEndTime;
private String sellEndTime;
@ApiModelProperty(value = "打印条码(自己制作的)")
private String printBarcode;
@ -134,6 +134,15 @@ public class Product implements Serializable {
@ApiModelProperty(value = "库存预警")
private Integer tailWarn;
@ApiModelProperty(value = "起售数量")
private Integer startPayNum;
@ApiModelProperty(value = "是否为加料 0否 1是")
private Integer isMoreBuy;
@ApiModelProperty(value = "餐盒费")
private BigDecimal lunchBox;
@ApiModelProperty(value = "入库状态:0:待入库(未维护对应的采购价信息);1:已入库;新增商品时为已入库")
private Integer inStorageStatus = 1;

17
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Shop.java

@ -17,6 +17,7 @@ package cc.hiver.mall.entity;
import cc.hiver.core.base.HiverBaseEntity;
import cc.hiver.core.vo.UserVo;
import cc.hiver.mall.pojo.vo.ProductPageVO;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
@ -116,6 +117,16 @@ public class Shop extends HiverBaseEntity {
@ApiModelProperty(value = "店铺对应店员")
private List<UserVo> users;
@Transient
@TableField(exist = false)
@ApiModelProperty(value = "店铺推荐商品")
private List<ProductPageVO> products;
@Transient
@TableField(exist = false)
@ApiModelProperty(value = "已售单量")
private Integer saleCounts;
@ApiModelProperty(value = "支付宝账号")
private String aliAccount;
@ -149,6 +160,12 @@ public class Shop extends HiverBaseEntity {
@ApiModelProperty(value = "是否为品牌店铺1是 0不是")
private Integer isbrandflag;
@ApiModelProperty(value = "排名")
private Integer shoprank;
@ApiModelProperty(value = "销量")
private Integer saleCount;
@ApiModelProperty(value = "副标题")
private String subtitle;
}

3
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/ShopArea.java

@ -34,6 +34,9 @@ public class ShopArea extends HiverBaseEntity {
@ApiModelProperty(value = "圈层名称")
private String title;
@ApiModelProperty(value = "1 是食堂")
private Integer isCanteen;
@ApiModelProperty(value = "父id")
@Column(nullable = false)
private String parentId;

12
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/query/ProductPageQuery.java

@ -49,6 +49,9 @@ public class ProductPageQuery extends HiverBasePageQuery {
@ApiModelProperty("货号")
private String productSn;
@ApiModelProperty("根据店铺id集合查询推款商品")
private List<String> shopIdList;
@ApiModelProperty("供应商id")
private String supplierId;
@ -81,4 +84,13 @@ public class ProductPageQuery extends HiverBasePageQuery {
@ApiModelProperty("盘点id")
private String checkStockId;
@ApiModelProperty(value = "是否为加料 0否 1是")
private Integer isMoreBuy;
@ApiModelProperty(value = "是否为推荐 0不是 1是")
private Integer isPush;
@ApiModelProperty(value = "是否为必点 0不是 1是")
private Integer isMust;
}

17
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/ProductPageVO.java

@ -16,6 +16,7 @@ limitations under the License.
package cc.hiver.mall.pojo.vo;
import cc.hiver.mall.checkstock.vo.CheckStockAttributeVo;
import cc.hiver.mall.entity.ProductGroupBuyPrice;
import cc.hiver.mall.productpicture.entity.ProductPicture;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
@ -111,11 +112,17 @@ public class ProductPageVO {
@ApiModelProperty(value = "销售周期")
private Date salesWeek;
@ApiModelProperty(value = "起售数量")
private Integer startPayNum;
@ApiModelProperty(value = "餐盒费")
private BigDecimal lunchBox;
@ApiModelProperty(value = "开始售卖时间")
private Date sellBeginTime;
private String sellBeginTime;
@ApiModelProperty(value = "结束售卖时间")
private Date sellEndTime;
private String sellEndTime;
@ApiModelProperty(value = "打印条码(自己制作的)")
private String printBarcode;
@ -149,6 +156,12 @@ public class ProductPageVO {
@ApiModelProperty(value = "商品购买数量")
private Integer buyCount;
@ApiModelProperty(value = "是否为加料 0否 1是")
private Integer isMoreBuy;
@ApiModelProperty(value = "盘点明细")
private List<CheckStockAttributeVo> checkStockAttributeVos;
@ApiModelProperty(value = "商品拼团信息")
private List<ProductGroupBuyPrice> productGroupBuyPrices;
}

13
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/ProductVo.java

@ -87,10 +87,10 @@ public class ProductVo extends HiverBaseEntity {
private Date salesWeek;
@ApiModelProperty(value = "开始售卖时间")
private Date sellBeginTime;
private String sellBeginTime;
@ApiModelProperty(value = "结束售卖时间")
private Date sellEndTime;
private String sellEndTime;
@ApiModelProperty(value = "打印条码(自己制作的)")
private String printBarcode;
@ -98,6 +98,15 @@ public class ProductVo extends HiverBaseEntity {
@ApiModelProperty(value = "库存预警")
private Integer tailWarn;
@ApiModelProperty(value = "起售数量")
private Integer startPayNum;
@ApiModelProperty(value = "餐盒费")
private BigDecimal lunchBox;
@ApiModelProperty(value = "是否为加料 0否 1是")
private Integer isMoreBuy;
@ApiModelProperty(value = "入库状态:0:待入库(未维护对应的采购价信息);1:已入库;新增商品时为已入库")
private Integer inStorageStatus = 1;

7
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/ShopService.java

@ -18,7 +18,10 @@ package cc.hiver.mall.service;
import cc.hiver.core.base.HiverBaseService;
import cc.hiver.mall.entity.Shop;
import cc.hiver.mall.pojo.dto.ShopRevenue;
import cc.hiver.mall.pojo.query.ProductPageQuery;
import cc.hiver.mall.pojo.vo.ProductPageVO;
import cc.hiver.mall.pojo.vo.QueryShopRevenueVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
@ -66,4 +69,8 @@ public interface ShopService extends HiverBaseService<Shop, String> {
List<Shop> getAllShopByCustomer(String userId);
Map<String,String> getShopRebateBalance();
List<Shop> getShopSaleCounts(List<String> shopIdList);
IPage<ProductPageVO> getShareList(ProductPageQuery productPageQuery);
}

2
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/ProductGroupBuyPriceService.java

@ -12,4 +12,6 @@ public interface ProductGroupBuyPriceService extends IService<ProductGroupBuyPri
List<ProductGroupBuyPrice> selectByProductId(String productId);
void deleteByProductId(String productId);
List<ProductGroupBuyPrice> getByProductIds(List<String> productIds);
}

26
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/ProductShareServiceImpl.java

@ -4,6 +4,7 @@ import cc.hiver.core.common.constant.CommonConstant;
import cc.hiver.core.common.utils.SecurityUtil;
import cc.hiver.core.entity.User;
import cc.hiver.mall.dao.ProductShareDao;
import cc.hiver.mall.entity.ProductGroupBuyPrice;
import cc.hiver.mall.entity.Share;
import cc.hiver.mall.entity.Shop;
import cc.hiver.mall.pojo.query.ProductPageQuery;
@ -14,6 +15,7 @@ import cc.hiver.mall.productpicture.entity.ProductPicture;
import cc.hiver.mall.productpicture.service.ProductPictureService;
import cc.hiver.mall.service.ProductShareService;
import cc.hiver.mall.service.ShopService;
import cc.hiver.mall.service.mybatis.ProductGroupBuyPriceService;
import cc.hiver.mall.service.mybatis.ProductService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.commons.lang3.StringUtils;
@ -39,6 +41,9 @@ public class ProductShareServiceImpl implements ProductShareService {
@Autowired
private ProductPictureService productPictureService;
@Autowired
private ProductGroupBuyPriceService productGroupBuyPriceService;
/**
* 新增分享链接
*
@ -101,9 +106,12 @@ public class ProductShareServiceImpl implements ProductShareService {
for (ProductPageVO record : shareList.getRecords()) {
productIds.add(record.getId());
}
if(!productIds.isEmpty()){
// 封装商品子图
final List<ProductPicture> productPictureByProductIds = productPictureService.getProductPictureByProductIds(productIds);
//封装拼团信息
final List<ProductGroupBuyPrice> productGroupBuyPrices = productGroupBuyPriceService.getByProductIds(productIds);
// 将productPictureByProductIds封装为map,key为商品id,value为实体
final Map<String,List<ProductPicture>> productPictureMap = new HashMap<>();
for (ProductPicture productPictureByProductId : productPictureByProductIds) {
@ -121,6 +129,24 @@ public class ProductShareServiceImpl implements ProductShareService {
shareList.getRecords().forEach(productPageVO -> {
productPageVO.setProductPictures(productPictureMap.get(productPageVO.getId()));
});
// 将productPictureByProductIds封装为map,key为商品id,value为实体
final Map<String,List<ProductGroupBuyPrice>> productGroupBuyPriceMap = new HashMap<>();
for (ProductGroupBuyPrice productGroupBuyPriceByProductId : productGroupBuyPrices) {
if (productPictureMap.containsKey(productGroupBuyPriceByProductId.getProductId())) {
final String productId = productGroupBuyPriceByProductId.getProductId();
final List<ProductGroupBuyPrice> productGroupBuyPrice = productGroupBuyPriceMap.get(productId);
productGroupBuyPrice.add(productGroupBuyPriceByProductId);
} else {
final List<ProductGroupBuyPrice> productGroupBuyPrice = new ArrayList<>();
productGroupBuyPrice.add(productGroupBuyPriceByProductId);
productGroupBuyPriceMap.put(productGroupBuyPriceByProductId.getProductId(),productGroupBuyPrice);
}
}
// 封装到实体中去。
shareList.getRecords().forEach(productPageVO -> {
productPageVO.setProductGroupBuyPrices(productGroupBuyPriceMap.get(productPageVO.getId()));
});
}
shareVO.setShareList(shareList);
return shareVO;

88
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/ShopServiceImpl.java

@ -17,15 +17,26 @@ package cc.hiver.mall.serviceimpl;
import cc.hiver.core.base.HiverBaseDao;
import cc.hiver.core.common.utils.SecurityUtil;
import cc.hiver.core.common.utils.StringUtils;
import cc.hiver.mall.dao.ShopDao;
import cc.hiver.mall.dao.mapper.ProductMapper;
import cc.hiver.mall.dao.mapper.SaleMapper;
import cc.hiver.mall.dao.mapper.ShopMapper;
import cc.hiver.mall.deductlog.service.DeductLogService;
import cc.hiver.mall.entity.ProductGroupBuyPrice;
import cc.hiver.mall.entity.Shop;
import cc.hiver.mall.invitelog.service.InviteLogService;
import cc.hiver.mall.pojo.dto.ShopRevenue;
import cc.hiver.mall.pojo.query.ProductPageQuery;
import cc.hiver.mall.pojo.vo.ProductPageVO;
import cc.hiver.mall.pojo.vo.QueryShopRevenueVO;
import cc.hiver.mall.productpicture.entity.ProductPicture;
import cc.hiver.mall.productpicture.service.ProductPictureService;
import cc.hiver.mall.service.ShopService;
import cc.hiver.mall.service.mybatis.ProductGroupBuyPriceService;
import cc.hiver.mall.utils.DateUtil;
import cn.hutool.core.text.CharSequenceUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
@ -64,6 +75,18 @@ public class ShopServiceImpl implements ShopService {
@Autowired
private DeductLogService deductLogService;
@Autowired
private ShopMapper shopMapper;
@Autowired
private ProductMapper productMapper;
@Autowired
private ProductPictureService productPictureService;
@Autowired
private ProductGroupBuyPriceService productGroupBuyPriceService;
@Override
public HiverBaseDao<Shop, String> getRepository() {
return shopDao;
@ -77,15 +100,19 @@ public class ShopServiceImpl implements ShopService {
public Predicate toPredicate(Root<Shop> root, CriteriaQuery<?> cq, CriteriaBuilder cb) {
final Path<String> ShopNameField = root.get("shopName");
final Path<String> regionField = root.get("regionId");
final Path<String> shopAreaField = root.get("shopArea");
final List<Predicate> list = new ArrayList<>();
final List<Predicate> list = new ArrayList<>();
if (CharSequenceUtil.isNotBlank(Shop.getShopName())) {
list.add(cb.like(ShopNameField, '%' + Shop.getShopName() + '%'));
}
if (CharSequenceUtil.isNotBlank(Shop.getRegionId())) {
list.add(cb.equal(regionField, Shop.getRegionId()));
}
if (CharSequenceUtil.isNotBlank(Shop.getShopArea())) {
list.add(cb.equal(shopAreaField, Shop.getShopArea()));
}
final Predicate[] arr = new Predicate[list.size()];
@ -140,4 +167,63 @@ public class ShopServiceImpl implements ShopService {
return resultMap;
}
@Override
public List<Shop> getShopSaleCounts(List<String> shopIdList) {
return shopMapper.getShopSaleCounts(shopIdList);
}
public IPage<ProductPageVO> getShareList(ProductPageQuery productPageQuery) {
if (StringUtils.isNotEmpty(productPageQuery.getEndDate())) {
// 加一天
productPageQuery.setEndDate(DateUtil.addDay(productPageQuery.getEndDate(), 1));
}
final com.baomidou.mybatisplus.extension.plugins.pagination.Page<ProductPageVO> page = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(productPageQuery.getPageNum(), productPageQuery.getPageSize());
final List<ProductPageVO> list = productMapper.getShareList(page, productPageQuery);
// 获取商品子图
final List<String> productIdList = new ArrayList<>();
for (ProductPageVO productPageVO : list) {
productIdList.add(productPageVO.getId());
}
if (!productIdList.isEmpty()) {
//封装拼团信息
final List<ProductGroupBuyPrice> productGroupBuyPrices = productGroupBuyPriceService.getByProductIds(productIdList);
// 获取子图
final List<ProductPicture> productPictureByProductIds = productPictureService.getProductPictureByProductIds(productIdList);
final Map<String, List<ProductPicture>> productPictureMap = new HashMap<>();
for (ProductPicture productPictureByProductId : productPictureByProductIds) {
if (productPictureMap.containsKey(productPictureByProductId.getProductId())) {
productPictureMap.get(productPictureByProductId.getProductId()).add(productPictureByProductId);
} else {
final List<ProductPicture> productPictureList = new ArrayList<>();
productPictureList.add(productPictureByProductId);
productPictureMap.put(productPictureByProductId.getProductId(), productPictureList);
}
}
final Map<String,List<ProductGroupBuyPrice>> productGroupBuyPriceMap = new HashMap<>();
for (ProductGroupBuyPrice productGroupBuyPrice : productGroupBuyPrices) {
if (productGroupBuyPriceMap.containsKey(productGroupBuyPrice.getProductId())) {
productGroupBuyPriceMap.get(productGroupBuyPrice.getProductId()).add(productGroupBuyPrice);
} else {
final List<ProductGroupBuyPrice> productGroupBuyPriceList = new ArrayList<>();
productGroupBuyPriceList.add(productGroupBuyPrice);
productGroupBuyPriceMap.put(productGroupBuyPrice.getProductId(), productGroupBuyPriceList);
}
}
for (ProductPageVO productPageVO : list) {
final String productId = productPageVO.getId();
if (productPictureMap.containsKey(productId)) {
productPageVO.setProductPictures(productPictureMap.get(productId));
}
if (productGroupBuyPriceMap.containsKey(productId)) {
productPageVO.setProductGroupBuyPrices(productGroupBuyPriceMap.get(productId));
}
}
}
page.setRecords(list);
return page;
}
}

5
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/ProductGroupBuyPriceServiceImpl.java

@ -33,4 +33,9 @@ public class ProductGroupBuyPriceServiceImpl extends ServiceImpl<ProductGroupBuy
public void deleteByProductId(String productId) {
productGroupBuyPriceMapper.deleteByProductId(productId);
}
@Override
public List<ProductGroupBuyPrice> getByProductIds(List<String> productIds) {
return productGroupBuyPriceMapper.getByProductIds(productIds);
}
}

16
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/ProductServiceImpl.java

@ -81,6 +81,8 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
}
if (!productIdList.isEmpty()) {
//封装拼团信息
final List<ProductGroupBuyPrice> productGroupBuyPrices = productGroupBuyPriceService.getByProductIds(productIdList);
// 获取子图
final List<ProductPicture> productPictureByProductIds = productPictureService.getProductPictureByProductIds(productIdList);
final Map<String, List<ProductPicture>> productPictureMap = new HashMap<>();
@ -93,11 +95,25 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
productPictureMap.put(productPictureByProductId.getProductId(), productPictureList);
}
}
final Map<String,List<ProductGroupBuyPrice>> productGroupBuyPriceMap = new HashMap<>();
for (ProductGroupBuyPrice productGroupBuyPrice : productGroupBuyPrices) {
if (productGroupBuyPriceMap.containsKey(productGroupBuyPrice.getProductId())) {
productGroupBuyPriceMap.get(productGroupBuyPrice.getProductId()).add(productGroupBuyPrice);
} else {
final List<ProductGroupBuyPrice> productGroupBuyPriceList = new ArrayList<>();
productGroupBuyPriceList.add(productGroupBuyPrice);
productGroupBuyPriceMap.put(productGroupBuyPrice.getProductId(), productGroupBuyPriceList);
}
}
for (ProductPageVO productPageVO : list) {
final String productId = productPageVO.getId();
if (productPictureMap.containsKey(productId)) {
productPageVO.setProductPictures(productPictureMap.get(productId));
}
if (productGroupBuyPriceMap.containsKey(productId)) {
productPageVO.setProductGroupBuyPrices(productGroupBuyPriceMap.get(productId));
}
}
// 获取商品均色均码的库存数
final List<Stock> stockList = stockService.getDefaultStockCount(productIdList);

32
hiver-modules/hiver-mall/src/main/resources/mapper/ProductCategoryMapper.xml

@ -300,9 +300,6 @@
<select id="getCategoryListByShopId" parameterType="java.lang.String" resultType="cc.hiver.mall.pojo.vo.ProductCategoryVo2">
SELECT
sum( count ) AS count,
sum( stock_count ) AS stock_count,
sum( minus_stock_count ) AS minus_stock_count,
dd.id,
dd.category_name,
dd.shop_id,
@ -314,37 +311,8 @@
dd.sort
FROM
t_product_category dd
LEFT JOIN (
SELECT
count( * ) AS count,
sum( COALESCE ( ss.stock_count, 0 ) ) AS stock_count,
sum( COALESCE ( ss.minus_stock_count, 0) ) AS minus_stock_count,
t.category_id
FROM
t_product t
LEFT JOIN (
SELECT
sum( CASE WHEN s.stock_count &lt; 0 THEN 0 ELSE s.stock_count END ) AS stock_count,
sum( CASE WHEN s.stock_count > 0 THEN 0 ELSE s.stock_count END ) AS minus_stock_count,
shop_id,
product_id
FROM
t_stock s
GROUP BY
shop_id,
product_id
) ss ON ss.product_id = t.id
AND ss.shop_id = t.shop_id
WHERE
t.del_flag != '2'
AND t.shop_id = #{shopId,jdbcType=VARCHAR}
GROUP BY
t.id
) aa ON dd.id = aa.category_id
WHERE
dd.shop_id = #{shopId,jdbcType=VARCHAR}
GROUP BY
dd.id
order by
CASE
WHEN dd.sort IS NULL OR dd.sort = '' THEN 1

10
hiver-modules/hiver-mall/src/main/resources/mapper/ProductGroupBuyPriceMapper.xml

@ -38,4 +38,14 @@
from t_product_group_buy_price
where product_id = #{productId,jdbcType=VARCHAR}
</delete>
<select id="getByProductIds" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from t_product_group_buy_price
where product_id in
<foreach close=")" collection="productIds" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</select>
</mapper>

101
hiver-modules/hiver-mall/src/main/resources/mapper/ProductMapper.xml

@ -34,8 +34,11 @@
<result column="is_push" jdbcType="INTEGER" property="isPush"/>
<result column="is_must" jdbcType="INTEGER" property="isMust"/>
<result column="order_filed" jdbcType="INTEGER" property="orderFiled"/>
<result column="sell_begin_time" jdbcType="TIMESTAMP" property="sellBeginTime"/>
<result column="sell_end_time" jdbcType="TIMESTAMP" property="sellEndTime"/>
<result column="sell_begin_time" jdbcType="VARCHAR" property="sellBeginTime"/>
<result column="sell_end_time" jdbcType="VARCHAR" property="sellEndTime"/>
<result column="start_pay_num" jdbcType="INTEGER" property="startPayNum"/>
<result column="lunch_box" jdbcType="DECIMAL" property="lunchBox"/>
<result column="is_more_buy" jdbcType="INTEGER" property="isMoreBuy"/>
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -101,7 +104,8 @@
id, create_by, create_time, del_flag, update_by, update_time, product_name, unit,
shop_id, category_id,attr_id, attribute_list, supplier_id,supplier_name, product_sn, barcode, price, purchase_price,commission,
wholesale_price, product_picture, product_video, product_intro, sales_week, print_barcode,
tail_warn,in_storage_status,customer_category_rule, attribute_list_price, is_push, is_must, order_filed, sell_begin_time, sell_end_time
tail_warn,in_storage_status,customer_category_rule, attribute_list_price, is_push,
is_must, order_filed, sell_begin_time, sell_end_time, start_pay_num, lunch_box, is_more_buy
</sql>
<select id="selectByExample" parameterType="cc.hiver.mall.entity.ProductExample" resultMap="BaseResultMap">
select
@ -143,7 +147,8 @@
purchase_price, commission, wholesale_price, product_picture,
product_video, product_intro, sales_week,
print_barcode, tail_warn,in_storage_status,customer_category_rule,
attribute_list_price,is_push,is_must,order_filed,sell_begin_time, sell_end_time)
attribute_list_price,is_push,is_must,order_filed,sell_begin_time, sell_end_time
, start_pay_num, lunch_box,is_more_buy)
values (#{id,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{delFlag,jdbcType=INTEGER}, #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
#{productName,jdbcType=VARCHAR}, #{unit,jdbcType=VARCHAR}, #{shopId,jdbcType=VARCHAR},
@ -154,7 +159,9 @@
#{productVideo,jdbcType=VARCHAR}, #{productIntro,jdbcType=VARCHAR}, #{salesWeek,jdbcType=TIMESTAMP},
#{printBarcode,jdbcType=VARCHAR}, #{tailWarn,jdbcType=INTEGER}, #{inStorageStatus,jdbcType=INTEGER},
#{customerCategoryRule,jdbcType=VARCHAR},#{attributeListPrice,jdbcType=VARCHAR},
#{isPush,jdbcType=INTEGER}, #{isMust,jdbcType=INTEGER}, #{orderFiled,jdbcType=INTEGER},#{sellBeginTime,jdbcType=TIMESTAMP},#{sellEndTime,jdbcType=TIMESTAMP})
#{isPush,jdbcType=INTEGER}, #{isMust,jdbcType=INTEGER},
#{orderFiled,jdbcType=INTEGER},#{sellBeginTime,jdbcType=VARCHAR},
#{sellEndTime,jdbcType=VARCHAR},#{startPayNum,jdbcType=INTEGER}, #{lunchBox,jdbcType=DECIMAL},#{isMoreBuy,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="cc.hiver.mall.entity.Product">
insert into t_product
@ -258,6 +265,15 @@
<if test="sellEndTime != null">
sell_end_time
</if>
<if test="startPayNum != null">
start_pay_num
</if>
<if test="lunchBox != null">
lunch_box
</if>
<if test="isMoreBuy != null">
is_more_buy
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -354,10 +370,19 @@
#{orderFiled,jdbcType=INTEGER}
</if>
<if test="sellBeginTime != null">
#{sellBeginTime,jdbcType=TIMESTAMP},
#{sellBeginTime,jdbcType=VARCHAR},
</if>
<if test="sellEndTime != null">
#{sellEndTime,jdbcType=TIMESTAMP},
#{sellEndTime,jdbcType=VARCHAR}
</if>
<if test="startPayNum != null">
#{startPayNum,jdbcType=INTEGER},
</if>
<if test="lunchBox != null">
#{lunchBox,jdbcType=DECIMAL}
</if>
<if test="isMoreBuy != null">
#{isMoreBuy,jdbcType=INTEGER}
</if>
</trim>
</insert>
@ -464,10 +489,19 @@
order_filed = #{record.orderFiled,jdbcType=INTEGER}
</if>
<if test="record.sellBeginTime != null">
sell_begin_time = #{record.sellBeginTime,jdbcType=TIMESTAMP},
sell_begin_time = #{record.sellBeginTime,jdbcType=VARCHAR},
</if>
<if test="record.sellEndTime != null">
sell_end_time = #{record.sellEndTime,jdbcType=TIMESTAMP}
sell_end_time = #{record.sellEndTime,jdbcType=VARCHAR}
</if>
<if test="record.startPayNum != null">
start_pay_num = #{record.startPayNum,jdbcType=INTEGER},
</if>
<if test="record.lunchBox != null">
lunch_box = #{record.lunchBox,jdbcType=DECIMAL}
</if>
<if test="record.lunchBox != null">
is_more_buy = #{isMoreBuy,jdbcType=INTEGER}
</if>
</set>
<if test="_parameter != null">
@ -507,8 +541,11 @@
is_push = #{record.isPush,jdbcType=INTEGER},
is_must = #{record.isMust,jdbcType=INTEGER},
order_filed = #{record.orderFiled,jdbcType=INTEGER},
sell_begin_time = #{record.sellBeginTime,jdbcType=TIMESTAMP},
sell_end_time = #{record.sellEndTime,jdbcType=TIMESTAMP}
sell_begin_time = #{record.sellBeginTime,jdbcType=VARCHAR},
sell_end_time = #{record.sellEndTime,jdbcType=VARCHAR},
start_pay_num = #{record.startPayNum,jdbcType=INTEGER},
lunch_box = #{record.lunchBox,jdbcType=DECIMAL},
is_more_buy = #{isMoreBuy,jdbcType=INTEGER}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
@ -607,10 +644,19 @@
order_filed = #{orderFiled,jdbcType=INTEGER}
</if>
<if test="sellBeginTime != null">
sell_begin_time = #{sellBeginTime,jdbcType=TIMESTAMP},
sell_begin_time = #{sellBeginTime,jdbcType=VARCHAR},
</if>
<if test="sellEndTime != null">
sell_end_time = #{sellEndTime,jdbcType=TIMESTAMP},
sell_end_time = #{sellEndTime,jdbcType=VARCHAR},
</if>
<if test="startPayNum != null">
start_pay_num = #{startPayNum,jdbcType=INTEGER},
</if>
<if test="lunchBox != null">
lunch_box = #{lunchBox,jdbcType=DECIMAL}
</if>
<if test="isMoreBuy != null">
is_more_buy = #{isMoreBuy,jdbcType=INTEGER}
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
@ -647,8 +693,11 @@
is_push = #{isPush,jdbcType=INTEGER},
is_must = #{isMust,jdbcType=INTEGER},
order_filed = #{orderFiled,jdbcType=INTEGER},
sell_begin_time = #{sellBeginTime,jdbcType=TIMESTAMP},
sell_end_time = #{sellEndTime,jdbcType=TIMESTAMP}
sell_begin_time = #{sellBeginTime,jdbcType=VARCHAR},
sell_end_time = #{sellEndTime,jdbcType=VARCHAR},
start_pay_num = #{startPayNum,jdbcType=INTEGER},
lunch_box = #{lunchBox,jdbcType=DECIMAL},
is_more_buy = #{isMoreBuy,jdbcType=INTEGER}
where id = #{id,jdbcType=VARCHAR}
</update>
@ -688,9 +737,13 @@
t.is_must,
t.order_filed,
t.sell_begin_time,
t.sell_end_time
t.sell_end_time,
t.start_pay_num,
t.lunch_box,
t.is_more_buy
FROM t_product t
<where>
t.del_flag != 2
<!--店铺id-->
<if test='queryParams.shopId!=null and queryParams.shopId.trim() neq ""'>
AND t.shop_id = #{queryParams.shopId}
@ -699,6 +752,16 @@
<if test='queryParams.delFlag!=null'>
AND t.del_flag = #{queryParams.delFlag}
</if>
<!--查询加料的-->
<if test='queryParams.isMoreBuy!=null'>
AND t.is_more_buy = #{queryParams.isMoreBuy}
</if>
<if test='queryParams.isPush!=null'>
AND t.is_push = #{queryParams.isPush}
</if>
<if test='queryParams.isMust!=null'>
AND t.is_must = #{queryParams.isMust}
</if>
<!--分类id-->
<if test='queryParams.categoryId!=null and queryParams.categoryId.trim() neq ""'>
AND t.category_id =#{queryParams.categoryId}
@ -714,6 +777,12 @@
#{item}
</foreach>
</if>
<if test='queryParams.shopIdList!=null '>
and t.shop_id in
<foreach item="item" index="index" collection="queryParams.shopIdList" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="queryParams.searchStr != null and queryParams.searchStr != ''">
and (
t.product_name like concat('%',#{queryParams.searchStr},'%')

19
hiver-modules/hiver-mall/src/main/resources/mapper/ShopAreaMapper.xml

@ -13,10 +13,11 @@
<result column="sort_order" property="sortOrder" jdbcType="DECIMAL" />
<result column="status" property="status" jdbcType="INTEGER" />
<result column="title" property="title" jdbcType="VARCHAR" />
<result column="is_canteen" property="isCanteen" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List" >
id, create_by, create_time, del_flag, update_by, update_time, is_parent, parent_id,
sort_order, status, title
sort_order, status, title, isCanteen
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
@ -32,11 +33,11 @@
insert into t_shop_area (id, create_by, create_time,
del_flag, update_by, update_time,
is_parent, parent_id, sort_order,
status, title)
status, title,is_canteen)
values (#{id,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{delFlag,jdbcType=INTEGER}, #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
#{isParent,jdbcType=BIT}, #{parentId,jdbcType=VARCHAR}, #{sortOrder,jdbcType=DECIMAL},
#{status,jdbcType=INTEGER}, #{title,jdbcType=VARCHAR})
#{status,jdbcType=INTEGER}, #{title,jdbcType=VARCHAR},#{isCanteen,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="cc.hiver.mall.entity.ShopArea" >
insert into t_shop_area
@ -74,6 +75,9 @@
<if test="title != null" >
title,
</if>
<if test="isCanteen != null" >
is_canteen,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
@ -109,6 +113,9 @@
<if test="title != null" >
#{title,jdbcType=VARCHAR},
</if>
<if test="isCanteen != null" >
#{isCanteen,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="cc.hiver.mall.entity.ShopArea" >
@ -144,6 +151,9 @@
<if test="title != null" >
title = #{title,jdbcType=VARCHAR},
</if>
<if test="isCanteen != null" >
is_canteen = #{isCanteen,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
@ -158,7 +168,8 @@
parent_id = #{parentId,jdbcType=VARCHAR},
sort_order = #{sortOrder,jdbcType=DECIMAL},
status = #{status,jdbcType=INTEGER},
title = #{title,jdbcType=VARCHAR}
title = #{title,jdbcType=VARCHAR},
is_canteen = #{isCanteen,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

52
hiver-modules/hiver-mall/src/main/resources/mapper/ShopMapper.xml

@ -36,9 +36,11 @@
<result column="shop_images" property="shopImages" jdbcType="VARCHAR" />
<result column="shop_lename" property="shopLename" jdbcType="VARCHAR" />
<result column="shop_lecard" property="shopLecard" jdbcType="VARCHAR" />
<result column="shop_score" property="shopScore" jdbcType="VARCHAR" />
<result column="shop_score" property="shopScore" jdbcType="DECIMAL" />
<result column="isbrandflag" property="isbrandflag" jdbcType="INTEGER" />
<result column="subtitle" property="subtitle" jdbcType="VARCHAR" />
<result column="shoprank" property="shoprank" jdbcType="INTEGER" />
<result column="sale_count" property="saleCount" jdbcType="INTEGER" />
</resultMap>
<resultMap id="ResultMapWithBLOBs" type="cc.hiver.mall.entity.Shop" extends="BaseResultMap" >
<result column="remark" property="remark" jdbcType="LONGVARCHAR" />
@ -47,7 +49,7 @@
id, create_by, create_time, del_flag, update_by, update_time, shop_name, shop_owner_id, shop_manger_id, region,
region_id, shop_area, shop_area_title, shop_type, shop_type_title, shop_address, year_fee, charge_time, start_time,
end_time, status, remark, business_district_level, contact_phone, shop_icon, defaulted, ali_account, ali_name,
rebate_amount, attr_id, printing_method,shop_images,shop_lename,shop_lecard,shop_score,isbrandflag,subtitle
rebate_amount, attr_id, printing_method,shop_images,shop_lename,shop_lecard,shop_score,isbrandflag,subtitle,shoprank,sale_count
</sql>
<sql id="Blob_Column_List" >
remark
@ -68,11 +70,11 @@ rebate_amount, attr_id, printing_method,shop_images,shop_lename,shop_lecard,shop
insert into t_shop (id, create_by, create_time, del_flag, update_by, update_time, shop_name, shop_owner_id, shop_manger_id, region,
region_id, shop_area, shop_area_title, shop_type, shop_type_title, shop_address, year_fee, charge_time, start_time,
end_time, status, remark, business_district_level, contact_phone, shop_icon, defaulted, ali_account, ali_name,
rebate_amount, attr_id, printing_method, shop_images, shop_lename, shop_lecard, shop_score, isbrandflag, subtitle)
rebate_amount, attr_id, printing_method, shop_images, shop_lename, shop_lecard, shop_score, isbrandflag, subtitle,shoprank, sale_count)
values (#{id,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{delFlag,jdbcType=INTEGER}, #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{shopName,jdbcType=VARCHAR}, #{shopOwnerId,jdbcType=VARCHAR}, #{shopMangerId,jdbcType=VARCHAR}, #{region,jdbcType=VARCHAR},
#{regionId,jdbcType=VARCHAR}, #{shopArea,jdbcType=VARCHAR}, #{shopAreaTitle,jdbcType=VARCHAR}, #{shopType,jdbcType=VARCHAR}, #{shopTypeTitle,jdbcType=VARCHAR}, #{shopAddress,jdbcType=VARCHAR}, #{yearFee,jdbcType=VARCHAR}, #{chargeTime,jdbcType=VARCHAR}, #{startTime,jdbcType=VARCHAR},
#{endTime,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{remark,jdbcType=LONGVARCHAR}, #{businessDistrictLevel,jdbcType=VARCHAR}, #{contactPhone,jdbcType=VARCHAR}, #{shopIcon,jdbcType=VARCHAR}, #{defaulted,jdbcType=INTEGER}, #{aliAccount,jdbcType=VARCHAR}, #{aliName,jdbcType=VARCHAR},
#{rebateAmount,jdbcType=VARCHAR}, #{attrId,jdbcType=VARCHAR}, #{printingMethod,jdbcType=VARCHAR}, #{shopImages,jdbcType=VARCHAR}, #{shopLename,jdbcType=VARCHAR}, #{shopLecard,jdbcType=VARCHAR}, #{shopScore,jdbcType=VARCHAR}, #{isbrandflag,jdbcType=INTEGER}, #{subtitle,jdbcType=VARCHAR})
#{rebateAmount,jdbcType=VARCHAR}, #{attrId,jdbcType=VARCHAR}, #{printingMethod,jdbcType=VARCHAR}, #{shopImages,jdbcType=VARCHAR}, #{shopLename,jdbcType=VARCHAR}, #{shopLecard,jdbcType=VARCHAR}, #{shopScore,jdbcType=DECIMAL}, #{isbrandflag,jdbcType=INTEGER}, #{subtitle,jdbcType=VARCHAR}, #{shoprank,jdbcType=INTEGER}, #{saleCount,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="cc.hiver.mall.entity.Shop" >
insert into t_shop
@ -164,6 +166,12 @@ rebate_amount, attr_id, printing_method,shop_images,shop_lename,shop_lecard,shop
<if test="subtitle != null" >
subtitle,
</if>
<if test="shoprank != null" >
shoprank,
</if>
<if test="saleCount != null" >
sale_count,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
@ -245,7 +253,7 @@ rebate_amount, attr_id, printing_method,shop_images,shop_lename,shop_lecard,shop
#{shopLecard,jdbcType=VARCHAR},
</if>
<if test="shopScore != null" >
#{shopScore,jdbcType=VARCHAR},
#{shopScore,jdbcType=DECIMAL},
</if>
<if test="isbrandflag != null" >
#{isbrandflag,jdbcType=INTEGER},
@ -253,6 +261,12 @@ rebate_amount, attr_id, printing_method,shop_images,shop_lename,shop_lecard,shop
<if test="subtitle != null" >
#{subtitle,jdbcType=VARCHAR},
</if>
<if test="shoprank != null" >
#{shoprank,jdbcType=INTEGER},
</if>
<if test="saleCount != null" >
#{saleCount,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="cc.hiver.mall.entity.Shop" >
@ -334,7 +348,7 @@ rebate_amount, attr_id, printing_method,shop_images,shop_lename,shop_lecard,shop
shop_lecard = #{shopLecard,jdbcType=VARCHAR},
</if>
<if test="shopScore != null" >
shop_score = #{shopScore,jdbcType=VARCHAR},
shop_score = #{shopScore,jdbcType=DECIMAL},
</if>
<if test="isbrandflag != null" >
isbrandflag = #{isbrandflag,jdbcType=INTEGER},
@ -342,6 +356,12 @@ rebate_amount, attr_id, printing_method,shop_images,shop_lename,shop_lecard,shop
<if test="subtitle != null" >
subtitle = #{subtitle,jdbcType=VARCHAR},
</if>
<if test="shoprank != null" >
shoprank = #{shoprank,jdbcType=INTEGER},
</if>
<if test="saleCount != null" >
sale_count = #{saleCount,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
@ -372,9 +392,11 @@ rebate_amount, attr_id, printing_method,shop_images,shop_lename,shop_lecard,shop
shop_images = #{shopImages,jdbcType=VARCHAR},
shop_lename = #{shopLename,jdbcType=VARCHAR},
shop_lecard = #{shopLecard,jdbcType=VARCHAR},
shop_score = #{shopScore,jdbcType=VARCHAR},
shop_score = #{shopScore,jdbcType=DECIMAL},
isbrandflag = #{isbrandflag,jdbcType=INTEGER},
subtitle = #{subtitle,jdbcType=VARCHAR}
subtitle = #{subtitle,jdbcType=VARCHAR},
shoprank = #{shoprank,jdbcType=INTEGER},
sale_count = #{saleCount,jdbcType=INTEGER}
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="cc.hiver.mall.entity.Shop" >
@ -412,9 +434,11 @@ rebate_amount, attr_id, printing_method,shop_images,shop_lename,shop_lecard,shop
shop_images = #{shopImages,jdbcType=VARCHAR},
shop_lename = #{shopLename,jdbcType=VARCHAR},
shop_lecard = #{shopLecard,jdbcType=VARCHAR},
shop_score = #{shopScore,jdbcType=VARCHAR},
shop_score = #{shopScore,jdbcType=DECIMAL},
isbrandflag = #{isbrandflag,jdbcType=INTEGER},
subtitle = #{subtitle,jdbcType=VARCHAR}
subtitle = #{subtitle,jdbcType=VARCHAR},
shoprank = #{shoprank,jdbcType=INTEGER},
sale_count = #{saleCount,jdbcType=INTEGER}
where id = #{id,jdbcType=VARCHAR}
</update>
<select id="findByUserId" resultType="cc.hiver.mall.entity.Shop">
@ -424,4 +448,12 @@ rebate_amount, attr_id, printing_method,shop_images,shop_lename,shop_lecard,shop
WHERE m.status = 1 AND (um.user_id = #{userId} OR m.shop_owner_id = #{userId} OR m.shop_manger_id = #{userId})
ORDER BY m.defaulted DESC
</select>
<select id="getShopSaleCounts" resultType="cc.hiver.mall.entity.Shop">
SELECT shop_id as id, count(*) as saleCounts FROM `t_sale` where del_flag = 0 and status = 4 and shop_id in
<foreach item="item" index="index" collection="shopIdList" open="(" close=")" separator=",">
#{item}
</foreach>
GROUP BY shop_id
</select>
</mapper>
Loading…
Cancel
Save