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
e1a9b743
Commit
e1a9b743
authored
Jan 31, 2023
by
ma
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
用户模块变更
parent
609280a3
Changes
35
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
35 changed files
with
613 additions
and
116 deletions
+613
-116
update.2023.1.sql
license/doc/update.2023.1.sql
+17
-17
LoginController.java
.../java/iot/sixiang/license/controller/LoginController.java
+77
-68
SysOperLogController.java
.../iot/sixiang/license/controller/SysOperLogController.java
+22
-8
UserController.java
...n/java/iot/sixiang/license/controller/UserController.java
+58
-6
Permission.java
.../src/main/java/iot/sixiang/license/entity/Permission.java
+32
-0
Report.java
license/src/main/java/iot/sixiang/license/entity/Report.java
+47
-0
ReportType.java
.../src/main/java/iot/sixiang/license/entity/ReportType.java
+35
-0
User.java
license/src/main/java/iot/sixiang/license/entity/User.java
+6
-0
UserPermission.java
.../main/java/iot/sixiang/license/entity/UserPermission.java
+35
-0
GlobalExceptionHandler.java
...a/iot/sixiang/license/handler/GlobalExceptionHandler.java
+2
-2
JwtFilter.java
license/src/main/java/iot/sixiang/license/jwt/JwtFilter.java
+5
-0
PermissionMapper.java
...ain/java/iot/sixiang/license/mapper/PermissionMapper.java
+12
-0
SysOperLogMapper.java
...ain/java/iot/sixiang/license/mapper/SysOperLogMapper.java
+1
-1
UserMapper.java
.../src/main/java/iot/sixiang/license/mapper/UserMapper.java
+1
-1
UserPermissionMapper.java
...java/iot/sixiang/license/mapper/UserPermissionMapper.java
+20
-0
AssignUserPermissionDTO.java
...ot/sixiang/license/model/dto/AssignUserPermissionDTO.java
+21
-0
CheckCodeDto.java
...main/java/iot/sixiang/license/model/dto/CheckCodeDto.java
+3
-0
LoginReqVo.java
...rc/main/java/iot/sixiang/license/model/vo/LoginReqVo.java
+2
-2
LoginVo.java
...e/src/main/java/iot/sixiang/license/model/vo/LoginVo.java
+6
-0
UserDeleteVO.java
.../main/java/iot/sixiang/license/model/vo/UserDeleteVO.java
+15
-0
UserResetPwdVo.java
...ain/java/iot/sixiang/license/model/vo/UserResetPwdVo.java
+1
-0
PermissionService.java
...n/java/iot/sixiang/license/service/PermissionService.java
+14
-0
SysOperLogService.java
...n/java/iot/sixiang/license/service/SysOperLogService.java
+1
-1
UserPermissionService.java
...va/iot/sixiang/license/service/UserPermissionService.java
+20
-0
UserService.java
...rc/main/java/iot/sixiang/license/service/UserService.java
+1
-1
PermissionServiceImpl.java
...t/sixiang/license/service/impl/PermissionServiceImpl.java
+25
-0
SysOperLogServiceImpl.java
...t/sixiang/license/service/impl/SysOperLogServiceImpl.java
+2
-2
UserPermissionServiceImpl.java
...xiang/license/service/impl/UserPermissionServiceImpl.java
+49
-0
UserServiceImpl.java
...ava/iot/sixiang/license/service/impl/UserServiceImpl.java
+11
-4
CommonUtil.java
...se/src/main/java/iot/sixiang/license/util/CommonUtil.java
+30
-0
PermissionMapper.xml
license/src/main/resources/mapper/PermissionMapper.xml
+5
-0
PmsUseLogMapper.xml
license/src/main/resources/mapper/PmsUseLogMapper.xml
+6
-0
SysOperLogMapper.xml
license/src/main/resources/mapper/SysOperLogMapper.xml
+9
-1
UserMapper.xml
license/src/main/resources/mapper/UserMapper.xml
+5
-2
UserPermissionMapper.xml
license/src/main/resources/mapper/UserPermissionMapper.xml
+17
-0
No files found.
license/doc/update.2023.1.sql
View file @
e1a9b743
...
...
@@ -6,7 +6,7 @@ ADD COLUMN `level` int(1) NULL COMMENT '账号等级(共有三级),空则
CREATE
TABLE
`permission`
(
`id`
int
(
10
)
NOT
NULL
AUTO_INCREMENT
,
`desc`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'权限说明'
,
`desc
ription
`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'权限说明'
,
`create_time`
datetime
DEFAULT
NULL
COMMENT
'创建时间'
,
`update_time`
datetime
DEFAULT
NULL
COMMENT
'更新时间'
,
`deleted`
int
(
1
)
DEFAULT
'0'
COMMENT
'逻辑删除标识 1:删除,0:未删除'
,
...
...
@@ -25,19 +25,19 @@ CREATE TABLE `user_permission`
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
0
DEFAULT
CHARSET
=
utf8
COMMENT
=
'用户权限表'
;
--添加权限--
INSERT
INTO
`permission`
(
`id`
,
`desc`
,
`create_time`
,
`update_time`
,
`deleted`
)
INSERT
INTO
`permission`
(
`id`
,
`desc
ription
`
,
`create_time`
,
`update_time`
,
`deleted`
)
VALUES
(
1
,
'邀请注册'
,
NULL
,
NULL
,
0
);
INSERT
INTO
`permission`
(
`id`
,
`desc`
,
`create_time`
,
`update_time`
,
`deleted`
)
INSERT
INTO
`permission`
(
`id`
,
`desc
ription
`
,
`create_time`
,
`update_time`
,
`deleted`
)
VALUES
(
2
,
'删除用户'
,
NULL
,
NULL
,
0
);
INSERT
INTO
`permission`
(
`id`
,
`desc`
,
`create_time`
,
`update_time`
,
`deleted`
)
INSERT
INTO
`permission`
(
`id`
,
`desc
ription
`
,
`create_time`
,
`update_time`
,
`deleted`
)
VALUES
(
3
,
'应用管理'
,
NULL
,
NULL
,
0
);
INSERT
INTO
`permission`
(
`id`
,
`desc`
,
`create_time`
,
`update_time`
,
`deleted`
)
INSERT
INTO
`permission`
(
`id`
,
`desc
ription
`
,
`create_time`
,
`update_time`
,
`deleted`
)
VALUES
(
4
,
'设备管理'
,
NULL
,
NULL
,
0
);
INSERT
INTO
`permission`
(
`id`
,
`desc`
,
`create_time`
,
`update_time`
,
`deleted`
)
INSERT
INTO
`permission`
(
`id`
,
`desc
ription
`
,
`create_time`
,
`update_time`
,
`deleted`
)
VALUES
(
5
,
'运维管理'
,
NULL
,
NULL
,
0
);
INSERT
INTO
`permission`
(
`id`
,
`desc`
,
`create_time`
,
`update_time`
,
`deleted`
)
INSERT
INTO
`permission`
(
`id`
,
`desc
ription
`
,
`create_time`
,
`update_time`
,
`deleted`
)
VALUES
(
6
,
'日志管理'
,
NULL
,
NULL
,
0
);
INSERT
INTO
`permission`
(
`id`
,
`desc`
,
`create_time`
,
`update_time`
,
`deleted`
)
INSERT
INTO
`permission`
(
`id`
,
`desc
ription
`
,
`create_time`
,
`update_time`
,
`deleted`
)
VALUES
(
7
,
'安全报警'
,
NULL
,
NULL
,
0
);
-- 报警类型表 --
...
...
@@ -46,7 +46,7 @@ CREATE TABLE `report_type`
(
`id`
int
(
10
)
NOT
NULL
AUTO_INCREMENT
,
`category`
int
(
1
)
DEFAULT
NULL
COMMENT
'报警大类 1:系统,0:设备'
,
`desc`
varchar
(
100
)
DEFAULT
NULL
COMMENT
'说明'
,
`desc
ription
`
varchar
(
100
)
DEFAULT
NULL
COMMENT
'说明'
,
`create_time`
datetime
DEFAULT
NULL
COMMENT
'创建时间'
,
`update_time`
datetime
DEFAULT
NULL
COMMENT
'更新时间'
,
`deleted`
int
(
1
)
DEFAULT
'0'
COMMENT
'逻辑删除标识 1:删除,0:未删除'
,
...
...
@@ -61,7 +61,7 @@ CREATE TABLE `report`
`category`
int
(
1
)
DEFAULT
NULL
COMMENT
'报警大类 1:系统,0:设备'
,
`type`
int
(
3
)
DEFAULT
NULL
COMMENT
'报警类型'
,
`sn`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'设备编码(系统报警该值为空)'
,
`desc`
varchar
(
100
)
DEFAULT
NULL
COMMENT
'报警说明'
,
`desc
ription
`
varchar
(
100
)
DEFAULT
NULL
COMMENT
'报警说明'
,
`user_name`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'报警账户'
,
`user_company`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'报警公司'
,
`create_time`
datetime
DEFAULT
NULL
COMMENT
'创建时间'
,
...
...
@@ -71,17 +71,17 @@ CREATE TABLE `report`
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
0
DEFAULT
CHARSET
=
utf8
COMMENT
=
'报警表'
;
-- 新增报警类型 --
INSERT
INTO
`report_type`
(
`id`
,
`category`
,
`desc`
,
`create_time`
,
`update_time`
,
`deleted`
)
INSERT
INTO
`report_type`
(
`id`
,
`category`
,
`desc
ription
`
,
`create_time`
,
`update_time`
,
`deleted`
)
VALUES
(
1
,
1
,
'系统故障'
,
NULL
,
NULL
,
0
);
INSERT
INTO
`report_type`
(
`id`
,
`category`
,
`desc`
,
`create_time`
,
`update_time`
,
`deleted`
)
INSERT
INTO
`report_type`
(
`id`
,
`category`
,
`desc
ription
`
,
`create_time`
,
`update_time`
,
`deleted`
)
VALUES
(
2
,
1
,
'系统超负荷'
,
NULL
,
NULL
,
0
);
INSERT
INTO
`report_type`
(
`id`
,
`category`
,
`desc`
,
`create_time`
,
`update_time`
,
`deleted`
)
INSERT
INTO
`report_type`
(
`id`
,
`category`
,
`desc
ription
`
,
`create_time`
,
`update_time`
,
`deleted`
)
VALUES
(
3
,
1
,
'系统连接失败'
,
NULL
,
NULL
,
0
);
INSERT
INTO
`report_type`
(
`id`
,
`category`
,
`desc`
,
`create_time`
,
`update_time`
,
`deleted`
)
INSERT
INTO
`report_type`
(
`id`
,
`category`
,
`desc
ription
`
,
`create_time`
,
`update_time`
,
`deleted`
)
VALUES
(
4
,
0
,
'数据请求失败'
,
NULL
,
NULL
,
0
);
INSERT
INTO
`report_type`
(
`id`
,
`category`
,
`desc`
,
`create_time`
,
`update_time`
,
`deleted`
)
INSERT
INTO
`report_type`
(
`id`
,
`category`
,
`desc
ription
`
,
`create_time`
,
`update_time`
,
`deleted`
)
VALUES
(
5
,
0
,
'卡交互失败'
,
NULL
,
NULL
,
0
);
INSERT
INTO
`report_type`
(
`id`
,
`category`
,
`desc`
,
`create_time`
,
`update_time`
,
`deleted`
)
INSERT
INTO
`report_type`
(
`id`
,
`category`
,
`desc
ription
`
,
`create_time`
,
`update_time`
,
`deleted`
)
VALUES
(
6
,
0
,
'鉴权失败'
,
NULL
,
NULL
,
0
);
INSERT
INTO
`report_type`
(
`id`
,
`category`
,
`desc`
,
`create_time`
,
`update_time`
,
`deleted`
)
INSERT
INTO
`report_type`
(
`id`
,
`category`
,
`desc
ription
`
,
`create_time`
,
`update_time`
,
`deleted`
)
VALUES
(
7
,
0
,
'解码失败'
,
NULL
,
NULL
,
0
);
license/src/main/java/iot/sixiang/license/controller/LoginController.java
View file @
e1a9b743
This diff is collapsed.
Click to expand it.
license/src/main/java/iot/sixiang/license/controller/SysOperLogController.java
View file @
e1a9b743
...
...
@@ -10,12 +10,16 @@ import iot.sixiang.license.model.PageInfoModel;
import
iot.sixiang.license.model.PageResult
;
import
iot.sixiang.license.model.vo.SysOperLogVo
;
import
iot.sixiang.license.service.SysOperLogService
;
import
iot.sixiang.license.util.CommonUtil
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.text.ParseException
;
import
java.util.Date
;
import
java.util.List
;
/**
...
...
@@ -31,6 +35,7 @@ public class SysOperLogController {
/**
* 分页查询所有的oper_log
*
* @param pageNo
* @param pageSize
* @return
...
...
@@ -39,17 +44,26 @@ public class SysOperLogController {
@GetMapping
(
"operate/list"
)
@MyLog
(
title
=
"获取日志列表"
,
businessType
=
BusinessType
.
SELECT
)
@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"
),
@ApiImplicitParam
(
name
=
"pageSize"
,
value
=
"每页显示多少条"
,
required
=
true
,
dataType
=
"int"
),
@ApiImplicitParam
(
name
=
"startTime"
,
value
=
"开始时间"
),
@ApiImplicitParam
(
name
=
"endTime"
,
value
=
"结束时间"
)
})
public
PageResult
<
SysOperLogVo
>
getOperLogList
(
@RequestParam
(
value
=
"pageNo"
,
defaultValue
=
"0"
)
int
pageNo
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"0"
)
int
pageSize
)
{
PageInfoModel
<
SysOperLogVo
>
records
=
sysOperLogService
.
getOperLogList
(
pageNo
,
pageSize
);
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"0"
)
int
pageSize
,
@RequestParam
(
value
=
"startTime"
,
required
=
false
,
defaultValue
=
""
)
String
startTime
,
@RequestParam
(
value
=
"endTime"
,
required
=
false
,
defaultValue
=
""
)
String
endTime
)
throws
ParseException
{
if
(
StringUtils
.
isEmpty
(
endTime
))
{
endTime
=
CommonUtil
.
getDayByNum
(
1
,
CommonUtil
.
dateToString
(
new
Date
(),
"yyyy-MM-dd"
));
}
else
{
endTime
=
CommonUtil
.
getDayByNum
(
1
,
endTime
);
}
PageInfoModel
<
SysOperLogVo
>
records
=
sysOperLogService
.
getOperLogList
(
pageNo
,
pageSize
,
startTime
,
endTime
);
int
total
=
records
.
getTotal
();
int
pages
=
total
/
pageSize
;
//pages为总页数
int
mod
=
total
%
pageSize
;
if
(
mod
!=
0
)
{
pages
=
pages
+
1
;
int
pages
=
total
/
pageSize
;
//pages为总页数
int
mod
=
total
%
pageSize
;
if
(
mod
!=
0
)
{
pages
=
pages
+
1
;
}
List
<
SysOperLogVo
>
result
=
records
.
getResult
();
return
new
PageResult
(
200
,
"查找成功"
,
pageNo
,
pages
,
total
,
result
);
...
...
license/src/main/java/iot/sixiang/license/controller/UserController.java
View file @
e1a9b743
...
...
@@ -10,6 +10,7 @@ import io.swagger.annotations.Api;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
iot.sixiang.license.entity.Permission
;
import
iot.sixiang.license.entity.User
;
import
iot.sixiang.license.jwt.UserUtils
;
import
iot.sixiang.license.log.BusinessType
;
...
...
@@ -17,8 +18,13 @@ import iot.sixiang.license.log.MyLog;
import
iot.sixiang.license.model.BaseResult
;
import
iot.sixiang.license.model.PageInfoModel
;
import
iot.sixiang.license.model.PageResult
;
import
iot.sixiang.license.model.ResResult
;
import
iot.sixiang.license.model.dto.AssignUserPermissionDTO
;
import
iot.sixiang.license.model.vo.UserDeleteVO
;
import
iot.sixiang.license.model.vo.UserUpdatePwdVo
;
import
iot.sixiang.license.model.vo.UserVo
;
import
iot.sixiang.license.service.PermissionService
;
import
iot.sixiang.license.service.UserPermissionService
;
import
iot.sixiang.license.service.UserService
;
import
iot.sixiang.license.util.CommonUtil
;
import
iot.sixiang.license.xss.XssUtil
;
...
...
@@ -29,6 +35,7 @@ import org.springframework.util.DigestUtils;
import
org.springframework.web.bind.WebDataBinder
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
java.util.List
;
/**
...
...
@@ -46,6 +53,11 @@ public class UserController {
@Autowired
private
UserService
userService
;
@Resource
private
PermissionService
permissionService
;
@Resource
private
UserPermissionService
userPermissionService
;
@Value
(
"${rsa.private_key}"
)
private
String
PRIVATE_KRY
;
@Value
(
"${other.error_count.change_pwd}"
)
...
...
@@ -89,16 +101,18 @@ public class UserController {
/**
* 删除user
*
* @param user
Id
* @param user
DeleteVO
* @return
*/
@ApiOperation
(
value
=
"用户删除接口"
,
notes
=
"删除用户"
)
@PostMapping
(
"delete"
)
@MyLog
(
title
=
"删除用户"
,
optParam
=
"#{userId}"
,
businessType
=
BusinessType
.
DELETE
)
public
BaseResult
deleteUser
(
@RequestParam
(
"userId"
)
int
userId
)
{
userId
=
Integer
.
valueOf
(
XssUtil
.
checkXSS
(
String
.
valueOf
(
userId
)));
boolean
res
=
userService
.
deleteUser
(
userId
);
public
BaseResult
deleteUser
(
@RequestBody
UserDeleteVO
userDeleteVO
)
{
String
userId
=
XssUtil
.
checkXSS
(
userDeleteVO
.
getUserId
());
boolean
res
=
userService
.
deleteUser
(
Integer
.
parseInt
(
userId
));
userPermissionService
.
deleteUserPermission
(
Integer
.
parseInt
(
userId
));
UserUtils
.
removeToken
(
userId
);
UserUtils
.
removeTokenExp
(
userId
);
if
(
res
)
{
return
BaseResult
.
success
();
}
else
{
...
...
@@ -219,7 +233,13 @@ public class UserController {
@RequestParam
(
value
=
"company"
,
required
=
false
)
String
company
)
{
userName
=
XssUtil
.
checkXSS
(
userName
);
company
=
XssUtil
.
checkXSS
(
company
);
PageInfoModel
<
UserVo
>
records
=
userService
.
getUserList
(
pageNo
,
pageSize
,
userName
,
company
);
String
userId
=
UserUtils
.
getLoginUserId
();
PageInfoModel
<
UserVo
>
records
;
if
(!
StringUtils
.
isEmpty
(
userId
))
{
records
=
userService
.
getUserList
(
pageNo
,
pageSize
,
userName
,
company
,
Integer
.
parseInt
(
userId
));
}
else
{
return
null
;
}
int
total
=
records
.
getTotal
();
int
pages
=
total
/
pageSize
;
//pages为总页数
int
mod
=
total
%
pageSize
;
...
...
@@ -233,5 +253,37 @@ public class UserController {
}
return
new
PageResult
(
200
,
"查找成功"
,
pageNo
,
pages
,
total
,
result
);
}
/**
* 查询所有权限类型
*
* @return
*/
@ApiOperation
(
value
=
"获取权限列表接口"
,
notes
=
"用于获取权限列表"
)
@GetMapping
(
"permission/list"
)
@MyLog
(
title
=
"获取权限列表"
,
businessType
=
BusinessType
.
SELECT
)
public
ResResult
<
List
<
Permission
>>
getPermissionList
()
{
List
<
Permission
>
permissionList
=
permissionService
.
getPermissionList
();
return
ResResult
.
success
().
goRecord
(
permissionList
);
}
/**
* 为用户批量分配权限
*
* @param assignUserPermissionDTO
* @return
*/
@ApiOperation
(
value
=
"分配权限接口"
,
notes
=
"用于为用户分配权限"
)
@PostMapping
(
"user_permission/assign"
)
@MyLog
(
title
=
"分配权限"
,
businessType
=
BusinessType
.
INSERT
)
public
BaseResult
assignUserPermission
(
@RequestBody
AssignUserPermissionDTO
assignUserPermissionDTO
)
{
boolean
res
=
userPermissionService
.
saveBatch
(
assignUserPermissionDTO
);
if
(
res
)
{
return
BaseResult
.
success
();
}
else
{
return
BaseResult
.
failed
();
}
}
}
license/src/main/java/iot/sixiang/license/entity/Permission.java
0 → 100644
View file @
e1a9b743
package
iot
.
sixiang
.
license
.
entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.Date
;
/**
* Created by m33
* Date 2023/1/31 14:26
* Description
*/
@Data
public
class
Permission
{
@ApiModelProperty
(
"id"
)
@TableId
(
type
=
IdType
.
AUTO
)
private
Integer
id
;
@ApiModelProperty
(
"权限说明"
)
private
String
description
;
@ApiModelProperty
(
"创建时间"
)
private
Date
createTime
;
@ApiModelProperty
(
"更新时间"
)
private
Date
updateTime
;
@ApiModelProperty
(
"逻辑删除标识 1:删除,0:未删除"
)
private
Integer
deleted
;
}
license/src/main/java/iot/sixiang/license/entity/Report.java
0 → 100644
View file @
e1a9b743
package
iot
.
sixiang
.
license
.
entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.Date
;
/**
* Created by m33
* Date 2023/1/31 14:27
* Description
*/
@Data
public
class
Report
{
@ApiModelProperty
(
"id"
)
@TableId
(
type
=
IdType
.
AUTO
)
private
Integer
id
;
@ApiModelProperty
(
"报警大类 1:系统,0:设备"
)
private
Integer
category
;
@ApiModelProperty
(
"报警类型"
)
private
Integer
type
;
@ApiModelProperty
(
"设备编码(系统报警该值为空)"
)
private
String
sn
;
@ApiModelProperty
(
"报警说明"
)
private
String
description
;
@ApiModelProperty
(
"报警账户"
)
private
String
userName
;
@ApiModelProperty
(
"报警公司"
)
private
String
userCompany
;
@ApiModelProperty
(
"创建时间"
)
private
Date
createTime
;
@ApiModelProperty
(
"更新时间"
)
private
Date
updateTime
;
@ApiModelProperty
(
"逻辑删除标识 1:删除,0:未删除"
)
private
Integer
deleted
;
}
license/src/main/java/iot/sixiang/license/entity/ReportType.java
0 → 100644
View file @
e1a9b743
package
iot
.
sixiang
.
license
.
entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.Date
;
/**
* Created by m33
* Date 2023/1/31 14:31
* Description
*/
@Data
public
class
ReportType
{
@ApiModelProperty
(
"id"
)
@TableId
(
type
=
IdType
.
AUTO
)
private
Integer
id
;
@ApiModelProperty
(
"报警大类 1:系统,0:设备"
)
private
Integer
category
;
@ApiModelProperty
(
"报警说明"
)
private
String
description
;
@ApiModelProperty
(
"创建时间"
)
private
Date
createTime
;
@ApiModelProperty
(
"更新时间"
)
private
Date
updateTime
;
@ApiModelProperty
(
"逻辑删除标识 1:删除,0:未删除"
)
private
Integer
deleted
;
}
license/src/main/java/iot/sixiang/license/entity/User.java
View file @
e1a9b743
...
...
@@ -43,6 +43,12 @@ public class User implements Serializable {
@ApiModelProperty
(
"报警的邮箱,注册的时候用户名是邮箱则这里自动填那个邮箱,可以修改"
)
private
String
notify
;
@ApiModelProperty
(
"父账号标识(超管为空)"
)
private
Integer
parent
;
@ApiModelProperty
(
"账号等级(共有三级),超管一级"
)
private
Integer
level
;
@ApiModelProperty
(
"创建时间"
)
private
Date
createTime
;
...
...
license/src/main/java/iot/sixiang/license/entity/UserPermission.java
0 → 100644
View file @
e1a9b743
package
iot
.
sixiang
.
license
.
entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.Date
;
/**
* Created by m33
* Date 2023/1/31 14:41
* Description
*/
@Data
public
class
UserPermission
{
@ApiModelProperty
(
"id"
)
@TableId
(
type
=
IdType
.
AUTO
)
private
Integer
id
;
@ApiModelProperty
(
"权限标识"
)
private
Integer
permission
;
@ApiModelProperty
(
"用户标识"
)
private
Integer
user
;
@ApiModelProperty
(
"创建时间"
)
private
Date
createTime
;
@ApiModelProperty
(
"更新时间"
)
private
Date
updateTime
;
@ApiModelProperty
(
"逻辑删除标识 1:删除,0:未删除"
)
private
Integer
deleted
;
}
license/src/main/java/iot/sixiang/license/handler/GlobalExceptionHandler.java
View file @
e1a9b743
...
...
@@ -17,7 +17,7 @@ public class GlobalExceptionHandler {
@ExceptionHandler
(
Exception
.
class
)
@ResponseBody
//为了返回数据
public
BaseResult
error
(
Exception
e
){
log
.
error
(
"出现
自定义
异常"
,
e
);
log
.
error
(
"出现
全局
异常"
,
e
);
return
BaseResult
.
serverException
();
}
...
...
@@ -25,7 +25,7 @@ public class GlobalExceptionHandler {
@ExceptionHandler
(
IotLicenseException
.
class
)
@ResponseBody
//为了返回数据
public
BaseResult
error
(
IotLicenseException
e
){
log
.
error
(
"出现自定义异常,{}"
+
e
.
getMsg
());
log
.
error
(
"出现自定义异常,{}"
,
e
.
getMsg
());
return
BaseResult
.
failed
().
setMsgValue
(
e
.
getMsg
()).
setCodeValue
(
e
.
getCode
());
}
}
license/src/main/java/iot/sixiang/license/jwt/JwtFilter.java
View file @
e1a9b743
...
...
@@ -97,6 +97,11 @@ public class JwtFilter implements Filter {
String
userId
=
userData
.
get
(
"userId"
).
asString
();
String
userName
=
userData
.
get
(
"userName"
).
asString
();
String
password
=
""
;
if
(
UserUtils
.
getToken
(
userId
)
==
null
)
{
request
.
setAttribute
(
"msg"
,
"登录信息已失效,请重新登录"
);
request
.
getRequestDispatcher
(
"/iot_license/fail"
).
forward
(
request
,
response
);
return
;
}
if
(!
token
.
equals
(
UserUtils
.
getToken
(
userId
)))
{
request
.
setAttribute
(
"msg"
,
"账户已在别处登录,请重新登录"
);
request
.
getRequestDispatcher
(
"/iot_license/fail"
).
forward
(
request
,
response
);
...
...
license/src/main/java/iot/sixiang/license/mapper/PermissionMapper.java
0 → 100644
View file @
e1a9b743
package
iot
.
sixiang
.
license
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
iot.sixiang.license.entity.Permission
;
/**
* Created by m33
* Date 2023/1/31 14:48
* Description
*/
public
interface
PermissionMapper
extends
BaseMapper
<
Permission
>
{
}
license/src/main/java/iot/sixiang/license/mapper/SysOperLogMapper.java
View file @
e1a9b743
...
...
@@ -19,5 +19,5 @@ public interface SysOperLogMapper extends BaseMapper<SysOperLog> {
boolean
addOperlog
(
String
title
,
Integer
businessType
,
String
uri
,
Integer
status
,
String
optParam
,
String
errorMsg
,
Date
operTime
);
List
<
SysOperLogVo
>
getOperLogList
();
List
<
SysOperLogVo
>
getOperLogList
(
String
startTime
,
String
endTime
);
}
license/src/main/java/iot/sixiang/license/mapper/UserMapper.java
View file @
e1a9b743
...
...
@@ -23,7 +23,7 @@ public interface UserMapper extends BaseMapper<User> {
boolean
updateUser
(
int
userId
,
String
password
);
List
<
UserVo
>
getUserList
(
String
userName
,
String
company
);
List
<
UserVo
>
getUserList
(
String
userName
,
String
company
,
int
userId
);
User
getUserByUserName
(
String
userName
);
...
...
license/src/main/java/iot/sixiang/license/mapper/UserPermissionMapper.java
0 → 100644
View file @
e1a9b743
package
iot
.
sixiang
.
license
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
iot.sixiang.license.entity.Permission
;
import
iot.sixiang.license.entity.UserPermission
;
import
java.util.List
;
/**
* Created by m33
* Date 2023/1/31 14:48
* Description
*/
public
interface
UserPermissionMapper
extends
BaseMapper
<
UserPermission
>
{
List
<
UserPermission
>
getPermissionById
(
int
userId
);
int
saveBatch
(
List
<
Integer
>
userPermissions
,
int
userId
);
void
deleteUserPermission
(
int
parseInt
);
}
license/src/main/java/iot/sixiang/license/model/dto/AssignUserPermissionDTO.java
0 → 100644
View file @
e1a9b743
package
iot
.
sixiang
.
license
.
model
.
dto
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.List
;
/**
* Created by m33
* Date 2023/1/31 15:32
* Description
*/
@Data
public
class
AssignUserPermissionDTO
{
@ApiModelProperty
(
"权限列表"
)
List
<
Integer
>
permissions
;
@ApiModelProperty
(
"用户id"
)
Integer
userId
;
}
license/src/main/java/iot/sixiang/license/model/dto/CheckCodeDto.java
View file @
e1a9b743
...
...
@@ -10,6 +10,9 @@ import lombok.Data;
*/
@Data
public
class
CheckCodeDto
{
@ApiModelProperty
(
"验证码"
)
private
String
account
;
@ApiModelProperty
(
"验证码"
)
private
String
code
;
}
license/src/main/java/iot/sixiang/license/model/vo/LoginReqVo.java
View file @
e1a9b743
...
...
@@ -16,8 +16,8 @@ public class LoginReqVo {
@ApiModelProperty
(
"用户名"
)
private
String
userName
;
@ApiModelProperty
(
"密码"
)
private
String
password
;
//
@ApiModelProperty("密码")
//
private String password;
@ApiModelProperty
(
"验证码"
)
private
String
code
;
...
...
license/src/main/java/iot/sixiang/license/model/vo/LoginVo.java
View file @
e1a9b743
package
iot
.
sixiang
.
license
.
model
.
vo
;
import
io.swagger.annotations.ApiModelProperty
;
import
iot.sixiang.license.entity.Permission
;
import
iot.sixiang.license.entity.UserPermission
;
import
lombok.Data
;
import
java.util.Date
;
import
java.util.List
;
/**
* Created by m33 on 2022/6/14 18:51
...
...
@@ -14,6 +17,9 @@ public class LoginVo {
@ApiModelProperty
(
"token"
)
private
String
authorization
;
@ApiModelProperty
(
"用户权限列表"
)
private
List
<
UserPermission
>
permissionList
;
@ApiModelProperty
(
"更新时间"
)
private
Date
updateTime
;
}
license/src/main/java/iot/sixiang/license/model/vo/UserDeleteVO.java
0 → 100644
View file @
e1a9b743
package
iot
.
sixiang
.
license
.
model
.
vo
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* Created by m33
* Date 2023/1/31 17:51
* Description
*/
@Data
public
class
UserDeleteVO
{
@ApiModelProperty
(
"userId"
)
public
String
userId
;
}
license/src/main/java/iot/sixiang/license/model/vo/UserResetPwdVo.java
View file @
e1a9b743
...
...
@@ -9,5 +9,6 @@ import lombok.Data;
*/
@Data
public
class
UserResetPwdVo
{
private
String
account
;
private
String
password
;
}
license/src/main/java/iot/sixiang/license/service/PermissionService.java
0 → 100644
View file @
e1a9b743
package
iot
.
sixiang
.
license
.
service
;
import
iot.sixiang.license.entity.Permission
;
import
java.util.List
;
/**
* Created by m33
* Date 2023/1/31 14:21
* Description
*/
public
interface
PermissionService
{
List
<
Permission
>
getPermissionList
();
}
license/src/main/java/iot/sixiang/license/service/SysOperLogService.java
View file @
e1a9b743
...
...
@@ -18,5 +18,5 @@ import java.util.Date;
public
interface
SysOperLogService
extends
IService
<
SysOperLog
>
{
boolean
addOperlog
(
String
title
,
Integer
businessType
,
String
uri
,
Integer
status
,
String
optParam
,
String
errorMsg
,
Date
operTime
);
PageInfoModel
<
SysOperLogVo
>
getOperLogList
(
int
pageNo
,
int
pageSize
);
PageInfoModel
<
SysOperLogVo
>
getOperLogList
(
int
pageNo
,
int
pageSize
,
String
startTime
,
String
endTime
);
}
license/src/main/java/iot/sixiang/license/service/UserPermissionService.java
0 → 100644
View file @
e1a9b743
package
iot
.
sixiang
.
license
.
service
;
import
iot.sixiang.license.entity.Permission
;
import
iot.sixiang.license.entity.UserPermission
;
import
iot.sixiang.license.model.dto.AssignUserPermissionDTO
;
import
java.util.List
;
/**
* Created by m33
* Date 2023/1/31 14:21
* Description
*/
public
interface
UserPermissionService
{
List
<
UserPermission
>
getPermissionById
(
int
userId
);
boolean
saveBatch
(
AssignUserPermissionDTO
assignUserPermissionDTO
);
void
deleteUserPermission
(
int
parseInt
);
}
license/src/main/java/iot/sixiang/license/service/UserService.java
View file @
e1a9b743
...
...
@@ -20,7 +20,7 @@ public interface UserService {
boolean
updateUser
(
User
user
);
PageInfoModel
<
UserVo
>
getUserList
(
int
pageNo
,
int
pageSize
,
String
userName
,
String
company
);
PageInfoModel
<
UserVo
>
getUserList
(
int
pageNo
,
int
pageSize
,
String
userName
,
String
company
,
int
userId
);
User
getUserById
(
int
userId
);
...
...
license/src/main/java/iot/sixiang/license/service/impl/PermissionServiceImpl.java
0 → 100644
View file @
e1a9b743
package
iot
.
sixiang
.
license
.
service
.
impl
;
import
iot.sixiang.license.entity.Permission
;
import
iot.sixiang.license.mapper.PermissionMapper
;
import
iot.sixiang.license.service.PermissionService
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.List
;
/**
* Created by m33
* Date 2023/1/31 14:21
* Description
*/
@Service
public
class
PermissionServiceImpl
implements
PermissionService
{
@Resource
PermissionMapper
permissionMapper
;
@Override
public
List
<
Permission
>
getPermissionList
()
{
return
permissionMapper
.
selectList
(
null
);
}
}
license/src/main/java/iot/sixiang/license/service/impl/SysOperLogServiceImpl.java
View file @
e1a9b743
...
...
@@ -45,11 +45,11 @@ public class SysOperLogServiceImpl extends ServiceImpl<SysOperLogMapper, SysOper
}
@Override
public
PageInfoModel
<
SysOperLogVo
>
getOperLogList
(
int
pageNo
,
int
pageSize
)
{
public
PageInfoModel
<
SysOperLogVo
>
getOperLogList
(
int
pageNo
,
int
pageSize
,
String
startTime
,
String
endTime
)
{
if
(
pageNo
==
0
||
pageSize
==
0
)
{
throw
new
IotLicenseException
(
ResultCode
.
VALIDATE_FAILED
.
getCode
(),
ResultCode
.
VALIDATE_FAILED
.
getMsg
());
}
List
<
SysOperLogVo
>
records
=
sysOperLogMapper
.
getOperLogList
();
List
<
SysOperLogVo
>
records
=
sysOperLogMapper
.
getOperLogList
(
startTime
,
endTime
);
List
<
SysOperLogVo
>
result
=
new
ArrayList
<>();
int
begin
=
(
pageNo
-
1
)
*
pageSize
;
if
(
begin
>=
0
&&
records
.
size
()
>
0
)
{
...
...
license/src/main/java/iot/sixiang/license/service/impl/UserPermissionServiceImpl.java
0 → 100644
View file @
e1a9b743
package
iot
.
sixiang
.
license
.
service
.
impl
;
import
iot.sixiang.license.consts.ResultCode
;
import
iot.sixiang.license.entity.Permission
;
import
iot.sixiang.license.entity.UserPermission
;
import
iot.sixiang.license.handler.IotLicenseException
;
import
iot.sixiang.license.mapper.PermissionMapper
;
import
iot.sixiang.license.mapper.UserPermissionMapper
;
import
iot.sixiang.license.model.dto.AssignUserPermissionDTO
;
import
iot.sixiang.license.service.PermissionService
;
import
iot.sixiang.license.service.UserPermissionService
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.List
;
/**
* Created by m33
* Date 2023/1/31 14:21
* Description
*/
@Service
public
class
UserPermissionServiceImpl
implements
UserPermissionService
{
@Resource
UserPermissionMapper
userPermissionMapper
;
@Override
public
List
<
UserPermission
>
getPermissionById
(
int
userId
)
{
if
(
userId
<=
0
)
{
throw
new
IotLicenseException
(
ResultCode
.
VALIDATE_FAILED
.
getCode
(),
ResultCode
.
VALIDATE_FAILED
.
getMsg
());
}
return
userPermissionMapper
.
getPermissionById
(
userId
);
}
@Override
public
boolean
saveBatch
(
AssignUserPermissionDTO
assignUserPermissionDTO
)
{
List
<
Integer
>
userPermissions
=
assignUserPermissionDTO
.
getPermissions
();
Integer
userId
=
assignUserPermissionDTO
.
getUserId
();
if
(
userPermissions
.
isEmpty
()
||
userId
<=
0
)
{
throw
new
IotLicenseException
(
ResultCode
.
VALIDATE_FAILED
.
getCode
(),
ResultCode
.
VALIDATE_FAILED
.
getMsg
());
}
return
userPermissionMapper
.
saveBatch
(
userPermissions
,
userId
)
>
0
;
}
@Override
public
void
deleteUserPermission
(
int
parseInt
)
{
userPermissionMapper
.
deleteUserPermission
(
parseInt
);
}
}
license/src/main/java/iot/sixiang/license/service/impl/UserServiceImpl.java
View file @
e1a9b743
package
iot
.
sixiang
.
license
.
service
.
impl
;
import
cn.hutool.core.lang.Validator
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
iot.sixiang.license.consts.ResultCode
;
...
...
@@ -35,11 +36,11 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
UserMapper
userMapper
;
@Override
public
PageInfoModel
<
UserVo
>
getUserList
(
int
pageNo
,
int
pageSize
,
String
userName
,
String
company
)
{
public
PageInfoModel
<
UserVo
>
getUserList
(
int
pageNo
,
int
pageSize
,
String
userName
,
String
company
,
int
userId
)
{
if
(
pageNo
==
0
||
pageSize
==
0
)
{
throw
new
IotLicenseException
(
ResultCode
.
VALIDATE_FAILED
.
getCode
(),
ResultCode
.
VALIDATE_FAILED
.
getMsg
());
}
List
<
UserVo
>
records
=
userMapper
.
getUserList
(
userName
,
company
);
List
<
UserVo
>
records
=
userMapper
.
getUserList
(
userName
,
company
,
userId
);
records
=
records
.
stream
().
sorted
(
Comparator
.
comparing
(
UserVo:
:
getCreateTime
,
Comparator
.
reverseOrder
())).
collect
(
Collectors
.
toList
());
List
<
UserVo
>
result
=
new
ArrayList
<>();
int
begin
=
(
pageNo
-
1
)
*
pageSize
;
...
...
@@ -74,14 +75,20 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
@Override
public
boolean
addUser
(
String
userName
,
String
company
,
String
password
)
{
if
(
StringUtils
.
isEmpty
(
userName
)
||
StringUtils
.
isEmpty
(
company
)
||
!
CommonUtil
.
regularMessage
(
userName
))
{
String
notify
;
if
(
Validator
.
isEmail
(
userName
))
{
notify
=
userName
;
}
else
{
throw
new
IotLicenseException
(
403
,
"请输入正确的邮箱账号"
);
}
if
(
StringUtils
.
isEmpty
(
userName
)
||
StringUtils
.
isEmpty
(
company
))
{
throw
new
IotLicenseException
(
ResultCode
.
VALIDATE_FAILED
.
getCode
(),
ResultCode
.
VALIDATE_FAILED
.
getMsg
());
}
User
res
=
userMapper
.
getUserByUserName
(
userName
);
if
(
res
!=
null
)
{
throw
new
IotLicenseException
(
403
,
"用户名已存在"
);
}
return
userMapper
.
addUser
(
userName
,
company
,
password
);
return
userMapper
.
addUser
(
userName
,
company
,
password
,
notify
);
}
@Override
...
...
license/src/main/java/iot/sixiang/license/util/CommonUtil.java
View file @
e1a9b743
...
...
@@ -11,7 +11,9 @@ import java.io.File;
import
java.io.UnsupportedEncodingException
;
import
java.security.NoSuchAlgorithmException
;
import
java.security.SecureRandom
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Locale
;
...
...
@@ -21,6 +23,34 @@ import java.util.regex.Pattern;
@Slf4j
public
class
CommonUtil
{
/**
* 获取指定日期前或后几天
*
* @return
*/
public
static
String
getDayByNum
(
int
num
,
String
dateStr
)
throws
ParseException
{
//获取指定当前日期的前三天时间
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
Date
date
=
format
.
parse
(
dateStr
);
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTime
(
date
);
calendar
.
add
(
Calendar
.
DATE
,
num
);
date
=
calendar
.
getTime
();
return
format
.
format
(
date
);
}
/**
* date 转 字符串
* @param date
* @param pattern
* @return
*/
public
static
String
dateToString
(
Date
date
,
String
pattern
)
{
SimpleDateFormat
ft
=
new
SimpleDateFormat
(
pattern
);
return
ft
.
format
(
date
);
}
/**
* 验证密码-是否包含用户名字符(密码应与用户名无相关性,密码中不得包含用户名的完整字符串、大小写变位或形似变换的字符串)
*/
...
...
license/src/main/resources/mapper/PermissionMapper.xml
0 → 100644
View file @
e1a9b743
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"iot.sixiang.license.mapper.PermissionMapper"
>
</mapper>
\ No newline at end of file
license/src/main/resources/mapper/PmsUseLogMapper.xml
View file @
e1a9b743
...
...
@@ -4,6 +4,12 @@
<select
id=
"getPmsUseLogList"
resultType=
"iot.sixiang.license.entity.PmsUseLog"
>
SELECT * FROM pms_use_log
where 1=1
<if
test=
"startTime != null and startTime != ''"
>
AND create_time
>
#{startTime}
</if>
<if
test=
"endTime != null and endTime != ''"
>
AND create_time
<
#{endTime}
</if>
<if
test=
"null != sn and '' != sn"
>
and sn like concat('%',#{sn},'%')
</if>
...
...
license/src/main/resources/mapper/SysOperLogMapper.xml
View file @
e1a9b743
...
...
@@ -6,6 +6,14 @@
</insert>
<select
id=
"getOperLogList"
resultType=
"iot.sixiang.license.model.vo.SysOperLogVo"
>
select id, title, business_type, uri, status, error_msg, oper_time from sys_oper_log order by oper_time desc
select id, title, business_type, uri, status, error_msg, oper_time from sys_oper_log
where 1=1
<if
test=
"startTime != null and startTime != ''"
>
AND oper_time
>
#{startTime}
</if>
<if
test=
"endTime != null and endTime != ''"
>
AND oper_time
<
#{endTime}
</if>
order by oper_time desc
</select>
</mapper>
license/src/main/resources/mapper/UserMapper.xml
View file @
e1a9b743
...
...
@@ -25,6 +25,9 @@
LEFT JOIN apply ON user.user_id = apply.user_id
LEFT JOIN device ON apply.app_id = device.app_id
where 1=1
<if
test=
"userId != null"
>
and (user.user_id = #{userId} or parent = #{userId})
</if>
<if
test=
"null != userName and '' != userName"
>
and user_name like concat('%',#{userName},'%')
</if>
...
...
@@ -35,11 +38,11 @@
</select>
<select
id=
"getUserByUserName"
resultType=
"iot.sixiang.license.entity.User"
>
select * from user where user_name = #{userName}
select * from user where user_name = #{userName}
limit 1
</select>
<select
id=
"getUserById"
resultType=
"iot.sixiang.license.entity.User"
>
select * from user where user_id = #{userId}
select * from user where user_id = #{userId}
limit 1
</select>
</mapper>
license/src/main/resources/mapper/UserPermissionMapper.xml
0 → 100644
View file @
e1a9b743
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"iot.sixiang.license.mapper.UserPermissionMapper"
>
<insert
id=
"saveBatch"
>
insert into user_permission(permission, user, create_time) values
<foreach
collection=
"userPermissions"
separator=
","
item=
"permission"
>
(#{permission}, #{userId}, now())
</foreach>
</insert>
<delete
id=
"deleteUserPermission"
>
delete from user_permission where user = #{userId}
</delete>
<select
id=
"getPermissionById"
resultType=
"iot.sixiang.license.entity.UserPermission"
>
SELECT * FROM `user_permission` WHERE user = #{userId} and deleted = 0
</select>
</mapper>
\ 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