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
Hide 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 @@
...
@@ -65,12 +65,6 @@
<groupId>
com.ruoyi
</groupId>
<groupId>
com.ruoyi
</groupId>
<artifactId>
ruoyi-framework
</artifactId>
<artifactId>
ruoyi-framework
</artifactId>
</dependency>
</dependency>
<!-- hutool工具 -->
<dependency>
<groupId>
cn.hutool
</groupId>
<artifactId>
hutool-all
</artifactId>
<version>
5.8.9
</version>
</dependency>
</dependencies>
</dependencies>
</project>
</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
...
@@ -41,33 +41,33 @@ public class UserPhotoStorageServiceImpl extends ServiceImpl<UserPhotoStorageMap
public
List
<
PhotoStorageVO
>
selectUserPhotoStorageList
(
UserPhotoStorageListRequest
request
)
public
List
<
PhotoStorageVO
>
selectUserPhotoStorageList
(
UserPhotoStorageListRequest
request
)
{
{
List
<
UserPhotoStorage
>
userPhotoStorages
=
userPhotoStorageMapper
.
selectUserPhotoStorageList
(
request
);
List
<
UserPhotoStorage
>
userPhotoStorages
=
userPhotoStorageMapper
.
selectUserPhotoStorageList
(
request
);
//
把查询出的数组按照时间分组
//
创建一个VOList,用于返回数据
List
<
PhotoStorageVO
>
photoStorageVOList
=
new
ArrayList
<>();
List
<
PhotoStorageVO
>
photoStorageVOList
=
new
ArrayList
<>();
// 创建一个hashMap,用于存储分类图片
HashMap
<
String
,
List
<
UserPhotoStorage
>>
photoStorageMap
=
new
HashMap
<>();
// 遍历userPhotoStorages,往photoStorageMap里添加数据
for
(
UserPhotoStorage
photoStorage
:
userPhotoStorages
)
{
for
(
UserPhotoStorage
photoStorage
:
userPhotoStorages
)
{
// 计算出当前图片对象的创建时间: yyyy-MM-dd
String
createTime
=
DateUtils
.
dateTime
(
photoStorage
.
getCreateTime
());
String
createTime
=
DateUtils
.
dateTime
(
photoStorage
.
getCreateTime
());
// photoStorageVOList为空时直接添加一个数据组
// Map里存在则取出value然后添加新的对象;则直接添加新的key-value
if
(
CollUtil
.
isEmpty
(
photoStorageVOList
))
{
if
(!
photoStorageMap
.
containsKey
(
createTime
))
{
addPhotoStorageInNotCreateTime
(
photoStorageVOList
,
photoStorage
,
createTime
);
List
<
UserPhotoStorage
>
photoStorageList
=
new
ArrayList
<>();
photoStorageList
.
add
(
photoStorage
);
photoStorageMap
.
put
(
createTime
,
photoStorageList
);
}
else
{
}
else
{
// 查看此时间有没有对应的对象
photoStorageMap
.
get
(
createTime
).
add
(
photoStorage
);
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,将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
());
photoStorageVOList
.
sort
(
Comparator
.
comparing
(
PhotoStorageVO:
:
getCreateTime
).
reversed
());
return
photoStorageVOList
;
return
photoStorageVOList
;
}
}
...
...
quality-review/src/main/java/com/ruoyi/web/UserPhotoStorageController.java
View file @
2ed08e25
...
@@ -43,7 +43,6 @@ public class UserPhotoStorageController extends BaseController
...
@@ -43,7 +43,6 @@ public class UserPhotoStorageController extends BaseController
/**
/**
* 查询用户照片存储列表
* 查询用户照片存储列表
*/
*/
@Anonymous
@ApiOperation
(
"分页查询照片存储列表"
)
@ApiOperation
(
"分页查询照片存储列表"
)
@PostMapping
(
"/list"
)
@PostMapping
(
"/list"
)
public
TableDataInfo
<
PhotoStorageVO
>
list
(
@Validated
@RequestBody
UserPhotoStorageListRequest
request
)
public
TableDataInfo
<
PhotoStorageVO
>
list
(
@Validated
@RequestBody
UserPhotoStorageListRequest
request
)
...
@@ -56,7 +55,6 @@ public class UserPhotoStorageController extends BaseController
...
@@ -56,7 +55,6 @@ public class UserPhotoStorageController extends BaseController
/**
/**
* 新增用户照片存储
* 新增用户照片存储
*/
*/
@Anonymous
@ApiOperation
(
"新增用户照片存储"
)
@ApiOperation
(
"新增用户照片存储"
)
@Log
(
title
=
"用户照片存储"
,
businessType
=
BusinessType
.
INSERT
)
@Log
(
title
=
"用户照片存储"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
(
"/create"
)
@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