mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-23 07:41:53 +08:00
fix:mall promotion SeckillActivity
This commit is contained in:
parent
78b3d2a20f
commit
b78f814552
@ -2,6 +2,9 @@ package cn.iocoder.yudao.module.promotion.controller.admin.seckill;
|
|||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
||||||
|
import cn.iocoder.yudao.module.product.api.spu.ProductSpuApi;
|
||||||
|
import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO;
|
||||||
import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.activity.*;
|
import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.activity.*;
|
||||||
import cn.iocoder.yudao.module.promotion.convert.seckill.seckillactivity.SeckillActivityConvert;
|
import cn.iocoder.yudao.module.promotion.convert.seckill.seckillactivity.SeckillActivityConvert;
|
||||||
import cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.seckillactivity.SeckillActivityDO;
|
import cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.seckillactivity.SeckillActivityDO;
|
||||||
@ -18,6 +21,7 @@ import javax.annotation.Resource;
|
|||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
@ -29,6 +33,8 @@ public class SeckillActivityController {
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private SeckillActivityService seckillActivityService;
|
private SeckillActivityService seckillActivityService;
|
||||||
|
@Resource
|
||||||
|
private ProductSpuApi spuApi;
|
||||||
|
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
@Operation(summary = "创建秒杀活动")
|
@Operation(summary = "创建秒杀活动")
|
||||||
@ -69,11 +75,8 @@ public class SeckillActivityController {
|
|||||||
@PreAuthorize("@ss.hasPermission('promotion:seckill-activity:query')")
|
@PreAuthorize("@ss.hasPermission('promotion:seckill-activity:query')")
|
||||||
public CommonResult<SeckillActivityDetailRespVO> getSeckillActivity(@RequestParam("id") Long id) {
|
public CommonResult<SeckillActivityDetailRespVO> getSeckillActivity(@RequestParam("id") Long id) {
|
||||||
SeckillActivityDO seckillActivity = seckillActivityService.getSeckillActivity(id);
|
SeckillActivityDO seckillActivity = seckillActivityService.getSeckillActivity(id);
|
||||||
if (seckillActivity == null) {
|
List<SeckillProductDO> seckillProducts = seckillActivityService.getSeckillProductListByActivityId(id);
|
||||||
return success(null);
|
return success(SeckillActivityConvert.INSTANCE.convert(seckillActivity, seckillProducts));
|
||||||
}
|
|
||||||
List<SeckillProductDO> seckillProducts = seckillActivityService.getSeckillProductListByActivityId(id);
|
|
||||||
return success(SeckillActivityConvert.INSTANCE.convert(seckillActivity,seckillProducts));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
@ -90,7 +93,11 @@ public class SeckillActivityController {
|
|||||||
@PreAuthorize("@ss.hasPermission('promotion:seckill-activity:query')")
|
@PreAuthorize("@ss.hasPermission('promotion:seckill-activity:query')")
|
||||||
public CommonResult<PageResult<SeckillActivityRespVO>> getSeckillActivityPage(@Valid SeckillActivityPageReqVO pageVO) {
|
public CommonResult<PageResult<SeckillActivityRespVO>> getSeckillActivityPage(@Valid SeckillActivityPageReqVO pageVO) {
|
||||||
PageResult<SeckillActivityDO> pageResult = seckillActivityService.getSeckillActivityPage(pageVO);
|
PageResult<SeckillActivityDO> pageResult = seckillActivityService.getSeckillActivityPage(pageVO);
|
||||||
return success(SeckillActivityConvert.INSTANCE.convertPage(pageResult));
|
Set<Long> aIds = CollectionUtils.convertSet(pageResult.getList(), SeckillActivityDO::getId);
|
||||||
|
List<SeckillProductDO> seckillProducts = seckillActivityService.getSeckillProductListByActivityId(aIds);
|
||||||
|
Set<Long> spuIds = CollectionUtils.convertSet(pageResult.getList(), SeckillActivityDO::getSpuId);
|
||||||
|
List<ProductSpuRespDTO> spuList = spuApi.getSpuList(spuIds);
|
||||||
|
return success(SeckillActivityConvert.INSTANCE.convertPage(pageResult, seckillProducts, spuList));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import lombok.Data;
|
|||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -19,6 +20,12 @@ import java.util.List;
|
|||||||
@ToString(callSuper = true)
|
@ToString(callSuper = true)
|
||||||
public class SeckillActivityRespVO extends SeckillActivityBaseVO {
|
public class SeckillActivityRespVO extends SeckillActivityBaseVO {
|
||||||
|
|
||||||
|
@Schema(description = "商品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "618大促")
|
||||||
|
private String spuName;
|
||||||
|
|
||||||
|
@Schema(description = "商品主图", requiredMode = Schema.RequiredMode.REQUIRED, example = "618大促")
|
||||||
|
private String picUrl;
|
||||||
|
|
||||||
@Schema(description = "秒杀活动id", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
@Schema(description = "秒杀活动id", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@ -28,4 +35,22 @@ public class SeckillActivityRespVO extends SeckillActivityBaseVO {
|
|||||||
@Schema(description = "活动状态 开启:0 禁用:1", requiredMode = Schema.RequiredMode.REQUIRED, example = "0")
|
@Schema(description = "活动状态 开启:0 禁用:1", requiredMode = Schema.RequiredMode.REQUIRED, example = "0")
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
|
@Schema(description = "订单实付金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "22354")
|
||||||
|
private Integer totalPrice;
|
||||||
|
|
||||||
|
@Schema(description = "秒杀库存", example = "10")
|
||||||
|
private Integer stock;
|
||||||
|
|
||||||
|
@Schema(description = "秒杀总库存", example = "20")
|
||||||
|
private Integer totalStock;
|
||||||
|
|
||||||
|
@Schema(description = "新增订单数", example = "20")
|
||||||
|
private Integer orderCount;
|
||||||
|
|
||||||
|
@Schema(description = "付款人数", example = "20")
|
||||||
|
private Integer userCount;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,11 +3,13 @@ package cn.iocoder.yudao.module.promotion.convert.seckill.seckillactivity;
|
|||||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
||||||
|
import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO;
|
||||||
import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.activity.SeckillActivityCreateReqVO;
|
import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.activity.SeckillActivityCreateReqVO;
|
||||||
import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.activity.SeckillActivityDetailRespVO;
|
import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.activity.SeckillActivityDetailRespVO;
|
||||||
import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.activity.SeckillActivityRespVO;
|
import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.activity.SeckillActivityRespVO;
|
||||||
import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.activity.SeckillActivityUpdateReqVO;
|
import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.activity.SeckillActivityUpdateReqVO;
|
||||||
import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.product.SeckillProductBaseVO;
|
import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.product.SeckillProductBaseVO;
|
||||||
|
import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.product.SeckillProductRespVO;
|
||||||
import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.product.SeckillProductUpdateReqVO;
|
import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.product.SeckillProductUpdateReqVO;
|
||||||
import cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.seckillactivity.SeckillActivityDO;
|
import cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.seckillactivity.SeckillActivityDO;
|
||||||
import cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.seckillactivity.SeckillProductDO;
|
import cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.seckillactivity.SeckillProductDO;
|
||||||
@ -40,9 +42,27 @@ public interface SeckillActivityConvert {
|
|||||||
|
|
||||||
PageResult<SeckillActivityRespVO> convertPage(PageResult<SeckillActivityDO> page);
|
PageResult<SeckillActivityRespVO> convertPage(PageResult<SeckillActivityDO> page);
|
||||||
|
|
||||||
SeckillActivityDetailRespVO convert(SeckillActivityDO seckillActivity, List<SeckillProductDO> seckillProducts);
|
default PageResult<SeckillActivityRespVO> convertPage(PageResult<SeckillActivityDO> page, List<SeckillProductDO> seckillProducts, List<ProductSpuRespDTO> spuList) {
|
||||||
|
Map<Long, ProductSpuRespDTO> spuMap = CollectionUtils.convertMap(spuList, ProductSpuRespDTO::getId, c -> c);
|
||||||
|
PageResult<SeckillActivityRespVO> pageResult = convertPage(page);
|
||||||
|
pageResult.getList().forEach(item -> {
|
||||||
|
item.setSpuName(spuMap.get(item.getSpuId()).getName());
|
||||||
|
item.setPicUrl(spuMap.get(item.getSpuId()).getPicUrl());
|
||||||
|
item.setProducts(convertList2(seckillProducts));
|
||||||
|
});
|
||||||
|
return pageResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
SeckillActivityDetailRespVO convert1(SeckillActivityDO seckillActivity);
|
||||||
|
|
||||||
|
default SeckillActivityDetailRespVO convert(SeckillActivityDO seckillActivity, List<SeckillProductDO> seckillProducts) {
|
||||||
|
SeckillActivityDetailRespVO respVO = convert1(seckillActivity);
|
||||||
|
respVO.setProducts(convertList2(seckillProducts));
|
||||||
|
return respVO;
|
||||||
|
}
|
||||||
|
|
||||||
@Mappings({
|
@Mappings({
|
||||||
|
@Mapping(target = "id", expression = "java(null)"),
|
||||||
@Mapping(target = "activityId", source = "activityDO.id"),
|
@Mapping(target = "activityId", source = "activityDO.id"),
|
||||||
@Mapping(target = "configIds", source = "activityDO.configIds"),
|
@Mapping(target = "configIds", source = "activityDO.configIds"),
|
||||||
@Mapping(target = "spuId", source = "activityDO.spuId"),
|
@Mapping(target = "spuId", source = "activityDO.spuId"),
|
||||||
@ -76,4 +96,6 @@ public interface SeckillActivityConvert {
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<SeckillProductRespVO> convertList2(List<SeckillProductDO> productDOs);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,10 @@ public interface SeckillProductMapper extends BaseMapperX<SeckillProductDO> {
|
|||||||
return selectList(SeckillProductDO::getActivityId, id);
|
return selectList(SeckillProductDO::getActivityId, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default List<SeckillProductDO> selectListByActivityId(Collection<Long> ids) {
|
||||||
|
return selectList(SeckillProductDO::getActivityId, ids);
|
||||||
|
}
|
||||||
|
|
||||||
default List<SeckillProductDO> selectListBySkuIds(Collection<Long> skuIds) {
|
default List<SeckillProductDO> selectListBySkuIds(Collection<Long> skuIds) {
|
||||||
return selectList(SeckillProductDO::getSkuId, skuIds);
|
return selectList(SeckillProductDO::getSkuId, skuIds);
|
||||||
}
|
}
|
||||||
|
@ -79,4 +79,12 @@ public interface SeckillActivityService {
|
|||||||
*/
|
*/
|
||||||
List<SeckillProductDO> getSeckillProductListByActivityId(Long id);
|
List<SeckillProductDO> getSeckillProductListByActivityId(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过活动编号获取活动商品
|
||||||
|
*
|
||||||
|
* @param ids 活动编号
|
||||||
|
* @return 活动商品列表
|
||||||
|
*/
|
||||||
|
List<SeckillProductDO> getSeckillProductListByActivityId(Collection<Long> ids);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -160,7 +160,7 @@ public class SeckillActivityServiceImpl implements SeckillActivityService {
|
|||||||
if (CollUtil.isNotEmpty(u)) {
|
if (CollUtil.isNotEmpty(u)) {
|
||||||
List<SeckillProductUpdateReqVO> vos = CollectionUtils.filterList(products, item -> u.contains(item.getSkuId()));
|
List<SeckillProductUpdateReqVO> vos = CollectionUtils.filterList(products, item -> u.contains(item.getSkuId()));
|
||||||
List<SeckillProductDO> productDOs = SeckillActivityConvert.INSTANCE.convertList1(updateObj, vos, seckillProductDOs);
|
List<SeckillProductDO> productDOs = SeckillActivityConvert.INSTANCE.convertList1(updateObj, vos, seckillProductDOs);
|
||||||
seckillProductMapper.insertBatch(productDOs);
|
seckillProductMapper.updateBatch(productDOs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,7 +206,7 @@ public class SeckillActivityServiceImpl implements SeckillActivityService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SeckillActivityDO getSeckillActivity(Long id) {
|
public SeckillActivityDO getSeckillActivity(Long id) {
|
||||||
return seckillActivityMapper.selectById(id);
|
return validateSeckillActivityExists(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -224,4 +224,9 @@ public class SeckillActivityServiceImpl implements SeckillActivityService {
|
|||||||
return seckillProductMapper.selectListByActivityId(id);
|
return seckillProductMapper.selectListByActivityId(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SeckillProductDO> getSeckillProductListByActivityId(Collection<Long> ids) {
|
||||||
|
return seckillProductMapper.selectListByActivityId(ids);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package cn.iocoder.yudao.module.promotion.util;
|
package cn.iocoder.yudao.module.promotion.util;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||||
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
||||||
import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils;
|
import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils;
|
||||||
@ -35,7 +36,8 @@ public class PromotionUtils {
|
|||||||
Set<Long> skuIdsSet = CollectionUtils.convertSet(products, func);
|
Set<Long> skuIdsSet = CollectionUtils.convertSet(products, func);
|
||||||
Set<Long> skuIdsSet1 = CollectionUtils.convertSet(skus, ProductSkuRespDTO::getId);
|
Set<Long> skuIdsSet1 = CollectionUtils.convertSet(skus, ProductSkuRespDTO::getId);
|
||||||
// 校验 skuId 是否存在
|
// 校验 skuId 是否存在
|
||||||
if (!skuIdsSet1.containsAll(skuIdsSet) || !skuIdsSet.containsAll(skuIdsSet1)) {
|
List<Long> f = CollectionUtils.filterList(skuIdsSet, s -> !skuIdsSet1.contains(s));
|
||||||
|
if (CollUtil.isNotEmpty(f)) {
|
||||||
throw exception(SKU_NOT_EXISTS);
|
throw exception(SKU_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,16 @@
|
|||||||
DELETE FROM "market_activity";
|
DELETE
|
||||||
DELETE FROM "promotion_coupon_template";
|
FROM "market_activity";
|
||||||
DELETE FROM "promotion_coupon";
|
DELETE
|
||||||
DELETE FROM "promotion_reward_activity";
|
FROM "promotion_coupon_template";
|
||||||
DELETE FROM "promotion_discount_activity";
|
DELETE
|
||||||
DELETE FROM "promotion_discount_product";
|
FROM "promotion_coupon";
|
||||||
DELETE FROM "promotion_seckill_config";
|
DELETE
|
||||||
|
FROM "promotion_reward_activity";
|
||||||
|
DELETE
|
||||||
|
FROM "promotion_discount_activity";
|
||||||
|
DELETE
|
||||||
|
FROM "promotion_discount_product";
|
||||||
|
DELETE
|
||||||
|
FROM "promotion_seckill_config";
|
||||||
|
DELETE
|
||||||
|
FROM "promotion_combination_activity";
|
||||||
|
@ -1,151 +1,183 @@
|
|||||||
CREATE TABLE IF NOT EXISTS "market_activity" (
|
CREATE TABLE IF NOT EXISTS "market_activity"
|
||||||
"id" bigint(20) NOT NULL GENERATED BY DEFAULT AS IDENTITY,
|
(
|
||||||
"title" varchar(50) NOT NULL,
|
"id" bigint(20) NOT NULL GENERATED BY DEFAULT AS IDENTITY,
|
||||||
"activity_type" tinyint(4) NOT NULL,
|
"title" varchar(50) NOT NULL,
|
||||||
"status" tinyint(4) NOT NULL,
|
"activity_type" tinyint(4) NOT NULL,
|
||||||
"start_time" datetime NOT NULL,
|
"status" tinyint(4) NOT NULL,
|
||||||
"end_time" datetime NOT NULL,
|
"start_time" datetime NOT NULL,
|
||||||
"invalid_time" datetime,
|
"end_time" datetime NOT NULL,
|
||||||
"delete_time" datetime,
|
"invalid_time" datetime,
|
||||||
|
"delete_time" datetime,
|
||||||
"time_limited_discount" varchar(2000),
|
"time_limited_discount" varchar(2000),
|
||||||
"full_privilege" varchar(2000),
|
"full_privilege" varchar(2000),
|
||||||
"creator" varchar(64) DEFAULT '',
|
"creator" varchar(64) DEFAULT '',
|
||||||
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
"updater" varchar(64) DEFAULT '',
|
"updater" varchar(64) DEFAULT '',
|
||||||
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
"deleted" bit NOT NULL DEFAULT FALSE,
|
"deleted" bit NOT NULL DEFAULT FALSE,
|
||||||
"tenant_id" bigint(20) NOT NULL,
|
"tenant_id" bigint(20) NOT NULL,
|
||||||
PRIMARY KEY ("id")
|
PRIMARY KEY ("id")
|
||||||
) COMMENT '促销活动';
|
) COMMENT '促销活动';
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS "promotion_coupon_template" (
|
CREATE TABLE IF NOT EXISTS "promotion_coupon_template"
|
||||||
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
|
(
|
||||||
"name" varchar NOT NULL,
|
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
|
||||||
"status" int NOT NULL,
|
"name" varchar NOT NULL,
|
||||||
"total_count" int NOT NULL,
|
"status" int NOT NULL,
|
||||||
"take_limit_count" int NOT NULL,
|
"total_count" int NOT NULL,
|
||||||
"take_type" int NOT NULL,
|
"take_limit_count" int NOT NULL,
|
||||||
"use_price" int NOT NULL,
|
"take_type" int NOT NULL,
|
||||||
"product_scope" int NOT NULL,
|
"use_price" int NOT NULL,
|
||||||
"product_spu_ids" varchar,
|
"product_scope" int NOT NULL,
|
||||||
"validity_type" int NOT NULL,
|
"product_spu_ids" varchar,
|
||||||
"valid_start_time" datetime,
|
"validity_type" int NOT NULL,
|
||||||
"valid_end_time" datetime,
|
"valid_start_time" datetime,
|
||||||
"fixed_start_term" int,
|
"valid_end_time" datetime,
|
||||||
"fixed_end_term" int,
|
"fixed_start_term" int,
|
||||||
"discount_type" int NOT NULL,
|
"fixed_end_term" int,
|
||||||
"discount_percent" int,
|
"discount_type" int NOT NULL,
|
||||||
"discount_price" int,
|
"discount_percent" int,
|
||||||
"discount_limit_price" int,
|
"discount_price" int,
|
||||||
"take_count" int NOT NULL DEFAULT 0,
|
"discount_limit_price" int,
|
||||||
"use_count" int NOT NULL DEFAULT 0,
|
"take_count" int NOT NULL DEFAULT 0,
|
||||||
"creator" varchar DEFAULT '',
|
"use_count" int NOT NULL DEFAULT 0,
|
||||||
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
"creator" varchar DEFAULT '',
|
||||||
"updater" varchar DEFAULT '',
|
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
"updater" varchar DEFAULT '',
|
||||||
"deleted" bit NOT NULL DEFAULT FALSE,
|
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
PRIMARY KEY ("id")
|
"deleted" bit NOT NULL DEFAULT FALSE,
|
||||||
|
PRIMARY KEY ("id")
|
||||||
) COMMENT '优惠劵模板';
|
) COMMENT '优惠劵模板';
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS "promotion_coupon" (
|
CREATE TABLE IF NOT EXISTS "promotion_coupon"
|
||||||
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
|
(
|
||||||
"template_id" bigint NOT NULL,
|
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
|
||||||
"name" varchar NOT NULL,
|
"template_id" bigint NOT NULL,
|
||||||
"status" int NOT NULL,
|
"name" varchar NOT NULL,
|
||||||
"user_id" bigint NOT NULL,
|
"status" int NOT NULL,
|
||||||
"take_type" int NOT NULL,
|
"user_id" bigint NOT NULL,
|
||||||
"useprice" int NOT NULL,
|
"take_type" int NOT NULL,
|
||||||
"valid_start_time" datetime NOT NULL,
|
"useprice" int NOT NULL,
|
||||||
"valid_end_time" datetime NOT NULL,
|
"valid_start_time" datetime NOT NULL,
|
||||||
"product_scope" int NOT NULL,
|
"valid_end_time" datetime NOT NULL,
|
||||||
"product_spu_ids" varchar,
|
"product_scope" int NOT NULL,
|
||||||
"discount_type" int NOT NULL,
|
"product_spu_ids" varchar,
|
||||||
"discount_percent" int,
|
"discount_type" int NOT NULL,
|
||||||
"discount_price" int,
|
"discount_percent" int,
|
||||||
|
"discount_price" int,
|
||||||
"discount_limit_price" int,
|
"discount_limit_price" int,
|
||||||
"use_order_id" bigint,
|
"use_order_id" bigint,
|
||||||
"use_time" datetime,
|
"use_time" datetime,
|
||||||
"creator" varchar DEFAULT '',
|
"creator" varchar DEFAULT '',
|
||||||
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
"updater" varchar DEFAULT '',
|
"updater" varchar DEFAULT '',
|
||||||
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
"deleted" bit NOT NULL DEFAULT FALSE,
|
"deleted" bit NOT NULL DEFAULT FALSE,
|
||||||
PRIMARY KEY ("id")
|
PRIMARY KEY ("id")
|
||||||
) COMMENT '优惠劵';
|
) COMMENT '优惠劵';
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS "promotion_reward_activity" (
|
CREATE TABLE IF NOT EXISTS "promotion_reward_activity"
|
||||||
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
|
(
|
||||||
"name" varchar NOT NULL,
|
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
|
||||||
"status" int NOT NULL,
|
"name" varchar NOT NULL,
|
||||||
"start_time" datetime NOT NULL,
|
"status" int NOT NULL,
|
||||||
"end_time" datetime NOT NULL,
|
"start_time" datetime NOT NULL,
|
||||||
"remark" varchar,
|
"end_time" datetime NOT NULL,
|
||||||
"condition_type" int NOT NULL,
|
"remark" varchar,
|
||||||
"product_scope" int NOT NULL,
|
"condition_type" int NOT NULL,
|
||||||
"product_spu_ids" varchar,
|
"product_scope" int NOT NULL,
|
||||||
"rules" varchar,
|
"product_spu_ids" varchar,
|
||||||
"creator" varchar DEFAULT '',
|
"rules" varchar,
|
||||||
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
"creator" varchar DEFAULT '',
|
||||||
"updater" varchar DEFAULT '',
|
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
"updater" varchar DEFAULT '',
|
||||||
"deleted" bit NOT NULL DEFAULT FALSE,
|
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
PRIMARY KEY ("id")
|
"deleted" bit NOT NULL DEFAULT FALSE,
|
||||||
|
PRIMARY KEY ("id")
|
||||||
) COMMENT '满减送活动';
|
) COMMENT '满减送活动';
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS "promotion_discount_activity" (
|
CREATE TABLE IF NOT EXISTS "promotion_discount_activity"
|
||||||
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
|
(
|
||||||
"name" varchar NOT NULL,
|
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
|
||||||
"status" int NOT NULL,
|
"name" varchar NOT NULL,
|
||||||
"start_time" datetime NOT NULL,
|
"status" int NOT NULL,
|
||||||
"end_time" datetime NOT NULL,
|
"start_time" datetime NOT NULL,
|
||||||
"remark" varchar,
|
"end_time" datetime NOT NULL,
|
||||||
"creator" varchar DEFAULT '',
|
"remark" varchar,
|
||||||
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
"creator" varchar DEFAULT '',
|
||||||
"updater" varchar DEFAULT '',
|
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
"updater" varchar DEFAULT '',
|
||||||
"deleted" bit NOT NULL DEFAULT FALSE,
|
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
PRIMARY KEY ("id")
|
"deleted" bit NOT NULL DEFAULT FALSE,
|
||||||
|
PRIMARY KEY ("id")
|
||||||
) COMMENT '限时折扣活动';
|
) COMMENT '限时折扣活动';
|
||||||
|
|
||||||
-- 将该建表 SQL 语句,添加到 yudao-module-promotion-biz 模块的 test/resources/sql/create_tables.sql 文件里
|
-- 将该建表 SQL 语句,添加到 yudao-module-promotion-biz 模块的 test/resources/sql/create_tables.sql 文件里
|
||||||
CREATE TABLE IF NOT EXISTS "promotion_seckill_activity" (
|
CREATE TABLE IF NOT EXISTS "promotion_seckill_activity"
|
||||||
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
|
(
|
||||||
"spu_id" bigint NOT NULL,
|
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
|
||||||
"name" varchar NOT NULL,
|
"spu_id" bigint NOT NULL,
|
||||||
"status" int NOT NULL,
|
"name" varchar NOT NULL,
|
||||||
"remark" varchar,
|
"status" int NOT NULL,
|
||||||
"start_time" varchar NOT NULL,
|
"remark" varchar,
|
||||||
"end_time" varchar NOT NULL,
|
"start_time" varchar NOT NULL,
|
||||||
"sort" int NOT NULL,
|
"end_time" varchar NOT NULL,
|
||||||
"config_ids" varchar NOT NULL,
|
"sort" int NOT NULL,
|
||||||
"order_count" int NOT NULL,
|
"config_ids" varchar NOT NULL,
|
||||||
"user_count" int NOT NULL,
|
"order_count" int NOT NULL,
|
||||||
"total_price" int NOT NULL,
|
"user_count" int NOT NULL,
|
||||||
"total_limit_count" int,
|
"total_price" int NOT NULL,
|
||||||
|
"total_limit_count" int,
|
||||||
"single_limit_count" int,
|
"single_limit_count" int,
|
||||||
"stock" int,
|
"stock" int,
|
||||||
"total_stock" int,
|
"total_stock" int,
|
||||||
"creator" varchar DEFAULT '',
|
"creator" varchar DEFAULT '',
|
||||||
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
"updater" varchar DEFAULT '',
|
"updater" varchar DEFAULT '',
|
||||||
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
"deleted" bit NOT NULL DEFAULT FALSE,
|
"deleted" bit NOT NULL DEFAULT FALSE,
|
||||||
"tenant_id" bigint NOT NULL,
|
"tenant_id" bigint NOT NULL,
|
||||||
PRIMARY KEY ("id")
|
PRIMARY KEY ("id")
|
||||||
) COMMENT '秒杀活动';
|
) COMMENT '秒杀活动';
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS "promotion_seckill_config" (
|
CREATE TABLE IF NOT EXISTS "promotion_seckill_config"
|
||||||
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
|
(
|
||||||
"name" varchar NOT NULL,
|
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
|
||||||
"start_time" varchar NOT NULL,
|
"name" varchar NOT NULL,
|
||||||
"end_time" varchar NOT NULL,
|
"start_time" varchar NOT NULL,
|
||||||
"pic_url" varchar NOT NULL,
|
"end_time" varchar NOT NULL,
|
||||||
"status" int NOT NULL,
|
"pic_url" varchar NOT NULL,
|
||||||
"creator" varchar DEFAULT '',
|
"status" int NOT NULL,
|
||||||
|
"creator" varchar DEFAULT '',
|
||||||
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
"updater" varchar DEFAULT '',
|
"updater" varchar DEFAULT '',
|
||||||
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
"deleted" bit NOT NULL DEFAULT FALSE,
|
"deleted" bit NOT NULL DEFAULT FALSE,
|
||||||
"tenant_id" bigint NOT NULL,
|
"tenant_id" bigint NOT NULL,
|
||||||
PRIMARY KEY ("id")
|
PRIMARY KEY ("id")
|
||||||
) COMMENT '秒杀时段配置';
|
) COMMENT '秒杀时段配置';
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS "promotion_combination_activity"
|
||||||
|
(
|
||||||
|
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
|
||||||
|
"name" varchar NOT NULL,
|
||||||
|
"spu_id" bigint,
|
||||||
|
"total_limit_count" int NOT NULL,
|
||||||
|
"single_limit_count" int NOT NULL,
|
||||||
|
"start_time" varchar NOT NULL,
|
||||||
|
"end_time" varchar NOT NULL,
|
||||||
|
"user_size" int NOT NULL,
|
||||||
|
"total_num" int NOT NULL,
|
||||||
|
"success_num" int NOT NULL,
|
||||||
|
"order_user_count" int NOT NULL,
|
||||||
|
"virtual_group" int NOT NULL,
|
||||||
|
"status" int NOT NULL,
|
||||||
|
"limit_duration" int NOT NULL,
|
||||||
|
"creator" varchar DEFAULT '',
|
||||||
|
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
"updater" varchar DEFAULT '',
|
||||||
|
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
|
"deleted" bit NOT NULL DEFAULT FALSE,
|
||||||
|
"tenant_id" bigint NOT NULL,
|
||||||
|
PRIMARY KEY ("id")
|
||||||
|
) COMMENT '拼团活动';
|
Loading…
Reference in New Issue
Block a user