Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
point-project
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hqzhdj
point-project
Commits
2c9d680d
Commit
2c9d680d
authored
Jan 17, 2025
by
阳浪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
日期查询优化1-今年2-本月3-今日4-本周
parent
0d47e437
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
9 deletions
+28
-9
cloud-point/src/main/java/com/yizhi/application/service/impl/PointUserServiceImpl.java
+22
-9
cloud-point/src/main/resources/mapper/PointUserMapper.xml
+6
-0
No files found.
cloud-point/src/main/java/com/yizhi/application/service/impl/PointUserServiceImpl.java
View file @
2c9d680d
...
@@ -64,15 +64,7 @@ public class PointUserServiceImpl extends ServiceImpl<PointUserMapper, PointUser
...
@@ -64,15 +64,7 @@ public class PointUserServiceImpl extends ServiceImpl<PointUserMapper, PointUser
Integer
start
=(
vo
.
getPageNo
()-
1
)*
vo
.
getPageSize
();
Integer
start
=(
vo
.
getPageNo
()-
1
)*
vo
.
getPageSize
();
Integer
end
=
vo
.
getPageNo
()*
vo
.
getPageSize
();
Integer
end
=
vo
.
getPageNo
()*
vo
.
getPageSize
();
Page
<
PointUserListVO
>
page
=
new
Page
<
PointUserListVO
>(
vo
.
getPageNo
(),
vo
.
getPageSize
());
Page
<
PointUserListVO
>
page
=
new
Page
<
PointUserListVO
>(
vo
.
getPageNo
(),
vo
.
getPageSize
());
String
date
=
DateUtil
.
toDay
(
new
Date
());
vo
.
setDateString
(
getDateString
(
vo
.
getDateType
()));
String
[]
dateArrays
=
date
.
split
(
"-"
);
vo
.
setDateString
(
date
);
if
(
Objects
.
equals
(
vo
.
getDateType
(),
1
)){
vo
.
setDateString
(
dateArrays
[
0
]);
}
if
(
Objects
.
equals
(
vo
.
getDateType
(),
2
)){
vo
.
setDateString
(
dateArrays
[
0
]+
"-"
+
dateArrays
[
1
]);
}
vo
.
setPageNo
(
start
);
vo
.
setPageNo
(
start
);
vo
.
setPageSize
(
end
);
vo
.
setPageSize
(
end
);
List
<
PointUserListVO
>
pointUserListVOS
=
pointUserMapper
.
getNewUserRankList
(
vo
);
List
<
PointUserListVO
>
pointUserListVOS
=
pointUserMapper
.
getNewUserRankList
(
vo
);
...
@@ -235,4 +227,25 @@ public class PointUserServiceImpl extends ServiceImpl<PointUserMapper, PointUser
...
@@ -235,4 +227,25 @@ public class PointUserServiceImpl extends ServiceImpl<PointUserMapper, PointUser
return
hashMap
;
return
hashMap
;
}
}
public
String
getDateString
(
Integer
dateType
)
{
String
dateString
=
DateUtil
.
toDay
(
new
Date
());
String
[]
dateArrays
=
dateString
.
split
(
"-"
);
if
(
Objects
.
equals
(
dateType
,
1
)){
dateString
=
dateArrays
[
0
];
}
if
(
Objects
.
equals
(
dateType
,
2
)){
dateString
=
dateArrays
[
0
]+
"-"
+
dateArrays
[
1
];
}
if
(
Objects
.
equals
(
dateType
,
4
)){
Calendar
calendar
=
Calendar
.
getInstance
();
int
week
=
calendar
.
get
(
Calendar
.
WEEK_OF_YEAR
);
if
(
week
==
1
){
dateString
=
String
.
valueOf
(
Integer
.
valueOf
(
dateArrays
[
0
])-
1
);
}
else
{
dateString
=
dateArrays
[
0
];
}
}
return
dateString
;
}
}
}
cloud-point/src/main/resources/mapper/PointUserMapper.xml
View file @
2c9d680d
...
@@ -73,6 +73,9 @@
...
@@ -73,6 +73,9 @@
<if
test=
"vo.dateType!=null and vo.dateType==3"
>
<if
test=
"vo.dateType!=null and vo.dateType==3"
>
and DATE_FORMAT(pu.create_time, '%Y-%m-%d') = #{vo.dateString}
and DATE_FORMAT(pu.create_time, '%Y-%m-%d') = #{vo.dateString}
</if>
</if>
<if
test=
"vo.dateType!=null and vo.dateType==4"
>
and WEEK(pu.create_time) = WEEK(now())
</if>
<if
test=
"vo.nameType!=null and vo.nameType==1"
>
<if
test=
"vo.nameType!=null and vo.nameType==1"
>
group by aug.name
group by aug.name
</if>
</if>
...
@@ -188,6 +191,9 @@
...
@@ -188,6 +191,9 @@
<if
test=
"vo.dateType!=null and vo.dateType==3"
>
<if
test=
"vo.dateType!=null and vo.dateType==3"
>
and DATE_FORMAT(pu.create_time, '%Y-%m-%d') = #{vo.dateString}
and DATE_FORMAT(pu.create_time, '%Y-%m-%d') = #{vo.dateString}
</if>
</if>
<if
test=
"vo.dateType!=null and vo.dateType==4"
>
and WEEK(pu.create_time) = WEEK(now())
</if>
<if
test=
"vo.nameType!=null and vo.nameType==1"
>
<if
test=
"vo.nameType!=null and vo.nameType==1"
>
group by aug.name
group by aug.name
</if>
</if>
...
...
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