Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jiedao-api-boot-master
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lanbaoming
jiedao-api-boot-master
Commits
1cfbe91a
Commit
1cfbe91a
authored
Oct 29, 2024
by
xiamw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优惠活动列表查询条件优化
parent
739b2ffa
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
74 additions
and
17 deletions
+74
-17
CouponMapper.java
...r/yudao/module/product/dal/mysql/coupon/CouponMapper.java
+61
-13
ProductMapper.java
...yudao/module/product/dal/mysql/product/ProductMapper.java
+4
-4
CouponPageReqVO.java
...coder/yudao/module/product/vo/coupon/CouponPageReqVO.java
+9
-0
No files found.
yudao-module-product/yudao-module-product-core/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/coupon/CouponMapper.java
View file @
1cfbe91a
...
...
@@ -295,17 +295,33 @@ public interface CouponMapper extends BaseMapperX<CouponDO> {
@ResultType
(
CouponDO
.
class
)
@Select
({
"<script>"
,
"select c.*, "
,
"c.coupon_id,"
,
"cr.nickname as creator_name, "
,
"up.nickname as updater_name"
,
"select c.*, "
,
"c.coupon_id,"
,
"cr.nickname as creator_name, "
,
"up.nickname as updater_name"
,
"from ecw_coupon c "
,
"left join system_user cr on cr.id = c.creator "
,
"left join system_user up on up.id = c.updater "
,
"left join system_user cr on cr.id = c.creator "
,
"left join system_user up on up.id = c.updater "
,
"where c.deleted = 0"
,
"<when test = 'reqVO.status != null'>"
,
"AND c.status = #{reqVO.status}"
,
"AND c.status = #{reqVO.status}"
,
"</when>"
,
"<when test=\"reqVO.statusList != null and reqVO.statusList.size()>0\">"
+
" <when test=\"reqVO.statusList != null and reqVO.statusList.size()==1 \">"
+
" AND c.`status` =\n"
+
" <foreach item='statusId' index='index' collection='reqVO.statusList' >\n"
+
" #{statusId}"
+
" </foreach>"
+
" </when>"
+
" <when test=\"reqVO.types != null and reqVO.statusList.size()>1 \">"
+
" AND c.`status` in "
+
" <foreach item='statusId' index='index' collection='reqVO.statusList' open='(' separator=',' close=')'>"
+
" #{statusId}"
+
" </foreach>"
+
" </when>"
+
"</when>"
,
"<when test = 'reqVO.overdueStatus != null'>"
,
"AND c.overdue_status = #{reqVO.overdueStatus}"
,
"</when>"
,
...
...
@@ -315,24 +331,56 @@ public interface CouponMapper extends BaseMapperX<CouponDO> {
"<when test = 'reqVO.type != null'>"
,
"AND c.type = #{reqVO.type}"
,
"</when>"
,
"<when test = 'reqVO.validDays != null'>"
,
"AND c.valid_days = #{reqVO.validDays}"
,
"</when>"
,
"<when test=\"reqVO.types != null and reqVO.types.size()>0\">"
+
" <when test=\"reqVO.types != null and reqVO.types.size()==1 \">"
+
" AND c.`type` =\n"
+
" <foreach item='typeId' index='index' collection='reqVO.types' >\n"
+
" #{typeId}"
+
" </foreach>"
+
" </when>"
+
" <when test=\"reqVO.types != null and reqVO.types.size()>1 \">"
+
" AND c.`type` in "
+
" <foreach item='typeId' index='index' collection='reqVO.types' open='(' separator=',' close=')'>"
+
" #{typeId}"
+
" </foreach>"
+
" </when>"
+
"</when>"
,
"<when test = 'reqVO.costType != null'>"
,
"AND c.cost_type = #{reqVO.costType}"
,
"AND c.cost_type = #{reqVO.costType}"
,
"</when>"
,
"<when test = 'reqVO.searchKey != null and reqVO.searchKey != \"\"'>"
,
"and (c.title_zh like CONCAT('%',#{reqVO.searchKey},'%') or c.title_en like CONCAT('%',#{reqVO.searchKey},'%'))"
,
"and (c.title_zh like CONCAT('%',#{reqVO.searchKey},'%') or c.title_en like CONCAT('%',#{reqVO.searchKey},'%'))"
,
"</when>"
,
"<when test = 'reqVO.titleZh != null and reqVO.titleZh != \"\"'>"
,
"and c.title_zh like CONCAT('%',#{reqVO.titleZh},'%')"
,
"and c.title_zh like CONCAT('%',#{reqVO.titleZh},'%')"
,
"</when>"
,
"<when test = 'reqVO.titleEn != null and reqVO.titleEn != \"\"'>"
,
"and c.title_en like CONCAT('%',#{reqVO.titleEn},'%')"
,
"and c.title_en like CONCAT('%',#{reqVO.titleEn},'%')"
,
"</when>"
,
"<when test = 'reqVO.beginStartTime != null and reqVO.endStartTime != null'>"
,
"AND c.start_time between #{reqVO.beginStartTime} and #{reqVO.endStartTime} "
,
"AND c.start_time between #{reqVO.beginStartTime} and #{reqVO.endStartTime} "
,
"</when>"
,
"<when test = 'reqVO.beginEndTime != null and reqVO.endEndTime != null'>"
,
"AND DATE_FORMAT(c.end_time,'%Y-%m-%d 23:59:59') between #{reqVO.beginEndTime} and #{reqVO.endEndTime} "
,
"AND DATE_FORMAT(c.end_time,'%Y-%m-%d 23:59:59') between #{reqVO.beginEndTime} and #{reqVO.endEndTime} "
,
"</when>"
,
" <when test='reqVO.beginCreateTime != null' >"
,
"AND <![CDATA[ c.create_time >= #{reqVO.beginCreateTime} ]]> "
,
"</when>"
,
" <when test='reqVO.endCreateTime != null' >"
,
"AND <![CDATA[ c.create_time <= #{reqVO.endCreateTime} ]]> "
,
"</when>"
,
"<when test=\"reqVO.creator != null and reqVO.creator != '' \">"
+
"AND cr.`nickname` like concat('%',concat(#{reqVO.creator},'%'))"
,
"</when>"
,
" order by c.coupon_id desc"
,
"</script>"
})
...
...
yudao-module-product/yudao-module-product-core/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/product/ProductMapper.java
View file @
1cfbe91a
...
...
@@ -196,19 +196,19 @@ public interface ProductMapper extends BaseMapperX<ProductDO> {
"</when>"
,
"<when test=\"query.titleZhKey != null and query.titleZhKey != '' \">"
+
"AND
c
.`title_zh` like concat('%',concat(#{query.titleZhKey},'%'))"
,
"AND
t
.`title_zh` like concat('%',concat(#{query.titleZhKey},'%'))"
,
"</when>"
,
"<when test=\"query.notTitleZhKey != null and query.notTitleZhKey != '' \">"
+
"AND
c
.`title_zh` not like concat('%',concat(#{query.notTitleZhKey},'%'))"
,
"AND
t
.`title_zh` not like concat('%',concat(#{query.notTitleZhKey},'%'))"
,
"</when>"
,
"<when test=\"query.eqTitleZhKey != null and query.eqTitleZhKey != '' \">"
+
"AND
c
.`title_zh` = #{query.eqTitleZhKey} "
,
"AND
t
.`title_zh` = #{query.eqTitleZhKey} "
,
"</when>"
,
"<when test=\"query.notEqTitleZhKey != null and query.notEqTitleZhKey != '' \">"
+
"AND
c
.`title_zh` != #{query.notEqTitleZhKey} "
,
"AND
t
.`title_zh` != #{query.notEqTitleZhKey} "
,
"</when>"
,
"order by t.id desc"
,
...
...
yudao-module-product/yudao-module-product-core/src/main/java/cn/iocoder/yudao/module/product/vo/coupon/CouponPageReqVO.java
View file @
1cfbe91a
...
...
@@ -26,6 +26,9 @@ public class CouponPageReqVO extends PageParam {
@ApiModelProperty
(
value
=
"类型 1:优惠卷 2:金额-满减 3:方数-满减 4 折扣 5优惠 6 特价 7区间价"
)
private
Integer
type
;
@ApiModelProperty
(
value
=
"类型ids"
)
private
List
<
Integer
>
types
;
@ApiModelProperty
(
value
=
"使用条件(优惠卷专用)"
)
private
BigDecimal
cashCondition
;
...
...
@@ -115,6 +118,9 @@ public class CouponPageReqVO extends PageParam {
@ApiModelProperty
(
value
=
"优惠券状态(0:草稿 1:发布)"
)
private
Integer
status
;
@ApiModelProperty
(
value
=
"优惠券状态ids"
)
private
List
<
Integer
>
statusList
;
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
)
@ApiModelProperty
(
value
=
"开始创建时间"
)
private
Date
beginCreateTime
;
...
...
@@ -123,6 +129,9 @@ public class CouponPageReqVO extends PageParam {
@ApiModelProperty
(
value
=
"结束创建时间"
)
private
Date
endCreateTime
;
@ApiModelProperty
(
value
=
"创建人"
)
private
String
creator
;
@ApiModelProperty
(
value
=
"关键字"
)
private
String
searchKey
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment