Merge branch 'refs/heads/stock-share' into dev
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/target/
|
||||
@@ -34,4 +34,6 @@ public interface TbProductMapper {
|
||||
|
||||
|
||||
void upGroupRealSalesNumber(@Param("id") String id,@Param("number") Integer number);
|
||||
}
|
||||
|
||||
void updateStockById(@Param("productId") String productId, @Param("num") Integer num);
|
||||
}
|
||||
|
||||
@@ -131,6 +131,8 @@ public class TbProduct implements Serializable {
|
||||
private String cartNumber="0";
|
||||
private String groupCategoryId;
|
||||
|
||||
private Integer stockNumber;
|
||||
|
||||
|
||||
public String getImages() {
|
||||
return images;
|
||||
@@ -650,4 +652,12 @@ public class TbProduct implements Serializable {
|
||||
public void setSpecTableHeaders(String specTableHeaders) {
|
||||
this.specTableHeaders = specTableHeaders == null ? null : specTableHeaders.trim();
|
||||
}
|
||||
}
|
||||
|
||||
public void setStockNumber(Integer stockNumber) {
|
||||
this.stockNumber = stockNumber;
|
||||
}
|
||||
|
||||
public Integer getStockNumber() {
|
||||
return this.stockNumber;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,6 +46,8 @@ public class TbProductSku implements Serializable {
|
||||
|
||||
private Long updatedAt;
|
||||
|
||||
private Integer isPauseSale = 0;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public Integer getId() {
|
||||
@@ -215,4 +217,12 @@ public class TbProductSku implements Serializable {
|
||||
public void setUpdatedAt(Long updatedAt) {
|
||||
this.updatedAt = updatedAt;
|
||||
}
|
||||
}
|
||||
|
||||
public Integer getIsPauseSale() {
|
||||
return isPauseSale;
|
||||
}
|
||||
|
||||
public void setIsPauseSale(Integer isPauseSale) {
|
||||
this.isPauseSale = isPauseSale;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,58 +94,102 @@ public class CartService {
|
||||
String tableId = jsonObject.getString("tableId");
|
||||
String shopId = jsonObject.getString("shopId");
|
||||
String productId = jsonObject.getString("productId");
|
||||
|
||||
String key = tableId + "-" + shopId;
|
||||
TbProduct tbProduct = productMapper.selectById(Integer.valueOf(productId));
|
||||
if (tbProduct == null) {
|
||||
JSONObject jsonObject1 = new JSONObject();
|
||||
jsonObject1.put("status", "fail");
|
||||
jsonObject1.put("msg", "该商品不存在");
|
||||
jsonObject1.put("data", new ArrayList<>());
|
||||
PushToAppChannelHandlerAdapter.getInstance().AppSendInfo(jsonObject1.toString(), key, jsonObject.getString("userId"), true);
|
||||
log.error("该商品不存在 productId:{}", productId);
|
||||
throw new MsgException("该商品不存在");
|
||||
}
|
||||
|
||||
String skuId = jsonObject.getString("skuId");
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
BigDecimal amount = BigDecimal.ZERO;
|
||||
boolean exist = redisUtil.exists(RedisCst.PRODUCT + shopId + ":" + jsonObject.getString("skuId"));
|
||||
if (!exist) {
|
||||
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = productSkuMapper.selectByPrimaryKey(Integer.valueOf(jsonObject.getString("skuId")));
|
||||
Double stock = tbProductSkuWithBLOBs.getStockNumber();
|
||||
redisUtil.saveMessage(RedisCst.PRODUCT + shopId + ":" + jsonObject.getString("skuId"), Math.round(stock) + "");
|
||||
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = productSkuMapper.selectByPrimaryKey(Integer.valueOf(skuId));
|
||||
|
||||
|
||||
if (Integer.valueOf(tbProduct.getIsPauseSale()).equals(1)) {
|
||||
JSONObject jsonObject1 = new JSONObject();
|
||||
jsonObject1.put("status", "fail");
|
||||
jsonObject1.put("msg", "该商品已售罄");
|
||||
jsonObject1.put("data", new ArrayList<>());
|
||||
PushToAppChannelHandlerAdapter.getInstance().AppSendInfo(jsonObject1.toString(), key, jsonObject.getString("userId"), true);
|
||||
log.error("该商品已售罄 productId:{}", productId);
|
||||
throw new MsgException("该商品已售罄");
|
||||
}
|
||||
String skuNum = redisUtil.getMessage(RedisCst.PRODUCT + shopId + ":" + jsonObject.getString("skuId"));
|
||||
TbProduct tbProduct = productMapper.selectById(Integer.valueOf(productId));
|
||||
|
||||
String skuNum;
|
||||
|
||||
// 1:共享库存 0:独立库存
|
||||
if (Integer.valueOf(tbProduct.getIsDistribute()).equals(1)) {
|
||||
boolean exist = redisUtil.exists(RedisCst.PRODUCT + shopId + ":product" + productId);
|
||||
if (!exist) {
|
||||
redisUtil.saveMessage(RedisCst.PRODUCT + shopId + ":product" + productId, tbProduct.getStockNumber() + "");
|
||||
}
|
||||
skuNum = redisUtil.getMessage(RedisCst.PRODUCT + shopId + ":product" + productId);
|
||||
} else {
|
||||
boolean exist = redisUtil.exists(RedisCst.PRODUCT + shopId + ":" + skuId);
|
||||
if (!exist) {
|
||||
Double stock = tbProductSkuWithBLOBs.getStockNumber();
|
||||
redisUtil.saveMessage(RedisCst.PRODUCT + shopId + ":" + skuId, Math.round(stock) + "");
|
||||
}
|
||||
skuNum = redisUtil.getMessage(RedisCst.PRODUCT + shopId + ":" + skuId);
|
||||
}
|
||||
|
||||
Integer buyNum = jsonObject.getInteger("num");
|
||||
if (tbProduct.getIsStock() == 1) {
|
||||
if (Integer.valueOf(skuNum) < 1 && jsonObject.getInteger("num") > 0) {
|
||||
boolean flag = false;
|
||||
|
||||
String id = skuId;
|
||||
if (Integer.valueOf(tbProduct.getIsDistribute()).equals(1)) {
|
||||
if (tbProduct.getStockNumber() < 1 && buyNum > 0) {
|
||||
flag = true;
|
||||
id = productId;
|
||||
}
|
||||
} else {
|
||||
if (tbProductSkuWithBLOBs.getIsPauseSale().equals(1)) {
|
||||
flag = true;
|
||||
} else if (Integer.valueOf(skuNum) < 1 && buyNum > 0) {
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
JSONObject jsonObject1 = new JSONObject();
|
||||
jsonObject1.put("status", "fail");
|
||||
jsonObject1.put("msg", "该商品库存已售罄");
|
||||
jsonObject1.put("data", new ArrayList<>());
|
||||
PushToAppChannelHandlerAdapter.getInstance().AppSendInfo(jsonObject1.toString(), key, jsonObject.getString("userId"), true);
|
||||
log.error("该商品库存已售罄 skuId:{}", jsonObject.getString("skuId"));
|
||||
log.error("该商品库存已售罄 skuId:{}", id);
|
||||
throw new MsgException("该商品库存已售罄");
|
||||
}
|
||||
}
|
||||
|
||||
if (redisUtil.exists(RedisCst.TABLE_CART.concat(jsonObject.getString("tableId").concat("-").concat(shopId)))) {
|
||||
JSONArray array = JSON.parseArray(redisUtil.getMessage(RedisCst.TABLE_CART.concat(jsonObject.getString("tableId").concat("-").concat(shopId))));
|
||||
if (Objects.isNull(array) || array.isEmpty() || array.size() < 1) {
|
||||
if (jsonObject.getInteger("num") > 0) {
|
||||
TbCashierCart cashierCart = addCart(jsonObject.getString("productId"), jsonObject.getString("skuId"),
|
||||
jsonObject.getInteger("userId"), jsonObject.getInteger("num"), tableId, jsonObject.getString("shopId"));
|
||||
if (Objects.isNull(array) || array.isEmpty()) {
|
||||
if (buyNum > 0) {
|
||||
TbCashierCart cashierCart = addCart(jsonObject.getString("productId"), skuId,
|
||||
jsonObject.getInteger("userId"), buyNum, tableId, shopId);
|
||||
jsonArray.add(cashierCart);
|
||||
amount = amount.add(new BigDecimal(cashierCart.getNumber()).multiply(cashierCart.getSalePrice().add(cashierCart.getPackFee())));
|
||||
if (jsonObject.getInteger("num") > 0) {
|
||||
redisUtil.getIncrNum(RedisCst.PRODUCT + shopId + ":" + jsonObject.getString("skuId"), "1");
|
||||
} else {
|
||||
redisUtil.getIncrNum(RedisCst.PRODUCT + shopId + ":" + jsonObject.getString("skuId"), "2");
|
||||
}
|
||||
productSkuMapper.updateStockById(jsonObject.getString("skuId"), jsonObject.getInteger("num"));
|
||||
|
||||
updateProductStock(tbProduct, tbProductSkuWithBLOBs, buyNum);
|
||||
}
|
||||
} else {
|
||||
boolean flag = true;
|
||||
for (int i = 0; i < array.size(); i++) {
|
||||
JSONObject object = array.getJSONObject(i);
|
||||
TbCashierCart cashierCart = JSONUtil.parseJSONStr2T(object.toJSONString(), TbCashierCart.class);
|
||||
if (cashierCart.getSkuId().equals(jsonObject.getString("skuId"))) {
|
||||
cashierCart.setTotalNumber(cashierCart.getTotalNumber() + jsonObject.getInteger("num"));
|
||||
cashierCart.setNumber(cashierCart.getNumber() + jsonObject.getInteger("num"));
|
||||
if (jsonObject.getInteger("num") > 0) {
|
||||
redisUtil.getIncrNum(RedisCst.PRODUCT + shopId + ":" + jsonObject.getString("skuId"), "1");
|
||||
} else {
|
||||
redisUtil.getIncrNum(RedisCst.PRODUCT + shopId + ":" + jsonObject.getString("skuId"), "2");
|
||||
}
|
||||
productSkuMapper.updateStockById(jsonObject.getString("skuId"), jsonObject.getInteger("num"));
|
||||
if (cashierCart.getSkuId().equals(skuId)) {
|
||||
cashierCart.setTotalNumber(cashierCart.getTotalNumber() + buyNum);
|
||||
cashierCart.setNumber(cashierCart.getNumber() + buyNum);
|
||||
updateProductStock(tbProduct, tbProductSkuWithBLOBs, buyNum);
|
||||
if (cashierCart.getNumber() > 0) {
|
||||
cashierCart.setTotalAmount(new BigDecimal(cashierCart.getTotalNumber()).multiply(cashierCart.getSalePrice().add(cashierCart.getPackFee())));
|
||||
cashierCart.setUpdatedAt(Instant.now().toEpochMilli());
|
||||
@@ -159,27 +203,21 @@ public class CartService {
|
||||
jsonArray.add(cashierCart);
|
||||
amount = amount.add(new BigDecimal(cashierCart.getTotalNumber()).multiply(cashierCart.getSalePrice().add(cashierCart.getPackFee())));
|
||||
}
|
||||
if (flag && jsonObject.getInteger("num") > 0) {
|
||||
TbCashierCart cashierCart = addCart(jsonObject.getString("productId"), jsonObject.getString("skuId"),
|
||||
jsonObject.getInteger("userId"), jsonObject.getInteger("num"), tableId, jsonObject.getString("shopId"));
|
||||
if (flag && buyNum > 0) {
|
||||
TbCashierCart cashierCart = addCart(jsonObject.getString("productId"), skuId,
|
||||
jsonObject.getInteger("userId"), buyNum, tableId, jsonObject.getString("shopId"));
|
||||
jsonArray.add(cashierCart);
|
||||
amount = amount.add(new BigDecimal(cashierCart.getTotalNumber()).multiply(cashierCart.getSalePrice().add(cashierCart.getPackFee())));
|
||||
if (jsonObject.getInteger("num") > 0) {
|
||||
redisUtil.getIncrNum(RedisCst.PRODUCT + shopId + ":" + jsonObject.getString("skuId"), "1");
|
||||
} else {
|
||||
redisUtil.getIncrNum(RedisCst.PRODUCT + shopId + ":" + jsonObject.getString("skuId"), "2");
|
||||
}
|
||||
productSkuMapper.updateStockById(jsonObject.getString("skuId"), jsonObject.getInteger("num"));
|
||||
updateProductStock(tbProduct, tbProductSkuWithBLOBs, buyNum);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (jsonObject.getInteger("num") > 0) {
|
||||
TbCashierCart cashierCart = addCart(jsonObject.getString("productId"), jsonObject.getString("skuId"),
|
||||
jsonObject.getInteger("userId"), jsonObject.getInteger("num"), tableId, jsonObject.getString("shopId"));
|
||||
if (buyNum > 0) {
|
||||
TbCashierCart cashierCart = addCart(jsonObject.getString("productId"), skuId,
|
||||
jsonObject.getInteger("userId"), buyNum, tableId, jsonObject.getString("shopId"));
|
||||
jsonArray.add(cashierCart);
|
||||
amount = amount.add(new BigDecimal(cashierCart.getTotalNumber()).multiply(cashierCart.getSalePrice().add(cashierCart.getPackFee())));
|
||||
redisUtil.getIncrNum(RedisCst.PRODUCT + shopId + ":" + jsonObject.getString("skuId"), "1");
|
||||
productSkuMapper.updateStockById(jsonObject.getString("skuId"), jsonObject.getInteger("num"));
|
||||
updateProductStock(tbProduct, tbProductSkuWithBLOBs, buyNum);
|
||||
}
|
||||
}
|
||||
redisUtil.saveMessage(RedisCst.TABLE_CART.concat(tableId).concat("-").concat(shopId), jsonArray.toJSONString());
|
||||
@@ -195,6 +233,22 @@ public class CartService {
|
||||
}
|
||||
}
|
||||
|
||||
private void updateProductStock(TbProduct product, TbProductSkuWithBLOBs productSku, Integer num) {
|
||||
String key = RedisCst.PRODUCT + product.getShopId() + ":product" + product.getId();
|
||||
if (product.getIsDistribute() == 1) {
|
||||
productMapper.updateStockById(product.getId().toString(), num);
|
||||
} else {
|
||||
key = RedisCst.PRODUCT + product.getShopId() + ":" + productSku.getId();
|
||||
productSkuMapper.updateStockById(productSku.getId().toString(), num);
|
||||
}
|
||||
|
||||
if (num > 0) {
|
||||
redisUtil.getIncrNum(key, "1");
|
||||
} else {
|
||||
redisUtil.getIncrNum(key, "2");
|
||||
}
|
||||
}
|
||||
|
||||
private TbCashierCart addCart(String productId, String skuId, Integer userId, Integer num, String tableId, String shopId) throws Exception {
|
||||
try {
|
||||
TbProduct product = productMapper.selectById(Integer.valueOf(productId));
|
||||
@@ -205,7 +259,7 @@ public class CartService {
|
||||
jsonObject1.put("msg", "该商品不存在");
|
||||
jsonObject1.put("data", new ArrayList<>());
|
||||
PushToAppChannelHandlerAdapter.getInstance().AppSendInfo(jsonObject1.toString(), key, userId.toString(), true);
|
||||
log.error("购物车添加商品异常,该商品不存在:{}",productId);
|
||||
log.error("购物车添加商品异常,该商品不存在:{}", productId);
|
||||
throw new MsgException("该商品不存在");
|
||||
}
|
||||
TbProductSkuWithBLOBs productSku = productSkuMapper.selectByPrimaryKey(Integer.valueOf(skuId));
|
||||
@@ -215,7 +269,7 @@ public class CartService {
|
||||
jsonObject1.put("msg", "该商品规格不存在");
|
||||
jsonObject1.put("data", new ArrayList<>());
|
||||
PushToAppChannelHandlerAdapter.getInstance().AppSendInfo(jsonObject1.toString(), key, userId.toString(), true);
|
||||
log.error("购物车添加商品异常,该商品sku不存在:{}",productId);
|
||||
log.error("购物车添加商品异常,该商品sku不存在:{}", productId);
|
||||
throw new MsgException("该商品规格不存在");
|
||||
}
|
||||
TbCashierCart cashierCart = new TbCashierCart();
|
||||
@@ -429,24 +483,24 @@ public class CartService {
|
||||
orderInfo.setIsUseCoupon(isuseYhq);
|
||||
orderInfo.setUserCouponAmount(couponAmount);
|
||||
|
||||
JSONObject object=new JSONObject();
|
||||
String outNumber= redisUtil.getMessage(RedisCst.OUT_NUMBER.concat(jsonObject.getString("shopId")));
|
||||
Integer number=1;
|
||||
if(Objects.isNull(outNumber)){
|
||||
object.put("outNumber",number);
|
||||
object.put("times",DateUtils.getDay());
|
||||
}else {
|
||||
object=JSONObject.parseObject(outNumber);
|
||||
if(object.getString("times").equals(DateUtils.getDay())){
|
||||
number=object.getInteger("outNumber")+1;
|
||||
object.put("outNumber",number);
|
||||
}else {
|
||||
object.put("outNumber",number);
|
||||
object.put("times",DateUtils.getDay());
|
||||
JSONObject object = new JSONObject();
|
||||
String outNumber = redisUtil.getMessage(RedisCst.OUT_NUMBER.concat(jsonObject.getString("shopId")));
|
||||
Integer number = 1;
|
||||
if (Objects.isNull(outNumber)) {
|
||||
object.put("outNumber", number);
|
||||
object.put("times", DateUtils.getDay());
|
||||
} else {
|
||||
object = JSONObject.parseObject(outNumber);
|
||||
if (object.getString("times").equals(DateUtils.getDay())) {
|
||||
number = object.getInteger("outNumber") + 1;
|
||||
object.put("outNumber", number);
|
||||
} else {
|
||||
object.put("outNumber", number);
|
||||
object.put("times", DateUtils.getDay());
|
||||
}
|
||||
}
|
||||
orderInfo.setOutNumber(number+"");
|
||||
redisUtil.saveMessage(RedisCst.OUT_NUMBER.concat(jsonObject.getString("shopId")),object.toString());
|
||||
orderInfo.setOutNumber(number + "");
|
||||
redisUtil.saveMessage(RedisCst.OUT_NUMBER.concat(jsonObject.getString("shopId")), object.toString());
|
||||
orderInfoMapper.insert(orderInfo);
|
||||
orderId = orderInfo.getId();
|
||||
}
|
||||
@@ -534,7 +588,7 @@ public class CartService {
|
||||
if (Objects.isNull(array) || array.isEmpty() || array.size() < 1) {
|
||||
for (int i = 0; i < array.size(); i++) {
|
||||
TbCashierCart cashierCart = JSONUtil.parseJSONStr2T(array.get(i).toString(), TbCashierCart.class);
|
||||
redisUtil.secAdd(RedisCst.PRODUCT+shopId+":"+jsonObject.getString("skuId"),cashierCart.getNumber().toString());
|
||||
redisUtil.secAdd(RedisCst.PRODUCT + shopId + ":" + jsonObject.getString("skuId"), cashierCart.getNumber().toString());
|
||||
productSkuMapper.updateAddStockById(jsonObject.getString("skuId"), cashierCart.getNumber());
|
||||
|
||||
}
|
||||
@@ -737,24 +791,24 @@ public class CartService {
|
||||
orderInfo.setIsUseCoupon(isuseYhq);
|
||||
orderInfo.setUserCouponAmount(couponAmount);
|
||||
|
||||
JSONObject object=new JSONObject();
|
||||
String outNumber= redisUtil.getMessage(RedisCst.OUT_NUMBER.concat(jsonObject.getString("shopId")));
|
||||
Integer number=1;
|
||||
if(Objects.isNull(outNumber)){
|
||||
object.put("outNumber",number);
|
||||
object.put("times",DateUtils.getDay());
|
||||
}else {
|
||||
object=JSONObject.parseObject(outNumber);
|
||||
if(object.getString("times").equals(DateUtils.getDay())){
|
||||
number=object.getInteger("outNumber")+1;
|
||||
object.put("outNumber",number);
|
||||
}else {
|
||||
object.put("outNumber",number);
|
||||
object.put("times",DateUtils.getDay());
|
||||
JSONObject object = new JSONObject();
|
||||
String outNumber = redisUtil.getMessage(RedisCst.OUT_NUMBER.concat(jsonObject.getString("shopId")));
|
||||
Integer number = 1;
|
||||
if (Objects.isNull(outNumber)) {
|
||||
object.put("outNumber", number);
|
||||
object.put("times", DateUtils.getDay());
|
||||
} else {
|
||||
object = JSONObject.parseObject(outNumber);
|
||||
if (object.getString("times").equals(DateUtils.getDay())) {
|
||||
number = object.getInteger("outNumber") + 1;
|
||||
object.put("outNumber", number);
|
||||
} else {
|
||||
object.put("outNumber", number);
|
||||
object.put("times", DateUtils.getDay());
|
||||
}
|
||||
}
|
||||
orderInfo.setOutNumber(number+"");
|
||||
redisUtil.saveMessage(RedisCst.OUT_NUMBER.concat(jsonObject.getString("shopId")),object.toString());
|
||||
orderInfo.setOutNumber(number + "");
|
||||
redisUtil.saveMessage(RedisCst.OUT_NUMBER.concat(jsonObject.getString("shopId")), object.toString());
|
||||
|
||||
|
||||
orderInfoMapper.insert(orderInfo);
|
||||
|
||||
@@ -63,6 +63,7 @@
|
||||
<result column="tax_config_id" jdbcType="VARCHAR" property="taxConfigId" />
|
||||
<result column="spec_table_headers" jdbcType="VARCHAR" property="specTableHeaders" />
|
||||
<result column="group_category_id" jdbcType="VARCHAR" property="groupCategoryId" />
|
||||
<result column="stock_number" jdbcType="INTEGER" property="stockNumber" />
|
||||
</resultMap>
|
||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.chaozhanggui.system.cashierservice.entity.TbProductWithBLOBs">
|
||||
<result column="images" jdbcType="LONGVARCHAR" property="images" />
|
||||
@@ -73,21 +74,21 @@
|
||||
<result column="select_spec" jdbcType="LONGVARCHAR" property="selectSpec" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, category_id, spec_id, source_path, brand_id, merchant_id, shop_id, name, short_title,
|
||||
id, category_id, spec_id, source_path, brand_id, merchant_id, shop_id, name, short_title,
|
||||
type, pack_fee, low_price, low_member_price, unit_id, unit_snap, cover_img, share_img, images,
|
||||
video_cover_img, sort, limit_number, product_score, status, fail_msg, is_recommend,
|
||||
is_hot, is_new, is_on_sale, is_show, type_enum, is_distribute, is_del, is_stock,
|
||||
is_pause_sale, is_free_freight, freight_id, strategy_type, strategy_id, is_vip, is_delete,
|
||||
created_at, updated_at, base_sales_number, real_sales_number, sales_number, thumb_count,
|
||||
store_count, furnish_meal, furnish_express, furnish_draw, furnish_vir, is_combo,
|
||||
is_show_cash, is_show_mall, is_need_examine, show_on_mall_status, show_on_mall_time,
|
||||
show_on_mall_error_msg, enable_label, tax_config_id, spec_table_headers,group_category_id
|
||||
video_cover_img, sort, limit_number, product_score, status, fail_msg, is_recommend,
|
||||
is_hot, is_new, is_on_sale, is_show, type_enum, is_distribute, is_del, is_stock,
|
||||
is_pause_sale, is_free_freight, freight_id, strategy_type, strategy_id, is_vip, is_delete,
|
||||
created_at, updated_at, base_sales_number, real_sales_number, sales_number, thumb_count,
|
||||
store_count, furnish_meal, furnish_express, furnish_draw, furnish_vir, is_combo,
|
||||
is_show_cash, is_show_mall, is_need_examine, show_on_mall_status, show_on_mall_time,
|
||||
show_on_mall_error_msg, enable_label, tax_config_id, spec_table_headers,group_category_id,stock_number
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
images, video, notice, group_snap, spec_info, select_spec
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="ResultMapWithBLOBs">
|
||||
select
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
,
|
||||
<include refid="Blob_Column_List" />
|
||||
@@ -99,51 +100,53 @@
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProductWithBLOBs">
|
||||
insert into tb_product (id, category_id, spec_id,
|
||||
source_path, brand_id, merchant_id,
|
||||
shop_id, name, short_title,
|
||||
type, pack_fee, low_price,
|
||||
low_member_price, unit_id, unit_snap,
|
||||
cover_img, share_img, video_cover_img,
|
||||
sort, limit_number, product_score,
|
||||
status, fail_msg, is_recommend,
|
||||
is_hot, is_new, is_on_sale,
|
||||
is_show, type_enum, is_distribute,
|
||||
is_del, is_stock, is_pause_sale,
|
||||
is_free_freight, freight_id, strategy_type,
|
||||
strategy_id, is_vip, is_delete,
|
||||
created_at, updated_at, base_sales_number,
|
||||
real_sales_number, sales_number, thumb_count,
|
||||
store_count, furnish_meal, furnish_express,
|
||||
furnish_draw, furnish_vir, is_combo,
|
||||
is_show_cash, is_show_mall, is_need_examine,
|
||||
show_on_mall_status, show_on_mall_time, show_on_mall_error_msg,
|
||||
enable_label, tax_config_id, spec_table_headers,
|
||||
images, video, notice,
|
||||
group_snap, spec_info, select_spec
|
||||
insert into tb_product (id, category_id, spec_id,
|
||||
source_path, brand_id, merchant_id,
|
||||
shop_id, name, short_title,
|
||||
type, pack_fee, low_price,
|
||||
low_member_price, unit_id, unit_snap,
|
||||
cover_img, share_img, video_cover_img,
|
||||
sort, limit_number, product_score,
|
||||
status, fail_msg, is_recommend,
|
||||
is_hot, is_new, is_on_sale,
|
||||
is_show, type_enum, is_distribute,
|
||||
is_del, is_stock, is_pause_sale,
|
||||
is_free_freight, freight_id, strategy_type,
|
||||
strategy_id, is_vip, is_delete,
|
||||
created_at, updated_at, base_sales_number,
|
||||
real_sales_number, sales_number, thumb_count,
|
||||
store_count, furnish_meal, furnish_express,
|
||||
furnish_draw, furnish_vir, is_combo,
|
||||
is_show_cash, is_show_mall, is_need_examine,
|
||||
show_on_mall_status, show_on_mall_time, show_on_mall_error_msg,
|
||||
enable_label, tax_config_id, spec_table_headers,
|
||||
images, video, notice,
|
||||
group_snap, spec_info, select_spec,group_category_id,stock_number
|
||||
)
|
||||
values (#{id,jdbcType=INTEGER}, #{categoryId,jdbcType=VARCHAR}, #{specId,jdbcType=INTEGER},
|
||||
#{sourcePath,jdbcType=VARCHAR}, #{brandId,jdbcType=INTEGER}, #{merchantId,jdbcType=VARCHAR},
|
||||
#{shopId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{shortTitle,jdbcType=VARCHAR},
|
||||
#{type,jdbcType=VARCHAR}, #{packFee,jdbcType=DECIMAL}, #{lowPrice,jdbcType=DECIMAL},
|
||||
#{lowMemberPrice,jdbcType=DECIMAL}, #{unitId,jdbcType=VARCHAR}, #{unitSnap,jdbcType=VARCHAR},
|
||||
#{coverImg,jdbcType=VARCHAR}, #{shareImg,jdbcType=VARCHAR}, #{videoCoverImg,jdbcType=VARCHAR},
|
||||
#{sort,jdbcType=INTEGER}, #{limitNumber,jdbcType=INTEGER}, #{productScore,jdbcType=INTEGER},
|
||||
#{status,jdbcType=TINYINT}, #{failMsg,jdbcType=VARCHAR}, #{isRecommend,jdbcType=TINYINT},
|
||||
#{isHot,jdbcType=TINYINT}, #{isNew,jdbcType=TINYINT}, #{isOnSale,jdbcType=TINYINT},
|
||||
#{isShow,jdbcType=TINYINT}, #{typeEnum,jdbcType=VARCHAR}, #{isDistribute,jdbcType=TINYINT},
|
||||
#{isDel,jdbcType=TINYINT}, #{isStock,jdbcType=TINYINT}, #{isPauseSale,jdbcType=TINYINT},
|
||||
#{isFreeFreight,jdbcType=TINYINT}, #{freightId,jdbcType=BIGINT}, #{strategyType,jdbcType=VARCHAR},
|
||||
#{strategyId,jdbcType=INTEGER}, #{isVip,jdbcType=TINYINT}, #{isDelete,jdbcType=TINYINT},
|
||||
#{createdAt,jdbcType=BIGINT}, #{updatedAt,jdbcType=BIGINT}, #{baseSalesNumber,jdbcType=DOUBLE},
|
||||
#{realSalesNumber,jdbcType=INTEGER}, #{salesNumber,jdbcType=INTEGER}, #{thumbCount,jdbcType=INTEGER},
|
||||
#{storeCount,jdbcType=INTEGER}, #{furnishMeal,jdbcType=INTEGER}, #{furnishExpress,jdbcType=INTEGER},
|
||||
#{furnishDraw,jdbcType=INTEGER}, #{furnishVir,jdbcType=INTEGER}, #{isCombo,jdbcType=TINYINT},
|
||||
#{isShowCash,jdbcType=TINYINT}, #{isShowMall,jdbcType=TINYINT}, #{isNeedExamine,jdbcType=TINYINT},
|
||||
#{showOnMallStatus,jdbcType=TINYINT}, #{showOnMallTime,jdbcType=BIGINT}, #{showOnMallErrorMsg,jdbcType=VARCHAR},
|
||||
#{enableLabel,jdbcType=TINYINT}, #{taxConfigId,jdbcType=VARCHAR}, #{specTableHeaders,jdbcType=VARCHAR},
|
||||
#{images,jdbcType=LONGVARCHAR}, #{video,jdbcType=LONGVARCHAR}, #{notice,jdbcType=LONGVARCHAR},
|
||||
#{groupSnap,jdbcType=LONGVARCHAR}, #{specInfo,jdbcType=LONGVARCHAR}, #{selectSpec,jdbcType=LONGVARCHAR}
|
||||
values (#{id,jdbcType=INTEGER}, #{categoryId,jdbcType=VARCHAR}, #{specId,jdbcType=INTEGER},
|
||||
#{sourcePath,jdbcType=VARCHAR}, #{brandId,jdbcType=INTEGER}, #{merchantId,jdbcType=VARCHAR},
|
||||
#{shopId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{shortTitle,jdbcType=VARCHAR},
|
||||
#{type,jdbcType=VARCHAR}, #{packFee,jdbcType=DECIMAL}, #{lowPrice,jdbcType=DECIMAL},
|
||||
#{lowMemberPrice,jdbcType=DECIMAL}, #{unitId,jdbcType=VARCHAR}, #{unitSnap,jdbcType=VARCHAR},
|
||||
#{coverImg,jdbcType=VARCHAR}, #{shareImg,jdbcType=VARCHAR}, #{videoCoverImg,jdbcType=VARCHAR},
|
||||
#{sort,jdbcType=INTEGER}, #{limitNumber,jdbcType=INTEGER}, #{productScore,jdbcType=INTEGER},
|
||||
#{status,jdbcType=TINYINT}, #{failMsg,jdbcType=VARCHAR}, #{isRecommend,jdbcType=TINYINT},
|
||||
#{isHot,jdbcType=TINYINT}, #{isNew,jdbcType=TINYINT}, #{isOnSale,jdbcType=TINYINT},
|
||||
#{isShow,jdbcType=TINYINT}, #{typeEnum,jdbcType=VARCHAR}, #{isDistribute,jdbcType=TINYINT},
|
||||
#{isDel,jdbcType=TINYINT}, #{isStock,jdbcType=TINYINT}, #{isPauseSale,jdbcType=TINYINT},
|
||||
#{isFreeFreight,jdbcType=TINYINT}, #{freightId,jdbcType=BIGINT}, #{strategyType,jdbcType=VARCHAR},
|
||||
#{strategyId,jdbcType=INTEGER}, #{isVip,jdbcType=TINYINT}, #{isDelete,jdbcType=TINYINT},
|
||||
#{createdAt,jdbcType=BIGINT}, #{updatedAt,jdbcType=BIGINT}, #{baseSalesNumber,jdbcType=DOUBLE},
|
||||
#{realSalesNumber,jdbcType=INTEGER}, #{salesNumber,jdbcType=INTEGER}, #{thumbCount,jdbcType=INTEGER},
|
||||
#{storeCount,jdbcType=INTEGER}, #{furnishMeal,jdbcType=INTEGER}, #{furnishExpress,jdbcType=INTEGER},
|
||||
#{furnishDraw,jdbcType=INTEGER}, #{furnishVir,jdbcType=INTEGER}, #{isCombo,jdbcType=TINYINT},
|
||||
#{isShowCash,jdbcType=TINYINT}, #{isShowMall,jdbcType=TINYINT}, #{isNeedExamine,jdbcType=TINYINT},
|
||||
#{showOnMallStatus,jdbcType=TINYINT}, #{showOnMallTime,jdbcType=BIGINT}, #{showOnMallErrorMsg,jdbcType=VARCHAR},
|
||||
#{enableLabel,jdbcType=TINYINT}, #{taxConfigId,jdbcType=VARCHAR}, #{specTableHeaders,jdbcType=VARCHAR},
|
||||
#{images,jdbcType=LONGVARCHAR}, #{video,jdbcType=LONGVARCHAR}, #{notice,jdbcType=LONGVARCHAR},
|
||||
#{groupSnap,jdbcType=LONGVARCHAR}, #{specInfo,jdbcType=LONGVARCHAR}, #{selectSpec,jdbcType=LONGVARCHAR},
|
||||
#{groupCategoryId,jdbcType=VARCHAR},#{stockNumber,jdbcType=INTEGER},
|
||||
#{groupCategoryId,jdbcType=VARCHAR},#{stockNumber,jdbcType=INTEGER}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProductWithBLOBs">
|
||||
@@ -347,6 +350,12 @@
|
||||
<if test="selectSpec != null">
|
||||
select_spec,
|
||||
</if>
|
||||
<if test="groupCategoryId != null">
|
||||
group_category_id,
|
||||
</if>
|
||||
<if test="stockNumber != null">
|
||||
stock_number,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
@@ -547,6 +556,12 @@
|
||||
<if test="selectSpec != null">
|
||||
#{selectSpec,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
<if test="groupCategoryId != null">
|
||||
#{groupCategoryId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="stockNumber != null">
|
||||
#{stockNumber,jdbcType=INTEGER},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProductWithBLOBs">
|
||||
@@ -747,6 +762,12 @@
|
||||
<if test="selectSpec != null">
|
||||
select_spec = #{selectSpec,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
<if test="groupCategoryId != null">
|
||||
group_category_id = #{groupCategoryId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="stockNumber != null">
|
||||
stock_number = #{stockNumber,jdbcType=INTEGER},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
@@ -816,7 +837,9 @@
|
||||
notice = #{notice,jdbcType=LONGVARCHAR},
|
||||
group_snap = #{groupSnap,jdbcType=LONGVARCHAR},
|
||||
spec_info = #{specInfo,jdbcType=LONGVARCHAR},
|
||||
select_spec = #{selectSpec,jdbcType=LONGVARCHAR}
|
||||
select_spec = #{selectSpec,jdbcType=LONGVARCHAR},
|
||||
group_category_id = #{groupCategoryId,jdbcType=VARCHAR},
|
||||
stock_number = #{stockNumber,jdbcType=INTEGER}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProduct">
|
||||
@@ -879,7 +902,9 @@
|
||||
show_on_mall_error_msg = #{showOnMallErrorMsg,jdbcType=VARCHAR},
|
||||
enable_label = #{enableLabel,jdbcType=TINYINT},
|
||||
tax_config_id = #{taxConfigId,jdbcType=VARCHAR},
|
||||
spec_table_headers = #{specTableHeaders,jdbcType=VARCHAR}
|
||||
spec_table_headers = #{specTableHeaders,jdbcType=VARCHAR},
|
||||
group_category_id = #{groupCategoryId,jdbcType=VARCHAR},
|
||||
stock_number = #{stockNumber,jdbcType=INTEGER}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
<update id="upGroupRealSalesNumber">
|
||||
@@ -888,6 +913,12 @@
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
|
||||
<update id="updateStockById">
|
||||
update tb_product
|
||||
set stock_number = stock_number - #{number,jdbcType=INTEGER}
|
||||
where id = #{productId}
|
||||
</update>
|
||||
|
||||
<select id="selectByIdIn" resultMap="BaseResultMap">
|
||||
select *
|
||||
from tb_product
|
||||
@@ -1025,4 +1056,4 @@
|
||||
group by `order`.pro_id
|
||||
ORDER BY number desc
|
||||
</select>
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
||||
@@ -23,21 +23,22 @@
|
||||
<result column="second_shared" jdbcType="DECIMAL" property="secondShared" />
|
||||
<result column="created_at" jdbcType="BIGINT" property="createdAt" />
|
||||
<result column="updated_at" jdbcType="BIGINT" property="updatedAt" />
|
||||
<result column="is_pause_sale" jdbcType="INTEGER" property="isPauseSale" />
|
||||
</resultMap>
|
||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.chaozhanggui.system.cashierservice.entity.TbProductSkuWithBLOBs">
|
||||
<result column="spec_info" jdbcType="LONGVARCHAR" property="specInfo" />
|
||||
<result column="spec_snap" jdbcType="LONGVARCHAR" property="specSnap" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, shop_id, bar_code, product_id, origin_price, cost_price, member_price, meal_price,
|
||||
sale_price, guide_price, strategy_price, stock_number, cover_img, warn_line, weight,
|
||||
volume, real_sales_number, first_shared, second_shared, created_at, updated_at
|
||||
id, shop_id, bar_code, product_id, origin_price, cost_price, member_price, meal_price,
|
||||
sale_price, guide_price, strategy_price, stock_number, cover_img, warn_line, weight,
|
||||
volume, real_sales_number, first_shared, second_shared, created_at, updated_at, is_pause_sale
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
spec_info, spec_snap
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="ResultMapWithBLOBs">
|
||||
select
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
,
|
||||
<include refid="Blob_Column_List" />
|
||||
@@ -54,22 +55,23 @@
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProductSkuWithBLOBs">
|
||||
insert into tb_product_sku (id, shop_id, bar_code,
|
||||
product_id, origin_price, cost_price,
|
||||
member_price, meal_price, sale_price,
|
||||
guide_price, strategy_price, stock_number,
|
||||
cover_img, warn_line, weight,
|
||||
volume, real_sales_number, first_shared,
|
||||
second_shared, created_at, updated_at,
|
||||
spec_info, spec_snap)
|
||||
values (#{id,jdbcType=INTEGER}, #{shopId,jdbcType=VARCHAR}, #{barCode,jdbcType=VARCHAR},
|
||||
#{productId,jdbcType=VARCHAR}, #{originPrice,jdbcType=DECIMAL}, #{costPrice,jdbcType=DECIMAL},
|
||||
#{memberPrice,jdbcType=DECIMAL}, #{mealPrice,jdbcType=DECIMAL}, #{salePrice,jdbcType=DECIMAL},
|
||||
#{guidePrice,jdbcType=DECIMAL}, #{strategyPrice,jdbcType=DECIMAL}, #{stockNumber,jdbcType=DOUBLE},
|
||||
#{coverImg,jdbcType=VARCHAR}, #{warnLine,jdbcType=INTEGER}, #{weight,jdbcType=DOUBLE},
|
||||
#{volume,jdbcType=REAL}, #{realSalesNumber,jdbcType=DOUBLE}, #{firstShared,jdbcType=DECIMAL},
|
||||
#{secondShared,jdbcType=DECIMAL}, #{createdAt,jdbcType=BIGINT}, #{updatedAt,jdbcType=BIGINT},
|
||||
#{specInfo,jdbcType=LONGVARCHAR}, #{specSnap,jdbcType=LONGVARCHAR})
|
||||
insert into tb_product_sku (id, shop_id, bar_code,
|
||||
product_id, origin_price, cost_price,
|
||||
member_price, meal_price, sale_price,
|
||||
guide_price, strategy_price, stock_number,
|
||||
cover_img, warn_line, weight,
|
||||
volume, real_sales_number, first_shared,
|
||||
second_shared, created_at, updated_at,
|
||||
spec_info, spec_snap, is_pause_sale)
|
||||
values (#{id,jdbcType=INTEGER}, #{shopId,jdbcType=VARCHAR}, #{barCode,jdbcType=VARCHAR},
|
||||
#{productId,jdbcType=VARCHAR}, #{originPrice,jdbcType=DECIMAL}, #{costPrice,jdbcType=DECIMAL},
|
||||
#{memberPrice,jdbcType=DECIMAL}, #{mealPrice,jdbcType=DECIMAL}, #{salePrice,jdbcType=DECIMAL},
|
||||
#{guidePrice,jdbcType=DECIMAL}, #{strategyPrice,jdbcType=DECIMAL}, #{stockNumber,jdbcType=DOUBLE},
|
||||
#{coverImg,jdbcType=VARCHAR}, #{warnLine,jdbcType=INTEGER}, #{weight,jdbcType=DOUBLE},
|
||||
#{volume,jdbcType=REAL}, #{realSalesNumber,jdbcType=DOUBLE}, #{firstShared,jdbcType=DECIMAL},
|
||||
#{secondShared,jdbcType=DECIMAL}, #{createdAt,jdbcType=BIGINT}, #{updatedAt,jdbcType=BIGINT},
|
||||
#{specInfo,jdbcType=LONGVARCHAR}, #{specSnap,jdbcType=LONGVARCHAR}),
|
||||
#{isPauseSale,jdbcType=INTEGER}
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProductSkuWithBLOBs">
|
||||
insert into tb_product_sku
|
||||
@@ -143,6 +145,9 @@
|
||||
<if test="specSnap != null">
|
||||
spec_snap,
|
||||
</if>
|
||||
<if test="isPauseSale != null">
|
||||
is_pause_sale,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
@@ -214,6 +219,9 @@
|
||||
<if test="specSnap != null">
|
||||
#{specSnap,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
<if test="isPauseSale != null">
|
||||
#{isPauseSale,jdbcType=INTEGER},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProductSkuWithBLOBs">
|
||||
@@ -285,6 +293,9 @@
|
||||
<if test="specSnap != null">
|
||||
spec_snap = #{specSnap,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
<if test="isPauseSale != null">
|
||||
is_pause_sale = #{isPauseSale,jdbcType=INTEGER},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
@@ -311,7 +322,8 @@
|
||||
created_at = #{createdAt,jdbcType=BIGINT},
|
||||
updated_at = #{updatedAt,jdbcType=BIGINT},
|
||||
spec_info = #{specInfo,jdbcType=LONGVARCHAR},
|
||||
spec_snap = #{specSnap,jdbcType=LONGVARCHAR}
|
||||
spec_snap = #{specSnap,jdbcType=LONGVARCHAR},
|
||||
is_pause_sale = #{isPauseSale,jdbcType=INTEGER}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProductSku">
|
||||
@@ -335,7 +347,8 @@
|
||||
first_shared = #{firstShared,jdbcType=DECIMAL},
|
||||
second_shared = #{secondShared,jdbcType=DECIMAL},
|
||||
created_at = #{createdAt,jdbcType=BIGINT},
|
||||
updated_at = #{updatedAt,jdbcType=BIGINT}
|
||||
updated_at = #{updatedAt,jdbcType=BIGINT},
|
||||
is_pause_sale = #{isPauseSale,jdbcType=INTEGER}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
<update id="updateStockById">
|
||||
@@ -431,4 +444,4 @@
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user