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
66919e83
Commit
66919e83
authored
Feb 23, 2024
by
盖献康
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
查询素材库 - 按照时间进行分组显示
parent
598b48fd
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
93 additions
and
8 deletions
+93
-8
pom.xml
quality-review/pom.xml
+6
-1
PhotoStorageVO.java
...iew/src/main/java/com/ruoyi/domain/vo/PhotoStorageVO.java
+32
-0
UserPhotoStorageService.java
.../main/java/com/ruoyi/service/UserPhotoStorageService.java
+2
-1
UserPhotoStorageServiceImpl.java
...a/com/ruoyi/service/impl/UserPhotoStorageServiceImpl.java
+49
-3
UserPhotoStorageController.java
...c/main/java/com/ruoyi/web/UserPhotoStorageController.java
+4
-3
No files found.
quality-review/pom.xml
View file @
66919e83
...
@@ -65,7 +65,12 @@
...
@@ -65,7 +65,12 @@
<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/domain/vo/PhotoStorageVO.java
0 → 100644
View file @
66919e83
package
com
.
ruoyi
.
domain
.
vo
;
import
com.ruoyi.domain.UserPhotoStorage
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.util.Date
;
import
java.util.List
;
/**
* 照片存储VO类
* @author gxk
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public
class
PhotoStorageVO
{
/**
* 图片的创建时间
*/
private
String
createTime
;
/**
* 图片数组
*/
private
List
<
UserPhotoStorage
>
userPhotoStorageList
;
}
quality-review/src/main/java/com/ruoyi/service/UserPhotoStorageService.java
View file @
66919e83
...
@@ -4,6 +4,7 @@ import java.util.List;
...
@@ -4,6 +4,7 @@ import java.util.List;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.ruoyi.domain.UserPhotoStorage
;
import
com.ruoyi.domain.UserPhotoStorage
;
import
com.ruoyi.domain.vo.PhotoStorageVO
;
import
com.ruoyi.web.request.UserPhotoStorageCreateRequest
;
import
com.ruoyi.web.request.UserPhotoStorageCreateRequest
;
import
com.ruoyi.web.request.UserPhotoStorageListRequest
;
import
com.ruoyi.web.request.UserPhotoStorageListRequest
;
...
@@ -21,7 +22,7 @@ public interface UserPhotoStorageService extends IService<UserPhotoStorage>
...
@@ -21,7 +22,7 @@ public interface UserPhotoStorageService extends IService<UserPhotoStorage>
* @param request 用户照片存储
* @param request 用户照片存储
* @return 用户照片存储集合
* @return 用户照片存储集合
*/
*/
public
List
<
UserPhotoStorage
>
selectUserPhotoStorageList
(
UserPhotoStorageListRequest
request
);
public
List
<
PhotoStorageVO
>
selectUserPhotoStorageList
(
UserPhotoStorageListRequest
request
);
/**
/**
* 新增用户照片存储
* 新增用户照片存储
...
...
quality-review/src/main/java/com/ruoyi/service/impl/UserPhotoStorageServiceImpl.java
View file @
66919e83
package
com
.
ruoyi
.
service
.
impl
;
package
com
.
ruoyi
.
service
.
impl
;
import
java.util.
List
;
import
java.util.
*
;
import
cn.hutool.core.collection.CollUtil
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.ruoyi.common.core.domain.model.LoginUser
;
import
com.ruoyi.common.core.domain.model.LoginUser
;
import
com.ruoyi.common.utils.DateUtils
;
import
com.ruoyi.common.utils.DateUtils
;
import
com.ruoyi.common.utils.SecurityUtils
;
import
com.ruoyi.common.utils.SecurityUtils
;
import
com.ruoyi.domain.vo.PhotoStorageVO
;
import
com.ruoyi.framework.websocket.WebSocketUsers
;
import
com.ruoyi.framework.websocket.WebSocketUsers
;
import
com.ruoyi.service.UserPhotoStorageService
;
import
com.ruoyi.service.UserPhotoStorageService
;
import
com.ruoyi.web.request.UserPhotoStorageCreateRequest
;
import
com.ruoyi.web.request.UserPhotoStorageCreateRequest
;
...
@@ -36,9 +38,53 @@ public class UserPhotoStorageServiceImpl extends ServiceImpl<UserPhotoStorageMap
...
@@ -36,9 +38,53 @@ public class UserPhotoStorageServiceImpl extends ServiceImpl<UserPhotoStorageMap
* @return 用户照片存储
* @return 用户照片存储
*/
*/
@Override
@Override
public
List
<
UserPhotoStorage
>
selectUserPhotoStorageList
(
UserPhotoStorageListRequest
request
)
public
List
<
PhotoStorageVO
>
selectUserPhotoStorageList
(
UserPhotoStorageListRequest
request
)
{
{
return
userPhotoStorageMapper
.
selectUserPhotoStorageList
(
request
);
List
<
UserPhotoStorage
>
userPhotoStorages
=
userPhotoStorageMapper
.
selectUserPhotoStorageList
(
request
);
// 把查询出的数组按照时间分组
List
<
PhotoStorageVO
>
photoStorageVOList
=
new
ArrayList
<>();
for
(
UserPhotoStorage
photoStorage
:
userPhotoStorages
)
{
String
createTime
=
DateUtils
.
dateTime
(
photoStorage
.
getCreateTime
());
// photoStorageVOList为空时直接添加一个数据组
if
(
CollUtil
.
isEmpty
(
photoStorageVOList
))
{
addPhotoStorageInNotCreateTime
(
photoStorageVOList
,
photoStorage
,
createTime
);
}
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
);
}
}
}
// 根据时间倒序排序
photoStorageVOList
.
sort
(
Comparator
.
comparing
(
PhotoStorageVO:
:
getCreateTime
).
reversed
());
return
photoStorageVOList
;
}
/**
* 在photoStorageVOList数据没有此时间时新增一条新数据
* @param photoStorageVOList
* @param photoStorage
* @param createTime
*/
private
void
addPhotoStorageInNotCreateTime
(
List
<
PhotoStorageVO
>
photoStorageVOList
,
UserPhotoStorage
photoStorage
,
String
createTime
)
{
List
<
UserPhotoStorage
>
photoStorageChildren
=
new
ArrayList
<>();
photoStorageChildren
.
add
(
photoStorage
);
PhotoStorageVO
photoStorageVO
=
PhotoStorageVO
.
builder
()
.
createTime
(
createTime
)
.
userPhotoStorageList
(
photoStorageChildren
).
build
();
photoStorageVOList
.
add
(
photoStorageVO
);
}
}
/**
/**
...
...
quality-review/src/main/java/com/ruoyi/web/UserPhotoStorageController.java
View file @
66919e83
...
@@ -5,6 +5,7 @@ import java.util.List;
...
@@ -5,6 +5,7 @@ import java.util.List;
import
com.ruoyi.common.annotation.Anonymous
;
import
com.ruoyi.common.annotation.Anonymous
;
import
com.ruoyi.common.core.domain.R
;
import
com.ruoyi.common.core.domain.R
;
import
com.ruoyi.domain.vo.PhotoStorageVO
;
import
com.ruoyi.service.UserPhotoStorageService
;
import
com.ruoyi.service.UserPhotoStorageService
;
import
com.ruoyi.web.request.UserPhotoStorageCreateRequest
;
import
com.ruoyi.web.request.UserPhotoStorageCreateRequest
;
import
com.ruoyi.web.request.UserPhotoStorageEditRequest
;
import
com.ruoyi.web.request.UserPhotoStorageEditRequest
;
...
@@ -45,10 +46,10 @@ public class UserPhotoStorageController extends BaseController
...
@@ -45,10 +46,10 @@ public class UserPhotoStorageController extends BaseController
@Anonymous
@Anonymous
@ApiOperation
(
"分页查询照片存储列表"
)
@ApiOperation
(
"分页查询照片存储列表"
)
@PostMapping
(
"/list"
)
@PostMapping
(
"/list"
)
public
TableDataInfo
<
UserPhotoStorage
>
list
(
@Validated
@RequestBody
UserPhotoStorageListRequest
request
)
public
TableDataInfo
<
PhotoStorageVO
>
list
(
@Validated
@RequestBody
UserPhotoStorageListRequest
request
)
{
{
startPage
();
//
startPage();
List
<
UserPhotoStorage
>
list
=
userPhotoStorageService
.
selectUserPhotoStorageList
(
request
);
List
<
PhotoStorageVO
>
list
=
userPhotoStorageService
.
selectUserPhotoStorageList
(
request
);
return
getDataTable
(
list
);
return
getDataTable
(
list
);
}
}
...
...
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