Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yudao-cloud
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
hblj
yudao-cloud
Commits
f8ae2153
提交
f8ae2153
authored
4月 05, 2019
作者:
YunaiV
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
后端 + 前端:优惠劵更新功能
上级
7f024bec
隐藏空白字符变更
内嵌
并排
正在显示
18 个修改的文件
包含
1138 行增加
和
54 行删除
+1138
-54
proxy.dev.js
admin-web/config/proxy/proxy.dev.js
+2
-1
couponCardTemplateList.js
admin-web/src/models/promotion/couponCardTemplateList.js
+19
-20
CouponCardTemplateList.js
admin-web/src/pages/Promotion/CouponCardTemplateList.js
+32
-21
promotion.js
admin-web/src/services/promotion.js
+6
-0
OrderRecipientMapper.xml
...rvice-impl/target/classes/mapper/OrderRecipientMapper.xml
+35
-0
OrderRecipientConvertImpl.java
...der/mall/order/biz/convert/OrderRecipientConvertImpl.java
+65
-0
AdminsCouponTemplateController.java
...ion/controller/admins/AdminsCouponTemplateController.java
+30
-2
CouponTemplateConvertImpl.java
...motion/application/convert/CouponTemplateConvertImpl.java
+109
-0
ProductRecommendConvertImpl.java
...tion/application/convert/ProductRecommendConvertImpl.java
+115
-0
PromotionErrorCodeEnum.java
...r/mall/promotion/api/constant/PromotionErrorCodeEnum.java
+8
-3
CouponCardTemplateAddDTO.java
...oder/mall/promotion/api/dto/CouponCardTemplateAddDTO.java
+0
-1
CouponCardTemplateUpdateDTO.java
...r/mall/promotion/api/dto/CouponCardTemplateUpdateDTO.java
+192
-0
CouponTemplateConvert.java
...der/mall/promotion/biz/convert/CouponTemplateConvert.java
+9
-1
CouponServiceImpl.java
...iocoder/mall/promotion/biz/service/CouponServiceImpl.java
+20
-5
CouponTemplateMapper.xml
...rvice-impl/target/classes/mapper/CouponTemplateMapper.xml
+152
-0
ProductRecommendMapper.xml
...ice-impl/target/classes/mapper/ProductRecommendMapper.xml
+126
-0
CouponTemplateConvertImpl.java
...mall/promotion/biz/convert/CouponTemplateConvertImpl.java
+135
-0
ProductRecommendConvertImpl.java
...ll/promotion/biz/convert/ProductRecommendConvertImpl.java
+83
-0
没有找到文件。
admin-web/config/proxy/proxy.dev.js
浏览文件 @
f8ae2153
...
...
@@ -20,7 +20,8 @@ export default {
pathRewrite
:
{},
},
'/promotion-api/'
:
{
target
:
'http://180.167.213.26:18085/'
,
// target: 'http://180.167.213.26:18085/',
target
:
'http://127.0.0.1:18085/'
,
changeOrigin
:
true
,
pathRewrite
:
{},
},
...
...
admin-web/src/models/promotion/couponCardTemplateList.js
浏览文件 @
f8ae2153
import
{
message
}
from
'antd'
;
import
{
deleteProductRecommend
,
updateProductRecommend
,
updateProductRecommendStatus
,
addCouponCardTemplate
,
updateCouponCardTemplate
,
getCouponCardTemplatePage
,
}
from
'../../services/promotion'
;
import
PaginationHelper
from
'../../../helpers/PaginationHelper'
;
const
SEARCH_PARAMS_DEFAULT
=
{
// type: 1
,
title
:
''
,
};
export
default
{
...
...
@@ -50,7 +49,7 @@ export default {
list
:
response
.
data
.
list
,
pagination
:
PaginationHelper
.
formatPagination
(
response
.
data
,
payload
),
searchParams
:
{
// type: payload.typ
e
title
:
payload
.
titl
e
}
},
});
...
...
@@ -100,7 +99,7 @@ export default {
});
// 请求
const
response
=
yield
call
(
update
ProductRecommend
,
body
);
const
response
=
yield
call
(
update
CouponCardTemplate
,
body
);
// 响应
if
(
response
.
code
===
0
)
{
if
(
callback
)
{
...
...
@@ -138,21 +137,21 @@ export default {
}
},
*
delete
({
payload
},
{
call
,
put
})
{
// 请求
const
response
=
yield
call
(
deleteProductRecommend
,
payload
);
// 响应
if
(
response
.
code
===
0
)
{
message
.
info
(
'删除成功!'
);
// 刷新列表
yield
put
({
type
:
'query'
,
payload
:
{
...
PaginationHelper
.
defaultPayload
},
});
}
},
//
* delete({ payload }, { call, put }) {
//
// 请求
//
const response = yield call(deleteProductRecommend, payload);
//
// 响应
//
if (response.code === 0) {
//
message.info('删除成功!');
//
// 刷新列表
//
yield put({
//
type: 'query',
//
payload: {
//
...PaginationHelper.defaultPayload
//
},
//
});
//
}
//
},
},
...
...
admin-web/src/pages/Promotion/CouponCardTemplateList.js
浏览文件 @
f8ae2153
...
...
@@ -136,6 +136,7 @@ function List ({ dataSource, loading, pagination, searchParams, dispatch,
// 支付金额(元) TODO 芋艿
// 客单价(元) TODO 芋艿
render
(
val
,
record
)
{
// debugger;
return
`
${
record
.
statFetchNum
}
/ `
+
(
record
.
total
-
record
.
statFetchNum
);
}
},
...
...
@@ -302,6 +303,16 @@ const AddOrUpdateForm = Form.create()(props => {
body
:
{
id
:
formVals
.
id
,
...
newFileds
,
priceAvailable
:
undefined
,
dateType
:
undefined
,
validStartTime
:
undefined
,
validEndTime
:
undefined
,
fixedStartTerm
:
undefined
,
fixedEndTerm
:
undefined
,
preferentialType
:
undefined
,
priceOff
:
undefined
,
percentOff
:
undefined
,
discountPriceLimit
:
undefined
,
},
callback
:
()
=>
{
// 清空表单
...
...
@@ -381,14 +392,14 @@ const AddOrUpdateForm = Form.create()(props => {
<
FormItem
labelCol
=
{{
span
:
5
}}
wrapperCol
=
{{
span
:
15
}}
label
=
"使用金额门槛"
>
{
form
.
getFieldDecorator
(
'priceAvailable'
,
{
rules
:
[{
required
:
true
,
message
:
'请输入使用金额门槛!'
},],
initialValue
:
formVals
.
priceAvailable
,
})(
<
InputNumber
placeholder
=
"请输入"
/>
)}
元
initialValue
:
formVals
.
priceAvailable
/
100.0
,
})(
<
InputNumber
disabled
=
{
modalType
!=
'add'
}
placeholder
=
"请输入"
/>
)}
元
<
/FormItem
>
<
FormItem
labelCol
=
{{
span
:
5
}}
wrapperCol
=
{{
span
:
15
}}
label
=
"可用范围"
>
{
form
.
getFieldDecorator
(
'rangeType'
,
{
rules
:
[{
required
:
true
,
message
:
'请选择可用范围!'
},
// TODO 芋艿,需要修改
],
initialValue
:
formVals
.
rangeType
,
initialValue
:
formVals
.
rangeType
+
''
,
})(
<
Select
placeholder
=
"请选择"
style
=
{{
maxWidth
:
200
,
width
:
'100%'
}}
onChange
=
{
onRangeTypeChange
}
>
<
SelectOption
value
=
"10"
>
所有可用
<
/SelectOption
>
...
...
@@ -416,10 +427,10 @@ const AddOrUpdateForm = Form.create()(props => {
{
form
.
getFieldDecorator
(
'dateType'
,
{
rules
:
[{
required
:
true
,
message
:
'请选择可用范围!'
},
// TODO 芋艿,需要修改
],
initialValue
:
formVals
.
dateType
,
initialValue
:
formVals
.
dateType
+
''
,
})(
<
Select
placeholder
=
"请选择"
style
=
{{
maxWidth
:
200
,
width
:
'100%'
}}
onChange
=
{
onDateTypeChange
}
>
<
SelectOption
value
=
"1"
><
/SelectOption
>
<
Select
disabled
=
{
modalType
!=
'add'
}
placeholder
=
"请选择"
style
=
{{
maxWidth
:
200
,
width
:
'100%'
}}
onChange
=
{
onDateTypeChange
}
>
<
SelectOption
value
=
"1"
>
固定日期
<
/SelectOption
>
<
SelectOption
value
=
"2"
>
领取日期
<
/SelectOption
>
<
/Select
>
)}
...
...
@@ -429,29 +440,29 @@ const AddOrUpdateForm = Form.create()(props => {
<
FormItem
labelCol
=
{{
span
:
5
}}
wrapperCol
=
{{
span
:
15
}}
label
=
"固定日期"
>
{
form
.
getFieldDecorator
(
'validStartTime'
,
{
rules
:
[{
required
:
true
,
message
:
'请输入固定日期!'
},],
initialValue
:
formVals
.
validStartTime
,
})(
<
DatePicker
format
=
"YYYY-MM-DD"
/>
)}
initialValue
:
formVals
.
validStartTime
?
moment
(
formVals
.
validStartTime
)
:
undefined
,
})(
<
DatePicker
disabled
=
{
modalType
!=
'add'
}
format
=
"YYYY-MM-DD"
/>
)}
&
nbsp
;
-&
nbsp
;
{
form
.
getFieldDecorator
(
'validEndTime'
,
{
rules
:
[{
required
:
true
,
message
:
'请输入固定日期!'
},],
initialValue
:
formVals
.
validEndTime
,
})(
<
DatePicker
format
=
"YYYY-MM-DD"
/>
)}
initialValue
:
formVals
.
validEndTime
?
moment
(
formVals
.
validEndTime
)
:
undefined
,
})(
<
DatePicker
disabled
=
{
modalType
!=
'add'
}
format
=
"YYYY-MM-DD"
/>
)}
<
/FormItem> : '
'
}
{
formVals
.
dateType
==
2
?
<
FormItem
labelCol
=
{{
span
:
5
}}
wrapperCol
=
{{
span
:
15
}}
label
=
"领取日期"
>
{
form
.
getFieldDecorator
(
'fixed
Begin
Term'
,
{
{
form
.
getFieldDecorator
(
'fixed
Start
Term'
,
{
rules
:
[{
required
:
true
,
message
:
'请输入固定日期!'
},
{
min
:
1
,
type
:
'number'
,
message
:
'最小值为 1'
}],
initialValue
:
formVals
.
fixed
Begin
Term
,
})(
<
InputNumber
placeholder
=
"请输入"
/>
)}
initialValue
:
formVals
.
fixed
Start
Term
,
})(
<
InputNumber
disabled
=
{
modalType
!=
'add'
}
placeholder
=
"请输入"
/>
)}
&
nbsp
;
-&
nbsp
;
{
form
.
getFieldDecorator
(
'fixedEndTerm'
,
{
rules
:
[{
required
:
true
,
message
:
'请输入固定日期!'
},
{
min
:
1
,
type
:
'number'
,
message
:
'最小值为 1'
}],
initialValue
:
formVals
.
fixedEndTerm
,
})(
<
InputNumber
placeholder
=
"请输入"
/>
)}
天
})(
<
InputNumber
disabled
=
{
modalType
!=
'add'
}
placeholder
=
"请输入"
/>
)}
天
<
/FormItem> : '
'
}
...
...
@@ -459,9 +470,9 @@ const AddOrUpdateForm = Form.create()(props => {
{
form
.
getFieldDecorator
(
'preferentialType'
,
{
rules
:
[{
required
:
true
,
message
:
'请选择优惠类型!'
},
// TODO 芋艿,需要修改
],
initialValue
:
formVals
.
preferentialType
,
initialValue
:
formVals
.
preferentialType
+
''
,
})(
<
Select
placeholder
=
"请选择"
style
=
{{
maxWidth
:
200
,
width
:
'100%'
}}
onChange
=
{
onPreferentialTypeChange
}
>
<
Select
disabled
=
{
modalType
!=
'add'
}
placeholder
=
"请选择"
style
=
{{
maxWidth
:
200
,
width
:
'100%'
}}
onChange
=
{
onPreferentialTypeChange
}
>
<
SelectOption
value
=
"1"
>
代金卷
<
/SelectOption
>
<
SelectOption
value
=
"2"
>
折扣卷
<
/SelectOption
>
<
/Select
>
...
...
@@ -473,8 +484,8 @@ const AddOrUpdateForm = Form.create()(props => {
{
form
.
getFieldDecorator
(
'priceOff'
,
{
rules
:
[{
required
:
true
,
message
:
'请输入优惠金额!'
},
{
min
:
0.01
,
type
:
'number'
,
message
:
'最小值为 0.01'
}],
initialValue
:
formVals
.
priceOff
,
})(
<
InputNumber
placeholder
=
"请输入"
/>
)}
initialValue
:
formVals
.
priceOff
?
formVals
.
priceOff
/
100.0
:
undefined
,
})(
<
InputNumber
disabled
=
{
modalType
!=
'add'
}
placeholder
=
"请输入"
/>
)}
<
/FormItem> : '
'
}
{
...
...
@@ -486,15 +497,15 @@ const AddOrUpdateForm = Form.create()(props => {
{
min
:
1
,
max
:
99
,
type
:
'number'
,
message
:
'范围为 [1, 99]'
},
],
initialValue
:
formVals
.
percentOff
,
})(
<
InputNumber
placeholder
=
"请输入"
/>
)}
%
})(
<
InputNumber
disabled
=
{
modalType
!=
'add'
}
placeholder
=
"请输入"
/>
)}
%
<
/FormItem
>
<
FormItem
labelCol
=
{{
span
:
5
}}
wrapperCol
=
{{
span
:
15
}}
label
=
"最多优惠"
>
{
form
.
getFieldDecorator
(
'discountPriceLimit'
,
{
rules
:
[{
required
:
false
,
message
:
'请输入最多优惠!'
},
{
min
:
0.01
,
type
:
'number'
,
message
:
'最小值为 0.01'
},
],
initialValue
:
formVals
.
discountPriceLimit
,
})(
<
InputNumber
placeholder
=
"请输入"
/>
)}
元
initialValue
:
formVals
.
discountPriceLimit
?
formVals
.
discountPriceLimit
/
100.0
:
undefineds
,
})(
<
InputNumber
disabled
=
{
modalType
!=
'add'
}
placeholder
=
"请输入"
/>
)}
元
<
/FormItem
>
<
/span> : '
'
}
...
...
admin-web/src/services/promotion.js
浏览文件 @
f8ae2153
...
...
@@ -78,3 +78,9 @@ export async function addCouponCardTemplate(params) {
method
:
'POST'
,
});
}
export
async
function
updateCouponCardTemplate
(
params
)
{
return
request
(
`/promotion-api/admins/coupon/template/update_card?
${
stringify
(
params
)}
`
,
{
method
:
'POST'
,
});
}
order/order-service-impl/target/classes/mapper/OrderRecipientMapper.xml
0 → 100644
浏览文件 @
f8ae2153
<?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.order.biz.dao.OrderRecipientMapper"
>
<sql
id=
"FIELDS"
>
id, order_id, `area_no`, `name`, mobile, address,
create_time, update_time
</sql>
<!--
插入数据
-->
<insert
id=
"insert"
parameterType=
"OrderRecipientDO"
useGeneratedKeys=
"true"
keyColumn=
"id"
keyProperty=
"id"
>
INSERT INTO `order_recipient` (
order_id, `area_no`, `name`, mobile, address,
create_time, update_time
) VALUES (
#{orderId}, #{areaNo}, #{name}, #{mobile}, #{address},
#{createTime}, #{updateTime}
)
</insert>
<!--
查询 - 根据 orderIds
-->
<select
id=
"selectByOrderIds"
resultType=
"cn.iocoder.mall.order.biz.dataobject.OrderRecipientDO"
>
SELECT
<include
refid=
"FIELDS"
/>
FROM `order_recipient`
WHERE order_id IN
<foreach
collection=
"orderIds"
item=
"orderId"
separator=
","
open=
"("
close=
")"
>
#{orderId}
</foreach>
</select>
</mapper>
order/order-service-impl/target/generated-sources/annotations/cn/iocoder/mall/order/biz/convert/OrderRecipientConvertImpl.java
0 → 100644
浏览文件 @
f8ae2153
package
cn
.
iocoder
.
mall
.
order
.
biz
.
convert
;
import
cn.iocoder.mall.order.api.bo.OrderRecipientBO
;
import
cn.iocoder.mall.order.api.dto.OrderCreateDTO
;
import
cn.iocoder.mall.order.biz.dataobject.OrderRecipientDO
;
import
java.util.ArrayList
;
import
java.util.List
;
import
javax.annotation.Generated
;
@Generated
(
value
=
"org.mapstruct.ap.MappingProcessor"
,
date
=
"2019-04-05T22:26:02+0800"
,
comments
=
"version: 1.3.0.Final, compiler: javac, environment: Java 11.0.1 (Oracle Corporation)"
)
public
class
OrderRecipientConvertImpl
implements
OrderRecipientConvert
{
@Override
public
OrderRecipientDO
convert
(
OrderCreateDTO
orderCreateDTO
)
{
if
(
orderCreateDTO
==
null
)
{
return
null
;
}
OrderRecipientDO
orderRecipientDO
=
new
OrderRecipientDO
();
orderRecipientDO
.
setAreaNo
(
orderCreateDTO
.
getAreaNo
()
);
orderRecipientDO
.
setName
(
orderCreateDTO
.
getName
()
);
orderRecipientDO
.
setMobile
(
orderCreateDTO
.
getMobile
()
);
orderRecipientDO
.
setAddress
(
orderCreateDTO
.
getAddress
()
);
return
orderRecipientDO
;
}
@Override
public
List
<
OrderRecipientBO
>
convert
(
List
<
OrderRecipientDO
>
orderRecipientDOList
)
{
if
(
orderRecipientDOList
==
null
)
{
return
null
;
}
List
<
OrderRecipientBO
>
list
=
new
ArrayList
<
OrderRecipientBO
>(
orderRecipientDOList
.
size
()
);
for
(
OrderRecipientDO
orderRecipientDO
:
orderRecipientDOList
)
{
list
.
add
(
orderRecipientDOToOrderRecipientBO
(
orderRecipientDO
)
);
}
return
list
;
}
protected
OrderRecipientBO
orderRecipientDOToOrderRecipientBO
(
OrderRecipientDO
orderRecipientDO
)
{
if
(
orderRecipientDO
==
null
)
{
return
null
;
}
OrderRecipientBO
orderRecipientBO
=
new
OrderRecipientBO
();
orderRecipientBO
.
setCreateTime
(
orderRecipientDO
.
getCreateTime
()
);
orderRecipientBO
.
setUpdateTime
(
orderRecipientDO
.
getUpdateTime
()
);
orderRecipientBO
.
setId
(
orderRecipientDO
.
getId
()
);
orderRecipientBO
.
setOrderId
(
orderRecipientDO
.
getOrderId
()
);
orderRecipientBO
.
setAreaNo
(
orderRecipientDO
.
getAreaNo
()
);
orderRecipientBO
.
setName
(
orderRecipientDO
.
getName
()
);
orderRecipientBO
.
setMobile
(
orderRecipientDO
.
getMobile
()
);
orderRecipientBO
.
setAddress
(
orderRecipientDO
.
getAddress
()
);
return
orderRecipientBO
;
}
}
promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/controller/admins/AdminsCouponTemplateController.java
浏览文件 @
f8ae2153
...
...
@@ -6,6 +6,7 @@ import cn.iocoder.mall.promotion.api.CouponService;
import
cn.iocoder.mall.promotion.api.bo.CouponTemplateBO
;
import
cn.iocoder.mall.promotion.api.bo.CouponTemplatePageBO
;
import
cn.iocoder.mall.promotion.api.dto.CouponCardTemplateAddDTO
;
import
cn.iocoder.mall.promotion.api.dto.CouponCardTemplateUpdateDTO
;
import
cn.iocoder.mall.promotion.api.dto.CouponTemplatePageDTO
;
import
cn.iocoder.mall.promotion.application.convert.CouponTemplateConvert
;
import
cn.iocoder.mall.promotion.application.vo.admins.AdminsCouponTemplatePageVO
;
...
...
@@ -31,7 +32,7 @@ public class AdminsCouponTemplateController {
// ========== 优惠劵(码)模板 ==========
@GetMapping
(
"/template/page"
)
@ApiOperation
(
value
=
"
Banner
分页"
)
@ApiOperation
(
value
=
"
优惠劵(码)模板
分页"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"title"
,
value
=
"标题,模糊匹配"
,
example
=
"活动 A"
),
@ApiImplicitParam
(
name
=
"pageNo"
,
value
=
"页码,从 1 开始"
,
example
=
"1"
),
...
...
@@ -75,7 +76,7 @@ public class AdminsCouponTemplateController {
@RequestParam
(
value
=
"total"
,
required
=
false
)
Integer
total
,
@RequestParam
(
value
=
"priceAvailable"
)
Integer
priceAvailable
,
@RequestParam
(
value
=
"rangeType"
)
Integer
rangeType
,
@RequestParam
(
value
=
"range
Type
"
,
required
=
false
)
String
rangeValues
,
@RequestParam
(
value
=
"range
Values
"
,
required
=
false
)
String
rangeValues
,
@RequestParam
(
value
=
"dateType"
)
Integer
dateType
,
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd"
)
@RequestParam
(
value
=
"validStartTime"
,
required
=
false
)
Date
validStartTime
,
...
...
@@ -103,6 +104,33 @@ public class AdminsCouponTemplateController {
return
CouponTemplateConvert
.
INSTANCE
.
convert2
(
result
);
}
@PostMapping
(
"/template/update_card"
)
@ApiOperation
(
value
=
"更新优惠劵模板"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"id"
,
value
=
"编号"
,
required
=
true
,
example
=
"1"
),
@ApiImplicitParam
(
name
=
"title"
,
value
=
"标题"
,
required
=
true
,
example
=
"优惠劵牛逼"
),
@ApiImplicitParam
(
name
=
"description"
,
value
=
"使用说明"
,
example
=
"我只是描述"
),
@ApiImplicitParam
(
name
=
"quota"
,
value
=
"每人限领个数"
,
required
=
true
),
@ApiImplicitParam
(
name
=
"total"
,
value
=
"发行总量"
),
@ApiImplicitParam
(
name
=
"rangeType"
,
value
=
"可用范围的类型"
,
required
=
true
,
example
=
"参见 CouponTemplateRangeTypeEnum 枚举"
),
@ApiImplicitParam
(
name
=
"rangeValues"
,
value
=
"指定商品 / 分类列表,使用逗号分隔商品编号"
),
})
public
CommonResult
<
Boolean
>
update
(
@RequestParam
(
value
=
"id"
)
Integer
id
,
@RequestParam
(
value
=
"title"
)
String
title
,
@RequestParam
(
value
=
"description"
,
required
=
false
)
String
description
,
@RequestParam
(
value
=
"quota"
)
Integer
quota
,
@RequestParam
(
value
=
"total"
,
required
=
false
)
Integer
total
,
@RequestParam
(
value
=
"rangeType"
)
Integer
rangeType
,
@RequestParam
(
value
=
"rangeValues"
,
required
=
false
)
String
rangeValues
)
{
// 创建 CouponCardTemplateAddDTO 对象
CouponCardTemplateUpdateDTO
couponCardTemplateUpdateDTO
=
new
CouponCardTemplateUpdateDTO
()
.
setId
(
id
)
.
setTitle
(
title
).
setDescription
(
description
)
.
setQuota
(
quota
).
setTotal
(
total
)
.
setRangeType
(
rangeType
).
setRangeValues
(
rangeValues
);
return
couponService
.
updateCouponCardTemplate
(
couponCardTemplateUpdateDTO
);
}
// ========== 优惠劵 ==========
// ========== 优惠码 ==========
...
...
promotion/promotion-application/target/generated-sources/annotations/cn/iocoder/mall/promotion/application/convert/CouponTemplateConvertImpl.java
0 → 100644
浏览文件 @
f8ae2153
package
cn
.
iocoder
.
mall
.
promotion
.
application
.
convert
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.mall.promotion.api.bo.CouponTemplateBO
;
import
cn.iocoder.mall.promotion.api.bo.CouponTemplatePageBO
;
import
cn.iocoder.mall.promotion.application.vo.admins.AdminsCouponTemplatePageVO
;
import
cn.iocoder.mall.promotion.application.vo.admins.AdminsCouponTemplateVO
;
import
java.util.ArrayList
;
import
java.util.List
;
import
javax.annotation.Generated
;
@Generated
(
value
=
"org.mapstruct.ap.MappingProcessor"
,
date
=
"2019-04-05T22:26:04+0800"
,
comments
=
"version: 1.3.0.Final, compiler: javac, environment: Java 11.0.1 (Oracle Corporation)"
)
public
class
CouponTemplateConvertImpl
implements
CouponTemplateConvert
{
@Override
public
AdminsCouponTemplateVO
convert
(
CouponTemplateBO
template
)
{
if
(
template
==
null
)
{
return
null
;
}
AdminsCouponTemplateVO
adminsCouponTemplateVO
=
new
AdminsCouponTemplateVO
();
adminsCouponTemplateVO
.
setId
(
template
.
getId
()
);
adminsCouponTemplateVO
.
setTitle
(
template
.
getTitle
()
);
adminsCouponTemplateVO
.
setDescription
(
template
.
getDescription
()
);
adminsCouponTemplateVO
.
setType
(
template
.
getType
()
);
adminsCouponTemplateVO
.
setCodeType
(
template
.
getCodeType
()
);
adminsCouponTemplateVO
.
setStatus
(
template
.
getStatus
()
);
adminsCouponTemplateVO
.
setQuota
(
template
.
getQuota
()
);
adminsCouponTemplateVO
.
setPriceAvailable
(
template
.
getPriceAvailable
()
);
adminsCouponTemplateVO
.
setRangeType
(
template
.
getRangeType
()
);
adminsCouponTemplateVO
.
setRangeValues
(
template
.
getRangeValues
()
);
adminsCouponTemplateVO
.
setDateType
(
template
.
getDateType
()
);
adminsCouponTemplateVO
.
setValidStartTime
(
template
.
getValidStartTime
()
);
adminsCouponTemplateVO
.
setValidEndTime
(
template
.
getValidEndTime
()
);
adminsCouponTemplateVO
.
setFixedStartTerm
(
template
.
getFixedStartTerm
()
);
adminsCouponTemplateVO
.
setFixedEndTerm
(
template
.
getFixedEndTerm
()
);
adminsCouponTemplateVO
.
setPreferentialType
(
template
.
getPreferentialType
()
);
adminsCouponTemplateVO
.
setPercentOff
(
template
.
getPercentOff
()
);
adminsCouponTemplateVO
.
setPriceOff
(
template
.
getPriceOff
()
);
adminsCouponTemplateVO
.
setDiscountPriceLimit
(
template
.
getDiscountPriceLimit
()
);
adminsCouponTemplateVO
.
setStatFetchNum
(
template
.
getStatFetchNum
()
);
adminsCouponTemplateVO
.
setCreateTime
(
template
.
getCreateTime
()
);
adminsCouponTemplateVO
.
setTotal
(
template
.
getTotal
()
);
return
adminsCouponTemplateVO
;
}
@Override
public
CommonResult
<
AdminsCouponTemplateVO
>
convert2
(
CommonResult
<
CouponTemplateBO
>
result
)
{
if
(
result
==
null
)
{
return
null
;
}
CommonResult
<
AdminsCouponTemplateVO
>
commonResult
=
new
CommonResult
<
AdminsCouponTemplateVO
>();
commonResult
.
setCode
(
result
.
getCode
()
);
commonResult
.
setMessage
(
result
.
getMessage
()
);
commonResult
.
setData
(
convert
(
result
.
getData
()
)
);
return
commonResult
;
}
@Override
public
CommonResult
<
AdminsCouponTemplatePageVO
>
convert
(
CommonResult
<
CouponTemplatePageBO
>
result
)
{
if
(
result
==
null
)
{
return
null
;
}
CommonResult
<
AdminsCouponTemplatePageVO
>
commonResult
=
new
CommonResult
<
AdminsCouponTemplatePageVO
>();
commonResult
.
setCode
(
result
.
getCode
()
);
commonResult
.
setMessage
(
result
.
getMessage
()
);
commonResult
.
setData
(
couponTemplatePageBOToAdminsCouponTemplatePageVO
(
result
.
getData
()
)
);
return
commonResult
;
}
@Override
public
List
<
AdminsCouponTemplateVO
>
convertList
(
List
<
CouponTemplateBO
>
templates
)
{
if
(
templates
==
null
)
{
return
null
;
}
List
<
AdminsCouponTemplateVO
>
list
=
new
ArrayList
<
AdminsCouponTemplateVO
>(
templates
.
size
()
);
for
(
CouponTemplateBO
couponTemplateBO
:
templates
)
{
list
.
add
(
convert
(
couponTemplateBO
)
);
}
return
list
;
}
protected
AdminsCouponTemplatePageVO
couponTemplatePageBOToAdminsCouponTemplatePageVO
(
CouponTemplatePageBO
couponTemplatePageBO
)
{
if
(
couponTemplatePageBO
==
null
)
{
return
null
;
}
AdminsCouponTemplatePageVO
adminsCouponTemplatePageVO
=
new
AdminsCouponTemplatePageVO
();
adminsCouponTemplatePageVO
.
setList
(
convertList
(
couponTemplatePageBO
.
getList
()
)
);
adminsCouponTemplatePageVO
.
setTotal
(
couponTemplatePageBO
.
getTotal
()
);
return
adminsCouponTemplatePageVO
;
}
}
promotion/promotion-application/target/generated-sources/annotations/cn/iocoder/mall/promotion/application/convert/ProductRecommendConvertImpl.java
0 → 100644
浏览文件 @
f8ae2153
package
cn
.
iocoder
.
mall
.
promotion
.
application
.
convert
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.mall.product.api.bo.ProductSpuBO
;
import
cn.iocoder.mall.promotion.api.bo.ProductRecommendBO
;
import
cn.iocoder.mall.promotion.api.bo.ProductRecommendPageBO
;
import
cn.iocoder.mall.promotion.application.vo.admins.AdminsProductRecommendPageVO
;
import
cn.iocoder.mall.promotion.application.vo.admins.AdminsProductRecommendVO
;
import
cn.iocoder.mall.promotion.application.vo.users.UsersProductRecommendVO
;
import
java.util.ArrayList
;
import
java.util.List
;
import
javax.annotation.Generated
;
@Generated
(
value
=
"org.mapstruct.ap.MappingProcessor"
,
date
=
"2019-04-05T22:26:04+0800"
,
comments
=
"version: 1.3.0.Final, compiler: javac, environment: Java 11.0.1 (Oracle Corporation)"
)
public
class
ProductRecommendConvertImpl
implements
ProductRecommendConvert
{
@Override
public
AdminsProductRecommendVO
convert
(
ProductRecommendBO
bannerBO
)
{
if
(
bannerBO
==
null
)
{
return
null
;
}
AdminsProductRecommendVO
adminsProductRecommendVO
=
new
AdminsProductRecommendVO
();
adminsProductRecommendVO
.
setId
(
bannerBO
.
getId
()
);
adminsProductRecommendVO
.
setType
(
bannerBO
.
getType
()
);
adminsProductRecommendVO
.
setProductSpuId
(
bannerBO
.
getProductSpuId
()
);
adminsProductRecommendVO
.
setSort
(
bannerBO
.
getSort
()
);
adminsProductRecommendVO
.
setStatus
(
bannerBO
.
getStatus
()
);
adminsProductRecommendVO
.
setMemo
(
bannerBO
.
getMemo
()
);
adminsProductRecommendVO
.
setCreateTime
(
bannerBO
.
getCreateTime
()
);
return
adminsProductRecommendVO
;
}
@Override
public
CommonResult
<
AdminsProductRecommendVO
>
convert2
(
CommonResult
<
ProductRecommendBO
>
result
)
{
if
(
result
==
null
)
{
return
null
;
}
CommonResult
<
AdminsProductRecommendVO
>
commonResult
=
new
CommonResult
<
AdminsProductRecommendVO
>();
commonResult
.
setCode
(
result
.
getCode
()
);
commonResult
.
setMessage
(
result
.
getMessage
()
);
commonResult
.
setData
(
convert
(
result
.
getData
()
)
);
return
commonResult
;
}
@Override
public
CommonResult
<
AdminsProductRecommendPageVO
>
convert
(
CommonResult
<
ProductRecommendPageBO
>
result
)
{
if
(
result
==
null
)
{
return
null
;
}
CommonResult
<
AdminsProductRecommendPageVO
>
commonResult
=
new
CommonResult
<
AdminsProductRecommendPageVO
>();
commonResult
.
setCode
(
result
.
getCode
()
);
commonResult
.
setMessage
(
result
.
getMessage
()
);
commonResult
.
setData
(
productRecommendPageBOToAdminsProductRecommendPageVO
(
result
.
getData
()
)
);
return
commonResult
;
}
@Override
public
UsersProductRecommendVO
convert
(
ProductSpuBO
productSpu
)
{
if
(
productSpu
==
null
)
{
return
null
;
}
UsersProductRecommendVO
usersProductRecommendVO
=
new
UsersProductRecommendVO
();
usersProductRecommendVO
.
setId
(
productSpu
.
getId
()
);
usersProductRecommendVO
.
setName
(
productSpu
.
getName
()
);
usersProductRecommendVO
.
setSellPoint
(
productSpu
.
getSellPoint
()
);
List
<
String
>
list
=
productSpu
.
getPicUrls
();
if
(
list
!=
null
)
{
usersProductRecommendVO
.
setPicUrls
(
new
ArrayList
<
String
>(
list
)
);
}
usersProductRecommendVO
.
setPrice
(
productSpu
.
getPrice
()
);
return
usersProductRecommendVO
;
}
protected
List
<
AdminsProductRecommendVO
>
productRecommendBOListToAdminsProductRecommendVOList
(
List
<
ProductRecommendBO
>
list
)
{
if
(
list
==
null
)
{
return
null
;
}
List
<
AdminsProductRecommendVO
>
list1
=
new
ArrayList
<
AdminsProductRecommendVO
>(
list
.
size
()
);
for
(
ProductRecommendBO
productRecommendBO
:
list
)
{
list1
.
add
(
convert
(
productRecommendBO
)
);
}
return
list1
;
}
protected
AdminsProductRecommendPageVO
productRecommendPageBOToAdminsProductRecommendPageVO
(
ProductRecommendPageBO
productRecommendPageBO
)
{
if
(
productRecommendPageBO
==
null
)
{
return
null
;
}
AdminsProductRecommendPageVO
adminsProductRecommendPageVO
=
new
AdminsProductRecommendPageVO
();
adminsProductRecommendPageVO
.
setList
(
productRecommendBOListToAdminsProductRecommendVOList
(
productRecommendPageBO
.
getList
()
)
);
adminsProductRecommendPageVO
.
setTotal
(
productRecommendPageBO
.
getTotal
()
);
return
adminsProductRecommendPageVO
;
}
}
promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant/PromotionErrorCodeEnum.java
浏览文件 @
f8ae2153
...
...
@@ -15,8 +15,14 @@ public enum PromotionErrorCodeEnum {
PRODUCT_RECOMMEND_PRODUCT_NOT_EXISTS
(
1006001001
,
"商品不存在"
),
PRODUCT_RECOMMEND_EXISTS
(
1006001002
,
"该商品推荐已经存在"
),
;
// ========== COUPON TEMPLATE 模块 ==========
PRODUCT_TEMPLATE_NOT_EXISTS
(
1006002000
,
"优惠劵模板(码)不存在"
),
PRODUCT_TEMPLATE_NOT_CARD
(
1006002001
,
"不是优惠劵模板"
),
PRODUCT_TEMPLATE_NOT_CODE
(
1006002002
,
"不是优惠码模板"
),
PRODUCT_TEMPLATE_TOTAL_CAN_NOT_REDUCE
(
1006002003
,
"优惠劵(码)模板的发放数量不能减小"
),
;
private
final
int
code
;
private
final
String
message
;
...
...
@@ -34,4 +40,4 @@ public enum PromotionErrorCodeEnum {
return
message
;
}
}
\ No newline at end of file
}
promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardTemplateAddDTO.java
浏览文件 @
f8ae2153
...
...
@@ -277,5 +277,4 @@ public class CouponCardTemplateAddDTO {
return
this
;
}
}
promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardTemplateUpdateDTO.java
浏览文件 @
f8ae2153
package
cn
.
iocoder
.
mall
.
promotion
.
api
.
dto
;
import
cn.iocoder.common.framework.validator.InEnum
;
import
cn.iocoder.mall.promotion.api.constant.CouponTemplateRangeTypeEnum
;
import
org.hibernate.validator.constraints.Length
;
import
javax.validation.constraints.Min
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotNull
;
public
class
CouponCardTemplateUpdateDTO
{
@NotNull
(
message
=
"编号不能为空"
)
private
Integer
id
;
// ========== 基本信息 BEGIN ==========
/**
* 标题
*/
@NotEmpty
(
message
=
"标题不能为空"
)
@Length
(
min
=
2
,
max
=
16
,
message
=
"标题长度为 {min}-{max} 位"
)
private
String
title
;
/**
* 使用说明
*/
@Length
(
max
=
255
,
message
=
"使用说明最大长度为 {max} 位"
)
private
String
description
;
// ========== 基本信息 END ==========
// ========== 领取规则 BEGIN ==========
/**
* 每人限领个数
*/
@NotNull
(
message
=
"每人限领个数不能为空"
)
@Min
(
value
=
1
,
message
=
"每人限领个数最小为 {value}"
)
private
Integer
quota
;
/**
* 发放总量
*/
@NotNull
(
message
=
"发放总量不能为空"
)
@Min
(
value
=
1
,
message
=
"每人限领个数最小为 {value}"
)
private
Integer
total
;
// ========== 领取规则 END ==========
// ========== 使用规则 BEGIN ==========
// /**
// * 是否设置满多少金额可用,单位:分
// *
// * 0-不限制
// * 大于0-多少金额可用
// */
// @NotNull(message = "使用金额门槛不能为空")
// @Min(value = 0L, message = "使用金额门槛最低为 {value}")
// private Integer priceAvailable;
/**
* 可用范围的类型
*
* 10-全部(ALL):所有可用
* 20-部分(PART):部分商品可用,或指定商品可用
* 21-部分(PART):部分商品不可用,或指定商品可用
* 30-部分(PART):部分分类可用,或指定分类可用
* 31-部分(PART):部分分类不可用,或指定分类可用
*/
@NotNull
(
message
=
"可用范围的类型不能为空"
)
@InEnum
(
value
=
CouponTemplateRangeTypeEnum
.
class
,
message
=
"可用范围的类型必须在 {value}"
)
private
Integer
rangeType
;
/**
* 指定商品 / 分类列表,使用逗号分隔商品编号
*/
private
String
rangeValues
;
// /**
// * 生效日期类型
// *
// * 1-固定日期
// * 2-领取日期:领到券 {@link #fixedEndTerm} 日开始 N 天内有效
// */
// @NotNull(message = "生效日期类型不能为空")
// @InEnum(value = CouponTemplateDateTypeEnum.class, message = "生效日期类型必须在 {value}")
// private Integer dateType;
// /**
// * 固定日期-生效开始时间
// */
// private Date validStartTime;
// /**
// * 固定日期-生效结束时间
// */
// private Date validEndTime;
// /**
// * 领取日期-开始天数
// *
// * 例如,0-当天;1-次天
// */
// @Min(value = 0L, message = "领取日期开始时间最小为 {value}")
// private Integer fixedBeginTerm;
// /**
// * 领取日期-结束天数
// */
// @Min(value = 1L, message = "领取日期结束时间最小为 {value}")
// private Integer fixedEndTerm;
// ========== 使用规则 END ==========
// ========== 使用效果 BEGIN ==========
// /**
// * 优惠类型
// *
// * 1-代金卷
// * 2-折扣卷
// */
// @NotNull(message = "优惠类型不能为空")
// @InEnum(value = CouponTemplatePreferentialTypeEnum.class, message = "优惠类型必须在 {value}")
// private Integer preferentialType;
// /**
// * 优惠金额,单位:分
// */
// @Min(value = 1, message = "优惠金额最小值为 {value}")
// private Integer priceOff;
// /**
// * 折扣百分比。
// *
// * 例如,80% 为 80。
// * 当 100% 为 100 ,则代表免费。
// */
// @Max(value = 100, message = "折扣比最大值为 {value}")
// private Integer percentOff;
// /**
// * 折扣上限,仅在 {@link #preferentialType} 等于 2 时生效。
// *
// * 例如,折扣上限为 20 元,当使用 8 折优惠券,订单金额为 1000 元时,最高只可折扣 20 元,而非 80 元。
// */
// @Min(value = 1, message = "折扣上限最小值为 {value}")
// private Integer discountPriceLimit;
// ========== 使用效果 END ==========
public
Integer
getId
()
{
return
id
;
}
public
CouponCardTemplateUpdateDTO
setId
(
Integer
id
)
{
this
.
id
=
id
;
return
this
;
}
public
String
getTitle
()
{
return
title
;
}
public
CouponCardTemplateUpdateDTO
setTitle
(
String
title
)
{
this
.
title
=
title
;
return
this
;
}
public
String
getDescription
()
{
return
description
;
}
public
CouponCardTemplateUpdateDTO
setDescription
(
String
description
)
{
this
.
description
=
description
;
return
this
;
}
public
Integer
getQuota
()
{
return
quota
;
}
public
CouponCardTemplateUpdateDTO
setQuota
(
Integer
quota
)
{
this
.
quota
=
quota
;
return
this
;
}
public
Integer
getTotal
()
{
return
total
;
}
public
CouponCardTemplateUpdateDTO
setTotal
(
Integer
total
)
{
this
.
total
=
total
;
return
this
;
}
public
Integer
getRangeType
()
{
return
rangeType
;
}
public
CouponCardTemplateUpdateDTO
setRangeType
(
Integer
rangeType
)
{
this
.
rangeType
=
rangeType
;
return
this
;
}
public
String
getRangeValues
()
{
return
rangeValues
;
}
public
CouponCardTemplateUpdateDTO
setRangeValues
(
String
rangeValues
)
{
this
.
rangeValues
=
rangeValues
;
return
this
;
}
}
promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/convert/CouponTemplateConvert.java
浏览文件 @
f8ae2153
...
...
@@ -2,7 +2,9 @@ package cn.iocoder.mall.promotion.biz.convert;
import
cn.iocoder.mall.promotion.api.bo.CouponTemplateBO
;
import
cn.iocoder.mall.promotion.api.dto.CouponCardTemplateAddDTO
;
import
cn.iocoder.mall.promotion.api.dto.CouponCardTemplateUpdateDTO
;
import
cn.iocoder.mall.promotion.api.dto.CouponCodeTemplateAddDTO
;
import
cn.iocoder.mall.promotion.api.dto.CouponCodeTemplateUpdateDTO
;
import
cn.iocoder.mall.promotion.biz.dataobject.CouponTemplateDO
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.Mappings
;
...
...
@@ -22,11 +24,17 @@ public interface CouponTemplateConvert {
List
<
CouponTemplateBO
>
convertToBO
(
List
<
CouponTemplateDO
>
templateList
);
@Mappings
({})
CouponTemplateDO
convert
(
CouponCodeTemplate
Add
DTO
template
);
CouponTemplateDO
convert
(
CouponCodeTemplate
Update
DTO
template
);
@Mappings
({})
CouponTemplateDO
convert
(
CouponCardTemplateAddDTO
template
);
@Mappings
({})
CouponTemplateDO
convert
(
CouponCardTemplateUpdateDTO
template
);
@Mappings
({})
CouponTemplateDO
convert
(
CouponCodeTemplateAddDTO
template
);
@Mappings
({})
CouponTemplateBO
convert
(
CouponTemplateDO
template
);
...
...
promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/service/CouponServiceImpl.java
浏览文件 @
f8ae2153
package
cn
.
iocoder
.
mall
.
promotion
.
biz
.
service
;
import
cn.iocoder.common.framework.constant.SysErrorCodeEnum
;
import
cn.iocoder.common.framework.util.ServiceExceptionUtil
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.mall.promotion.api.CouponService
;
import
cn.iocoder.mall.promotion.api.bo.CouponCardBO
;
import
cn.iocoder.mall.promotion.api.bo.CouponTemplateBO
;
import
cn.iocoder.mall.promotion.api.bo.CouponTemplatePageBO
;
import
cn.iocoder.mall.promotion.api.constant.CouponTemplateDateTypeEnum
;
import
cn.iocoder.mall.promotion.api.constant.CouponTemplatePreferentialTypeEnum
;
import
cn.iocoder.mall.promotion.api.constant.CouponTemplateStatusEnum
;
import
cn.iocoder.mall.promotion.api.constant.CouponTemplateTypeEnum
;
import
cn.iocoder.mall.promotion.api.constant.*
;
import
cn.iocoder.mall.promotion.api.dto.*
;
import
cn.iocoder.mall.promotion.biz.convert.CouponTemplateConvert
;
import
cn.iocoder.mall.promotion.biz.dao.CouponTemplateMapper
;
...
...
@@ -82,7 +80,24 @@ public class CouponServiceImpl implements CouponService {
@Override
public
CommonResult
<
Boolean
>
updateCouponCardTemplate
(
CouponCardTemplateUpdateDTO
couponCardTemplateUpdateDTO
)
{
return
null
;
// 校验 CouponCardTemplate 存在
CouponTemplateDO
template
=
couponTemplateMapper
.
selectById
(
couponCardTemplateUpdateDTO
.
getId
());
if
(
template
==
null
)
{
return
ServiceExceptionUtil
.
error
(
PromotionErrorCodeEnum
.
PRODUCT_TEMPLATE_NOT_EXISTS
.
getCode
());
}
// 校验 CouponCardTemplate 是 CARD
if
(!
CouponTemplateTypeEnum
.
CARD
.
getValue
().
equals
(
template
.
getType
()))
{
return
ServiceExceptionUtil
.
error
(
PromotionErrorCodeEnum
.
PRODUCT_TEMPLATE_NOT_CARD
.
getCode
());
}
// 校验发放数量不能减少
if
(
couponCardTemplateUpdateDTO
.
getTotal
()
<
template
.
getTotal
())
{
return
ServiceExceptionUtil
.
error
(
PromotionErrorCodeEnum
.
PRODUCT_TEMPLATE_TOTAL_CAN_NOT_REDUCE
.
getCode
());
}
// 更新优惠劵模板到数据库
CouponTemplateDO
updateTemplateDO
=
CouponTemplateConvert
.
INSTANCE
.
convert
(
couponCardTemplateUpdateDTO
);
couponTemplateMapper
.
update
(
updateTemplateDO
);
// 返回成功
return
CommonResult
.
success
(
true
);
}
@Override
...
...
promotion/promotion-service-impl/target/classes/mapper/CouponTemplateMapper.xml
0 → 100644
浏览文件 @
f8ae2153
<?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, total, price_available, range_type,
range_values, date_type, valid_start_time, valid_end_time, fixed_start_term, fixed_end_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=
"type != null"
>
AND type = #{type}
</if>
<if
test=
"title != null"
>
AND 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=
"type != null"
>
AND type = #{type}
</if>
<if
test=
"title != null"
>
AND 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, total, price_available, range_type,
range_values, date_type, valid_start_time, valid_end_time, fixed_start_term, fixed_end_term,
preferential_type, percent_off, price_off, discount_price_limit, stat_fetch_num,
create_time
) VALUES (
#{title}, #{description}, #{type}, #{codeType},
#{status}, #{quota}, #{total}, #{priceAvailable}, #{rangeType},
#{rangeValues}, #{dateType}, #{validStartTime}, #{validEndTime}, #{fixedStartTerm}, #{fixedEndTerm}
#{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=
"total != null"
>
total = #{total},
</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=
"fixedStartTerm != null"
>
fixed_start_term = #{fixedStartTerm},
</if>
<if
test=
"fixedEndTerm != null"
>
fixed_end_term = #{fixedEndTerm},
</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>
promotion/promotion-service-impl/target/classes/mapper/ProductRecommendMapper.xml
0 → 100644
浏览文件 @
f8ae2153
<?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.ProductRecommendMapper"
>
<sql
id=
"FIELDS"
>
id, type, product_spu_id, sort,
status, memo, create_time
</sql>
<!-- <select id="selectListByPidAndStatusOrderBySort" resultType="ProductRecommendDO">-->
<!-- SELECT-->
<!-- <include refid="FIELDS" />-->
<!-- FROM product_recommend-->
<!-- WHERE pid = #{pid}-->
<!-- AND status = #{status}-->
<!-- AND deleted = 0-->
<!-- ORDER BY sort ASC-->
<!-- </select>-->
<!-- <select id="selectList" resultType="ProductRecommendDO">-->
<!-- SELECT-->
<!-- <include refid="FIELDS" />-->
<!-- FROM product_recommend-->
<!-- WHERE deleted = 0-->
<!-- </select>-->
<select
id=
"selectById"
parameterType=
"Integer"
resultType=
"ProductRecommendDO"
>
SELECT
<include
refid=
"FIELDS"
/>
FROM product_recommend
WHERE id = #{id}
AND deleted = 0
</select>
<select
id=
"selectByProductSpuIdAndType"
resultType=
"ProductRecommendDO"
>
SELECT
<include
refid=
"FIELDS"
/>
FROM product_recommend
<where>
<if
test=
"productSpuId != null"
>
product_spu_id = #{productSpuId}
</if>
<if
test=
"type != null"
>
AND type = #{type}
</if>
AND deleted = 0
</where>
</select>
<select
id=
"selectListByTypeAndStatus"
parameterType=
"Integer"
resultType=
"ProductRecommendDO"
>
SELECT
<include
refid=
"FIELDS"
/>
FROM product_recommend
<where>
<if
test=
"type != null"
>
type = #{type}
</if>
<if
test=
"status != null"
>
AND status = #{status}
</if>
AND deleted = 0
</where>
</select>
<select
id=
"selectPageByType"
resultType=
"ProductRecommendDO"
>
SELECT
<include
refid=
"FIELDS"
/>
FROM product_recommend
<where>
<if
test=
"type != null"
>
type = #{type}
</if>
AND deleted = 0
</where>
LIMIT #{offset}, #{limit}
</select>
<select
id=
"selectCountByType"
resultType=
"Integer"
>
SELECT
COUNT(1)
FROM product_recommend
<where>
<if
test=
"type != null"
>
type = #{type}
</if>
AND deleted = 0
</where>
</select>
<insert
id=
"insert"
parameterType=
"ProductRecommendDO"
useGeneratedKeys=
"true"
keyColumn=
"id"
keyProperty=
"id"
>
INSERT INTO product_recommend (
type, product_spu_id, sort, status, memo,
create_time, deleted
) VALUES (
#{type}, #{productSpuId}, #{sort}, #{status}, #{memo},
#{createTime}, #{deleted}
)
</insert>
<update
id=
"update"
parameterType=
"ProductRecommendDO"
>
UPDATE product_recommend
<set>
<if
test=
"type != null"
>
type = #{type},
</if>
<if
test=
"productSpuId != null"
>
product_spu_id = #{productSpuId},
</if>
<if
test=
"sort != null"
>
sort = #{sort},
</if>
<if
test=
"status != null"
>
status = #{status},
</if>
<if
test=
"memo != null"
>
memo = #{memo},
</if>
<if
test=
"deleted != null"
>
deleted = #{deleted}
</if>
</set>
WHERE id = #{id}
</update>
</mapper>
\ No newline at end of file
promotion/promotion-service-impl/target/generated-sources/annotations/cn/iocoder/mall/promotion/biz/convert/CouponTemplateConvertImpl.java
0 → 100644
浏览文件 @
f8ae2153
package
cn
.
iocoder
.
mall
.
promotion
.
biz
.
convert
;
import
cn.iocoder.mall.promotion.api.bo.CouponTemplateBO
;
import
cn.iocoder.mall.promotion.api.dto.CouponCardTemplateAddDTO
;
import
cn.iocoder.mall.promotion.api.dto.CouponCardTemplateUpdateDTO
;
import
cn.iocoder.mall.promotion.api.dto.CouponCodeTemplateAddDTO
;
import
cn.iocoder.mall.promotion.api.dto.CouponCodeTemplateUpdateDTO
;
import
cn.iocoder.mall.promotion.biz.dataobject.CouponTemplateDO
;
import
java.util.ArrayList
;
import
java.util.List
;
import
javax.annotation.Generated
;
@Generated
(
value
=
"org.mapstruct.ap.MappingProcessor"
,
date
=
"2019-04-06T00:20:10+0800"
,
comments
=
"version: 1.3.0.Final, compiler: javac, environment: Java 11.0.1 (Oracle Corporation)"
)
public
class
CouponTemplateConvertImpl
implements
CouponTemplateConvert
{
@Override
public
List
<
CouponTemplateBO
>
convertToBO
(
List
<
CouponTemplateDO
>
templateList
)
{
if
(
templateList
==
null
)
{
return
null
;
}
List
<
CouponTemplateBO
>
list
=
new
ArrayList
<
CouponTemplateBO
>(
templateList
.
size
()
);
for
(
CouponTemplateDO
couponTemplateDO
:
templateList
)
{
list
.
add
(
convert
(
couponTemplateDO
)
);
}
return
list
;
}
@Override
public
CouponTemplateDO
convert
(
CouponCodeTemplateUpdateDTO
template
)
{
if
(
template
==
null
)
{
return
null
;
}
CouponTemplateDO
couponTemplateDO
=
new
CouponTemplateDO
();
return
couponTemplateDO
;
}
@Override
public
CouponTemplateDO
convert
(
CouponCardTemplateAddDTO
template
)
{
if
(
template
==
null
)
{
return
null
;
}
CouponTemplateDO
couponTemplateDO
=
new
CouponTemplateDO
();
couponTemplateDO
.
setTitle
(
template
.
getTitle
()
);
couponTemplateDO
.
setDescription
(
template
.
getDescription
()
);
couponTemplateDO
.
setQuota
(
template
.
getQuota
()
);
couponTemplateDO
.
setTotal
(
template
.
getTotal
()
);
couponTemplateDO
.
setPriceAvailable
(
template
.
getPriceAvailable
()
);
couponTemplateDO
.
setRangeType
(
template
.
getRangeType
()
);
couponTemplateDO
.
setRangeValues
(
template
.
getRangeValues
()
);
couponTemplateDO
.
setDateType
(
template
.
getDateType
()
);
couponTemplateDO
.
setValidStartTime
(
template
.
getValidStartTime
()
);
couponTemplateDO
.
setValidEndTime
(
template
.
getValidEndTime
()
);
couponTemplateDO
.
setFixedEndTerm
(
template
.
getFixedEndTerm
()
);
couponTemplateDO
.
setPreferentialType
(
template
.
getPreferentialType
()
);
couponTemplateDO
.
setPercentOff
(
template
.
getPercentOff
()
);
couponTemplateDO
.
setPriceOff
(
template
.
getPriceOff
()
);
couponTemplateDO
.
setDiscountPriceLimit
(
template
.
getDiscountPriceLimit
()
);
return
couponTemplateDO
;
}
@Override
public
CouponTemplateDO
convert
(
CouponCardTemplateUpdateDTO
template
)
{
if
(
template
==
null
)
{
return
null
;
}
CouponTemplateDO
couponTemplateDO
=
new
CouponTemplateDO
();
couponTemplateDO
.
setId
(
template
.
getId
()
);
couponTemplateDO
.
setTitle
(
template
.
getTitle
()
);
couponTemplateDO
.
setDescription
(
template
.
getDescription
()
);
couponTemplateDO
.
setQuota
(
template
.
getQuota
()
);
couponTemplateDO
.
setTotal
(
template
.
getTotal
()
);
couponTemplateDO
.
setRangeType
(
template
.
getRangeType
()
);
couponTemplateDO
.
setRangeValues
(
template
.
getRangeValues
()
);
return
couponTemplateDO
;
}
@Override
public
CouponTemplateDO
convert
(
CouponCodeTemplateAddDTO
template
)
{
if
(
template
==
null
)
{
return
null
;
}
CouponTemplateDO
couponTemplateDO
=
new
CouponTemplateDO
();
return
couponTemplateDO
;
}
@Override
public
CouponTemplateBO
convert
(
CouponTemplateDO
template
)
{
if
(
template
==
null
)
{
return
null
;
}
CouponTemplateBO
couponTemplateBO
=
new
CouponTemplateBO
();
couponTemplateBO
.
setId
(
template
.
getId
()
);
couponTemplateBO
.
setTitle
(
template
.
getTitle
()
);
couponTemplateBO
.
setDescription
(
template
.
getDescription
()
);
couponTemplateBO
.
setType
(
template
.
getType
()
);
couponTemplateBO
.
setCodeType
(
template
.
getCodeType
()
);
couponTemplateBO
.
setStatus
(
template
.
getStatus
()
);
couponTemplateBO
.
setQuota
(
template
.
getQuota
()
);
couponTemplateBO
.
setTotal
(
template
.
getTotal
()
);
couponTemplateBO
.
setPriceAvailable
(
template
.
getPriceAvailable
()
);
couponTemplateBO
.
setRangeType
(
template
.
getRangeType
()
);
couponTemplateBO
.
setRangeValues
(
template
.
getRangeValues
()
);
couponTemplateBO
.
setDateType
(
template
.
getDateType
()
);
couponTemplateBO
.
setValidStartTime
(
template
.
getValidStartTime
()
);
couponTemplateBO
.
setValidEndTime
(
template
.
getValidEndTime
()
);
couponTemplateBO
.
setPreferentialType
(
template
.
getPreferentialType
()
);
couponTemplateBO
.
setPercentOff
(
template
.
getPercentOff
()
);
couponTemplateBO
.
setPriceOff
(
template
.
getPriceOff
()
);
couponTemplateBO
.
setDiscountPriceLimit
(
template
.
getDiscountPriceLimit
()
);
couponTemplateBO
.
setStatFetchNum
(
template
.
getStatFetchNum
()
);
couponTemplateBO
.
setCreateTime
(
template
.
getCreateTime
()
);
couponTemplateBO
.
setFixedStartTerm
(
template
.
getFixedStartTerm
()
);
couponTemplateBO
.
setFixedEndTerm
(
template
.
getFixedEndTerm
()
);
return
couponTemplateBO
;
}
}
promotion/promotion-service-impl/target/generated-sources/annotations/cn/iocoder/mall/promotion/biz/convert/ProductRecommendConvertImpl.java
0 → 100644
浏览文件 @
f8ae2153
package
cn
.
iocoder
.
mall
.
promotion
.
biz
.
convert
;
import
cn.iocoder.mall.promotion.api.bo.ProductRecommendBO
;
import
cn.iocoder.mall.promotion.api.dto.ProductRecommendAddDTO
;
import
cn.iocoder.mall.promotion.api.dto.ProductRecommendUpdateDTO
;
import
cn.iocoder.mall.promotion.biz.dataobject.ProductRecommendDO
;
import
java.util.ArrayList
;
import
java.util.List
;
import
javax.annotation.Generated
;
@Generated
(
value
=
"org.mapstruct.ap.MappingProcessor"
,
date
=
"2019-04-06T00:20:10+0800"
,
comments
=
"version: 1.3.0.Final, compiler: javac, environment: Java 11.0.1 (Oracle Corporation)"
)
public
class
ProductRecommendConvertImpl
implements
ProductRecommendConvert
{
@Override
public
ProductRecommendBO
convertToBO
(
ProductRecommendDO
banner
)
{
if
(
banner
==
null
)
{
return
null
;
}
ProductRecommendBO
productRecommendBO
=
new
ProductRecommendBO
();
productRecommendBO
.
setId
(
banner
.
getId
()
);
productRecommendBO
.
setType
(
banner
.
getType
()
);
productRecommendBO
.
setProductSpuId
(
banner
.
getProductSpuId
()
);
productRecommendBO
.
setSort
(
banner
.
getSort
()
);
productRecommendBO
.
setStatus
(
banner
.
getStatus
()
);
productRecommendBO
.
setMemo
(
banner
.
getMemo
()
);
productRecommendBO
.
setCreateTime
(
banner
.
getCreateTime
()
);
return
productRecommendBO
;
}
@Override
public
List
<
ProductRecommendBO
>
convertToBO
(
List
<
ProductRecommendDO
>
bannerList
)
{
if
(
bannerList
==
null
)
{
return
null
;
}
List
<
ProductRecommendBO
>
list
=
new
ArrayList
<
ProductRecommendBO
>(
bannerList
.
size
()
);
for
(
ProductRecommendDO
productRecommendDO
:
bannerList
)
{
list
.
add
(
convertToBO
(
productRecommendDO
)
);
}
return
list
;
}
@Override
public
ProductRecommendDO
convert
(
ProductRecommendAddDTO
bannerAddDTO
)
{
if
(
bannerAddDTO
==
null
)
{
return
null
;
}
ProductRecommendDO
productRecommendDO
=
new
ProductRecommendDO
();
productRecommendDO
.
setType
(
bannerAddDTO
.
getType
()
);
productRecommendDO
.
setProductSpuId
(
bannerAddDTO
.
getProductSpuId
()
);
productRecommendDO
.
setSort
(
bannerAddDTO
.
getSort
()
);
productRecommendDO
.
setMemo
(
bannerAddDTO
.
getMemo
()
);
return
productRecommendDO
;
}
@Override
public
ProductRecommendDO
convert
(
ProductRecommendUpdateDTO
bannerUpdateDTO
)
{
if
(
bannerUpdateDTO
==
null
)
{
return
null
;
}
ProductRecommendDO
productRecommendDO
=
new
ProductRecommendDO
();
productRecommendDO
.
setId
(
bannerUpdateDTO
.
getId
()
);
productRecommendDO
.
setType
(
bannerUpdateDTO
.
getType
()
);
productRecommendDO
.
setProductSpuId
(
bannerUpdateDTO
.
getProductSpuId
()
);
productRecommendDO
.
setSort
(
bannerUpdateDTO
.
getSort
()
);
productRecommendDO
.
setMemo
(
bannerUpdateDTO
.
getMemo
()
);
return
productRecommendDO
;
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论