Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
ioc_sixiang_license
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
zengtianlai3
ioc_sixiang_license
Commits
fc99621e
Commit
fc99621e
authored
Jul 15, 2022
by
AfirSraftGarrier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改
parent
a8e382c2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
71 additions
and
70 deletions
+71
-70
DeviceController.java
...java/iot/sixiang/license/controller/DeviceController.java
+35
-50
OperateController.java
...ava/iot/sixiang/license/controller/OperateController.java
+7
-1
UserController.java
...n/java/iot/sixiang/license/controller/UserController.java
+29
-19
No files found.
license/src/main/java/iot/sixiang/license/controller/DeviceController.java
View file @
fc99621e
...
@@ -18,13 +18,14 @@ import iot.sixiang.license.model.vo.DeviceVo;
...
@@ -18,13 +18,14 @@ import iot.sixiang.license.model.vo.DeviceVo;
import
iot.sixiang.license.service.DeviceBlackService
;
import
iot.sixiang.license.service.DeviceBlackService
;
import
iot.sixiang.license.service.DeviceService
;
import
iot.sixiang.license.service.DeviceService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.WebDataBinder
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
import
java.util.List
;
/**
/**
* <p>
* <p>
*
前端控制器
* 前端控制器
* </p>
* </p>
*
*
* @author m33
* @author m33
...
@@ -43,22 +44,25 @@ public class DeviceController {
...
@@ -43,22 +44,25 @@ public class DeviceController {
@Autowired
@Autowired
private
DeviceBlackService
deviceBlackService
;
private
DeviceBlackService
deviceBlackService
;
@InitBinder
public
void
initBinder
(
WebDataBinder
binder
)
{
binder
.
setDisallowedFields
(
new
String
[]{
"adminCome"
});
}
/**
/**
* 添加device
* 添加device
*
* @param jsonObject
* @param jsonObject
* @return
* @return
*/
*/
@ApiOperation
(
value
=
"添加设备接口"
,
notes
=
"用于添加设备"
)
@ApiOperation
(
value
=
"添加设备接口"
,
notes
=
"用于添加设备"
)
@PostMapping
(
"add"
)
@PostMapping
(
"add"
)
@ApiOperationSupport
(
params
=
@DynamicParameters
(
name
=
"jsonObject"
,
properties
=
{
@ApiOperationSupport
(
params
=
@DynamicParameters
(
name
=
"jsonObject"
,
properties
=
{
@DynamicParameter
(
name
=
"appId"
,
value
=
"应用Id"
,
required
=
true
,
dataTypeClass
=
String
.
class
),
@DynamicParameter
(
name
=
"count"
,
value
=
"需要创建的设备数量"
,
required
=
true
,
dataTypeClass
=
Integer
.
class
),}))
@DynamicParameter
(
name
=
"appId"
,
value
=
"应用Id"
,
required
=
true
,
dataTypeClass
=
String
.
class
),
@DynamicParameter
(
name
=
"count"
,
value
=
"需要创建的设备数量"
,
required
=
true
,
dataTypeClass
=
Integer
.
class
),
}))
@MyLog
(
title
=
"添加设备"
,
optParam
=
"#{jsonObject}"
,
businessType
=
BusinessType
.
INSERT
)
@MyLog
(
title
=
"添加设备"
,
optParam
=
"#{jsonObject}"
,
businessType
=
BusinessType
.
INSERT
)
public
BaseResult
addDevice
(
@RequestBody
JSONObject
jsonObject
)
{
public
BaseResult
addDevice
(
@RequestBody
JSONObject
jsonObject
)
{
String
appId
=
jsonObject
.
getString
(
"appId"
);
String
appId
=
jsonObject
.
getString
(
"appId"
);
int
count
=
jsonObject
.
getIntValue
(
"count"
);
int
count
=
jsonObject
.
getIntValue
(
"count"
);
boolean
res
=
deviceService
.
addDevice
(
appId
,
count
);
boolean
res
=
deviceService
.
addDevice
(
appId
,
count
);
if
(
res
)
{
if
(
res
)
{
return
BaseResult
.
success
();
return
BaseResult
.
success
();
}
else
{
}
else
{
...
@@ -68,6 +72,7 @@ public class DeviceController {
...
@@ -68,6 +72,7 @@ public class DeviceController {
/**
/**
* 可按条件分页查询所有的设备
* 可按条件分页查询所有的设备
*
* @param pageNo
* @param pageNo
* @param pageSize
* @param pageSize
* @param appName
* @param appName
...
@@ -77,40 +82,24 @@ public class DeviceController {
...
@@ -77,40 +82,24 @@ public class DeviceController {
@ApiOperation
(
value
=
"获取设备列表接口"
,
notes
=
"用于获取设备列表"
)
@ApiOperation
(
value
=
"获取设备列表接口"
,
notes
=
"用于获取设备列表"
)
@GetMapping
(
"list"
)
@GetMapping
(
"list"
)
@MyLog
(
title
=
"获取设备列表"
,
optParam
=
"#{pageNo},#{pageSize},#{appName},#{userName}"
,
businessType
=
BusinessType
.
SELECT
)
@MyLog
(
title
=
"获取设备列表"
,
optParam
=
"#{pageNo},#{pageSize},#{appName},#{userName}"
,
businessType
=
BusinessType
.
SELECT
)
@ApiImplicitParams
({
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"pageNo"
,
value
=
"当前在第几页"
,
required
=
true
,
dataType
=
"int"
),
@ApiImplicitParam
(
name
=
"pageSize"
,
value
=
"每页显示多少页"
,
required
=
true
,
dataType
=
"int"
),
@ApiImplicitParam
(
name
=
"appName"
,
value
=
"应用名"
),
@ApiImplicitParam
(
name
=
"userName"
,
value
=
"用户名"
)})
@ApiImplicitParam
(
name
=
"pageNo"
,
value
=
"当前在第几页"
,
required
=
true
,
dataType
=
"int"
),
public
PageResult
<
DeviceVo
>
getDeviceList
(
@RequestParam
(
value
=
"pageNo"
,
defaultValue
=
"0"
)
int
pageNo
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"0"
)
int
pageSize
,
@RequestParam
(
value
=
"appName"
,
required
=
false
)
String
appName
,
@RequestParam
(
value
=
"userName"
,
required
=
false
)
String
userName
)
{
@ApiImplicitParam
(
name
=
"pageSize"
,
value
=
"每页显示多少页"
,
required
=
true
,
dataType
=
"int"
),
PageInfoModel
<
DeviceVo
>
records
=
deviceService
.
getDeviceList
(
pageNo
,
pageSize
,
appName
,
userName
);
@ApiImplicitParam
(
name
=
"appName"
,
value
=
"应用名"
),
@ApiImplicitParam
(
name
=
"userName"
,
value
=
"用户名"
)
})
public
PageResult
<
DeviceVo
>
getDeviceList
(
@RequestParam
(
value
=
"pageNo"
,
defaultValue
=
"0"
)
int
pageNo
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"0"
)
int
pageSize
,
@RequestParam
(
value
=
"appName"
,
required
=
false
)
String
appName
,
@RequestParam
(
value
=
"userName"
,
required
=
false
)
String
userName
)
{
PageInfoModel
<
DeviceVo
>
records
=
deviceService
.
getDeviceList
(
pageNo
,
pageSize
,
appName
,
userName
);
int
total
=
records
.
getTotal
();
int
total
=
records
.
getTotal
();
int
pages
=
total
/
pageSize
;
//pages为总页数
int
pages
=
total
/
pageSize
;
//pages为总页数
int
mod
=
total
%
pageSize
;
int
mod
=
total
%
pageSize
;
if
(
mod
!=
0
)
{
if
(
mod
!=
0
)
{
pages
=
pages
+
1
;
pages
=
pages
+
1
;
}
}
List
<
DeviceVo
>
pageResult
=
records
.
getResult
();
List
<
DeviceVo
>
pageResult
=
records
.
getResult
();
return
new
PageResult
(
200
,
"查找成功"
,
pageNo
,
pages
,
total
,
pageResult
);
return
new
PageResult
(
200
,
"查找成功"
,
pageNo
,
pages
,
total
,
pageResult
);
}
}
@ApiOperation
(
value
=
"获取设备详细信息接口"
,
notes
=
"用于获取设备详细信息列表"
)
@ApiOperation
(
value
=
"获取设备详细信息接口"
,
notes
=
"用于获取设备详细信息列表"
)
@GetMapping
(
"detail/list"
)
@GetMapping
(
"detail/list"
)
@MyLog
(
title
=
"获取设备详细信息接口"
,
optParam
=
"#{pageNo},#{pageSize},#{appName},#{userName}"
,
businessType
=
BusinessType
.
SELECT
)
@MyLog
(
title
=
"获取设备详细信息接口"
,
optParam
=
"#{pageNo},#{pageSize},#{appName},#{userName}"
,
businessType
=
BusinessType
.
SELECT
)
@ApiImplicitParams
({
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"pageNo"
,
value
=
"当前在第几页"
,
required
=
true
,
dataType
=
"int"
),
@ApiImplicitParam
(
name
=
"pageSize"
,
value
=
"每页显示多少条"
,
required
=
true
,
dataType
=
"int"
),
@ApiImplicitParam
(
name
=
"appName"
,
value
=
"应用名"
),
@ApiImplicitParam
(
name
=
"userName"
,
value
=
"用户名"
)})
@ApiImplicitParam
(
name
=
"pageNo"
,
value
=
"当前在第几页"
,
required
=
true
,
dataType
=
"int"
),
public
PageResult
<
DeviceDetailVo
>
getDeviceDetailList
(
@RequestParam
(
value
=
"pageNo"
,
defaultValue
=
"0"
)
int
pageNo
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"0"
)
int
pageSize
,
@RequestParam
(
value
=
"appName"
,
required
=
false
)
String
appName
,
@RequestParam
(
value
=
"userName"
,
required
=
false
)
String
userName
)
{
@ApiImplicitParam
(
name
=
"pageSize"
,
value
=
"每页显示多少条"
,
required
=
true
,
dataType
=
"int"
),
@ApiImplicitParam
(
name
=
"appName"
,
value
=
"应用名"
),
@ApiImplicitParam
(
name
=
"userName"
,
value
=
"用户名"
)
})
public
PageResult
<
DeviceDetailVo
>
getDeviceDetailList
(
@RequestParam
(
value
=
"pageNo"
,
defaultValue
=
"0"
)
int
pageNo
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"0"
)
int
pageSize
,
@RequestParam
(
value
=
"appName"
,
required
=
false
)
String
appName
,
@RequestParam
(
value
=
"userName"
,
required
=
false
)
String
userName
)
{
PageInfoModel
<
DeviceDetailVo
>
records
=
deviceManager
.
getDeviceDetailList
(
pageNo
,
pageSize
,
appName
,
userName
);
PageInfoModel
<
DeviceDetailVo
>
records
=
deviceManager
.
getDeviceDetailList
(
pageNo
,
pageSize
,
appName
,
userName
);
int
total
=
records
.
getTotal
();
int
total
=
records
.
getTotal
();
...
@@ -125,14 +114,13 @@ public class DeviceController {
...
@@ -125,14 +114,13 @@ public class DeviceController {
/**
/**
* 添加device_black
* 添加device_black
*
* @param jsonObject
* @param jsonObject
* @return
* @return
*/
*/
@ApiOperation
(
value
=
"添加设备黑名单接口"
,
notes
=
"用于添加设备黑名单"
)
@ApiOperation
(
value
=
"添加设备黑名单接口"
,
notes
=
"用于添加设备黑名单"
)
@PostMapping
(
"device_black/add"
)
@PostMapping
(
"device_black/add"
)
@ApiOperationSupport
(
params
=
@DynamicParameters
(
name
=
"jsonObject"
,
properties
=
{
@ApiOperationSupport
(
params
=
@DynamicParameters
(
name
=
"jsonObject"
,
properties
=
{
@DynamicParameter
(
name
=
"deviceId"
,
value
=
"设备Id"
,
required
=
true
,
dataTypeClass
=
Integer
.
class
)}))
@DynamicParameter
(
name
=
"deviceId"
,
value
=
"设备Id"
,
required
=
true
,
dataTypeClass
=
Integer
.
class
)
}))
@MyLog
(
title
=
"添加设备黑名单"
,
optParam
=
"#{jsonObject}"
,
businessType
=
BusinessType
.
INSERT
)
@MyLog
(
title
=
"添加设备黑名单"
,
optParam
=
"#{jsonObject}"
,
businessType
=
BusinessType
.
INSERT
)
public
BaseResult
addDeviceBlack
(
@RequestBody
JSONObject
jsonObject
)
{
public
BaseResult
addDeviceBlack
(
@RequestBody
JSONObject
jsonObject
)
{
int
deviceId
=
jsonObject
.
getIntValue
(
"deviceId"
);
int
deviceId
=
jsonObject
.
getIntValue
(
"deviceId"
);
...
@@ -146,14 +134,13 @@ public class DeviceController {
...
@@ -146,14 +134,13 @@ public class DeviceController {
/**
/**
* 删除device_black
* 删除device_black
*
* @param jsonObject
* @param jsonObject
* @return
* @return
*/
*/
@ApiOperation
(
value
=
"设备黑名单删除接口"
,
notes
=
"删除设备黑名单"
)
@ApiOperation
(
value
=
"设备黑名单删除接口"
,
notes
=
"删除设备黑名单"
)
@PostMapping
(
"device_black/delete"
)
@PostMapping
(
"device_black/delete"
)
@ApiOperationSupport
(
params
=
@DynamicParameters
(
name
=
"jsonObject"
,
properties
=
{
@ApiOperationSupport
(
params
=
@DynamicParameters
(
name
=
"jsonObject"
,
properties
=
{
@DynamicParameter
(
name
=
"deviceId"
,
value
=
"设备Id"
,
required
=
true
,
dataTypeClass
=
Integer
.
class
)}))
@DynamicParameter
(
name
=
"deviceId"
,
value
=
"设备Id"
,
required
=
true
,
dataTypeClass
=
Integer
.
class
)
}))
@MyLog
(
title
=
"删除设备黑名单"
,
optParam
=
"#{deviceId}"
,
businessType
=
BusinessType
.
DELETE
)
@MyLog
(
title
=
"删除设备黑名单"
,
optParam
=
"#{deviceId}"
,
businessType
=
BusinessType
.
DELETE
)
public
BaseResult
deleteDeviceBlack
(
@RequestBody
JSONObject
jsonObject
)
{
public
BaseResult
deleteDeviceBlack
(
@RequestBody
JSONObject
jsonObject
)
{
int
deviceId
=
jsonObject
.
getIntValue
(
"deviceId"
);
int
deviceId
=
jsonObject
.
getIntValue
(
"deviceId"
);
...
@@ -167,6 +154,7 @@ public class DeviceController {
...
@@ -167,6 +154,7 @@ public class DeviceController {
/**
/**
* 分页查询所有黑名单设备
* 分页查询所有黑名单设备
*
* @param pageNo
* @param pageNo
* @param pageSize
* @param pageSize
* @return
* @return
...
@@ -174,20 +162,17 @@ public class DeviceController {
...
@@ -174,20 +162,17 @@ public class DeviceController {
@ApiOperation
(
value
=
"获取设备黑名单列表接口"
,
notes
=
"用于获取设备黑名单列表"
)
@ApiOperation
(
value
=
"获取设备黑名单列表接口"
,
notes
=
"用于获取设备黑名单列表"
)
@GetMapping
(
"device_black/list"
)
@GetMapping
(
"device_black/list"
)
@MyLog
(
title
=
"获取设备黑名单列表"
,
optParam
=
"#{pageNo},#{pageSize}"
,
businessType
=
BusinessType
.
SELECT
)
@MyLog
(
title
=
"获取设备黑名单列表"
,
optParam
=
"#{pageNo},#{pageSize}"
,
businessType
=
BusinessType
.
SELECT
)
@ApiImplicitParams
({
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"pageNo"
,
value
=
"当前在第几页"
,
required
=
true
,
dataType
=
"int"
),
@ApiImplicitParam
(
name
=
"pageSize"
,
value
=
"每页显示多少页"
,
required
=
true
,
dataType
=
"int"
)})
@ApiImplicitParam
(
name
=
"pageNo"
,
value
=
"当前在第几页"
,
required
=
true
,
dataType
=
"int"
),
public
PageResult
<
DeviceBlack
>
getDeviceBlackList
(
@RequestParam
(
value
=
"pageNo"
,
defaultValue
=
"0"
)
int
pageNo
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"0"
)
int
pageSize
)
{
@ApiImplicitParam
(
name
=
"pageSize"
,
value
=
"每页显示多少页"
,
required
=
true
,
dataType
=
"int"
)
PageInfoModel
<
DeviceBlack
>
records
=
deviceBlackService
.
getDeviceBlackList
(
pageNo
,
pageSize
);
})
public
PageResult
<
DeviceBlack
>
getDeviceBlackList
(
@RequestParam
(
value
=
"pageNo"
,
defaultValue
=
"0"
)
int
pageNo
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"0"
)
int
pageSize
){
PageInfoModel
<
DeviceBlack
>
records
=
deviceBlackService
.
getDeviceBlackList
(
pageNo
,
pageSize
);
int
total
=
records
.
getTotal
();
int
total
=
records
.
getTotal
();
int
pages
=
total
/
pageSize
;
//pages为总页数
int
pages
=
total
/
pageSize
;
//pages为总页数
int
mod
=
total
%
pageSize
;
int
mod
=
total
%
pageSize
;
if
(
mod
!=
0
)
{
if
(
mod
!=
0
)
{
pages
=
pages
+
1
;
pages
=
pages
+
1
;
}
}
List
<
DeviceBlack
>
pageResult
=
records
.
getResult
();
List
<
DeviceBlack
>
pageResult
=
records
.
getResult
();
return
new
PageResult
(
200
,
"查找成功"
,
pageNo
,
pages
,
total
,
pageResult
);
return
new
PageResult
(
200
,
"查找成功"
,
pageNo
,
pages
,
total
,
pageResult
);
}
}
}
}
license/src/main/java/iot/sixiang/license/controller/OperateController.java
View file @
fc99621e
...
@@ -28,6 +28,7 @@ import iot.sixiang.license.service.ServerService;
...
@@ -28,6 +28,7 @@ import iot.sixiang.license.service.ServerService;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.owasp.esapi.ESAPI
;
import
org.owasp.esapi.ESAPI
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.WebDataBinder
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
...
@@ -56,6 +57,11 @@ public class OperateController {
...
@@ -56,6 +57,11 @@ public class OperateController {
@Autowired
@Autowired
HttpServletResponse
response
;
HttpServletResponse
response
;
@InitBinder
public
void
initBinder
(
WebDataBinder
binder
)
{
binder
.
setDisallowedFields
(
new
String
[]{
"adminCome"
});
}
@ApiOperation
(
value
=
"服务接口"
,
notes
=
"用于获取服务列表"
)
@ApiOperation
(
value
=
"服务接口"
,
notes
=
"用于获取服务列表"
)
@GetMapping
(
"monitor/server"
)
@GetMapping
(
"monitor/server"
)
@MyLog
(
title
=
"获取服务列表"
,
businessType
=
BusinessType
.
SELECT
)
@MyLog
(
title
=
"获取服务列表"
,
businessType
=
BusinessType
.
SELECT
)
...
@@ -95,7 +101,7 @@ public class OperateController {
...
@@ -95,7 +101,7 @@ public class OperateController {
@GetMapping
(
"alarm/list"
)
@GetMapping
(
"alarm/list"
)
@MyLog
(
title
=
"获取告警列表"
,
businessType
=
BusinessType
.
SELECT
)
@MyLog
(
title
=
"获取告警列表"
,
businessType
=
BusinessType
.
SELECT
)
public
ResResult
<
List
<
AlarmVo
>>
getAlarmList
()
{
public
ResResult
<
List
<
AlarmVo
>>
getAlarmList
()
{
response
.
setHeader
(
"Set-Cookie"
,
"cookiename=cookievalue; path=/; Domain=domainvaule; Max-age=seconds; HttpOnly"
);
response
.
setHeader
(
"Set-Cookie"
,
"cookiename=cookievalue; path=/; Domain=domainvaule; Max-age=seconds; HttpOnly"
);
String
user
=
UserUtils
.
getLoginUserId
();
String
user
=
UserUtils
.
getLoginUserId
();
int
userI
=
Integer
.
valueOf
(
user
);
int
userI
=
Integer
.
valueOf
(
user
);
List
<
AlarmVo
>
alarmList
=
alarmService
.
getAlarmList
(
userI
);
List
<
AlarmVo
>
alarmList
=
alarmService
.
getAlarmList
(
userI
);
...
...
license/src/main/java/iot/sixiang/license/controller/UserController.java
View file @
fc99621e
...
@@ -18,13 +18,14 @@ import iot.sixiang.license.model.vo.UserVo;
...
@@ -18,13 +18,14 @@ import iot.sixiang.license.model.vo.UserVo;
import
iot.sixiang.license.service.UserService
;
import
iot.sixiang.license.service.UserService
;
import
iot.sixiang.license.util.CommonUtil
;
import
iot.sixiang.license.util.CommonUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.WebDataBinder
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
import
java.util.List
;
/**
/**
* <p>
* <p>
*
前端控制器
* 前端控制器
* </p>
* </p>
*
*
* @author m33
* @author m33
...
@@ -38,17 +39,23 @@ public class UserController {
...
@@ -38,17 +39,23 @@ public class UserController {
@Autowired
@Autowired
private
UserService
userService
;
private
UserService
userService
;
@InitBinder
public
void
initBinder
(
WebDataBinder
binder
)
{
binder
.
setDisallowedFields
(
new
String
[]{
"adminCome"
});
}
/**
/**
* 添加user
* 添加user
*
* @param jsonObject
* @param jsonObject
* @return
* @return
*/
*/
@ApiOperation
(
value
=
"用户添加接口"
,
notes
=
"用于添加用户"
)
@ApiOperation
(
value
=
"用户添加接口"
,
notes
=
"用于添加用户"
)
@PostMapping
(
"add"
)
@PostMapping
(
"add"
)
@MyLog
(
title
=
"添加用户"
,
optParam
=
"#{jsonObject}"
,
businessType
=
BusinessType
.
INSERT
)
@MyLog
(
title
=
"添加用户"
,
optParam
=
"#{jsonObject}"
,
businessType
=
BusinessType
.
INSERT
)
@ApiOperationSupport
(
params
=
@DynamicParameters
(
name
=
"jsonObject"
,
properties
=
{
@ApiOperationSupport
(
params
=
@DynamicParameters
(
name
=
"jsonObject"
,
properties
=
{
@DynamicParameter
(
name
=
"userName"
,
value
=
"账户名"
,
required
=
true
,
dataTypeClass
=
String
.
class
),
@DynamicParameter
(
name
=
"userName"
,
value
=
"账户名"
,
required
=
true
,
dataTypeClass
=
String
.
class
),
@DynamicParameter
(
name
=
"company"
,
value
=
"公司名"
,
required
=
true
,
dataTypeClass
=
String
.
class
)
@DynamicParameter
(
name
=
"company"
,
value
=
"公司名"
,
required
=
true
,
dataTypeClass
=
String
.
class
)
}))
}))
public
BaseResult
addUser
(
@RequestBody
JSONObject
jsonObject
)
{
public
BaseResult
addUser
(
@RequestBody
JSONObject
jsonObject
)
{
String
userName
=
(
String
)
jsonObject
.
get
(
"userName"
);
String
userName
=
(
String
)
jsonObject
.
get
(
"userName"
);
...
@@ -64,6 +71,7 @@ public class UserController {
...
@@ -64,6 +71,7 @@ public class UserController {
/**
/**
* 删除user
* 删除user
*
* @param userId
* @param userId
* @return
* @return
*/
*/
...
@@ -81,15 +89,16 @@ public class UserController {
...
@@ -81,15 +89,16 @@ public class UserController {
/**
/**
* 修改user
* 修改user
*
* @param jsonObject
* @param jsonObject
* @return
* @return
*/
*/
@ApiOperation
(
value
=
"用户修改接口"
,
notes
=
"修改用户"
)
@ApiOperation
(
value
=
"用户修改接口"
,
notes
=
"修改用户"
)
@PostMapping
(
"update"
)
@PostMapping
(
"update"
)
@MyLog
(
title
=
"修改用户"
,
optParam
=
"#{userId},#{password}"
,
businessType
=
BusinessType
.
UPDATE
)
@MyLog
(
title
=
"修改用户"
,
optParam
=
"#{userId},#{password}"
,
businessType
=
BusinessType
.
UPDATE
)
@ApiOperationSupport
(
params
=
@DynamicParameters
(
name
=
"jsonObject"
,
properties
=
{
@ApiOperationSupport
(
params
=
@DynamicParameters
(
name
=
"jsonObject"
,
properties
=
{
@DynamicParameter
(
name
=
"userId"
,
value
=
"用户Id"
,
required
=
true
,
dataTypeClass
=
Integer
.
class
),
@DynamicParameter
(
name
=
"userId"
,
value
=
"用户Id"
,
required
=
true
,
dataTypeClass
=
Integer
.
class
),
@DynamicParameter
(
name
=
"password"
,
value
=
"密码"
,
required
=
true
,
dataTypeClass
=
String
.
class
)
@DynamicParameter
(
name
=
"password"
,
value
=
"密码"
,
required
=
true
,
dataTypeClass
=
String
.
class
)
}))
}))
public
BaseResult
updateUser
(
@RequestBody
JSONObject
jsonObject
)
{
public
BaseResult
updateUser
(
@RequestBody
JSONObject
jsonObject
)
{
int
userId
=
jsonObject
.
getInteger
(
"userId"
);
int
userId
=
jsonObject
.
getInteger
(
"userId"
);
...
@@ -105,6 +114,7 @@ public class UserController {
...
@@ -105,6 +114,7 @@ public class UserController {
/**
/**
* 分页查询所有的user
* 分页查询所有的user
*
* @param pageNo
* @param pageNo
* @param pageSize
* @param pageSize
* @return
* @return
...
@@ -113,24 +123,24 @@ public class UserController {
...
@@ -113,24 +123,24 @@ public class UserController {
@GetMapping
(
"list"
)
@GetMapping
(
"list"
)
@MyLog
(
title
=
"获取用户列表"
,
optParam
=
"#{pageNo},#{pageSize},#{userName},#{company}"
,
businessType
=
BusinessType
.
SELECT
)
@MyLog
(
title
=
"获取用户列表"
,
optParam
=
"#{pageNo},#{pageSize},#{userName},#{company}"
,
businessType
=
BusinessType
.
SELECT
)
@ApiImplicitParams
({
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"pageNo"
,
value
=
"当前在第几页"
,
required
=
true
,
dataType
=
"int"
),
@ApiImplicitParam
(
name
=
"pageNo"
,
value
=
"当前在第几页"
,
required
=
true
,
dataType
=
"int"
),
@ApiImplicitParam
(
name
=
"pageSize"
,
value
=
"每页显示多少条"
,
required
=
true
,
dataType
=
"int"
),
@ApiImplicitParam
(
name
=
"pageSize"
,
value
=
"每页显示多少条"
,
required
=
true
,
dataType
=
"int"
),
@ApiImplicitParam
(
name
=
"userName"
,
value
=
"用户名"
),
@ApiImplicitParam
(
name
=
"userName"
,
value
=
"用户名"
),
@ApiImplicitParam
(
name
=
"company"
,
value
=
"公司名"
)
@ApiImplicitParam
(
name
=
"company"
,
value
=
"公司名"
)
})
})
public
PageResult
<
UserVo
>
getUserList
(
@RequestParam
(
value
=
"pageNo"
,
defaultValue
=
"0"
)
int
pageNo
,
public
PageResult
<
UserVo
>
getUserList
(
@RequestParam
(
value
=
"pageNo"
,
defaultValue
=
"0"
)
int
pageNo
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"0"
)
int
pageSize
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"0"
)
int
pageSize
,
@RequestParam
(
value
=
"userName"
,
required
=
false
)
String
userName
,
@RequestParam
(
value
=
"userName"
,
required
=
false
)
String
userName
,
@RequestParam
(
value
=
"company"
,
required
=
false
)
String
company
)
{
@RequestParam
(
value
=
"company"
,
required
=
false
)
String
company
)
{
PageInfoModel
<
UserVo
>
records
=
userService
.
getUserList
(
pageNo
,
pageSize
,
userName
,
company
);
PageInfoModel
<
UserVo
>
records
=
userService
.
getUserList
(
pageNo
,
pageSize
,
userName
,
company
);
int
total
=
records
.
getTotal
();
int
total
=
records
.
getTotal
();
int
pages
=
total
/
pageSize
;
//pages为总页数
int
pages
=
total
/
pageSize
;
//pages为总页数
int
mod
=
total
%
pageSize
;
int
mod
=
total
%
pageSize
;
if
(
mod
!=
0
)
{
if
(
mod
!=
0
)
{
pages
=
pages
+
1
;
pages
=
pages
+
1
;
}
}
List
<
UserVo
>
result
=
records
.
getResult
();
List
<
UserVo
>
result
=
records
.
getResult
();
return
new
PageResult
(
200
,
"查找成功"
,
pageNo
,
pages
,
total
,
result
);
return
new
PageResult
(
200
,
"查找成功"
,
pageNo
,
pages
,
total
,
result
);
}
}
}
}
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