Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vehicle-quality-review
Project
Project
Details
Activity
Releases
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王飞
vehicle-quality-review
Commits
2ed08e25
Commit
2ed08e25
authored
Feb 26, 2024
by
盖献康
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
查询素材库 - 按照时间进行分组显示(修改)
parent
5b7d534c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
29 deletions
+21
-29
pom.xml
quality-review/pom.xml
+0
-6
UserPhotoStorageServiceImpl.java
...a/com/ruoyi/service/impl/UserPhotoStorageServiceImpl.java
+21
-21
UserPhotoStorageController.java
...c/main/java/com/ruoyi/web/UserPhotoStorageController.java
+0
-2
No files found.
quality-review/pom.xml
View file @
2ed08e25
...
...
@@ -65,12 +65,6 @@
<groupId>
com.ruoyi
</groupId>
<artifactId>
ruoyi-framework
</artifactId>
</dependency>
<!-- hutool工具 -->
<dependency>
<groupId>
cn.hutool
</groupId>
<artifactId>
hutool-all
</artifactId>
<version>
5.8.9
</version>
</dependency>
</dependencies>
</project>
quality-review/src/main/java/com/ruoyi/service/impl/UserPhotoStorageServiceImpl.java
View file @
2ed08e25
...
...
@@ -41,33 +41,33 @@ public class UserPhotoStorageServiceImpl extends ServiceImpl<UserPhotoStorageMap
public
List
<
PhotoStorageVO
>
selectUserPhotoStorageList
(
UserPhotoStorageListRequest
request
)
{
List
<
UserPhotoStorage
>
userPhotoStorages
=
userPhotoStorageMapper
.
selectUserPhotoStorageList
(
request
);
//
把查询出的数组按照时间分组
//
创建一个VOList,用于返回数据
List
<
PhotoStorageVO
>
photoStorageVOList
=
new
ArrayList
<>();
// 创建一个hashMap,用于存储分类图片
HashMap
<
String
,
List
<
UserPhotoStorage
>>
photoStorageMap
=
new
HashMap
<>();
// 遍历userPhotoStorages,往photoStorageMap里添加数据
for
(
UserPhotoStorage
photoStorage
:
userPhotoStorages
)
{
// 计算出当前图片对象的创建时间: yyyy-MM-dd
String
createTime
=
DateUtils
.
dateTime
(
photoStorage
.
getCreateTime
());
// photoStorageVOList为空时直接添加一个数据组
if
(
CollUtil
.
isEmpty
(
photoStorageVOList
))
{
addPhotoStorageInNotCreateTime
(
photoStorageVOList
,
photoStorage
,
createTime
);
// Map里存在则取出value然后添加新的对象;则直接添加新的key-value
if
(!
photoStorageMap
.
containsKey
(
createTime
))
{
List
<
UserPhotoStorage
>
photoStorageList
=
new
ArrayList
<>();
photoStorageList
.
add
(
photoStorage
);
photoStorageMap
.
put
(
createTime
,
photoStorageList
);
}
else
{
// 查看此时间有没有对应的对象
PhotoStorageVO
storageVO
=
new
PhotoStorageVO
();
int
num
=
0
;
for
(
PhotoStorageVO
photoStorageVO
:
photoStorageVOList
)
{
if
(
photoStorageVO
.
getCreateTime
().
equals
(
createTime
))
{
num
++;
storageVO
=
photoStorageVO
;
}
}
// num为0表示,没有此时间的对象,直接添加一个数据组;则取出此时间对象,往集合里新插入一条数据
if
(
num
==
0
)
{
addPhotoStorageInNotCreateTime
(
photoStorageVOList
,
photoStorage
,
createTime
);
}
else
{
List
<
UserPhotoStorage
>
userPhotoStorageList
=
storageVO
.
getUserPhotoStorageList
();
userPhotoStorageList
.
add
(
photoStorage
);
photoStorageMap
.
get
(
createTime
).
add
(
photoStorage
);
}
}
// 遍历photoStorageMap,将value赋值给photoStorageVOList
for
(
Map
.
Entry
<
String
,
List
<
UserPhotoStorage
>>
entry
:
photoStorageMap
.
entrySet
())
{
// entry.getValue()以时间降序排列
entry
.
getValue
().
sort
(
Comparator
.
comparing
(
UserPhotoStorage:
:
getCreateTime
).
reversed
());
PhotoStorageVO
photoStorageVO
=
PhotoStorageVO
.
builder
()
.
createTime
(
entry
.
getKey
())
.
userPhotoStorageList
(
entry
.
getValue
()).
build
();
photoStorageVOList
.
add
(
photoStorageVO
);
}
//
根据时间倒序排序
//
photoStorageVOList以创建时间降序排列
photoStorageVOList
.
sort
(
Comparator
.
comparing
(
PhotoStorageVO:
:
getCreateTime
).
reversed
());
return
photoStorageVOList
;
}
...
...
quality-review/src/main/java/com/ruoyi/web/UserPhotoStorageController.java
View file @
2ed08e25
...
...
@@ -43,7 +43,6 @@ public class UserPhotoStorageController extends BaseController
/**
* 查询用户照片存储列表
*/
@Anonymous
@ApiOperation
(
"分页查询照片存储列表"
)
@PostMapping
(
"/list"
)
public
TableDataInfo
<
PhotoStorageVO
>
list
(
@Validated
@RequestBody
UserPhotoStorageListRequest
request
)
...
...
@@ -56,7 +55,6 @@ public class UserPhotoStorageController extends BaseController
/**
* 新增用户照片存储
*/
@Anonymous
@ApiOperation
(
"新增用户照片存储"
)
@Log
(
title
=
"用户照片存储"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
(
"/create"
)
...
...
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