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
3764883a
Commit
3764883a
authored
Jun 04, 2021
by
tangwei
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'developer' of
http://172.16.10.76/moa/amos-boot-biz
into developer
parents
0e293a4c
f0fa58bf
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
344 additions
and
157 deletions
+344
-157
ElevatorDto.java
...com/yeejoin/amos/boot/module/tzs/api/dto/ElevatorDto.java
+10
-11
Elevator.java
...com/yeejoin/amos/boot/module/tzs/api/entity/Elevator.java
+10
-11
ElevatorVo.java
...a/com/yeejoin/amos/boot/module/tzs/api/vo/ElevatorVo.java
+11
-14
ElevatorController.java
...os/boot/module/tzs/biz/controller/ElevatorController.java
+101
-38
MaintenanceUnitController.java
.../module/tzs/biz/controller/MaintenanceUnitController.java
+107
-50
UseUnitController.java
...mos/boot/module/tzs/biz/controller/UseUnitController.java
+43
-33
BeanDtoVoUtils.java
...eejoin/amos/boot/module/tzs/biz/utils/BeanDtoVoUtils.java
+62
-0
No files found.
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/api/dto/ElevatorDto.java
View file @
3764883a
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
api
.
dto
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
java.util.Date
;
import
com.yeejoin.amos.boot.biz.common.entity.BaseEntity
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.databind.ser.std.ToStringSerializer
;
/**
*
*
* @author tb
* @date 2021-06-01
*/
* @author tb
* @date 2021-06-01
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
@TableName
(
"tcb_elevator"
)
@ApiModel
(
value
=
"ElevatorDto"
,
description
=
"
"
)
@ApiModel
(
value
=
"ElevatorDto"
,
description
=
"ElevatorDto
"
)
public
class
ElevatorDto
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
...
...
@@ -115,6 +111,9 @@ public class ElevatorDto extends BaseEntity {
@ApiModelProperty
(
value
=
"使用单位"
)
private
String
useUnit
;
@ApiModelProperty
(
value
=
"使用单位id"
)
private
Long
useUnitId
;
@ApiModelProperty
(
value
=
"制造单位名称"
)
private
String
manufacturerName
;
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/api/entity/Elevator.java
View file @
3764883a
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
api
.
entity
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
java.util.Date
;
import
com.yeejoin.amos.boot.biz.common.entity.BaseEntity
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.databind.ser.std.ToStringSerializer
;
/**
*
*
* @author tb
* @date 2021-06-01
*/
* @author tb
* @date 2021-06-01
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
@TableName
(
"tcb_elevator"
)
@ApiModel
(
value
=
"Elevator对象"
,
description
=
"
"
)
@ApiModel
(
value
=
"Elevator对象"
,
description
=
"Elevator对象
"
)
public
class
Elevator
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
...
...
@@ -116,6 +112,9 @@ public class Elevator extends BaseEntity {
@ApiModelProperty
(
value
=
"使用单位"
)
private
String
useUnit
;
@ApiModelProperty
(
value
=
"使用单位id"
)
private
Long
useUnitId
;
@ApiModelProperty
(
value
=
"制造单位名称"
)
private
String
manufacturerName
;
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/api/vo/ElevatorVo.java
View file @
3764883a
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
api
.
vo
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
java.util.Date
;
import
com.yeejoin.amos.boot.biz.common.entity.BaseEntity
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.databind.ser.std.ToStringSerializer
;
/**
*
*
* @author tb
* @date 2021-06-01
*/
* @author tb
* @date 2021-06-01
*/
@Data
@Accessors
(
chain
=
true
)
@TableName
(
"tcb_elevator"
)
@ApiModel
(
value
=
"ElevatorVo"
,
description
=
"
"
)
public
class
ElevatorVo
{
@ApiModel
(
value
=
"ElevatorVo"
,
description
=
"ElevatorVo
"
)
public
class
ElevatorVo
{
private
static
final
long
serialVersionUID
=
1L
;
...
...
@@ -115,6 +109,9 @@ public class ElevatorVo{
@ApiModelProperty
(
value
=
"使用单位"
)
private
String
useUnit
;
@ApiModelProperty
(
value
=
"使用单位id"
)
private
Long
useUnitId
;
@ApiModelProperty
(
value
=
"制造单位名称"
)
private
String
manufacturerName
;
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/controller/ElevatorController.java
View file @
3764883a
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
biz
.
controller
;
import
com.yeejoin.amos.boot.module.tzs.api.dto.ElevatorDto
;
import
com.yeejoin.amos.boot.module.tzs.api.vo.ElevatorVo
;
import
com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.Api
;
...
...
@@ -10,7 +16,7 @@ import com.yeejoin.amos.boot.module.tzs.api.service.IElevatorService;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
javax.servlet.http.HttpServletRequest
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
org.springframework.web.bind.annotation.*
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
...
...
@@ -18,85 +24,94 @@ import com.yeejoin.amos.boot.module.tzs.api.entity.Elevator;
import
com.yeejoin.amos.boot.biz.common.utils.NameUtils
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
java.util.Arrays
;
import
java.util.Arrays
;
/**
* 电梯
*
* @author tb
* @date 2021-06-01
*/
* 电梯Api
*
* @author tb
* @date 2021-06-01
*/
@RestController
@Api
(
tags
=
"电梯Api"
)
@RequestMapping
(
value
=
"/tzs/elevator"
)
public
class
ElevatorController
extends
BaseController
{
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ElevatorController
.
class
);
@Autowired
IElevatorService
iElevatorService
;
/**
* 新增电梯
* @return
*/
* 新增电梯
*
* @param elevatorDto 新增参数
* @return 返回结果
*/
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/save"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增电梯"
,
notes
=
"新增电梯"
)
public
boolean
saveElevator
(
HttpServletRequest
request
,
@RequestBody
Elevator
elevator
){
public
boolean
saveElevator
(
@RequestBody
ElevatorDto
elevatorDto
)
{
Elevator
elevator
=
BeanDtoVoUtils
.
convert
(
elevatorDto
,
Elevator
.
class
);
return
iElevatorService
.
save
(
elevator
);
}
/**
* 根据id删除
* @param id
* @return
*/
* 根据id删除
*
* @param id id
* @return 返回结果
*/
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
DELETE
)
@ApiOperation
(
httpMethod
=
"DELETE"
,
value
=
"根据id删除"
,
notes
=
"根据id删除"
)
public
boolean
deleteById
(
HttpServletRequest
request
,
@PathVariable
Long
id
)
{
public
boolean
deleteById
(
@PathVariable
Long
id
)
{
return
iElevatorService
.
removeById
(
id
);
}
/**
* 修改电梯
* @return
*/
* 修改电梯
*
* @param elevatorDto 修改参数
* @return 返回结果
*/
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/updateById"
,
method
=
RequestMethod
.
PUT
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"修改电梯"
,
notes
=
"修改电梯"
)
public
boolean
updateByIdElevator
(
HttpServletRequest
request
,
@RequestBody
Elevator
elevator
){
public
boolean
updateByIdElevator
(
@RequestBody
ElevatorDto
elevatorDto
)
{
Elevator
elevator
=
BeanDtoVoUtils
.
convert
(
elevatorDto
,
Elevator
.
class
);
return
iElevatorService
.
updateById
(
elevator
);
}
/**
* 根据id查询
* @param id
* @return
*/
* 根据id查询
*
* @param id id
* @return 返回结果
*/
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据id查询"
,
notes
=
"根据id查询"
)
public
Elevator
selectById
(
HttpServletRequest
request
,
@PathVariable
Long
id
){
return
iElevatorService
.
getById
(
id
);
public
ElevatorVo
selectById
(
@PathVariable
Long
id
)
{
Elevator
elevator
=
iElevatorService
.
getById
(
id
);
return
BeanDtoVoUtils
.
convert
(
elevator
,
ElevatorVo
.
class
);
}
/**
* 列表分页查询
* @return
*/
* 列表分页查询
*
* @param pageNum 当前页
* @param pageSize 每页大小
* @param elevatorDto 查询参数
* @return 返回结果
*/
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"列表分页查询"
,
notes
=
"列表分页查询"
)
public
IPage
<
Elevator
>
listPage
(
String
pageNum
,
String
pageSize
,
Elevator
elevator
)
{
public
IPage
<
Elevator
Vo
>
listPage
(
String
pageNum
,
String
pageSize
,
ElevatorDto
elevatorDto
)
{
Elevator
elevator
=
BeanDtoVoUtils
.
convert
(
elevatorDto
,
Elevator
.
class
);
Page
<
Elevator
>
pageBean
;
QueryWrapper
<
Elevator
>
elevatorQueryWrapper
=
new
QueryWrapper
<>();
Class
<?
extends
Elevator
>
aClass
=
elevator
.
getClass
();
...
...
@@ -122,6 +137,7 @@ public class ElevatorController extends BaseController {
}
}
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
());
}
});
IPage
<
Elevator
>
page
;
...
...
@@ -131,7 +147,54 @@ public class ElevatorController extends BaseController {
pageBean
=
new
Page
<>(
Integer
.
parseInt
(
pageNum
),
Integer
.
parseInt
(
pageSize
));
}
page
=
iElevatorService
.
page
(
pageBean
,
elevatorQueryWrapper
);
return
page
;
return
BeanDtoVoUtils
.
iPageVoStream
(
page
,
ElevatorVo
.
class
);
}
/**
* 分页查询电梯信息
*
* @param pageNum 当前页
* @param pageSize 每页大小
* @param elevatorDto 查询参数
* @return 查询结果
*/
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/query_elevator_list"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"分页查询电梯信息"
,
notes
=
"分页查询电梯信息"
)
public
IPage
<
ElevatorVo
>
queryElevatorList
(
String
pageNum
,
String
pageSize
,
ElevatorDto
elevatorDto
)
{
Elevator
elevator
=
BeanDtoVoUtils
.
convert
(
elevatorDto
,
Elevator
.
class
);
Page
<
Elevator
>
pageBean
;
QueryWrapper
<
Elevator
>
elevatorQueryWrapper
=
new
QueryWrapper
<>();
Class
<?
extends
Elevator
>
aClass
=
elevator
.
getClass
();
Arrays
.
stream
(
aClass
.
getDeclaredFields
()).
forEach
(
field
->
{
try
{
field
.
setAccessible
(
true
);
Object
o
=
field
.
get
(
elevator
);
if
(
o
!=
null
)
{
String
name
=
NameUtils
.
camel2Underline
(
field
.
getName
());
if
(
"rescue_code"
.
equalsIgnoreCase
(
name
))
{
Integer
fileValue
=
(
Integer
)
o
;
elevatorQueryWrapper
.
like
(
name
,
fileValue
);
}
else
if
(
"city"
.
equalsIgnoreCase
(
name
)
||
"district"
.
equalsIgnoreCase
(
name
))
{
String
fileValue
=
(
String
)
o
;
elevatorQueryWrapper
.
eq
(
name
,
fileValue
);
}
else
{
String
fileValue
=
(
String
)
o
;
elevatorQueryWrapper
.
like
(
name
,
fileValue
);
}
}
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
());
}
});
IPage
<
Elevator
>
page
;
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
=
iElevatorService
.
page
(
pageBean
,
elevatorQueryWrapper
);
return
BeanDtoVoUtils
.
iPageVoStream
(
page
,
ElevatorVo
.
class
);
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/controller/MaintenanceUnitController.java
View file @
3764883a
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
biz
.
controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.Api
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.module.tzs.api.service.IMaintenanceUnitService
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
javax.servlet.http.HttpServletRequest
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
org.springframework.web.bind.annotation.*
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.
module.tzs.api.entity.MaintenanceUnit
;
import
com.yeejoin.amos.boot.
biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.biz.common.utils.NameUtils
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.MaintenanceUnit
;
import
com.yeejoin.amos.boot.module.tzs.api.service.IMaintenanceUnitService
;
import
com.yeejoin.amos.boot.module.tzs.api.vo.MaintenanceUnitVo
;
import
com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
java.util.Arrays
;
/**
* 维保单位
*
* @author tb
* @date 2021-06-01
*/
* 维保单位Api
*
* @author tb
* @date 2021-06-01
*/
@RestController
@Api
(
tags
=
"维保单位Api"
)
@RequestMapping
(
value
=
"/tzs/maintenance-unit"
)
public
class
MaintenanceUnitController
extends
BaseController
{
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
MaintenanceUnitController
.
class
);
@Autowired
IMaintenanceUnitService
iMaintenanceUnitService
;
/**
* 新增维保单位
* @return
*/
* 新增维保单位
*
* @param maintenanceUnitDto 新增参数
* @return 返回结果
*/
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/save"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增维保单位"
,
notes
=
"新增维保单位"
)
public
boolean
saveMaintenanceUnit
(
HttpServletRequest
request
,
@RequestBody
MaintenanceUnit
maintenanceUnit
){
public
boolean
saveMaintenanceUnit
(
@RequestBody
MaintenanceUnit
maintenanceUnitDto
)
{
MaintenanceUnit
maintenanceUnit
=
BeanDtoVoUtils
.
convert
(
maintenanceUnitDto
,
MaintenanceUnit
.
class
);
return
iMaintenanceUnitService
.
save
(
maintenanceUnit
);
}
/**
* 根据id删除
* @param id
* @return
*/
* 根据id删除
*
* @param id id
* @return 返回结果
*/
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
DELETE
)
@ApiOperation
(
httpMethod
=
"DELETE"
,
value
=
"根据id删除"
,
notes
=
"根据id删除"
)
public
boolean
deleteById
(
HttpServletRequest
request
,
@PathVariable
Long
id
)
{
public
boolean
deleteById
(
@PathVariable
Long
id
)
{
return
iMaintenanceUnitService
.
removeById
(
id
);
}
/**
* 修改维保单位
* @return
*/
* 修改维保单位
*
* @param maintenanceUnitDto 修改参数
* @return 返回结果
*/
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/updateById"
,
method
=
RequestMethod
.
PUT
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"修改维保单位"
,
notes
=
"修改维保单位"
)
public
boolean
updateByIdMaintenanceUnit
(
HttpServletRequest
request
,
@RequestBody
MaintenanceUnit
maintenanceUnit
){
public
boolean
updateByIdMaintenanceUnit
(
@RequestBody
MaintenanceUnit
maintenanceUnitDto
)
{
MaintenanceUnit
maintenanceUnit
=
BeanDtoVoUtils
.
convert
(
maintenanceUnitDto
,
MaintenanceUnit
.
class
);
return
iMaintenanceUnitService
.
updateById
(
maintenanceUnit
);
}
/**
* 根据id查询
* @param id
* @return
*/
* 根据id查询
*
* @param id id
* @return 返回结果
*/
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据id查询"
,
notes
=
"根据id查询"
)
public
MaintenanceUnit
selectById
(
HttpServletRequest
request
,
@PathVariable
Long
id
){
return
iMaintenanceUnitService
.
getById
(
id
);
public
MaintenanceUnitVo
selectById
(
@PathVariable
Long
id
)
{
MaintenanceUnit
maintenanceUnit
=
iMaintenanceUnitService
.
getById
(
id
);
return
BeanDtoVoUtils
.
convert
(
maintenanceUnit
,
MaintenanceUnitVo
.
class
);
}
/**
* 列表分页查询
* @return
*/
* 列表分页查询
*
* @param pageNum 当前页
* @param pageSize 每页大小
* @param maintenanceUnitDto 查询参数
* @return 返回结果
*/
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"列表分页查询"
,
notes
=
"列表分页查询"
)
public
IPage
<
MaintenanceUnit
>
listPage
(
String
pageNum
,
String
pageSize
,
MaintenanceUnit
maintenanceUnit
)
{
public
IPage
<
MaintenanceUnit
Vo
>
listPage
(
String
pageNum
,
String
pageSize
,
MaintenanceUnit
maintenanceUnitDto
)
{
MaintenanceUnit
maintenanceUnit
=
BeanDtoVoUtils
.
convert
(
maintenanceUnitDto
,
MaintenanceUnit
.
class
);
Page
<
MaintenanceUnit
>
pageBean
;
QueryWrapper
<
MaintenanceUnit
>
maintenanceUnitQueryWrapper
=
new
QueryWrapper
<>();
Class
<?
extends
MaintenanceUnit
>
aClass
=
maintenanceUnit
.
getClass
();
...
...
@@ -122,6 +130,7 @@ public class MaintenanceUnitController extends BaseController {
}
}
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
());
}
});
IPage
<
MaintenanceUnit
>
page
;
...
...
@@ -131,7 +140,55 @@ public class MaintenanceUnitController extends BaseController {
pageBean
=
new
Page
<>(
Integer
.
parseInt
(
pageNum
),
Integer
.
parseInt
(
pageSize
));
}
page
=
iMaintenanceUnitService
.
page
(
pageBean
,
maintenanceUnitQueryWrapper
);
return
page
;
return
BeanDtoVoUtils
.
iPageVoStream
(
page
,
MaintenanceUnitVo
.
class
);
}
/**
* 分页查询维保单位信息
*
* @param pageNum 当前页
* @param pageSize 每页大小
* @param maintenanceUnitDto 查询参数
* @return 返回结果
*/
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/query_maintenance_unit_list"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"分页查询维保单位信息"
,
notes
=
"分页查询维保单位信息"
)
public
IPage
<
MaintenanceUnitVo
>
queryMaintenanceUnitList
(
String
pageNum
,
String
pageSize
,
MaintenanceUnit
maintenanceUnitDto
)
{
MaintenanceUnit
maintenanceUnit
=
BeanDtoVoUtils
.
convert
(
maintenanceUnitDto
,
MaintenanceUnit
.
class
);
Page
<
MaintenanceUnit
>
pageBean
;
QueryWrapper
<
MaintenanceUnit
>
maintenanceUnitQueryWrapper
=
new
QueryWrapper
<>();
Class
<?
extends
MaintenanceUnit
>
aClass
=
maintenanceUnit
.
getClass
();
Arrays
.
stream
(
aClass
.
getDeclaredFields
()).
forEach
(
field
->
{
try
{
field
.
setAccessible
(
true
);
Object
o
=
field
.
get
(
maintenanceUnit
);
if
(
o
!=
null
)
{
String
name
=
NameUtils
.
camel2Underline
(
field
.
getName
());
if
(
"city"
.
equalsIgnoreCase
(
name
)
||
"district"
.
equalsIgnoreCase
(
name
)
||
"qualification_level"
.
equalsIgnoreCase
(
name
))
{
String
fileValue
=
(
String
)
o
;
maintenanceUnitQueryWrapper
.
eq
(
name
,
fileValue
);
}
else
if
(
"credit_level"
.
equalsIgnoreCase
(
name
))
{
Integer
fileValue
=
(
Integer
)
o
;
maintenanceUnitQueryWrapper
.
eq
(
name
,
fileValue
);
}
else
{
String
fileValue
=
(
String
)
o
;
maintenanceUnitQueryWrapper
.
like
(
name
,
fileValue
);
}
}
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
());
}
});
IPage
<
MaintenanceUnit
>
page
;
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
=
iMaintenanceUnitService
.
page
(
pageBean
,
maintenanceUnitQueryWrapper
);
return
BeanDtoVoUtils
.
iPageVoStream
(
page
,
MaintenanceUnitVo
.
class
);
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/controller/UseUnitController.java
View file @
3764883a
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
biz
.
controller
;
import
com.yeejoin.amos.boot.module.tzs.api.service.EquipFeignService
;
import
com.yeejoin.amos.boot.module.tzs.api.vo.UseUnitVo
;
import
com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.Api
;
...
...
@@ -11,7 +14,9 @@ import com.yeejoin.amos.boot.module.tzs.api.service.IUseUnitService;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
javax.servlet.http.HttpServletRequest
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
org.springframework.web.bind.annotation.*
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
...
...
@@ -25,11 +30,11 @@ import java.util.Arrays;
/**
* 使用单位
*
* @author tb
* @date 2021-06-01
*/
* 使用单位
*
* @author tb
* @date 2021-06-01
*/
@RestController
@Api
(
tags
=
"使用单位Api"
)
@RequestMapping
(
value
=
"/tzs/use-unit"
)
...
...
@@ -42,44 +47,46 @@ public class UseUnitController extends BaseController {
EquipFeignService
equipFeignService
;
/**
* 新增使用单位
* @return
*/
* 新增使用单位
*
* @return
*/
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/save"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增使用单位"
,
notes
=
"新增使用单位"
)
public
boolean
saveUseUnit
(
HttpServletRequest
request
,
@RequestBody
UseUnit
useUnit
){
public
boolean
saveUseUnit
(
HttpServletRequest
request
,
@RequestBody
UseUnit
useUnit
)
{
return
iUseUnitService
.
save
(
useUnit
);
}
/**
* 根据id删除
* @param id
* @return
*/
* 根据id删除
*
* @param id
* @return
*/
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
DELETE
)
@ApiOperation
(
httpMethod
=
"DELETE"
,
value
=
"根据id删除"
,
notes
=
"根据id删除"
)
public
boolean
deleteById
(
HttpServletRequest
request
,
@PathVariable
Long
id
){
public
boolean
deleteById
(
HttpServletRequest
request
,
@PathVariable
Long
id
)
{
return
iUseUnitService
.
removeById
(
id
);
}
/**
* 修改使用单位
* @return
*/
* 修改使用单位
*
* @return
*/
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/updateById"
,
method
=
RequestMethod
.
PUT
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"修改使用单位"
,
notes
=
"修改使用单位"
)
public
boolean
updateByIdUseUnit
(
HttpServletRequest
request
,
@RequestBody
UseUnit
useUnit
){
public
boolean
updateByIdUseUnit
(
HttpServletRequest
request
,
@RequestBody
UseUnit
useUnit
)
{
return
iUseUnitService
.
updateById
(
useUnit
);
}
/**
* 获取消防建筑树
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
...
...
@@ -91,27 +98,30 @@ public class UseUnitController extends BaseController {
}
/**
* 根据id查询
* @param id
* @return
*/
* 根据id查询
*
* @param id id
* @return 返回结果
*/
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据id查询"
,
notes
=
"根据id查询"
)
public
UseUnit
selectById
(
HttpServletRequest
request
,
@PathVariable
Long
id
){
return
iUseUnitService
.
getById
(
id
);
public
UseUnitVo
selectById
(
HttpServletRequest
request
,
@PathVariable
Long
id
)
{
UseUnit
useUnit
=
iUseUnitService
.
getById
(
id
);
UseUnitVo
useUnitVo
=
BeanDtoVoUtils
.
convert
(
useUnit
,
UseUnitVo
.
class
);
return
useUnitVo
;
}
/**
* 列表分页查询
* @return
*/
* 列表分页查询
*
* @return
*/
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"列表分页查询"
,
notes
=
"列表分页查询"
)
public
IPage
<
UseUnit
>
listPage
(
String
pageNum
,
String
pageSize
,
UseUnit
useUnit
)
{
public
IPage
<
UseUnit
>
listPage
(
String
pageNum
,
String
pageSize
,
UseUnit
useUnit
)
{
Page
<
UseUnit
>
pageBean
;
QueryWrapper
<
UseUnit
>
useUnitQueryWrapper
=
new
QueryWrapper
<>();
...
...
@@ -147,7 +157,7 @@ public class UseUnitController extends BaseController {
pageBean
=
new
Page
<>(
Integer
.
parseInt
(
pageNum
),
Integer
.
parseInt
(
pageSize
));
}
page
=
iUseUnitService
.
page
(
pageBean
,
useUnitQueryWrapper
);
return
page
;
}
return
page
;
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/utils/BeanDtoVoUtils.java
0 → 100644
View file @
3764883a
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
biz
.
utils
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
org.springframework.beans.BeanUtils
;
/**
* @title: 实体类 Dto,Vo,entity 转换工具类
* @Author fpy
* @Date: 2021/6/3 13:53
*/
public
class
BeanDtoVoUtils
{
/**
* Dot ,Do ,Entity 相互转换
*
* @param source 原数据
* @param targetClass 目标类
* @param <T> 泛型类
* @return 转换返回值
*/
public
static
<
T
>
T
convert
(
Object
source
,
Class
<
T
>
targetClass
)
{
// 判断source是否为空
if
(
source
==
null
)
{
return
null
;
}
// 判断targetClass是否为空
if
(
targetClass
==
null
)
{
return
null
;
}
try
{
// 创建新的对象实例
T
target
=
targetClass
.
newInstance
();
// 把原对象数据拷贝到新对象
BeanUtils
.
copyProperties
(
source
,
target
);
// 返回新对象
return
target
;
}
catch
(
Exception
e
)
{
return
null
;
}
}
/**
* IPage<Entity> 分页对象转 IPage<Vo>
*
* @param page 原分页对象
* @param v 目标vo类
* @param <E> 泛型类
* @param <V> 泛型类
* @return 转换后的分页对象
*/
public
static
<
E
,
V
>
IPage
<
V
>
iPageVoStream
(
IPage
<
E
>
page
,
Class
<
V
>
v
)
{
return
page
.
convert
(
item
->
{
try
{
return
convert
(
item
,
v
);
}
catch
(
Exception
e
)
{
return
null
;
}
});
}
}
\ No newline at end of file
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