Merge remote-tracking branch 'refs/remotes/origin/test' into dev
# Conflicts: # src/main/java/com/chaozhanggui/system/cashierservice/entity/TbCashierCart.java # src/main/java/com/chaozhanggui/system/cashierservice/entity/TbOrderDetail.java
This commit is contained in:
@@ -19,6 +19,23 @@ public interface TableConstant {
|
||||
}
|
||||
}
|
||||
|
||||
class Product {
|
||||
@Getter
|
||||
public enum Type {
|
||||
NORMAL("normal"), PACKAGE("package");
|
||||
private final String value;
|
||||
|
||||
Type(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public boolean equalsVals(String value) {
|
||||
return this.value.equals(value);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class CashierCart {
|
||||
public static final String ID = "-999";
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ public interface TbProductMapper {
|
||||
|
||||
TbProduct selectById(Integer id);
|
||||
|
||||
List<TbProduct> selectByIdIn(@Param("ids") String ids);
|
||||
List<TbProduct> selectByIdInAndCheck(@Param("ids") String ids);
|
||||
List<TbProduct> selectHot(@Param("shopId") String shopId,@Param("list") Set<Integer> proIds);
|
||||
|
||||
|
||||
@@ -81,6 +81,9 @@ public class TbCashierCart implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String useCouponInfo;
|
||||
private String proGroupInfo;
|
||||
private String typeEnum;
|
||||
private Integer groupType;
|
||||
|
||||
public String getSkuName() {
|
||||
if(StringUtils.isNotBlank(skuName)){
|
||||
@@ -113,12 +116,4 @@ public class TbCashierCart implements Serializable {
|
||||
return BigDecimal.valueOf(num).multiply(salePrice);
|
||||
}
|
||||
}
|
||||
|
||||
public void setUseCouponInfo(String useCouponInfo) {
|
||||
this.useCouponInfo = useCouponInfo;
|
||||
}
|
||||
|
||||
public String getUseCouponInfo() {
|
||||
return useCouponInfo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,5 +51,7 @@ public class TbOrderDetail implements Serializable {
|
||||
private Integer isMember;
|
||||
private String useCouponInfo;
|
||||
private BigDecimal canReturnAmount;
|
||||
private String proGroupInfo;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,20 +1,23 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.ProductGroupVo;
|
||||
import lombok.Data;
|
||||
import org.springframework.data.annotation.Transient;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalTime;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* (TbProduct)实体类
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-11-18 14:41:53
|
||||
* @since 2024-11-19 15:52:20
|
||||
*/
|
||||
@Data
|
||||
public class TbProduct implements Serializable {
|
||||
private static final long serialVersionUID = -40921077034892720L;
|
||||
private static final long serialVersionUID = 876918627328411456L;
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@@ -27,11 +30,6 @@ public class TbProduct implements Serializable {
|
||||
* 商品规格
|
||||
*/
|
||||
private Integer specId;
|
||||
/**
|
||||
* 商户Id
|
||||
*/
|
||||
private String merchantId;
|
||||
|
||||
private String shopId;
|
||||
/**
|
||||
* 商品名称
|
||||
@@ -42,7 +40,7 @@ public class TbProduct implements Serializable {
|
||||
*/
|
||||
private String shortTitle;
|
||||
/**
|
||||
* 商品类型(属性):普通商品 normal 套餐商品 package 称重商品 weigh 团购券商品 coupon
|
||||
* 普通商品 normal 套餐商品 package 称重商品 weigh 团购券 coupon
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
@@ -76,10 +74,6 @@ public class TbProduct implements Serializable {
|
||||
* 0--待审核 1审核通过 -1审核失败 -2违规下架
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 审核失败原因
|
||||
*/
|
||||
private String failMsg;
|
||||
/**
|
||||
* 是否热销
|
||||
*/
|
||||
@@ -108,6 +102,10 @@ public class TbProduct implements Serializable {
|
||||
private Long createdAt;
|
||||
|
||||
private Long updatedAt;
|
||||
/**
|
||||
* 0 固定套餐 1可选套餐
|
||||
*/
|
||||
private Integer groupType;
|
||||
/**
|
||||
* 套餐内容
|
||||
*/
|
||||
@@ -148,6 +146,42 @@ public class TbProduct implements Serializable {
|
||||
* 库存警戒线
|
||||
*/
|
||||
private Integer warnLine;
|
||||
/**
|
||||
* 堂食 table 自取 dine 配送 delivery 快递 express
|
||||
*/
|
||||
private String showType;
|
||||
/**
|
||||
* 称重 价格/千克
|
||||
*/
|
||||
private BigDecimal weight;
|
||||
/**
|
||||
* 是否允许临时改价
|
||||
*/
|
||||
private Integer isTempPrice;
|
||||
/**
|
||||
* 日销售上限
|
||||
*/
|
||||
private Integer dayLimit;
|
||||
/**
|
||||
* 每单销售上限
|
||||
*/
|
||||
private Integer singleOrderLimit;
|
||||
/**
|
||||
* 每人销售上限
|
||||
*/
|
||||
private Integer singlePeopleLimit;
|
||||
/**
|
||||
* 周 数组 周一,周二,周日
|
||||
*/
|
||||
private String days;
|
||||
/**
|
||||
* 可用开始时间
|
||||
*/
|
||||
private LocalTime startTime;
|
||||
/**
|
||||
* 可用结束时间
|
||||
*/
|
||||
private LocalTime endTime;
|
||||
|
||||
private String cartNumber="0";
|
||||
|
||||
@@ -158,7 +192,6 @@ public class TbProduct implements Serializable {
|
||||
|
||||
@Transient
|
||||
private TbProductSkuResult productSkuResult;
|
||||
|
||||
|
||||
private List<ProductGroupVo> proGroupVo;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class ProductGroupVo {
|
||||
|
||||
private Integer count;
|
||||
//选几个
|
||||
private Integer number;
|
||||
//类别
|
||||
private String title;
|
||||
|
||||
//食物
|
||||
private List<Food> goods=new ArrayList<>();
|
||||
|
||||
@Data
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public static class Food {
|
||||
private Integer proId;
|
||||
private String proName;
|
||||
private Integer skuId;
|
||||
private String skuName;
|
||||
private BigDecimal price;
|
||||
private String number;
|
||||
private String unitName;
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@ import com.chaozhanggui.system.cashierservice.entity.Enum.PlatformTypeEnum;
|
||||
import com.chaozhanggui.system.cashierservice.entity.Enum.ShopWxMsgTypeEnum;
|
||||
import com.chaozhanggui.system.cashierservice.entity.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.ProductGroupVo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.TbUserCouponVo;
|
||||
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
||||
import com.chaozhanggui.system.cashierservice.mapper.MpCashierCartMapper;
|
||||
@@ -281,6 +282,90 @@ public class CartService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置购物车套餐商品信息
|
||||
*/
|
||||
private void resetGroupProductCart(List<Integer> productIds, TbCashierCart cashierCart) {
|
||||
if (StrUtil.isBlank(cashierCart.getProductId())) {
|
||||
return;
|
||||
}
|
||||
|
||||
TbProduct product = productMapper.selectById(Integer.valueOf(cashierCart.getProductId()));
|
||||
|
||||
resetCartInfo(productIds, product, cashierCart);
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置购物车套餐商品信息
|
||||
*/
|
||||
private void resetGroupProductCart(List<Integer> productIds, TbProduct product, TbCashierCart cashierCart) {
|
||||
if (StrUtil.isBlank(cashierCart.getProductId())) {
|
||||
return;
|
||||
}
|
||||
resetCartInfo(productIds, product, cashierCart);
|
||||
}
|
||||
|
||||
private void resetCartInfo(List<Integer> productIds, TbProduct product, TbCashierCart cashierCart) {
|
||||
boolean isChoseGroup = TableConstant.Product.Type.PACKAGE.equalsVals(product.getType()) && product.getGroupType() == 1;
|
||||
boolean isFixGroup = TableConstant.Product.Type.PACKAGE.equalsVals(product.getType()) && product.getGroupType() == 0;
|
||||
if (isChoseGroup && productIds != null && !productIds.isEmpty()) {
|
||||
String groupSnap = product.getGroupSnap();
|
||||
if (StrUtil.isNotBlank(groupSnap)) {
|
||||
ArrayList<ProductGroupVo.Food> foods = new ArrayList<>();
|
||||
HashMap<String, ProductGroupVo.Food> groupVoHashMap = new HashMap<>();
|
||||
JSONObject.parseArray(groupSnap).forEach(item -> {
|
||||
ProductGroupVo productGroupVo = ((JSONObject) item).toJavaObject(ProductGroupVo.class);
|
||||
productGroupVo.getGoods().forEach(goods -> {
|
||||
groupVoHashMap.put(goods.getProId().toString(), goods);
|
||||
});
|
||||
});
|
||||
|
||||
productIds.forEach(item -> {
|
||||
ProductGroupVo.Food food = groupVoHashMap.get(item.toString());
|
||||
if (food == null) {
|
||||
throw new MsgException("存在无效套餐商品");
|
||||
}
|
||||
foods.add(food);
|
||||
});
|
||||
|
||||
cashierCart.setProGroupInfo(JSONObject.toJSONString(foods));
|
||||
}
|
||||
}else if (isFixGroup) {
|
||||
String groupSnap = product.getGroupSnap();
|
||||
if (StrUtil.isNotBlank(groupSnap)) {
|
||||
ArrayList<ProductGroupVo.Food> foods = new ArrayList<>();
|
||||
HashMap<String, ProductGroupVo.Food> groupVoHashMap = new HashMap<>();
|
||||
JSONObject.parseArray(groupSnap).forEach(item -> {
|
||||
ProductGroupVo productGroupVo = ((JSONObject) item).toJavaObject(ProductGroupVo.class);
|
||||
productGroupVo.getGoods().forEach(goods -> {
|
||||
groupVoHashMap.put(goods.getProId().toString(), goods);
|
||||
});
|
||||
});
|
||||
|
||||
cashierCart.setProGroupInfo(JSONObject.toJSONString(groupVoHashMap.values()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private TbCashierCart getCartByCache(String shopId, String tableId, String userId, String skuId) {
|
||||
String tableCartKey = RedisCst.getTableCartKey(shopId, tableId, userId);
|
||||
if (!redisUtil.exists(tableCartKey)) {
|
||||
return null;
|
||||
}
|
||||
JSONArray array = JSON.parseArray(redisUtil.getMessage(tableCartKey));
|
||||
for (int i = 0; i < array.size(); i++) {
|
||||
JSONObject object = array.getJSONObject(i);
|
||||
TbCashierCart cashierCart = JSONUtil.parseJSONStr2T(object.toJSONString(), TbCashierCart.class);
|
||||
cashierCart.setPlaceNum(cashierCart.getPlaceNum() == null ? 0 : cashierCart.getPlaceNum());
|
||||
|
||||
if (cashierCart.getSkuId().equals(skuId)) {
|
||||
return cashierCart;
|
||||
}
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 加入购物车
|
||||
*
|
||||
@@ -295,10 +380,14 @@ public class CartService {
|
||||
Integer type = jsonObject.getInteger("type");
|
||||
Integer buyNum = jsonObject.getInteger("num");
|
||||
Integer userId = jsonObject.getInteger("userId");
|
||||
List<Integer> groupProductIdList = null;
|
||||
if (jsonObject.containsKey("groupProductIdList")) {
|
||||
groupProductIdList = jsonObject.getJSONArray("groupProductIdList").toJavaList(Integer.class);
|
||||
}
|
||||
// 商品备注
|
||||
String note = jsonObject.getString("note");
|
||||
if (StringUtils.isBlank(shopId) || StringUtils.isBlank(productId)
|
||||
|| StringUtils.isBlank(skuId) || type == null || buyNum == null) {
|
||||
|| type == null || buyNum == null) {
|
||||
return Result.fail("参数缺失");
|
||||
}
|
||||
|
||||
@@ -316,7 +405,7 @@ public class CartService {
|
||||
return Result.fail("该商品不存在");
|
||||
}
|
||||
// 判断商品是否已下架
|
||||
tbProductSkuWithBLOBs = productSkuMapper.selectByPrimaryKey(Integer.valueOf(skuId));
|
||||
tbProductSkuWithBLOBs = StrUtil.isBlank(skuId) ? null: productSkuMapper.selectByPrimaryKey(Integer.valueOf(skuId));
|
||||
if (tbProductSkuWithBLOBs == null || tbProductSkuWithBLOBs.getIsGrounding().equals(0)) {
|
||||
rmCart(jsonObject, skuId, tableCartKey);
|
||||
return Result.fail("商品已下架");
|
||||
@@ -350,12 +439,13 @@ public class CartService {
|
||||
BigDecimal amount = BigDecimal.ZERO;
|
||||
BigDecimal memberAmount = BigDecimal.ZERO;
|
||||
try {
|
||||
// 存在缓存
|
||||
if (redisUtil.exists(tableCartKey)) {
|
||||
JSONArray array = JSON.parseArray(redisUtil.getMessage(tableCartKey));
|
||||
if (Objects.isNull(array) || array.isEmpty()) {
|
||||
if (type == 1) {
|
||||
TbCashierCart cashierCart = addCart(productId, skuId,
|
||||
jsonObject.getInteger("userId"), buyNum, tableId, shopId, note, shopEatTypeInfoDTO);
|
||||
jsonObject.getInteger("userId"), buyNum, tableId, shopId, note, shopEatTypeInfoDTO, groupProductIdList);
|
||||
jsonArray.add(cashierCart);
|
||||
cashierCart.setPlaceNum(cashierCart.getPlaceNum() == null ? 0 : cashierCart.getPlaceNum());
|
||||
cashierCartArrayList.add(cashierCart);
|
||||
@@ -374,7 +464,9 @@ public class CartService {
|
||||
TbCashierCart cashierCart = JSONUtil.parseJSONStr2T(object.toJSONString(), TbCashierCart.class);
|
||||
cashierCart.setPlaceNum(cashierCart.getPlaceNum() == null ? 0 : cashierCart.getPlaceNum());
|
||||
|
||||
if (cashierCart.getSkuId().equals(skuId)) {
|
||||
if (cashierCart.getSkuId().equals(skuId) && (cashierCart.getGroupType() == null || cashierCart.getGroupType() == 0)) {
|
||||
resetGroupProductCart(groupProductIdList, cashierCart);
|
||||
|
||||
cashierCart.setTotalNumber(buyNum);
|
||||
cashierCart.setNumber(buyNum);
|
||||
cashierCart.setNote(note);
|
||||
@@ -402,11 +494,7 @@ public class CartService {
|
||||
product.getPackFee().multiply(BigDecimal.valueOf(buyNum)) : BigDecimal.ZERO);
|
||||
|
||||
}
|
||||
// if (isVip != null && isVip == 1) {
|
||||
// cashierCart.setTotalAmount(BigDecimal.ZERO);
|
||||
// } else {
|
||||
cashierCart.resetTotalAmount();
|
||||
// }
|
||||
cashierCart.setUpdatedAt(Instant.now().toEpochMilli());
|
||||
mpCashierCartMapper.updateById(cashierCart);
|
||||
} else {
|
||||
@@ -421,15 +509,11 @@ public class CartService {
|
||||
BigDecimal mPrice = cashierCart.getIsMember() != null && cashierCart.getIsMember() == 1 &&
|
||||
cashierCart.getMemberPrice() != null && cashierCart.getMemberPrice().compareTo(BigDecimal.ZERO) > 0 ? cashierCart.getMemberPrice() : cashierCart.getSalePrice();
|
||||
memberAmount = memberAmount.add(mPrice.multiply(BigDecimal.valueOf(cashierCart.getTotalNumber())).add(cashierCart.getPackFee()));
|
||||
|
||||
if ("-999".equals(cashierCart.getProductId())) {
|
||||
hasSeat = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (flag && type == 1) {
|
||||
TbCashierCart cashierCart = addCart(productId, skuId,
|
||||
jsonObject.getInteger("userId"), buyNum, tableId, shopId, note, shopEatTypeInfoDTO);
|
||||
jsonObject.getInteger("userId"), buyNum, tableId, shopId, note, shopEatTypeInfoDTO, groupProductIdList);
|
||||
jsonArray.add(cashierCart);
|
||||
amount = amount.add(new BigDecimal(cashierCart.getTotalNumber()).multiply(cashierCart.getSalePrice().add(cashierCart.getPackFee())));
|
||||
BigDecimal mPrice = cashierCart.getIsMember() != null && cashierCart.getIsMember() == 1 &&
|
||||
@@ -439,10 +523,12 @@ public class CartService {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 不存在缓存
|
||||
} else {
|
||||
if (type == 1) {
|
||||
TbCashierCart cashierCart = addCart(productId, skuId,
|
||||
jsonObject.getInteger("userId"), buyNum, tableId, shopId, note, shopEatTypeInfoDTO);
|
||||
jsonObject.getInteger("userId"), buyNum, tableId, shopId, note, shopEatTypeInfoDTO, groupProductIdList);
|
||||
if (!TableConstant.CART_SEAT_ID.equals(productId)) {
|
||||
jsonArray.add(cashierCart);
|
||||
}
|
||||
@@ -577,7 +663,7 @@ public class CartService {
|
||||
}
|
||||
|
||||
private TbCashierCart addCart(String productId, String skuId, Integer userId, Integer num,
|
||||
String tableId, String shopId, String note, ShopEatTypeInfoDTO shopEatTypeInfoDTO) throws Exception {
|
||||
String tableId, String shopId, String note, ShopEatTypeInfoDTO shopEatTypeInfoDTO, List<Integer> groupProductIds) throws Exception {
|
||||
try {
|
||||
// 查询用户信息
|
||||
TbShopUser shopUser = shopUserMapper.selectByUserIdAndShopId(String.valueOf(userId), shopId);
|
||||
@@ -612,6 +698,8 @@ public class CartService {
|
||||
cashierCart.setNumber(num);
|
||||
cashierCart.setTotalNumber(num);
|
||||
}
|
||||
cashierCart.setTypeEnum(product.getTypeEnum());
|
||||
cashierCart.setGroupType(product.getGroupType());
|
||||
cashierCart.setNote(note);
|
||||
cashierCart.setProductId(productId);
|
||||
cashierCart.setSkuId(skuId);
|
||||
@@ -643,6 +731,7 @@ public class CartService {
|
||||
cashierCart.setIsVip((byte) 0);
|
||||
cashierCart.resetTotalAmount();
|
||||
cashierCart.setPlatformType(PlatformTypeEnum.MINI_APP.getValue());
|
||||
resetGroupProductCart(groupProductIds, product, cashierCart);
|
||||
mpCashierCartMapper.insert(cashierCart);
|
||||
|
||||
//修改耗材数据
|
||||
@@ -1115,6 +1204,7 @@ public class CartService {
|
||||
orderDetail.setProductSkuName(productSku.getSpecSnap());
|
||||
}
|
||||
|
||||
orderDetail.setProGroupInfo(cashierCart.getProGroupInfo());
|
||||
orderDetail.setMemberPrice(cashierCart.getMemberPrice());
|
||||
orderDetail.setNote(cashierCart.getNote());
|
||||
orderDetail.setCreateTime(DateUtil.date().toTimestamp());
|
||||
@@ -1670,7 +1760,7 @@ public class CartService {
|
||||
public List<TbCashierCart> choseEatModel(ChoseEatModelDTO choseEatModelDTO) {
|
||||
List<TbCashierCart> cashierCartList;
|
||||
ShopEatTypeInfoDTO shopEatTypeInfoDTO = shopUtils.checkEatModel(choseEatModelDTO.getTableId(), choseEatModelDTO.getShopId());
|
||||
// 外带模式
|
||||
// 切换外带模式
|
||||
if (choseEatModelDTO.getType() == 1) {
|
||||
cashierCartList = cashierCartService.selectByShopEatTypeInfo(shopEatTypeInfoDTO, choseEatModelDTO.getUserId());
|
||||
cashierCartList = cashierCartList.stream().filter(item -> !TableConstant.CART_SEAT_ID.equals(item.getProductId())).collect(Collectors.toList());
|
||||
|
||||
@@ -477,6 +477,9 @@ public class ProductService {
|
||||
boolean isMemberPrice = shopInfo.getIsMemberPrice() != null && shopInfo.getIsMemberPrice() == 1;
|
||||
if (!CollectionUtils.isEmpty(products)) {
|
||||
products.parallelStream().forEach(it -> {
|
||||
if("package".equals(it.getType())){
|
||||
it.setProGroupVo(JSONUtil.parseListTNewList(it.getGroupSnap(), ProductGroupVo.class));
|
||||
}
|
||||
TbShopUnit tbShopUnit = unitMapper.selectByPrimaryKey(Integer.valueOf(it.getUnitId()));
|
||||
it.setUnitSnap(tbShopUnit != null ? tbShopUnit.getName() : "");
|
||||
if(check){
|
||||
|
||||
@@ -6,20 +6,17 @@
|
||||
<result property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="categoryId" column="category_id" jdbcType="VARCHAR"/>
|
||||
<result property="specId" column="spec_id" jdbcType="INTEGER"/>
|
||||
<result property="merchantId" column="merchant_id" jdbcType="VARCHAR"/>
|
||||
<result property="shopId" column="shop_id" jdbcType="VARCHAR"/>
|
||||
<result property="name" column="name" jdbcType="VARCHAR"/>
|
||||
<result property="shortTitle" column="short_title" jdbcType="VARCHAR"/>
|
||||
<result property="type" column="type" jdbcType="VARCHAR"/>
|
||||
<result property="packFee" column="pack_fee" jdbcType="DECIMAL"/>
|
||||
<result property="lowPrice" column="low_price" jdbcType="DECIMAL"/>
|
||||
<result property="lowMemberPrice" column="low_member_price" jdbcType="DECIMAL"/>
|
||||
<result property="packFee" column="pack_fee" jdbcType="NUMERIC"/>
|
||||
<result property="lowPrice" column="low_price" jdbcType="NUMERIC"/>
|
||||
<result property="unitId" column="unit_id" jdbcType="INTEGER"/>
|
||||
<result property="coverImg" column="cover_img" jdbcType="VARCHAR"/>
|
||||
<result property="images" column="images" jdbcType="VARCHAR"/>
|
||||
<result property="sort" column="sort" jdbcType="INTEGER"/>
|
||||
<result property="status" column="status" jdbcType="INTEGER"/>
|
||||
<result property="failMsg" column="fail_msg" jdbcType="VARCHAR"/>
|
||||
<result property="isHot" column="is_hot" jdbcType="INTEGER"/>
|
||||
<result property="typeEnum" column="type_enum" jdbcType="VARCHAR"/>
|
||||
<result property="isDel" column="is_del" jdbcType="INTEGER"/>
|
||||
@@ -27,6 +24,10 @@
|
||||
<result property="isPauseSale" column="is_pause_sale" jdbcType="INTEGER"/>
|
||||
<result property="createdAt" column="created_at" jdbcType="INTEGER"/>
|
||||
<result property="updatedAt" column="updated_at" jdbcType="INTEGER"/>
|
||||
<result property="groupType" column="group_type" jdbcType="INTEGER"/>
|
||||
<result property="groupSnap" column="group_snap" jdbcType="VARCHAR"/>
|
||||
<result property="specInfo" column="spec_info" jdbcType="VARCHAR"/>
|
||||
<result property="selectSpec" column="select_spec" jdbcType="VARCHAR"/>
|
||||
<result property="specTableHeaders" column="spec_table_headers" jdbcType="VARCHAR"/>
|
||||
<result property="groupCategoryId" column="group_category_id" jdbcType="VARCHAR"/>
|
||||
<result property="realSalesNumber" column="real_sales_number" jdbcType="INTEGER"/>
|
||||
@@ -34,14 +35,26 @@
|
||||
<result property="isGrounding" column="is_grounding" jdbcType="INTEGER"/>
|
||||
<result property="isRefundStock" column="is_refund_stock" jdbcType="INTEGER"/>
|
||||
<result property="warnLine" column="warn_line" jdbcType="INTEGER"/>
|
||||
<result property="showType" column="show_type" jdbcType="VARCHAR"/>
|
||||
<result property="weight" column="weight" jdbcType="NUMERIC"/>
|
||||
<result property="isTempPrice" column="is_temp_price" jdbcType="INTEGER"/>
|
||||
<result property="dayLimit" column="day_limit" jdbcType="INTEGER"/>
|
||||
<result property="singleOrderLimit" column="single_order_limit" jdbcType="INTEGER"/>
|
||||
<result property="singlePeopleLimit" column="single_people_limit" jdbcType="INTEGER"/>
|
||||
<result property="days" column="days" jdbcType="VARCHAR"/>
|
||||
<result property="startTime" column="start_time" jdbcType="VARCHAR"/>
|
||||
<result property="endTime" column="end_time" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id
|
||||
, category_id, spec_id, merchant_id, shop_id, name, short_title, type, pack_fee, low_price, low_member_price,
|
||||
unit_id, cover_img, images, sort, status, fail_msg, is_hot, type_enum, is_del, is_stock, is_pause_sale,
|
||||
created_at, updated_at, group_snap, spec_info, select_spec,
|
||||
spec_table_headers, group_category_id, real_sales_number, stock_number, is_grounding, is_refund_stock, warn_line </sql>
|
||||
, category_id, spec_id, shop_id, name, short_title, type, pack_fee,
|
||||
low_price, unit_id, cover_img, images, sort, status, fail_msg, is_hot, type_enum,
|
||||
is_del, is_stock, is_pause_sale, created_at, updated_at, group_type, group_snap,
|
||||
spec_info, select_spec, spec_table_headers, group_category_id, real_sales_number,
|
||||
stock_number, is_grounding, is_refund_stock, warn_line, show_type, weight, is_temp_price,
|
||||
day_limit, single_order_limit, single_people_limit, days, start_time, end_time </sql>
|
||||
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
@@ -49,23 +62,14 @@
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</select>
|
||||
|
||||
<select id="selectByIdIn" resultMap="BaseResultMap">
|
||||
select min(sku.suit) as suit, tb.*
|
||||
from tb_product tb
|
||||
LEFT JOIN tb_product_sku sku ON tb.id = sku.product_id
|
||||
where tb.id in (${ids})
|
||||
and sku.is_del = 0
|
||||
group by tb.id
|
||||
order by tb.sort asc
|
||||
</select>
|
||||
|
||||
<select id="selectByIdInAndCheck" resultMap="BaseResultMap">
|
||||
select min(sku.suit) as suit, tb.*, sum(sku.real_sales_number) as stockNumber
|
||||
from tb_product tb
|
||||
LEFT JOIN tb_product_sku sku ON tb.id = sku.product_id and sku.is_del = 0
|
||||
where tb.id in (${ids})
|
||||
and tb.is_grounding = 1
|
||||
and tb.type_enum!='group' and tb.status = 1
|
||||
and tb.is_grounding = 1 and tb.type!='coupon' and tb.type != 'weigh' and tb.status = 1 and tb.is_del = 0
|
||||
and tb.days LIKE concat('%',DAYNAME(CURRENT_DATE),'%') and tb.start_time <= CURRENT_TIMESTAMP and tb.end_time >= CURRENT_TIMESTAMP
|
||||
group by tb.id
|
||||
order by tb.sort asc
|
||||
</select>
|
||||
@@ -76,9 +80,8 @@
|
||||
LEFT JOIN tb_product_sku sku ON tb.id = sku.product_id
|
||||
JOIN (SELECT product_id ,SUM(real_sales_number) as realSalesNumber
|
||||
FROM tb_product_sku
|
||||
WHERE shop_id = #{shopId}
|
||||
and is_del = 0
|
||||
AND product_id IN
|
||||
WHERE
|
||||
shop_id = #{shopId} and is_del = 0 AND product_id IN
|
||||
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
@@ -86,7 +89,8 @@
|
||||
ORDER BY realSalesNumber DESC LIMIT 3) AS top_products ON tb.id = top_products.product_id
|
||||
where
|
||||
tb.status = 1
|
||||
and tb.type_enum != 'group'
|
||||
and tb.type != 'coupon' and tb.is_del = 0
|
||||
and tb.days LIKE concat('%',DAYNAME(CURRENT_DATE),'%') and tb.start_time <= CURRENT_TIMESTAMP and tb.end_time >= CURRENT_TIMESTAMP
|
||||
and tb.is_grounding = 1
|
||||
group by tb.id
|
||||
order by stockNumber desc
|
||||
@@ -101,17 +105,12 @@
|
||||
and tb.shop_id = #{shopId}
|
||||
and tb.status = 1
|
||||
and tb.is_grounding = 1
|
||||
and tb.type_enum != 'group'
|
||||
and tb.type != 'coupon' and tb.type != 'weigh' and tb.is_del = 0
|
||||
and tb.days LIKE concat('%',DAYNAME(CURRENT_DATE),'%') and tb.start_time <= CURRENT_TIMESTAMP and tb.end_time >= CURRENT_TIMESTAMP
|
||||
group by tb.id
|
||||
order by tb.sort asc
|
||||
</select>
|
||||
|
||||
|
||||
<!-- <select id="selectByIdIn" resultMap="BaseResultMap">-->
|
||||
<!-- select *-->
|
||||
<!-- from tb_product-->
|
||||
<!-- where id in (${ids}) and is_show_mall =1 order by sort asc-->
|
||||
<!-- </select>-->
|
||||
<select id="selectById" resultType="com.chaozhanggui.system.cashierservice.entity.TbProduct">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
@@ -183,8 +182,7 @@
|
||||
LEFT JOIN tb_shop_info AS info ON info.id = pro.shop_id
|
||||
<where>
|
||||
info.`status`='1'
|
||||
# AND pro.is_combo = '1'
|
||||
AND pro.type_enum = 'group'
|
||||
AND pro.type = 'coupon'
|
||||
AND (info.cities = #{cities} or info.districts = #{cities})
|
||||
<if test="proName != null and proName != ''">
|
||||
AND pro.`name` LIKE concat('%',#{proName,jdbcType=VARCHAR},'%')
|
||||
@@ -232,7 +230,7 @@
|
||||
LEFT JOIN tb_shop_info AS info ON info.id = `order`.shop_id
|
||||
<where>
|
||||
info.`status`='1'
|
||||
AND pro.type_enum = 'group'
|
||||
AND pro.type = 'coupon'
|
||||
AND (info.cities = #{cities} or info.districts = #{cities})
|
||||
<if test="proName != null and proName != ''">
|
||||
AND pro.`name` LIKE concat('%',#{proName,jdbcType=VARCHAR},'%')
|
||||
|
||||
Reference in New Issue
Block a user