小程序首页初版,订单回显商户二维码,

This commit is contained in:
liuyingfang
2024-04-08 14:05:38 +08:00
parent e77a77c883
commit 934a116cf2
25 changed files with 1525 additions and 64 deletions

View File

@@ -21,8 +21,8 @@ public class HomeController {
private HomePageService homePageService;
@PostMapping
public Result homePage(@RequestBody HomeDto homeDto){
return homePageService.homePage(homeDto);
public Result homePage(@RequestBody HomeDto homeDto,@RequestHeader("environment") String environmen)throws Exception{
return homePageService.homePage(homeDto, environmen);
}
@PostMapping("/homePageUp")
public Result homePageUp(@RequestHeader("environment") String environment){

View File

@@ -1,6 +1,10 @@
package com.chaozhanggui.system.cashierservice.dao;
import com.chaozhanggui.system.cashierservice.entity.SysDict;
import com.chaozhanggui.system.cashierservice.entity.SysDictDetail;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface SysDictDetailMapper {
int deleteByPrimaryKey(Long detailId);
@@ -11,6 +15,12 @@ public interface SysDictDetailMapper {
SysDictDetail selectByPrimaryKey(Long detailId);
List<SysDict> selectByAll();
List<SysDictDetail> selectByAllDetail(@Param("list") List<Long> dictId);
List<SysDictDetail> selectByDictId(@Param("dictId") Long dictId);
int updateByPrimaryKeySelective(SysDictDetail record);
int updateByPrimaryKey(SysDictDetail record);

View File

@@ -0,0 +1,85 @@
package com.chaozhanggui.system.cashierservice.dao;
import com.chaozhanggui.system.cashierservice.entity.TbMerchantCoupon;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Pageable;
import java.util.List;
/**
* 优惠券(TbMerchantCoupon)表数据库访问层
*
* @author lyf
* @since 2024-04-02 09:24:16
*/
public interface TbMerchantCouponMapper {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
TbMerchantCoupon queryById(Integer id);
/**
* 查询指定行数据
*
* @param tbMerchantCoupon 查询条件
* @param pageable 分页对象
* @return 对象列表
*/
List<TbMerchantCoupon> queryAllByLimit(TbMerchantCoupon tbMerchantCoupon, @Param("pageable") Pageable pageable);
List<TbMerchantCoupon> queryAllByPage(@Param("page")Integer page, @Param("size")Integer size);
/**
* 统计总行数
*
* @param tbMerchantCoupon 查询条件
* @return 总行数
*/
long count(TbMerchantCoupon tbMerchantCoupon);
/**
* 新增数据
*
* @param tbMerchantCoupon 实例对象
* @return 影响行数
*/
int insert(TbMerchantCoupon tbMerchantCoupon);
/**
* 批量新增数据MyBatis原生foreach方法
*
* @param entities List<TbMerchantCoupon> 实例对象列表
* @return 影响行数
*/
int insertBatch(@Param("entities") List<TbMerchantCoupon> entities);
/**
* 批量新增或按主键更新数据MyBatis原生foreach方法
*
* @param entities List<TbMerchantCoupon> 实例对象列表
* @return 影响行数
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常请自行校验入参
*/
int insertOrUpdateBatch(@Param("entities") List<TbMerchantCoupon> entities);
/**
* 修改数据
*
* @param tbMerchantCoupon 实例对象
* @return 影响行数
*/
int update(TbMerchantCoupon tbMerchantCoupon);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 影响行数
*/
int deleteById(Integer id);
}

View File

@@ -29,7 +29,7 @@ public interface TbProductMapper {
List<TbProduct> selectByIdIn(@Param("ids") String ids);
List<TbProduct> selectByIds(@Param("list") List<String> ids);
Integer selectByQcode(@Param("code") String code,@Param("productId") Integer productId,@Param("shopId") String shopId);
Integer selectByNewQcode(@Param("code") String code,@Param("productId") Integer productId,@Param("shopId") String shopId,@Param("list") List<String> list);
}

View File

@@ -2,6 +2,7 @@ package com.chaozhanggui.system.cashierservice.dao;
import com.chaozhanggui.system.cashierservice.entity.TbProductSku;
import com.chaozhanggui.system.cashierservice.entity.TbProductSkuWithBLOBs;
import com.chaozhanggui.system.cashierservice.entity.vo.HomeVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
@@ -20,7 +21,9 @@ public interface TbProductSkuMapper {
TbProductSkuWithBLOBs selectByPrimaryKey(Integer id);
Integer selectBySpecSnap(@Param("shopId")String shopId,@Param("tableId") Integer tableId,@Param("specSnap") String specSnap);
int updateByPrimaryKeySelective(TbProductSkuWithBLOBs record);
List<HomeVO> selectSale();
List<HomeVO> selectDay();
int updateByPrimaryKeyWithBLOBs(TbProductSkuWithBLOBs record);
int updateByPrimaryKey(TbProductSku record);
@@ -33,4 +36,6 @@ public interface TbProductSkuMapper {
List<TbProductSku> selectAll();
List<TbProductSku> selectDownSku(@Param("list") List<Integer> productId);
List<TbProductSku> selectSkus(@Param("list") List<String> productId);
}

View File

@@ -19,6 +19,7 @@ public interface TbShopInfoMapper {
int insertSelective(TbShopInfo record);
TbShopInfo selectByPrimaryKey(Integer id);
List<TbShopInfo> selectByIds(@Param("list") List<String> ids);
int updateByPrimaryKeySelective(TbShopInfo record);

View File

@@ -18,8 +18,18 @@ public class SysDict implements Serializable {
private Date updateTime;
private Integer isChild;
private static final long serialVersionUID = 1L;
public Integer getIsChild() {
return isChild;
}
public void setIsChild(Integer isChild) {
this.isChild = isChild;
}
public Long getDictId() {
return dictId;
}

View File

@@ -0,0 +1,411 @@
package com.chaozhanggui.system.cashierservice.entity;
import java.util.Date;
import java.io.Serializable;
/**
* 优惠券(TbMerchantCoupon)实体类
*
* @author lyf
* @since 2024-04-02 09:22:41
*/
public class TbMerchantCoupon implements Serializable {
private static final long serialVersionUID = 391103766508753856L;
/**
* 自增
*/
private Integer id;
/**
* 状态0-关闭 1 正常
*/
private Integer status;
/**
* 优惠券名称
*/
private String title;
private String templateId;
private String shopId;
private String shopSnap;
/**
* 开始时间
*/
private Date fromTime;
/**
* 到期时间
*/
private Date toTime;
/**
* 限领数量
*/
private String limitNumber;
/**
* 发放数量
*/
private Integer number;
/**
* 剩余数量
*/
private String leftNumber;
/**
* 优惠金额
*/
private Double amount;
/**
* 订单满赠金额
*/
private Double limitAmount;
/**
* 是否显示0-不显示 1显示
*/
private Integer isShow;
/**
* 图标
*/
private String pic;
/**
* 0-满减 1-折扣
*/
private Integer type;
/**
* 折扣 ,一位小数
*/
private Float ratio;
/**
* 最大折扣金额
*/
private Double maxRatioAmount;
/**
* 优惠券途径,首充|分销
*/
private String track;
/**
* 品类product 商品券 ---cateogry 品类券common -通 用券
*/
private String classType;
/**
* 有效期类型0-toTime有效 1-effectDays有效
*/
private Integer effectType;
/**
* 领取之日有效天数
*/
private Integer effectDays;
/**
* 关联商品Id
*/
private String relationIds;
private String relationList;
/**
* 发放人
*/
private String editor;
/**
* 说明
*/
private String note;
private Long createdAt;
private Long updatedAt;
/**
* 支持堂食
*/
private Integer furnishMeal;
/**
* 支持配送
*/
private Integer furnishExpress;
/**
* 支持自提
*/
private Integer furnishDraw;
/**
* 支持虚拟
*/
private Integer furnishVir;
private Integer disableDistribute;
/**
* 商户Id
*/
private String merchantId;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getTemplateId() {
return templateId;
}
public void setTemplateId(String templateId) {
this.templateId = templateId;
}
public String getShopId() {
return shopId;
}
public void setShopId(String shopId) {
this.shopId = shopId;
}
public String getShopSnap() {
return shopSnap;
}
public void setShopSnap(String shopSnap) {
this.shopSnap = shopSnap;
}
public Date getFromTime() {
return fromTime;
}
public void setFromTime(Date fromTime) {
this.fromTime = fromTime;
}
public Date getToTime() {
return toTime;
}
public void setToTime(Date toTime) {
this.toTime = toTime;
}
public String getLimitNumber() {
return limitNumber;
}
public void setLimitNumber(String limitNumber) {
this.limitNumber = limitNumber;
}
public Integer getNumber() {
return number;
}
public void setNumber(Integer number) {
this.number = number;
}
public String getLeftNumber() {
return leftNumber;
}
public void setLeftNumber(String leftNumber) {
this.leftNumber = leftNumber;
}
public Double getAmount() {
return amount;
}
public void setAmount(Double amount) {
this.amount = amount;
}
public Double getLimitAmount() {
return limitAmount;
}
public void setLimitAmount(Double limitAmount) {
this.limitAmount = limitAmount;
}
public Integer getIsShow() {
return isShow;
}
public void setIsShow(Integer isShow) {
this.isShow = isShow;
}
public String getPic() {
return pic;
}
public void setPic(String pic) {
this.pic = pic;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public Float getRatio() {
return ratio;
}
public void setRatio(Float ratio) {
this.ratio = ratio;
}
public Double getMaxRatioAmount() {
return maxRatioAmount;
}
public void setMaxRatioAmount(Double maxRatioAmount) {
this.maxRatioAmount = maxRatioAmount;
}
public String getTrack() {
return track;
}
public void setTrack(String track) {
this.track = track;
}
public String getClassType() {
return classType;
}
public void setClassType(String classType) {
this.classType = classType;
}
public Integer getEffectType() {
return effectType;
}
public void setEffectType(Integer effectType) {
this.effectType = effectType;
}
public Integer getEffectDays() {
return effectDays;
}
public void setEffectDays(Integer effectDays) {
this.effectDays = effectDays;
}
public String getRelationIds() {
return relationIds;
}
public void setRelationIds(String relationIds) {
this.relationIds = relationIds;
}
public String getRelationList() {
return relationList;
}
public void setRelationList(String relationList) {
this.relationList = relationList;
}
public String getEditor() {
return editor;
}
public void setEditor(String editor) {
this.editor = editor;
}
public String getNote() {
return note;
}
public void setNote(String note) {
this.note = note;
}
public Long getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Long createdAt) {
this.createdAt = createdAt;
}
public Long getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(Long updatedAt) {
this.updatedAt = updatedAt;
}
public Integer getFurnishMeal() {
return furnishMeal;
}
public void setFurnishMeal(Integer furnishMeal) {
this.furnishMeal = furnishMeal;
}
public Integer getFurnishExpress() {
return furnishExpress;
}
public void setFurnishExpress(Integer furnishExpress) {
this.furnishExpress = furnishExpress;
}
public Integer getFurnishDraw() {
return furnishDraw;
}
public void setFurnishDraw(Integer furnishDraw) {
this.furnishDraw = furnishDraw;
}
public Integer getFurnishVir() {
return furnishVir;
}
public void setFurnishVir(Integer furnishVir) {
this.furnishVir = furnishVir;
}
public Integer getDisableDistribute() {
return disableDistribute;
}
public void setDisableDistribute(Integer disableDistribute) {
this.disableDistribute = disableDistribute;
}
public String getMerchantId() {
return merchantId;
}
public void setMerchantId(String merchantId) {
this.merchantId = merchantId;
}
}

View File

@@ -91,6 +91,18 @@ public class TbShopInfo implements Serializable {
private String proxyId;
private String view;
/**
* 商家二维码
*/
private String shopQrcode;
public String getShopQrcode() {
return shopQrcode;
}
public void setShopQrcode(String shopQrcode) {
this.shopQrcode = shopQrcode;
}
private static final long serialVersionUID = 1L;

View File

@@ -18,7 +18,7 @@ public class HomeDto {
*/
private Integer orderBy;
/**
* 附近1KM 1 0
* 附近1KM 1选中 0未选中
*/
private Integer distance;

View File

@@ -0,0 +1,50 @@
package com.chaozhanggui.system.cashierservice.entity.vo;
import com.chaozhanggui.system.cashierservice.entity.SysDictDetail;
import java.util.List;
/**
* @author lyf
*/
public class DicDetailVO {
private String name;
private String description;
private List<SysDictDetail> detail;
private Integer isChild;
public Integer getIsChild() {
return isChild;
}
public void setIsChild(Integer isChild) {
this.isChild = isChild;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public List<SysDictDetail> getDetail() {
return detail;
}
public void setDetail(List<SysDictDetail> detail) {
this.detail = detail;
}
}

View File

@@ -1,5 +1,6 @@
package com.chaozhanggui.system.cashierservice.entity.vo;
import com.chaozhanggui.system.cashierservice.entity.SysDict;
import com.chaozhanggui.system.cashierservice.entity.TbPlatformDict;
import lombok.Data;
@@ -8,7 +9,7 @@ import java.util.List;
/**
* @author lyf
*/
@Data
public class HomeUpVO {
/**
* 轮播图
@@ -18,5 +19,56 @@ public class HomeUpVO {
* 金刚区
*/
List<TbPlatformDict> district;
/**
* 条件查询
*/
List<DicDetailVO> menu;
/**
* 今日上新
*/
TodayRankingVO todayList;
/**
* 销量飙升
*/
HotRankingVO salesList;
public TodayRankingVO getTodayList() {
return todayList;
}
public void setTodayList(TodayRankingVO todayList) {
this.todayList = todayList;
}
public HotRankingVO getSalesList() {
return salesList;
}
public void setSalesList(HotRankingVO salesList) {
this.salesList = salesList;
}
public List<TbPlatformDict> getCarousel() {
return carousel;
}
public void setCarousel(List<TbPlatformDict> carousel) {
this.carousel = carousel;
}
public List<TbPlatformDict> getDistrict() {
return district;
}
public void setDistrict(List<TbPlatformDict> district) {
this.district = district;
}
public List<DicDetailVO> getMenu() {
return menu;
}
public void setMenu(List<DicDetailVO> menu) {
this.menu = menu;
}
}

View File

@@ -10,10 +10,6 @@ public class HomeVO {
* 店铺名称
*/
private String shopName;
/**
* 距离
*/
private String distance;
/**
* 商品名称
*/
@@ -33,7 +29,7 @@ public class HomeVO {
/**
* 折扣
*/
private BigDecimal discount;
private Float discount;
/**
* 共省金额
*/
@@ -45,6 +41,52 @@ public class HomeVO {
private BigDecimal realSalesNumber;
private Integer productId;
/**
* 店铺标签
*/
private String shopTag;
/**
* 商品标签
*/
private String proTag;
/**
* 距离
*/
private String distances ="100";
private Integer id;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getDistances() {
return distances;
}
public void setDistances(String distances) {
this.distances = distances;
}
public String getShopTag() {
return shopTag;
}
public void setShopTag(String shopTag) {
this.shopTag = shopTag;
}
public String getProTag() {
return proTag;
}
public void setProTag(String proTag) {
this.proTag = proTag;
}
public Integer getProductId() {
return productId;
@@ -62,13 +104,6 @@ public class HomeVO {
this.shopName = shopName;
}
public String getDistance() {
return distance;
}
public void setDistance(String distance) {
this.distance = distance;
}
public String getProductName() {
return productName;
@@ -102,11 +137,11 @@ public class HomeVO {
this.salePrice = salePrice;
}
public BigDecimal getDiscount() {
public Float getDiscount() {
return discount;
}
public void setDiscount(BigDecimal discount) {
public void setDiscount(Float discount) {
this.discount = discount;
}

View File

@@ -0,0 +1,40 @@
package com.chaozhanggui.system.cashierservice.entity.vo;
import java.util.List;
/**
* @author lyf
*/
public class HotRankingVO {
/**
* 榜单名称
*/
private String name = "飙升热榜";
private String Date = "8点更新";
List<HomeVO> hotList;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDate() {
return Date;
}
public void setDate(String date) {
Date = date;
}
public List<HomeVO> getHotList() {
return hotList;
}
public void setHotList(List<HomeVO> hotList) {
this.hotList = hotList;
}
}

View File

@@ -17,6 +17,7 @@ public class OrderVo {
private String status;
private String tableName;
private String shopQrcode;
private List<TbOrderDetail> details;

View File

@@ -0,0 +1,40 @@
package com.chaozhanggui.system.cashierservice.entity.vo;
import java.util.List;
/**
* @author lyf
*/
public class TodayRankingVO {
/**
* 榜单名称
*/
private String name = "今日上新";
private String Date = "10点更新";
List<HomeVO> todayList;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDate() {
return Date;
}
public void setDate(String date) {
Date = date;
}
public List<HomeVO> getTodayList() {
return todayList;
}
public void setTodayList(List<HomeVO> todayList) {
this.todayList = todayList;
}
}

View File

@@ -1,16 +1,12 @@
package com.chaozhanggui.system.cashierservice.service;
import com.chaozhanggui.system.cashierservice.dao.TbPlatformDictMapper;
import com.chaozhanggui.system.cashierservice.dao.TbProductSkuMapper;
import com.chaozhanggui.system.cashierservice.dao.TbShopInfoMapper;
import com.chaozhanggui.system.cashierservice.entity.TbPlatformDict;
import com.chaozhanggui.system.cashierservice.entity.TbProductSku;
import com.chaozhanggui.system.cashierservice.dao.*;
import com.chaozhanggui.system.cashierservice.entity.*;
import com.chaozhanggui.system.cashierservice.entity.dto.HomeDto;
import com.chaozhanggui.system.cashierservice.entity.vo.HomeUpVO;
import com.chaozhanggui.system.cashierservice.entity.vo.HomeVO;
import com.chaozhanggui.system.cashierservice.entity.vo.UserDutyVo;
import com.chaozhanggui.system.cashierservice.entity.vo.*;
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
import com.chaozhanggui.system.cashierservice.sign.Result;
import com.chaozhanggui.system.cashierservice.util.Threads;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@@ -19,6 +15,8 @@ import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
/**
* @author lyf
@@ -32,52 +30,79 @@ public class HomePageService {
private TbProductSkuMapper productSkuMapper;
@Resource
private TbPlatformDictMapper platformDictMapper;
@Resource
private TbMerchantCouponMapper merchantCouponMapper;
@Resource
private TbProductMapper productMapper;
@Resource
private SysDictDetailMapper sysDictDetailMapper;
public Result homePage(HomeDto homeDto){
public Result homePage(HomeDto homeDto,String environmen) throws ExecutionException, InterruptedException {
int beginNo;
if(homeDto.getPage() <=0){
beginNo = 0;
}else{
beginNo = (homeDto.getPage() - 1) * homeDto.getSize();
}
List<HomeVO> homeVO = shopInfoMapper.selectShopInfo(beginNo,homeDto.getSize());
List<Integer> objects = new ArrayList<>();
for (HomeVO o :homeVO) {
objects.add(o.getProductId());
//优惠卷
List<TbMerchantCoupon> tbMerchantCoupons = merchantCouponMapper.queryAllByPage(beginNo, homeDto.getSize());
//统计shopId以及productId
List<String> shopIds = new ArrayList<>();
List<String> productIds = new ArrayList<>();
for (TbMerchantCoupon coupon : tbMerchantCoupons) {
shopIds.add(coupon.getShopId());
productIds.add(coupon.getRelationIds());
}
//原价现价
List<TbProductSku> tbProductSkus = productSkuMapper.selectDownSku(objects);
//销量
List<UserDutyVo> userDutyVos = shopInfoMapper.searchUserDutyDetail(objects);
//组装数据
for (HomeVO o :homeVO) {
for (TbProductSku sku :tbProductSkus) {
if (o.getProductId().toString().equals(sku.getProductId())){
o.setOriginPrice(sku.getOriginPrice() == null?BigDecimal.ZERO:sku.getOriginPrice());
o.setSalePrice(sku.getSalePrice() == null?BigDecimal.ZERO:sku.getSalePrice());
CompletableFuture<List<TbShopInfo>> shopInfo = CompletableFuture.supplyAsync(() ->
shopInfoMapper.selectByIds(shopIds));
CompletableFuture<List<TbProduct>> product = CompletableFuture.supplyAsync(() ->
productMapper.selectByIds((productIds)));
CompletableFuture<List<TbProductSku>> productSku = CompletableFuture.supplyAsync(() ->
productSkuMapper.selectSkus((productIds)));
CompletableFuture<List<TbPlatformDict>> dictPro = CompletableFuture.supplyAsync(() ->
platformDictMapper.queryAllByType("proTag",environmen));
CompletableFuture<List<TbPlatformDict>> dictShop = CompletableFuture.supplyAsync(() ->
platformDictMapper.queryAllByType("shopTag",environmen));
Threads.call(shopInfo,product,productSku,dictPro,dictShop);
boolean isFirstAdded = true;
//组装
List<HomeVO> homeVOList = new ArrayList<>();
for (TbMerchantCoupon o :tbMerchantCoupons) {
HomeVO homeVO = new HomeVO();
homeVO.setDiscount(o.getRatio());
if (isFirstAdded){
homeVO.setShopTag(dictShop.get().get(0).getName());
homeVO.setProTag(dictPro.get().get(0).getName());
isFirstAdded = false;
}
for (TbShopInfo tbShopInfo : shopInfo.get()) {
if (o.getShopId().equals(tbShopInfo.getId().toString())) {
homeVO.setShopName(tbShopInfo.getShopName());
homeVO.setImage(tbShopInfo.getLogo());
}
}
if (userDutyVos == null){
o.setRealSalesNumber(BigDecimal.ZERO);
}else {
for (UserDutyVo duty : userDutyVos) {
if (o.getProductId().equals(duty.getProductId())) {
o.setRealSalesNumber(duty.getNumber());
}else {
o.setRealSalesNumber(BigDecimal.ZERO);
}
for (TbProduct tbProduct :product.get()) {
if (o.getRelationIds().equals(tbProduct.getId().toString())) {
homeVO.setProductName(tbProduct.getName());
homeVO.setImage(tbProduct.getCoverImg());
homeVO.setId(tbProduct.getId());
}
}
//共省金额
o.setSave(o.getOriginPrice().subtract(o.getSalePrice()));
if (o.getOriginPrice().compareTo(BigDecimal.ZERO) == 0){
o.setDiscount(null);
}else {
o.setDiscount(o.getSalePrice().divide(o.getOriginPrice(), 2, RoundingMode.DOWN).multiply(new BigDecimal("10")));
for (TbProductSku tbProductSku :productSku.get()) {
if (o.getRelationIds().equals(tbProductSku.getProductId())) {
homeVO.setOriginPrice(tbProductSku.getSalePrice());
homeVO.setRealSalesNumber(tbProductSku.getRealSalesNumber() == null?BigDecimal.ZERO: new BigDecimal(tbProductSku.getRealSalesNumber()));
Float discount = homeVO.getDiscount();
BigDecimal discountDecimal = new BigDecimal(discount);
homeVO.setSalePrice(tbProductSku.getSalePrice().multiply((discountDecimal.multiply(new BigDecimal("0.1")))));
homeVO.setSave(homeVO.getOriginPrice().subtract(homeVO.getSalePrice()));
}
}
homeVOList.add(homeVO);
}
return Result.success(CodeEnum.SUCCESS,homeVO);
return Result.success(CodeEnum.SUCCESS,homeVOList);
}
public Result homePageUp(String environment){
@@ -88,6 +113,44 @@ public class HomePageService {
//金刚区
List<TbPlatformDict> districtList = platformDictMapper.queryAllByType("homeDistrict",environment);
homeUpVO.setDistrict(districtList);
//菜单
List<SysDict> sysDicts = sysDictDetailMapper.selectByAll();
List<DicDetailVO> dicDetailVO = new ArrayList<>();
for (SysDict sysDictsList : sysDicts) {
DicDetailVO dicDetailVOList = new DicDetailVO();
dicDetailVOList.setName(sysDictsList.getName());
dicDetailVOList.setDescription(sysDictsList.getDescription());
dicDetailVOList.setDetail(sysDictDetailMapper.selectByDictId(sysDictsList.getDictId()));
dicDetailVOList.setIsChild(sysDictsList.getIsChild());
dicDetailVO.add(dicDetailVOList);
}
homeUpVO.setMenu(dicDetailVO);
/**
* 销量榜
*/
List<HomeVO> homeVOs = productSkuMapper.selectSale();
for (HomeVO o : homeVOs) {
BigDecimal originPrice = o.getOriginPrice();
if (originPrice.compareTo(BigDecimal.ZERO)!= 0){
BigDecimal multiply = o.getSalePrice().divide(o.getOriginPrice(),2,RoundingMode.DOWN).multiply(BigDecimal.TEN);
o.setDiscount(multiply.floatValue());
}else {
o.setDiscount(null);
}
}
HotRankingVO hotRankingVO = new HotRankingVO();
hotRankingVO.setHotList(homeVOs);
homeUpVO.setSalesList(hotRankingVO);
/**
*每日榜
*/
List<HomeVO> homeVODay = productSkuMapper.selectDay();
TodayRankingVO todayRankingVO = new TodayRankingVO();
todayRankingVO.setTodayList(homeVODay);
homeUpVO.setTodayList(todayRankingVO);
return Result.success(CodeEnum.SUCCESS,homeUpVO);
}
}

View File

@@ -165,7 +165,8 @@ public class OrderService {
OrderVo orderVo = new OrderVo();
orderVo.setName(tbShopInfo.getShopName());
orderVo.setStatus(orderInfo.getStatus());
//TODO 增加商家二维码
orderVo.setShopQrcode(tbShopInfo.getShopQrcode());
orderVo.setDetails(details);
orderVo.setOrderNo(orderInfo.getOrderNo());
orderVo.setTime(orderInfo.getCreatedAt());

View File

@@ -0,0 +1,114 @@
package com.chaozhanggui.system.cashierservice.util;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.concurrent.*;
/**
* 线程相关工具类.
*
* @author ruoyi
*/
public class Threads
{
private static final Logger logger = LoggerFactory.getLogger(Threads.class);
/**
* sleep等待,单位为毫秒
*/
public static void sleep(long milliseconds)
{
try
{
Thread.sleep(milliseconds);
}
catch (InterruptedException e)
{
return;
}
}
/**
* 停止线程池
* 先使用shutdown, 停止接收新任务并尝试完成所有已存在任务.
* 如果超时, 则调用shutdownNow, 取消在workQueue中Pending的任务,并中断所有阻塞函数.
* 如果仍然超時,則強制退出.
* 另对在shutdown时线程本身被调用中断做了处理.
*/
public static void shutdownAndAwaitTermination(ExecutorService pool)
{
if (pool != null && !pool.isShutdown())
{
pool.shutdown();
try
{
if (!pool.awaitTermination(120, TimeUnit.SECONDS))
{
pool.shutdownNow();
if (!pool.awaitTermination(120, TimeUnit.SECONDS))
{
logger.info("Pool did not terminate");
}
}
}
catch (InterruptedException ie)
{
pool.shutdownNow();
Thread.currentThread().interrupt();
}
}
}
/**
* 打印线程异常信息
*/
public static void printException(Runnable r, Throwable t)
{
if (t == null && r instanceof Future<?>)
{
try
{
Future<?> future = (Future<?>) r;
if (future.isDone())
{
future.get();
}
}
catch (CancellationException ce)
{
t = ce;
}
catch (ExecutionException ee)
{
t = ee.getCause();
}
catch (InterruptedException ie)
{
Thread.currentThread().interrupt();
}
}
if (t != null)
{
logger.error(t.getMessage(), t);
}
}
/**
* 并行调用
* @param value
* @return
*/
public static <T> CompletableFuture<T> parallel(T value){
return CompletableFuture.supplyAsync(() ->
value);
}
/**
* 并行执行
* @param cfs
*/
public static void call(CompletableFuture<?>... cfs){
CompletableFuture.allOf(cfs);
}
}

View File

@@ -21,6 +21,20 @@
from sys_dict_detail
where detail_id = #{detailId,jdbcType=BIGINT}
</select>
<select id="selectByAll" resultType="com.chaozhanggui.system.cashierservice.entity.SysDict">
select * from sys_dict
</select>
<select id="selectByAllDetail" resultType="com.chaozhanggui.system.cashierservice.entity.SysDictDetail">
select * from sys_dict_detail
where dict_id IN
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</select>
<select id="selectByDictId" resultType="com.chaozhanggui.system.cashierservice.entity.SysDictDetail">
select * from sys_dict_detail
where dict_id = #{dictId}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from sys_dict_detail
where detail_id = #{detailId,jdbcType=BIGINT}

View File

@@ -0,0 +1,449 @@
<?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="com.chaozhanggui.system.cashierservice.dao.TbMerchantCouponMapper">
<resultMap type="com.chaozhanggui.system.cashierservice.entity.TbMerchantCoupon" id="TbMerchantCouponMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="status" column="status" jdbcType="INTEGER"/>
<result property="title" column="title" jdbcType="VARCHAR"/>
<result property="templateId" column="template_id" jdbcType="VARCHAR"/>
<result property="shopId" column="shop_id" jdbcType="VARCHAR"/>
<result property="shopSnap" column="shop_snap" jdbcType="VARCHAR"/>
<result property="fromTime" column="from_time" jdbcType="TIMESTAMP"/>
<result property="toTime" column="to_time" jdbcType="TIMESTAMP"/>
<result property="limitNumber" column="limit_number" jdbcType="VARCHAR"/>
<result property="number" column="number" jdbcType="INTEGER"/>
<result property="leftNumber" column="left_number" jdbcType="VARCHAR"/>
<result property="amount" column="amount" jdbcType="NUMERIC"/>
<result property="limitAmount" column="limit_amount" jdbcType="NUMERIC"/>
<result property="isShow" column="is_show" jdbcType="INTEGER"/>
<result property="pic" column="pic" jdbcType="VARCHAR"/>
<result property="type" column="type" jdbcType="INTEGER"/>
<result property="ratio" column="ratio" jdbcType="NUMERIC"/>
<result property="maxRatioAmount" column="max_ratio_amount" jdbcType="NUMERIC"/>
<result property="track" column="track" jdbcType="VARCHAR"/>
<result property="classType" column="class_type" jdbcType="VARCHAR"/>
<result property="effectType" column="effect_type" jdbcType="INTEGER"/>
<result property="effectDays" column="effect_days" jdbcType="INTEGER"/>
<result property="relationIds" column="relation_ids" jdbcType="VARCHAR"/>
<result property="relationList" column="relation_list" jdbcType="VARCHAR"/>
<result property="editor" column="editor" jdbcType="VARCHAR"/>
<result property="note" column="note" jdbcType="VARCHAR"/>
<result property="createdAt" column="created_at" jdbcType="INTEGER"/>
<result property="updatedAt" column="updated_at" jdbcType="INTEGER"/>
<result property="furnishMeal" column="furnish_meal" jdbcType="INTEGER"/>
<result property="furnishExpress" column="furnish_express" jdbcType="INTEGER"/>
<result property="furnishDraw" column="furnish_draw" jdbcType="INTEGER"/>
<result property="furnishVir" column="furnish_vir" jdbcType="INTEGER"/>
<result property="disableDistribute" column="disable_distribute" jdbcType="INTEGER"/>
<result property="merchantId" column="merchant_id" jdbcType="VARCHAR"/>
</resultMap>
<!--查询单个-->
<select id="queryById" resultMap="TbMerchantCouponMap">
select
id, status, title, template_id, shop_id, shop_snap, from_time, to_time, limit_number, number, left_number, amount, limit_amount, is_show, pic, type, ratio, max_ratio_amount, track, class_type, effect_type, effect_days, relation_ids, relation_list, editor, note, created_at, updated_at, furnish_meal, furnish_express, furnish_draw, furnish_vir, disable_distribute, merchant_id
from tb_merchant_coupon
where id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="TbMerchantCouponMap">
select
id, status, title, template_id, shop_id, shop_snap, from_time, to_time, limit_number, number, left_number, amount, limit_amount, is_show, pic, type, ratio, max_ratio_amount, track, class_type, effect_type, effect_days, relation_ids, relation_list, editor, note, created_at, updated_at, furnish_meal, furnish_express, furnish_draw, furnish_vir, disable_distribute, merchant_id
from tb_merchant_coupon
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="status != null">
and status = #{status}
</if>
<if test="title != null and title != ''">
and title = #{title}
</if>
<if test="templateId != null and templateId != ''">
and template_id = #{templateId}
</if>
<if test="shopId != null and shopId != ''">
and shop_id = #{shopId}
</if>
<if test="shopSnap != null and shopSnap != ''">
and shop_snap = #{shopSnap}
</if>
<if test="fromTime != null">
and from_time = #{fromTime}
</if>
<if test="toTime != null">
and to_time = #{toTime}
</if>
<if test="limitNumber != null and limitNumber != ''">
and limit_number = #{limitNumber}
</if>
<if test="number != null">
and number = #{number}
</if>
<if test="leftNumber != null and leftNumber != ''">
and left_number = #{leftNumber}
</if>
<if test="amount != null">
and amount = #{amount}
</if>
<if test="limitAmount != null">
and limit_amount = #{limitAmount}
</if>
<if test="isShow != null">
and is_show = #{isShow}
</if>
<if test="pic != null and pic != ''">
and pic = #{pic}
</if>
<if test="type != null">
and type = #{type}
</if>
<if test="ratio != null">
and ratio = #{ratio}
</if>
<if test="maxRatioAmount != null">
and max_ratio_amount = #{maxRatioAmount}
</if>
<if test="track != null and track != ''">
and track = #{track}
</if>
<if test="classType != null and classType != ''">
and class_type = #{classType}
</if>
<if test="effectType != null">
and effect_type = #{effectType}
</if>
<if test="effectDays != null">
and effect_days = #{effectDays}
</if>
<if test="relationIds != null and relationIds != ''">
and relation_ids = #{relationIds}
</if>
<if test="relationList != null and relationList != ''">
and relation_list = #{relationList}
</if>
<if test="editor != null and editor != ''">
and editor = #{editor}
</if>
<if test="note != null and note != ''">
and note = #{note}
</if>
<if test="createdAt != null">
and created_at = #{createdAt}
</if>
<if test="updatedAt != null">
and updated_at = #{updatedAt}
</if>
<if test="furnishMeal != null">
and furnish_meal = #{furnishMeal}
</if>
<if test="furnishExpress != null">
and furnish_express = #{furnishExpress}
</if>
<if test="furnishDraw != null">
and furnish_draw = #{furnishDraw}
</if>
<if test="furnishVir != null">
and furnish_vir = #{furnishVir}
</if>
<if test="disableDistribute != null">
and disable_distribute = #{disableDistribute}
</if>
<if test="merchantId != null and merchantId != ''">
and merchant_id = #{merchantId}
</if>
</where>
limit #{pageable.offset}, #{pageable.pageSize}
</select>
<!--统计总行数-->
<select id="count" resultType="java.lang.Long">
select count(1)
from tb_merchant_coupon
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="status != null">
and status = #{status}
</if>
<if test="title != null and title != ''">
and title = #{title}
</if>
<if test="templateId != null and templateId != ''">
and template_id = #{templateId}
</if>
<if test="shopId != null and shopId != ''">
and shop_id = #{shopId}
</if>
<if test="shopSnap != null and shopSnap != ''">
and shop_snap = #{shopSnap}
</if>
<if test="fromTime != null">
and from_time = #{fromTime}
</if>
<if test="toTime != null">
and to_time = #{toTime}
</if>
<if test="limitNumber != null and limitNumber != ''">
and limit_number = #{limitNumber}
</if>
<if test="number != null">
and number = #{number}
</if>
<if test="leftNumber != null and leftNumber != ''">
and left_number = #{leftNumber}
</if>
<if test="amount != null">
and amount = #{amount}
</if>
<if test="limitAmount != null">
and limit_amount = #{limitAmount}
</if>
<if test="isShow != null">
and is_show = #{isShow}
</if>
<if test="pic != null and pic != ''">
and pic = #{pic}
</if>
<if test="type != null">
and type = #{type}
</if>
<if test="ratio != null">
and ratio = #{ratio}
</if>
<if test="maxRatioAmount != null">
and max_ratio_amount = #{maxRatioAmount}
</if>
<if test="track != null and track != ''">
and track = #{track}
</if>
<if test="classType != null and classType != ''">
and class_type = #{classType}
</if>
<if test="effectType != null">
and effect_type = #{effectType}
</if>
<if test="effectDays != null">
and effect_days = #{effectDays}
</if>
<if test="relationIds != null and relationIds != ''">
and relation_ids = #{relationIds}
</if>
<if test="relationList != null and relationList != ''">
and relation_list = #{relationList}
</if>
<if test="editor != null and editor != ''">
and editor = #{editor}
</if>
<if test="note != null and note != ''">
and note = #{note}
</if>
<if test="createdAt != null">
and created_at = #{createdAt}
</if>
<if test="updatedAt != null">
and updated_at = #{updatedAt}
</if>
<if test="furnishMeal != null">
and furnish_meal = #{furnishMeal}
</if>
<if test="furnishExpress != null">
and furnish_express = #{furnishExpress}
</if>
<if test="furnishDraw != null">
and furnish_draw = #{furnishDraw}
</if>
<if test="furnishVir != null">
and furnish_vir = #{furnishVir}
</if>
<if test="disableDistribute != null">
and disable_distribute = #{disableDistribute}
</if>
<if test="merchantId != null and merchantId != ''">
and merchant_id = #{merchantId}
</if>
</where>
</select>
<select id="queryAllByPage" resultType="com.chaozhanggui.system.cashierservice.entity.TbMerchantCoupon">
select
id, status, title, template_id, shop_id, shop_snap, from_time, to_time, limit_number, number, left_number, amount, limit_amount, is_show, pic, type, ratio, max_ratio_amount, track, class_type, effect_type, effect_days, relation_ids, relation_list, editor, note, created_at, updated_at, furnish_meal, furnish_express, furnish_draw, furnish_vir, disable_distribute, merchant_id
from tb_merchant_coupon
where class_type ='product'
AND ratio IS NOT NULL
limit #{page}, #{size}
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into tb_merchant_coupon(status, title, template_id, shop_id, shop_snap, from_time, to_time, limit_number, number, left_number, amount, limit_amount, is_show, pic, type, ratio, max_ratio_amount, track, class_type, effect_type, effect_days, relation_ids, relation_list, editor, note, created_at, updated_at, furnish_meal, furnish_express, furnish_draw, furnish_vir, disable_distribute, merchant_id)
values (#{status}, #{title}, #{templateId}, #{shopId}, #{shopSnap}, #{fromTime}, #{toTime}, #{limitNumber}, #{number}, #{leftNumber}, #{amount}, #{limitAmount}, #{isShow}, #{pic}, #{type}, #{ratio}, #{maxRatioAmount}, #{track}, #{classType}, #{effectType}, #{effectDays}, #{relationIds}, #{relationList}, #{editor}, #{note}, #{createdAt}, #{updatedAt}, #{furnishMeal}, #{furnishExpress}, #{furnishDraw}, #{furnishVir}, #{disableDistribute}, #{merchantId})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into tb_merchant_coupon(status, title, template_id, shop_id, shop_snap, from_time, to_time, limit_number, number, left_number, amount, limit_amount, is_show, pic, type, ratio, max_ratio_amount, track, class_type, effect_type, effect_days, relation_ids, relation_list, editor, note, created_at, updated_at, furnish_meal, furnish_express, furnish_draw, furnish_vir, disable_distribute, merchant_id)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.status}, #{entity.title}, #{entity.templateId}, #{entity.shopId}, #{entity.shopSnap}, #{entity.fromTime}, #{entity.toTime}, #{entity.limitNumber}, #{entity.number}, #{entity.leftNumber}, #{entity.amount}, #{entity.limitAmount}, #{entity.isShow}, #{entity.pic}, #{entity.type}, #{entity.ratio}, #{entity.maxRatioAmount}, #{entity.track}, #{entity.classType}, #{entity.effectType}, #{entity.effectDays}, #{entity.relationIds}, #{entity.relationList}, #{entity.editor}, #{entity.note}, #{entity.createdAt}, #{entity.updatedAt}, #{entity.furnishMeal}, #{entity.furnishExpress}, #{entity.furnishDraw}, #{entity.furnishVir}, #{entity.disableDistribute}, #{entity.merchantId})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into tb_merchant_coupon(status, title, template_id, shop_id, shop_snap, from_time, to_time, limit_number, number, left_number, amount, limit_amount, is_show, pic, type, ratio, max_ratio_amount, track, class_type, effect_type, effect_days, relation_ids, relation_list, editor, note, created_at, updated_at, furnish_meal, furnish_express, furnish_draw, furnish_vir, disable_distribute, merchant_id)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.status}, #{entity.title}, #{entity.templateId}, #{entity.shopId}, #{entity.shopSnap}, #{entity.fromTime}, #{entity.toTime}, #{entity.limitNumber}, #{entity.number}, #{entity.leftNumber}, #{entity.amount}, #{entity.limitAmount}, #{entity.isShow}, #{entity.pic}, #{entity.type}, #{entity.ratio}, #{entity.maxRatioAmount}, #{entity.track}, #{entity.classType}, #{entity.effectType}, #{entity.effectDays}, #{entity.relationIds}, #{entity.relationList}, #{entity.editor}, #{entity.note}, #{entity.createdAt}, #{entity.updatedAt}, #{entity.furnishMeal}, #{entity.furnishExpress}, #{entity.furnishDraw}, #{entity.furnishVir}, #{entity.disableDistribute}, #{entity.merchantId})
</foreach>
on duplicate key update
status = values(status),
title = values(title),
template_id = values(template_id),
shop_id = values(shop_id),
shop_snap = values(shop_snap),
from_time = values(from_time),
to_time = values(to_time),
limit_number = values(limit_number),
number = values(number),
left_number = values(left_number),
amount = values(amount),
limit_amount = values(limit_amount),
is_show = values(is_show),
pic = values(pic),
type = values(type),
ratio = values(ratio),
max_ratio_amount = values(max_ratio_amount),
track = values(track),
class_type = values(class_type),
effect_type = values(effect_type),
effect_days = values(effect_days),
relation_ids = values(relation_ids),
relation_list = values(relation_list),
editor = values(editor),
note = values(note),
created_at = values(created_at),
updated_at = values(updated_at),
furnish_meal = values(furnish_meal),
furnish_express = values(furnish_express),
furnish_draw = values(furnish_draw),
furnish_vir = values(furnish_vir),
disable_distribute = values(disable_distribute),
merchant_id = values(merchant_id)
</insert>
<!--通过主键修改数据-->
<update id="update">
update tb_merchant_coupon
<set>
<if test="status != null">
status = #{status},
</if>
<if test="title != null and title != ''">
title = #{title},
</if>
<if test="templateId != null and templateId != ''">
template_id = #{templateId},
</if>
<if test="shopId != null and shopId != ''">
shop_id = #{shopId},
</if>
<if test="shopSnap != null and shopSnap != ''">
shop_snap = #{shopSnap},
</if>
<if test="fromTime != null">
from_time = #{fromTime},
</if>
<if test="toTime != null">
to_time = #{toTime},
</if>
<if test="limitNumber != null and limitNumber != ''">
limit_number = #{limitNumber},
</if>
<if test="number != null">
number = #{number},
</if>
<if test="leftNumber != null and leftNumber != ''">
left_number = #{leftNumber},
</if>
<if test="amount != null">
amount = #{amount},
</if>
<if test="limitAmount != null">
limit_amount = #{limitAmount},
</if>
<if test="isShow != null">
is_show = #{isShow},
</if>
<if test="pic != null and pic != ''">
pic = #{pic},
</if>
<if test="type != null">
type = #{type},
</if>
<if test="ratio != null">
ratio = #{ratio},
</if>
<if test="maxRatioAmount != null">
max_ratio_amount = #{maxRatioAmount},
</if>
<if test="track != null and track != ''">
track = #{track},
</if>
<if test="classType != null and classType != ''">
class_type = #{classType},
</if>
<if test="effectType != null">
effect_type = #{effectType},
</if>
<if test="effectDays != null">
effect_days = #{effectDays},
</if>
<if test="relationIds != null and relationIds != ''">
relation_ids = #{relationIds},
</if>
<if test="relationList != null and relationList != ''">
relation_list = #{relationList},
</if>
<if test="editor != null and editor != ''">
editor = #{editor},
</if>
<if test="note != null and note != ''">
note = #{note},
</if>
<if test="createdAt != null">
created_at = #{createdAt},
</if>
<if test="updatedAt != null">
updated_at = #{updatedAt},
</if>
<if test="furnishMeal != null">
furnish_meal = #{furnishMeal},
</if>
<if test="furnishExpress != null">
furnish_express = #{furnishExpress},
</if>
<if test="furnishDraw != null">
furnish_draw = #{furnishDraw},
</if>
<if test="furnishVir != null">
furnish_vir = #{furnishVir},
</if>
<if test="disableDistribute != null">
disable_distribute = #{disableDistribute},
</if>
<if test="merchantId != null and merchantId != ''">
merchant_id = #{merchantId},
</if>
</set>
where id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete from tb_merchant_coupon where id = #{id}
</delete>
</mapper>

View File

@@ -143,12 +143,12 @@
<if test="type != null and type != ''">
type = #{type}
</if>
<if test="environment == app">
and is_show_mall = 1
</if>
<if test="environment == wx">
<if test="environment == 'app'">
and is_show_app = 1
</if>
<if test="environment == 'wx'">
and is_show_mall = 1
</if>
</where>
</select>

View File

@@ -886,7 +886,6 @@
select *
from tb_product
where id in (${ids}) and is_show_mall =1
</select>
<select id="selectById" resultType="com.chaozhanggui.system.cashierservice.entity.TbProduct">
select
@@ -926,4 +925,12 @@
t.shop_id,
t.product_id
</select>
<select id="selectByIds" resultType="com.chaozhanggui.system.cashierservice.entity.TbProduct">
select *
from tb_product
where id IN
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</select>
</mapper>

View File

@@ -368,6 +368,53 @@
GROUP BY
product_id
</select>
<select id="selectSkus" resultType="com.chaozhanggui.system.cashierservice.entity.TbProductSku">
SELECT
*
FROM
tb_product_sku
WHERE
product_id IN
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
GROUP BY
product_id
</select>
<select id="selectSale" resultType="com.chaozhanggui.system.cashierservice.entity.vo.HomeVO">
SELECT
pro.id as id,
pro.`name` as productName,
pro.cover_img as image,
sku.origin_price as originPrice,
sku.sale_price as salePrice,
MAX(sku.real_sales_number) AS realSalesNumber
FROM
tb_product_sku sku
LEFT JOIN tb_product pro ON sku.product_id = pro.id
GROUP BY
sku.product_id
ORDER BY
realSalesNumber DESC
LIMIT 2
</select>
<select id="selectDay" resultType="com.chaozhanggui.system.cashierservice.entity.vo.HomeVO">
SELECT
pro.id as id,
pro.`name` as productName,
pro.cover_img as image,
sku.origin_price as originPrice,
sku.sale_price as salePrice,
MAX(sku.real_sales_number) AS realSalesNumber
FROM
tb_product_sku sku
LEFT JOIN tb_product pro ON sku.product_id = pro.id
GROUP BY
sku.product_id
ORDER BY
sku.created_at DESC
LIMIT 2
</select>
</mapper>

View File

@@ -68,6 +68,9 @@
from tb_shop_info
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tb_shop_info
where id = #{id,jdbcType=INTEGER}
@@ -644,4 +647,15 @@
GROUP BY
product_id
</select>
<select id="selectByIds" resultType="com.chaozhanggui.system.cashierservice.entity.TbShopInfo">
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from tb_shop_info
where id IN
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</select>
</mapper>