Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yudao-cloud
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
hblj
yudao-cloud
Commits
e1db53e3
提交
e1db53e3
authored
4月 02, 2019
作者:
YunaiV
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
后端:优惠劵 rpc api 的设计
后端:优惠劵模板 mapper 编写
上级
243e976e
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
294 行增加
和
16 行删除
+294
-16
CouponCardTemplateAddDTO.java
...oder/mall/promotion/api/dto/CouponCardTemplateAddDTO.java
+115
-0
CouponTemplateMapper.java
.../iocoder/mall/promotion/biz/dao/CouponTemplateMapper.java
+28
-0
CouponTemplateDO.java
...coder/mall/promotion/biz/dataobject/CouponTemplateDO.java
+8
-16
CouponTemplateMapper.xml
...e-impl/src/main/resources/mapper/CouponTemplateMapper.xml
+143
-0
没有找到文件。
promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardTemplateAddDTO.java
浏览文件 @
e1db53e3
package
cn
.
iocoder
.
mall
.
promotion
.
api
.
dto
;
package
cn
.
iocoder
.
mall
.
promotion
.
api
.
dto
;
import
org.hibernate.validator.constraints.Length
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotNull
;
import
java.util.Date
;
public
class
CouponCardTemplateAddDTO
{
public
class
CouponCardTemplateAddDTO
{
// ========== 基本信息 BEGIN ==========
/**
* 标题
*/
@NotEmpty
(
message
=
"标题不能为空"
)
@Length
(
min
=
6
,
max
=
16
,
message
=
"标题长度为 {min}-{max} 位"
)
private
String
title
;
/**
* 使用说明
*/
@Length
(
max
=
255
,
message
=
"使用说明最大长度为 {max} 位"
)
private
String
description
;
// ========== 基本信息 END ==========
// ========== 领取规则 BEGIN ==========
/**
* 每人限领个数
*
* null - 则表示不限制
*/
private
Integer
quota
;
/**
* 剩余可用库存
*
* null - 则表示无限库存
*/
private
Integer
stock
;
// ========== 领取规则 END ==========
// ========== 使用规则 BEGIN ==========
/**
* 是否设置满多少金额可用,单位:分
*
* 0-不限制
* 大于0-多少金额可用
*/
@NotNull
(
message
=
"使用金额门槛不能为空"
)
private
Integer
priceAvailable
;
/**
* 可用范围的类型
*
* 10-全部(ALL):所有可用
* 20-部分(PART):部分商品可用,或指定商品可用
* 21-部分(PART):部分商品不可用,或指定商品可用
* 30-部分(PART):部分分类可用,或指定商品可用
* 31-部分(PART):部分分类不可用,或指定商品可用
*/
@NotNull
(
message
=
"可用范围的类型不能为空"
)
private
Integer
rangeType
;
/**
* 指定商品 / 分类列表,使用逗号分隔商品编号
*/
private
String
rangeValues
;
/**
* 生效日期类型
*
* 1-固定日期
* 2-领取日期:领到券 {@link #fixedTerm} 日开始 N 天内有效
*/
@NotNull
(
message
=
"生效日期类型不能为空"
)
private
Integer
dateType
;
/**
* 固定日期-生效开始时间
*/
private
Date
validStartTime
;
/**
* 固定日期-生效结束时间
*/
private
Date
validEndTime
;
// /**
// * 领取日期-开始天数
// *
// * 例如,0-当天;1-次天
// */
// private Integer fixedBeginTerm;
/**
* 领取日期-结束天数
*/
private
Integer
fixedTerm
;
// ========== 使用规则 END ==========
// ========== 使用效果 BEGIN ==========
/**
* 优惠类型
*
* 1-代金卷
* 2-折扣卷
*/
private
Integer
preferentialType
;
/**
* 折扣百分比。
*
* 例如,80% 为 80。
* 当 100% 为 100 ,则代表免费。
*/
private
Integer
percentOff
;
/**
* 优惠金额,单位:分
*/
private
Integer
priceOff
;
/**
* 折扣上限,仅在 {@link #preferentialType} 等于 2 时生效。
*
* 例如,折扣上限为 20 元,当使用 8 折优惠券,订单金额为 1000 元时,最高只可折扣 20 元,而非 80 元。
*/
private
Integer
discountPriceLimit
;
// ========== 使用效果 END ==========
}
}
promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dao/CouponTemplateMapper.java
0 → 100644
浏览文件 @
e1db53e3
package
cn
.
iocoder
.
mall
.
promotion
.
biz
.
dao
;
import
cn.iocoder.mall.promotion.biz.dataobject.CouponTemplateDO
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
@Repository
public
interface
CouponTemplateMapper
{
CouponTemplateDO
selectById
(
@Param
(
"id"
)
Integer
id
);
List
<
CouponTemplateDO
>
selectListByPage
(
@Param
(
"title"
)
String
title
,
@Param
(
"status"
)
Integer
status
,
@Param
(
"preferentialType"
)
Integer
preferentialType
,
@Param
(
"offset"
)
Integer
offset
,
@Param
(
"limit"
)
Integer
limit
);
Integer
selectCountByPage
(
@Param
(
"title"
)
String
title
,
@Param
(
"status"
)
Integer
status
,
@Param
(
"preferentialType"
)
Integer
preferentialType
);
void
insert
(
CouponTemplateDO
couponTemplate
);
int
update
(
CouponTemplateDO
couponTemplate
);
}
promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/CouponTemplateDO.java
浏览文件 @
e1db53e3
...
@@ -54,22 +54,14 @@ public class CouponTemplateDO extends BaseDO {
...
@@ -54,22 +54,14 @@ public class CouponTemplateDO extends BaseDO {
// * 是否可分享领取链接
// * 是否可分享领取链接
// */
// */
// private Boolean isShare;
// private Boolean isShare;
/**
//
/**
* 设置为失效时间
//
* 设置为失效时间
*/
//
*/
private
Date
invalidTime
;
//
private Date invalidTime;
// /**
// /**
// * 删除时间
// * 删除时间
// */
// */
// private Date deleteTime;
// private Date deleteTime;
/**
* 可领取的开始时间
*/
private
Date
beginTime
;
/**
* 可领取的结束时间
*/
private
Date
endTime
;
// ========== 基本信息 END ==========
// ========== 基本信息 END ==========
...
@@ -208,10 +200,10 @@ public class CouponTemplateDO extends BaseDO {
...
@@ -208,10 +200,10 @@ public class CouponTemplateDO extends BaseDO {
// * 领取优惠券的人数
// * 领取优惠券的人数
// */
// */
// private Integer statFetchUserNum;
// private Integer statFetchUserNum;
//
/**
/**
//
* 领取优惠券的次数
* 领取优惠券的次数
//
*/
*/
//
private Integer statFetchNum;
private
Integer
statFetchNum
;
// /**
// /**
// * 使用优惠券的次数
// * 使用优惠券的次数
// */
// */
...
...
promotion/promotion-service-impl/src/main/resources/mapper/CouponTemplateMapper.xml
0 → 100644
浏览文件 @
e1db53e3
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"cn.iocoder.mall.promotion.biz.dao.CouponTemplateMapper"
>
<sql
id=
"FIELDS"
>
id, title, description, type, code_type,
status, quota, stock, price_available, range_type,
range_values, date_type, valid_start_time, valid_end_time, fixed_term,
preferential_type, percent_off, price_off, discount_price_limit, stat_fetch_num,
create_time
</sql>
<!-- <select id="selectListByPidAndStatusOrderBySort" resultType="CouponTemplateDO">-->
<!-- SELECT-->
<!-- <include refid="FIELDS" />-->
<!-- FROM coupon_template-->
<!-- WHERE pid = #{pid}-->
<!-- AND status = #{status}-->
<!-- AND deleted = 0-->
<!-- ORDER BY sort ASC-->
<!-- </select>-->
<!-- <select id="selectList" resultType="CouponTemplateDO">-->
<!-- SELECT-->
<!-- <include refid="FIELDS" />-->
<!-- FROM coupon_template-->
<!-- WHERE deleted = 0-->
<!-- </select>-->
<select
id=
"selectById"
parameterType=
"Integer"
resultType=
"CouponTemplateDO"
>
SELECT
<include
refid=
"FIELDS"
/>
FROM coupon_template
WHERE id = #{id}
</select>
<select
id=
"selectListByPage"
resultType=
"CouponTemplateDO"
>
SELECT
<include
refid=
"FIELDS"
/>
FROM coupon_template
<where>
<if
test=
"title != null"
>
title LIKE "%"#{title}"%"
</if>
<if
test=
"status != null"
>
AND status = #{status}
</if>
<if
test=
"preferentialType != null"
>
AND preferential_type = #{preferentialType}
</if>
</where>
LIMIT #{offset}, #{limit}
</select>
<select
id=
"selectCountByPage"
resultType=
"Integer"
>
SELECT
COUNT(1)
FROM coupon_template
<where>
<if
test=
"title != null"
>
title LIKE "%"#{title}"%"
</if>
<if
test=
"status != null"
>
AND status = #{status}
</if>
<if
test=
"preferentialType != null"
>
AND preferential_type = #{preferentialType}
</if>
</where>
</select>
<insert
id=
"insert"
parameterType=
"CouponTemplateDO"
useGeneratedKeys=
"true"
keyColumn=
"id"
keyProperty=
"id"
>
INSERT INTO coupon_template (
title, description, type, code_type,
status, quota, stock, price_available, range_type,
range_values, date_type, valid_start_time, valid_end_time, fixed_term,
preferential_type, percent_off, price_off, discount_price_limit, stat_fetch_num,
create_time
) VALUES (
#{title}, #{description, #{type, #{code_type},
#{status}, #{quota, #{stock}, #{priceAvailable}, #{rangeType},
#{rangeValues}, #{dateType}, #{validStartTime}, #{validEndTime, #{fixedTerm},
#{preferentialType, #{percentOff}, #{priceOff}, #{discountPriceLimit}, #{statFetchNum},
#{createTime}
)
</insert>
<update
id=
"update"
parameterType=
"CouponTemplateDO"
>
UPDATE coupon_template
<set>
<if
test=
"title != null"
>
title = #{title},
</if>
<if
test=
"description != null"
>
description = #{description},
</if>
<if
test=
"status != null"
>
status = #{status},
</if>
<if
test=
"quota != null"
>
quota = #{quota},
</if>
<if
test=
"stock != null"
>
stock = #{stock},
</if>
<if
test=
"priceAvailable != null"
>
price_available = #{priceAvailable}
</if>
<if
test=
"rangeType != null"
>
range_type = #{rangeType}
</if>
<if
test=
"rangeValues != null"
>
range_values = #{rangeValues}
</if>
<if
test=
"dateType != null"
>
date_type = #{dateType}
</if>
<if
test=
"validStartTime != null"
>
valid_start_time = #{validStartTime}
</if>
<if
test=
"validEndTime != null"
>
valid_end_time = #{validEndTime}
</if>
<if
test=
"fixedTerm != null"
>
fixed_term = #{fixedTerm}
</if>
<if
test=
"preferentialType != null"
>
preferential_type = #{preferentialType}
</if>
<if
test=
"percentOff != null"
>
percent_off = #{percentOff}
</if>
<if
test=
"priceOff != null"
>
price_off = #{priceOff}
</if>
<if
test=
"discountPriceLimit != null"
>
discount_price_limit = #{discountPriceLimit}
</if>
</set>
WHERE id = #{id}
</update>
</mapper>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论