Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
项目统一框架
amos-boot-biz
Commits
1b34c82b
Commit
1b34c82b
authored
Dec 03, 2021
by
kongfm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
设备列表查询接口
parent
1d1ca8ae
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
75 additions
and
20 deletions
+75
-20
EquipmentController.java
...ot/module/tzs/flc/biz/controller/EquipmentController.java
+75
-20
No files found.
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/biz/controller/EquipmentController.java
View file @
1b34c82b
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
flc
.
biz
.
controller
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
import
com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentDto
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.dto.UnitInfoDto
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.entity.Equipment
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.entity.UnitInfo
;
import
com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.EquipmentServiceImpl
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
...
...
@@ -104,33 +112,80 @@ public class EquipmentController extends BaseController {
/**
* 列表分页查询
*
* @param
current
当前页
* @param
current
每页大小
* @param
pageNum
当前页
* @param
pageSize
每页大小
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/page"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"装备信息表分页查询"
,
notes
=
"装备信息表分页查询"
)
public
ResponseModel
<
Page
<
EquipmentDto
>>
queryForPage
(
@RequestParam
(
value
=
"current"
)
int
current
,
@RequestParam
(
value
=
"size"
)
int
size
)
{
Page
<
EquipmentDto
>
page
=
new
Page
<
EquipmentDto
>();
page
.
setCurrent
(
current
);
page
.
setSize
(
size
);
return
ResponseHelper
.
buildResponse
(
equipmentServiceImpl
.
queryForEquipmentPage
(
page
));
@GetMapping
(
value
=
"/list"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"装备列表查询"
,
notes
=
"装备列表查询"
)
public
ResponseModel
<
IPage
<
EquipmentDto
>>
queryForPage
(
String
pageNum
,
String
pageSize
,
String
sort
,
EquipmentDto
equipmentDto
)
{
Page
<
Equipment
>
pageBean
;
IPage
<
Equipment
>
page
;
QueryWrapper
<
Equipment
>
equipmentQueryWrapper
=
new
QueryWrapper
<
Equipment
>();
setQueryWrapper
(
equipmentQueryWrapper
,
equipmentDto
,
sort
);
if
(
StringUtils
.
isBlank
(
pageNum
)
||
StringUtils
.
isBlank
(
pageSize
))
{
pageBean
=
new
Page
<>(
0
,
Long
.
MAX_VALUE
);
}
else
{
pageBean
=
new
Page
<>(
Integer
.
parseInt
(
pageNum
),
Integer
.
parseInt
(
pageSize
));
}
page
=
equipmentServiceImpl
.
page
(
pageBean
,
equipmentQueryWrapper
);
int
num
=
equipmentServiceImpl
.
count
(
equipmentQueryWrapper
);
pageBean
.
setTotal
(
num
);
IPage
<
EquipmentDto
>
equipmentDtoIPager
=
BeanDtoVoUtils
.
iPageVoStream
(
page
,
EquipmentDto
.
class
);
return
ResponseHelper
.
buildResponse
(
equipmentDtoIPager
);
}
/**
* 列表全部数据查询
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"装备信息表列表全部数据查询"
,
notes
=
"装备信息表列表全部数据查询"
)
@GetMapping
(
value
=
"/list"
)
public
ResponseModel
<
List
<
EquipmentDto
>>
selectForList
()
{
return
ResponseHelper
.
buildResponse
(
equipmentServiceImpl
.
queryForEquipmentList
());
private
QueryWrapper
<
Equipment
>
setQueryWrapper
(
QueryWrapper
<
Equipment
>
queryWrapper
,
EquipmentDto
equipmentDto
,
String
sort
)
{
queryWrapper
.
eq
(
"is_delete"
,
false
);
if
(
sort
!=
null
)
{
// 排序失效
String
[]
date
=
sort
.
split
(
","
);
if
(
date
[
1
].
equals
(
"ascend"
))
{
queryWrapper
.
orderByAsc
(
RedisKey
.
humpToLine
(
date
[
0
]));
}
else
{
queryWrapper
.
orderByDesc
(
RedisKey
.
humpToLine
(
date
[
0
]));
}
}
else
{
queryWrapper
.
orderByDesc
(
"rec_date"
);
}
if
(!
ValidationUtil
.
isEmpty
(
equipmentDto
.
getCode
()))
{
// 设备代码
queryWrapper
.
like
(
"code"
,
equipmentDto
.
getCode
());
}
if
(!
ValidationUtil
.
isEmpty
(
equipmentDto
.
getProductCode
()))
{
// 产品编号
queryWrapper
.
like
(
"product_code"
,
equipmentDto
.
getProductCode
());
}
if
(!
ValidationUtil
.
isEmpty
(
equipmentDto
.
getInnerCode
()))
{
// 单位内部编码
queryWrapper
.
like
(
"inner_code"
,
equipmentDto
.
getInnerCode
());
}
if
(!
ValidationUtil
.
isEmpty
(
equipmentDto
.
getName
()))
{
// 设备名称
queryWrapper
.
like
(
"name"
,
equipmentDto
.
getName
());
}
if
(!
ValidationUtil
.
isEmpty
(
equipmentDto
.
getTypeId
()))
{
// 设备种类
queryWrapper
.
eq
(
"type_id"
,
equipmentDto
.
getTypeId
());
}
if
(!
ValidationUtil
.
isEmpty
(
equipmentDto
.
getCategoryId
()))
{
// 设备类别
queryWrapper
.
eq
(
"category_id"
,
equipmentDto
.
getCategoryId
());
}
if
(!
ValidationUtil
.
isEmpty
(
equipmentDto
.
getVarietyId
()))
{
// 设备品种
queryWrapper
.
eq
(
"variety_id"
,
equipmentDto
.
getVarietyId
());
}
if
(!
ValidationUtil
.
isEmpty
(
equipmentDto
.
getDesignUnitName
()))
{
// 设计单位
queryWrapper
.
like
(
"design_unit_name"
,
equipmentDto
.
getDesignUnitName
());
}
if
(!
ValidationUtil
.
isEmpty
(
equipmentDto
.
getManufacturer
()))
{
// 制造单位
queryWrapper
.
like
(
"manufacturer"
,
equipmentDto
.
getManufacturer
());
}
if
(!
ValidationUtil
.
isEmpty
(
equipmentDto
.
getStatus
()))
{
// 状态
queryWrapper
.
eq
(
"status"
,
equipmentDto
.
getStatus
());
}
return
queryWrapper
;
}
/**
* 获取设备ID
* @return
...
...
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