Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
L
lefull-lot-microservice
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
yangqi
lefull-lot-microservice
Commits
597761d3
提交
597761d3
authored
12月 16, 2022
作者:
yangqi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
添加设备
上级
254fed5a
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
252 行增加
和
7 行删除
+252
-7
LisaController.java
...t-api-web/src/main/java/cn/lefull/api/LisaController.java
+2
-1
pom.xml
lefull-lot-common/pom.xml
+5
-0
PageBuilder.java
...mon/src/main/java/cn/lefull/common/utils/PageBuilder.java
+52
-0
BasePage.java
...rc/main/java/cn/lefull/interaction/pageresp/BasePage.java
+99
-0
Paginable.java
...c/main/java/cn/lefull/interaction/pageresp/Paginable.java
+38
-0
Pagination.java
.../main/java/cn/lefull/interaction/pageresp/Pagination.java
+45
-0
EquipmentListVO.java
...n/java/cn/lefull/interaction/vo/face/EquipmentListVO.java
+2
-1
EquipmentService.java
...rc/main/java/cn/lefull/service/lisa/EquipmentService.java
+2
-1
EquipmentServiceImpl.java
...ain/java/cn/lefull/service/lisa/EquipmentServiceImpl.java
+7
-4
没有找到文件。
lefull-lot-api-web/src/main/java/cn/lefull/api/LisaController.java
浏览文件 @
597761d3
...
...
@@ -2,6 +2,7 @@ package cn.lefull.api;
import
cn.lefull.common.annotation.NoAuth
;
import
cn.lefull.common.response.ApiResponse
;
import
cn.lefull.interaction.pageresp.Pagination
;
import
cn.lefull.interaction.vo.face.EquipmentListVO
;
import
cn.lefull.service.lisa.EquipmentService
;
import
com.github.pagehelper.PageInfo
;
...
...
@@ -30,7 +31,7 @@ public class LisaController {
@NoAuth
@GetMapping
(
"/getEquipmentList"
)
public
ApiResponse
<
Object
>
getEquipmentList
()
{
Pag
eInfo
<
EquipmentListVO
>
equipmentListVOPageInfo
=
equipmentService
.
getEquipmentList
(
1
,
20
);
Pag
ination
<
EquipmentListVO
>
equipmentListVOPageInfo
=
equipmentService
.
getEquipmentList
(
1
,
20
);
return
new
ApiResponse
<>(
equipmentListVOPageInfo
);
}
}
lefull-lot-common/pom.xml
浏览文件 @
597761d3
...
...
@@ -31,6 +31,11 @@
<version>
3.15.0
</version>
<scope>
compile
</scope>
</dependency>
<dependency>
<groupId>
cn.lefull
</groupId>
<artifactId>
lefull-lot-interaction
</artifactId>
<version>
${project.build.version}
</version>
</dependency>
</dependencies>
<packaging>
jar
</packaging>
...
...
lefull-lot-common/src/main/java/cn/lefull/common/utils/PageBuilder.java
0 → 100644
浏览文件 @
597761d3
package
cn
.
lefull
.
common
.
utils
;
import
cn.lefull.interaction.pageresp.Pagination
;
import
com.github.pagehelper.Page
;
import
java.io.Serializable
;
import
java.util.HashMap
;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.Map
;
/**
* 构建分页结果
* @author created by Singer email:313402703@qq.com
* @time 2018/10/12
* @description
*/
public
class
PageBuilder
<
T
extends
Serializable
>
implements
Serializable
{
/**
* 构建分页结果
* @param page
* @param list
* @return
*/
public
static
<
T
>
Pagination
buildPageResult
(
Page
<
Object
>
page
,
List
<
T
>
list
){
Pagination
pagination
=
new
Pagination
();
pagination
.
setData
(
list
);
pagination
.
setCount
(
page
.
getTotal
());
pagination
.
setItemsPerPage
(
page
.
getPageSize
());
pagination
.
setCurrentPage
(
page
.
getPageNum
());
pagination
.
setTotalPage
(
page
.
getPages
());
return
pagination
;
}
public
static
<
T
>
Pagination
buildPageResult
(
Pagination
page1
,
Pagination
page2
){
Pagination
pagination
=
new
Pagination
();
Map
m
=
new
HashMap
<>();
m
.
put
(
"rented"
,
page1
.
getData
());
m
.
put
(
"preOrdain"
,
page2
.
getData
());
List
l
=
new
LinkedList
();
l
.
add
(
m
);
pagination
.
setData
(
l
);
pagination
.
setCount
(
page1
.
getCount
()+
page2
.
getCount
());
pagination
.
setItemsPerPage
(
page1
.
getItemsPerPage
());
pagination
.
setCurrentPage
(
page1
.
getCurrentPage
());
pagination
.
setTotalPage
(
page1
.
getTotalPage
()>=
page2
.
getTotalPage
()?
page1
.
getTotalPage
():
page2
.
getTotalPage
());
return
pagination
;
}
}
lefull-lot-interaction/src/main/java/cn/lefull/interaction/pageresp/BasePage.java
0 → 100644
浏览文件 @
597761d3
package
cn
.
lefull
.
interaction
.
pageresp
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* @author created by Singer email:313402703@qq.com
* @time 2018/10/12
* @description
*/
@Data
@ApiModel
public
class
BasePage
implements
Paginable
{
public
static
final
int
DEF_COUNT
=
10
;
@ApiModelProperty
(
value
=
"总条数"
,
required
=
true
,
notes
=
"总条数"
,
example
=
"1000"
)
protected
long
count
=
0
;
@ApiModelProperty
(
value
=
"每页条数"
,
required
=
true
,
notes
=
"每页条数"
,
example
=
"10"
)
protected
int
itemsPerPage
=
DEF_COUNT
;
@ApiModelProperty
(
value
=
"当前页码数"
,
required
=
true
,
notes
=
"当前页码数"
,
example
=
"1"
)
protected
int
currentPage
=
1
;
@ApiModelProperty
(
value
=
"总页数"
,
required
=
true
,
notes
=
"总页数"
,
example
=
"list"
)
protected
int
totalPage
=
1
;
public
BasePage
()
{
}
public
BasePage
(
int
pageNo
,
int
pageSize
,
long
totalCount
)
{
if
(
totalCount
<=
0
)
{
this
.
count
=
0
;
}
else
{
this
.
count
=
totalCount
;
}
if
(
pageSize
<=
0
)
{
this
.
itemsPerPage
=
DEF_COUNT
;
}
else
{
this
.
itemsPerPage
=
pageSize
;
}
if
(
pageNo
<=
0
)
{
this
.
currentPage
=
1
;
}
else
{
this
.
currentPage
=
pageNo
;
}
if
((
this
.
currentPage
-
1
)
*
this
.
itemsPerPage
>=
totalCount
)
{
if
(
this
.
count
/
this
.
itemsPerPage
==
0
)
{
this
.
currentPage
=
1
;
}
else
{
this
.
currentPage
=
(
int
)
this
.
count
/
this
.
itemsPerPage
;
}
}
}
@Override
public
int
getCurrentPage
()
{
return
currentPage
;
}
@Override
public
int
getItemsPerPage
()
{
return
itemsPerPage
;
}
@Override
public
long
getCount
()
{
return
count
;
}
@Override
public
int
getTotalPage
()
{
int
totalPage
=
(
int
)
count
/
itemsPerPage
;
if
(
count
%
itemsPerPage
!=
0
||
totalPage
==
0
)
{
totalPage
++;
}
return
totalPage
;
}
public
void
setCount
(
long
count
)
{
this
.
count
=
count
;
}
public
void
setItemsPerPage
(
int
pageSize
)
{
this
.
itemsPerPage
=
pageSize
;
}
public
void
setCurrentPage
(
int
pageNo
)
{
this
.
currentPage
=
pageNo
;
}
public
void
setTotalPage
(
int
totalPage
)
{
this
.
totalPage
=
totalPage
;
}
}
lefull-lot-interaction/src/main/java/cn/lefull/interaction/pageresp/Paginable.java
0 → 100644
浏览文件 @
597761d3
package
cn
.
lefull
.
interaction
.
pageresp
;
/**
* 可分页接口
* @author ZBC singer E-mail:313402703@qq.com
* 创建时间:2018/5/9 下午9:59
*/
public
interface
Paginable
{
/**
* 总记录数
*
* @return
*/
long
getCount
();
/**
* 总页数
*
* @return
*/
int
getTotalPage
();
/**
* 每页记录数
*
* @return
*/
int
getItemsPerPage
();
/**
* 当前页号
*
* @return
*/
int
getCurrentPage
();
}
lefull-lot-interaction/src/main/java/cn/lefull/interaction/pageresp/Pagination.java
0 → 100644
浏览文件 @
597761d3
package
cn
.
lefull
.
interaction
.
pageresp
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serializable
;
import
java.util.List
;
/**
* 分页封装对象
* @author created by Singer email:313402703@qq.com
* @time 2018/10/12
* @description
*/
public
class
Pagination
<
T
extends
Serializable
>
extends
BasePage
implements
Serializable
,
Paginable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 当前页的数据
*/
@ApiModelProperty
(
value
=
"分页的数据,为一个集合"
,
required
=
true
,
notes
=
"分页的数据,为一个集合"
,
example
=
"list"
)
private
List
<
T
>
data
;
public
Pagination
()
{
}
public
Pagination
(
int
pageNo
,
int
pageSize
,
long
totalCount
)
{
super
(
pageNo
,
pageSize
,
totalCount
);
}
public
Pagination
(
int
pageNo
,
int
pageSize
,
int
totalCount
,
List
<
T
>
data
)
{
super
(
pageNo
,
pageSize
,
totalCount
);
this
.
data
=
data
;
}
public
List
<
T
>
getData
()
{
return
data
;
}
public
void
setData
(
List
<
T
>
data
)
{
this
.
data
=
data
;
}
}
lefull-lot-interaction/src/main/java/cn/lefull/interaction/vo/face/EquipmentListVO.java
浏览文件 @
597761d3
...
...
@@ -2,13 +2,14 @@ package cn.lefull.interaction.vo.face;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
/**
* @author 杨奇
*/
@Data
public
class
EquipmentListVO
{
public
class
EquipmentListVO
implements
Serializable
{
/**
* 主键
...
...
lefull-lot-service/src/main/java/cn/lefull/service/lisa/EquipmentService.java
浏览文件 @
597761d3
package
cn
.
lefull
.
service
.
lisa
;
import
cn.lefull.interaction.pageresp.Pagination
;
import
cn.lefull.interaction.vo.face.EquipmentListVO
;
import
com.github.pagehelper.PageInfo
;
import
org.springframework.stereotype.Service
;
...
...
@@ -15,5 +16,5 @@ public interface EquipmentService {
*/
void
addEquipment
(
int
apartmentId
,
String
uuid
,
String
name
,
String
position
,
int
employeeId
)
throws
Exception
;
Pag
eInfo
<
EquipmentListVO
>
getEquipmentList
(
int
page
,
int
pageSize
);
Pag
ination
<
EquipmentListVO
>
getEquipmentList
(
int
page
,
int
pageSize
);
}
lefull-lot-service/src/main/java/cn/lefull/service/lisa/EquipmentServiceImpl.java
浏览文件 @
597761d3
package
cn
.
lefull
.
service
.
lisa
;
import
cn.lefull.common.utils.PageBuilder
;
import
cn.lefull.common.utils.Utils
;
import
cn.lefull.interaction.pageresp.Pagination
;
import
cn.lefull.interaction.vo.face.EquipmentListVO
;
import
cn.lefull.repository.bo.face.CameraEquipmentBO
;
import
cn.lefull.repository.mapper.face.CameraEquipmentMapper
;
import
cn.lefull.repository.model.face.CameraEquipment
;
import
com.github.pagehelper.Page
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -43,13 +46,13 @@ public class EquipmentServiceImpl implements EquipmentService {
}
@Override
public
Pag
eInfo
<
EquipmentListVO
>
getEquipmentList
(
int
page
,
int
pageSize
)
public
Pag
ination
<
EquipmentListVO
>
getEquipmentList
(
int
page
,
int
pageSize
)
{
PageHelper
.
startPage
(
page
,
pageSize
);
Page
<
Object
>
objects
=
Page
Helper
.
startPage
(
page
,
pageSize
);
List
<
CameraEquipmentBO
>
equipmentList
=
equipmentMapper
.
getEquipmentList
();
if
(
CollectionUtils
.
isEmpty
(
equipmentList
))
{
return
new
Pag
eInfo
<>();
return
new
Pag
ination
<>();
}
List
<
EquipmentListVO
>
equipmentListVOS
=
new
ArrayList
<>();
...
...
@@ -63,6 +66,6 @@ public class EquipmentServiceImpl implements EquipmentService {
equipmentListVO
.
setPosition
(
cameraEquipmentBO
.
getPosition
());
equipmentListVOS
.
add
(
equipmentListVO
);
}
return
new
PageInfo
<>(
equipmentListVOS
);
return
PageBuilder
.
buildPageResult
(
objects
,
equipmentListVOS
);
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论