Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sv-springboot
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bsoft
sv-springboot
Commits
8d7d7db6
Commit
8d7d7db6
authored
Dec 25, 2019
by
Suvalue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.token过期时间修改
2.数据库地址改为测试地址 3.相关接口修改
parent
cc9a3a82
Show whitespace changes
Inline
Side-by-side
Showing
35 changed files
with
331 additions
and
132 deletions
+331
-132
bsoft-admin/pom.xml
+0
-16
bsoft-admin/src/main/java/com/bsoft/admin/common/aspect/TokenAspect.java
+1
-1
bsoft-admin/src/main/java/com/bsoft/admin/common/utils/TokenUtil.java
+1
-1
bsoft-admin/src/main/java/com/bsoft/admin/controller/LoginController.java
+2
-1
bsoft-admin/src/main/java/com/bsoft/admin/controller/MenuController.java
+17
-8
bsoft-admin/src/main/java/com/bsoft/admin/controller/OrgController.java
+17
-7
bsoft-admin/src/main/java/com/bsoft/admin/controller/RoleController.java
+4
-3
bsoft-admin/src/main/java/com/bsoft/admin/controller/UserController.java
+8
-6
bsoft-admin/src/main/java/com/bsoft/admin/mapper/SysMenuMapper.java
+4
-0
bsoft-admin/src/main/java/com/bsoft/admin/mapper/SysRoleMenuRsMapper.java
+5
-1
bsoft-admin/src/main/java/com/bsoft/admin/mapper/SysUserMenuRsMapper.java
+5
-1
bsoft-admin/src/main/java/com/bsoft/admin/mapper/SysUserOrgRsMapper.java
+7
-1
bsoft-admin/src/main/java/com/bsoft/admin/mapper/SysUserRoleRsMapper.java
+6
-0
bsoft-admin/src/main/java/com/bsoft/admin/model/reqmodel/CodeAndPwd.java
+3
-2
bsoft-admin/src/main/java/com/bsoft/admin/model/reqmodel/MenuReq.java
+3
-2
bsoft-admin/src/main/java/com/bsoft/admin/model/reqmodel/OrgReq.java
+16
-14
bsoft-admin/src/main/java/com/bsoft/admin/model/reqmodel/RoleReq.java
+3
-2
bsoft-admin/src/main/java/com/bsoft/admin/model/reqmodel/UserReq.java
+8
-7
bsoft-admin/src/main/java/com/bsoft/admin/model/respmodel/SysRoleMenuRsList.java
+22
-0
bsoft-admin/src/main/java/com/bsoft/admin/model/respmodel/SysUserMenuRsList.java
+22
-0
bsoft-admin/src/main/java/com/bsoft/admin/model/respmodel/SysUserOrgRsList.java
+22
-0
bsoft-admin/src/main/java/com/bsoft/admin/service/DicOrgService.java
+4
-3
bsoft-admin/src/main/java/com/bsoft/admin/service/SysMenuService.java
+6
-3
bsoft-admin/src/main/java/com/bsoft/admin/service/impl/DicOrgServiceImpl.java
+22
-13
bsoft-admin/src/main/java/com/bsoft/admin/service/impl/SysMenuServiceImpl.java
+34
-17
bsoft-admin/src/main/java/com/bsoft/admin/service/impl/SysRoleServiceImpl.java
+12
-4
bsoft-admin/src/main/resources/application-test.properties
+1
-1
bsoft-admin/src/main/resources/application.properties
+2
-2
bsoft-admin/src/main/resources/logback-spring.xml
+1
-1
bsoft-admin/src/main/resources/mapper/DicOrgMapper.xml
+6
-2
bsoft-admin/src/main/resources/mapper/SysMenuMapper.xml
+6
-0
bsoft-admin/src/main/resources/mapper/SysRoleMenuRsMapper.xml
+17
-6
bsoft-admin/src/main/resources/mapper/SysUserMenuRsMapper.xml
+16
-5
bsoft-admin/src/main/resources/mapper/SysUserOrgRsMapper.xml
+17
-2
bsoft-admin/src/main/resources/mapper/SysUserRoleRsMapper.xml
+11
-0
No files found.
bsoft-admin/pom.xml
View file @
8d7d7db6
...
...
@@ -29,18 +29,6 @@
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
<exclusions>
<exclusion>
<groupId>
org.junit.vintage
</groupId>
<artifactId>
junit-vintage-engine
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.mybatis.spring.boot
</groupId>
...
...
@@ -90,10 +78,6 @@
<artifactId>
spring-boot-starter-aop
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-thymeleaf
</artifactId>
</dependency>
</dependencies>
<build>
...
...
bsoft-admin/src/main/java/com/bsoft/admin/common/aspect/TokenAspect.java
View file @
8d7d7db6
...
...
@@ -23,7 +23,7 @@ import javax.servlet.http.HttpServletRequest;
@Aspect
@Component
@Order
(
1
)
@Profile
({
"test"
,
"prod"
})
@Profile
({
"
dev"
,
"
test"
,
"prod"
})
public
class
TokenAspect
{
@Pointcut
(
"@annotation(com.bsoft.admin.common.annotations.Token)"
)
public
void
tokenAspect
(){}
...
...
bsoft-admin/src/main/java/com/bsoft/admin/common/utils/TokenUtil.java
View file @
8d7d7db6
...
...
@@ -5,7 +5,7 @@ import com.bsoft.common.utils.JWTUtil;
import
com.bsoft.common.utils.RedisUtil
;
public
class
TokenUtil
{
public
final
static
long
TOKEN_TIME_OUT
=
2L
*
60
*
60
;
public
final
static
long
TOKEN_TIME_OUT
=
7
2L
*
60
*
60
;
public
final
static
long
OLD_TOKEN_DURATION
=
5L
*
60
;
/**
...
...
bsoft-admin/src/main/java/com/bsoft/admin/controller/LoginController.java
View file @
8d7d7db6
...
...
@@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.RestController;
import
springfox.documentation.annotations.ApiIgnore
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.validation.Valid
;
@RestController
@RequestMapping
()
...
...
@@ -25,7 +26,7 @@ public class LoginController {
@PostMapping
(
"login"
)
@ApiOperation
(
value
=
"Result«LoginService.LoginInfo»登录"
)
public
Result
<
LoginService
.
LoginInfo
>
login
(
@
RequestBody
CodeAndPwd
codeAndPwd
,
HttpServletRequest
request
){
public
Result
<
LoginService
.
LoginInfo
>
login
(
@
Valid
@RequestBody
CodeAndPwd
codeAndPwd
,
HttpServletRequest
request
){
String
ip
=
HttpUtil
.
getIP
(
request
);
LoginService
.
LoginInfo
loginInfo
=
loginServiceImpl
.
login
(
codeAndPwd
.
getLoginName
(),
codeAndPwd
.
getPassword
(),
ip
);
...
...
bsoft-admin/src/main/java/com/bsoft/admin/controller/MenuController.java
View file @
8d7d7db6
...
...
@@ -4,10 +4,10 @@ import com.bsoft.admin.common.Result;
import
com.bsoft.admin.common.annotations.CurrentUser
;
import
com.bsoft.admin.common.annotations.Token
;
import
com.bsoft.admin.model.SysMenu
;
import
com.bsoft.admin.model.SysRoleMenuRs
;
import
com.bsoft.admin.model.SysUserMenuRs
;
import
com.bsoft.admin.model.reqmodel.MenuReq
;
import
com.bsoft.admin.model.respmodel.SysMenuList
;
import
com.bsoft.admin.model.respmodel.SysRoleMenuRsList
;
import
com.bsoft.admin.model.respmodel.SysUserMenuRsList
;
import
com.bsoft.admin.service.SysMenuService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -18,6 +18,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RestController
;
import
springfox.documentation.annotations.ApiIgnore
;
import
javax.validation.Valid
;
import
java.util.List
;
@Api
(
tags
=
"菜单API"
,
produces
=
"produces"
,
consumes
=
"consumes"
,
protocols
=
"protocols"
)
...
...
@@ -27,11 +28,19 @@ public class MenuController {
@Autowired
private
SysMenuService
sysMenuService
;
@PostMapping
(
"parentall"
)
@Token
@ApiOperation
(
"查询菜单列表及其子级列表"
)
public
Object
getParentAll
(
@RequestBody
MenuReq
.
GetMenuReq
menu
)
throws
Exception
{
List
<
SysMenuList
>
list
=
sysMenuService
.
getParentAll
(
menu
);
return
Result
.
success
(
list
);
}
@PostMapping
(
"all"
)
@Token
@ApiOperation
(
"查询菜单列表"
)
public
Object
getAll
(
@RequestBody
MenuReq
.
GetMenuReq
menu
)
throws
Exception
{
List
<
SysMenu
List
>
list
=
sysMenuService
.
getAll
(
menu
);
public
Object
getAll
()
throws
Exception
{
List
<
SysMenu
>
list
=
sysMenuService
.
getAll
(
);
return
Result
.
success
(
list
);
}
...
...
@@ -46,7 +55,7 @@ public class MenuController {
@PostMapping
(
"add"
)
@Token
@ApiOperation
(
"添加菜单"
)
public
Object
addUser
(
@ApiIgnore
@CurrentUser
Long
userId
,
@RequestBody
MenuReq
.
AddMenuReq
menu
)
throws
Exception
{
public
Object
addUser
(
@ApiIgnore
@CurrentUser
Long
userId
,
@Valid
@RequestBody
MenuReq
.
AddMenuReq
menu
)
throws
Exception
{
boolean
result
=
sysMenuService
.
addMenu
(
userId
,
menu
);
if
(
result
)
return
Result
.
success
(
null
);
...
...
@@ -68,7 +77,7 @@ public class MenuController {
@PostMapping
(
"update"
)
@Token
@ApiOperation
(
"修改菜单"
)
public
Object
addUser
(
@RequestBody
MenuReq
.
UpdateMenuReq
menu
)
throws
Exception
{
public
Object
addUser
(
@
Valid@
RequestBody
MenuReq
.
UpdateMenuReq
menu
)
throws
Exception
{
boolean
result
=
sysMenuService
.
updateMenu
(
menu
);
if
(
result
)
return
Result
.
success
(
null
);
...
...
@@ -80,7 +89,7 @@ public class MenuController {
@Token
@ApiOperation
(
"查询用户菜单"
)
public
Object
getUserMenu
(
@RequestBody
MenuReq
.
GetUserMenuReq
menu
)
throws
Exception
{
List
<
SysUserMenuRs
>
list
=
sysMenuService
.
getUserMenu
(
menu
.
getUserId
());
List
<
SysUserMenuRs
List
>
list
=
sysMenuService
.
getUserMenu
(
menu
.
getUserId
());
return
Result
.
success
(
list
);
}
...
...
@@ -99,7 +108,7 @@ public class MenuController {
@Token
@ApiOperation
(
"查询角色菜单"
)
public
Object
getRoleMenu
(
@RequestBody
MenuReq
.
GetRoleMenuReq
menu
)
throws
Exception
{
List
<
SysRoleMenuRs
>
list
=
sysMenuService
.
getRoleMenu
(
menu
.
getRoleId
());
List
<
SysRoleMenuRs
List
>
list
=
sysMenuService
.
getRoleMenu
(
menu
.
getRoleId
());
return
Result
.
success
(
list
);
}
...
...
bsoft-admin/src/main/java/com/bsoft/admin/controller/OrgController.java
View file @
8d7d7db6
...
...
@@ -4,9 +4,9 @@ import com.bsoft.admin.common.Result;
import
com.bsoft.admin.common.annotations.CurrentUser
;
import
com.bsoft.admin.common.annotations.Token
;
import
com.bsoft.admin.model.DicOrg
;
import
com.bsoft.admin.model.SysUserOrgRs
;
import
com.bsoft.admin.model.reqmodel.OrgReq
;
import
com.bsoft.admin.model.respmodel.DicOrgList
;
import
com.bsoft.admin.model.respmodel.SysUserOrgRsList
;
import
com.bsoft.admin.service.DicOrgService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RestController
;
import
springfox.documentation.annotations.ApiIgnore
;
import
javax.validation.Valid
;
import
java.util.List
;
@Api
(
tags
=
"机构API"
,
produces
=
"produces"
,
consumes
=
"consumes"
,
protocols
=
"protocols"
)
...
...
@@ -28,14 +29,23 @@ public class OrgController {
private
DicOrgService
dicOrgService
;
@PostMapping
(
"parentall"
)
@Token
@ApiOperation
(
"查询机构列表"
)
public
Object
getParentAll
(
@RequestBody
OrgReq
.
GetOrgReq
org
)
throws
Exception
{
List
<
DicOrgList
>
list
=
dicOrgService
.
getParentAll
(
org
);
return
Result
.
success
(
list
);
}
@PostMapping
(
"all"
)
@Token
@ApiOperation
(
"查询机构列表"
)
public
Object
getAll
(
@RequestBody
OrgReq
.
GetOrgReq
org
)
throws
Exception
{
List
<
DicOrg
List
>
list
=
dicOrgService
.
getAll
(
org
);
public
Object
getAll
(
)
{
List
<
DicOrg
>
list
=
dicOrgService
.
getAll
(
);
return
Result
.
success
(
list
);
}
@PostMapping
(
"info"
)
@Token
@ApiOperation
(
"查询机构详细信息"
)
...
...
@@ -47,7 +57,7 @@ public class OrgController {
@PostMapping
(
"add"
)
@Token
@ApiOperation
(
"添加机构"
)
public
Object
addUser
(
@ApiIgnore
@CurrentUser
Long
userId
,
@RequestBody
OrgReq
.
AddOrgReq
org
)
throws
Exception
{
public
Object
addUser
(
@ApiIgnore
@CurrentUser
Long
userId
,
@Valid
@RequestBody
OrgReq
.
AddOrgReq
org
)
throws
Exception
{
DicOrg
sysRole
=
dicOrgService
.
getByName
(
org
.
getOrgName
());
if
(
sysRole
!=
null
){
return
Result
.
error
(
"该机构已存在!"
);
...
...
@@ -73,7 +83,7 @@ public class OrgController {
@PostMapping
(
"update"
)
@Token
@ApiOperation
(
"修改机构"
)
public
Object
addUser
(
@RequestBody
OrgReq
.
UpdateOrgReq
org
)
throws
Exception
{
public
Object
addUser
(
@
Valid
@
RequestBody
OrgReq
.
UpdateOrgReq
org
)
throws
Exception
{
DicOrg
reqDic
=
dicOrgService
.
info
(
org
.
getOrgId
());
DicOrg
nameRole
=
dicOrgService
.
getByName
(
org
.
getOrgName
());
if
(
reqDic
!=
null
){
...
...
@@ -92,8 +102,8 @@ public class OrgController {
@Token
@ApiOperation
(
"查询用户机构"
)
public
Object
getUserOrg
(
@RequestBody
OrgReq
.
GetUserOrgReq
org
)
throws
Exception
{
SysUserOrgRs
info
=
dicOrgService
.
getUserOrg
(
org
.
getUserId
());
return
Result
.
success
(
info
);
List
<
SysUserOrgRsList
>
list
=
dicOrgService
.
getUserOrg
(
org
.
getUserId
());
return
Result
.
success
(
list
);
}
@PostMapping
(
"saveuserorg"
)
...
...
bsoft-admin/src/main/java/com/bsoft/admin/controller/RoleController.java
View file @
8d7d7db6
...
...
@@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RestController
;
import
springfox.documentation.annotations.ApiIgnore
;
import
javax.validation.Valid
;
import
java.util.List
;
@Api
(
tags
=
"角色API"
,
produces
=
"produces"
,
consumes
=
"consumes"
,
protocols
=
"protocols"
)
...
...
@@ -27,7 +28,7 @@ public class RoleController {
@PostMapping
(
"all"
)
@Token
@ApiOperation
(
"查询角色列表"
)
public
Object
getAll
(
@RequestBody
RoleReq
.
GetRoleReq
role
)
throws
Exception
{
public
Object
getAll
(
@
Valid
@
RequestBody
RoleReq
.
GetRoleReq
role
)
throws
Exception
{
List
<
SysRole
>
list
=
sysRoleService
.
getAll
(
role
);
return
Result
.
success
(
list
);
}
...
...
@@ -43,7 +44,7 @@ public class RoleController {
@PostMapping
(
"add"
)
@Token
@ApiOperation
(
"添加角色"
)
public
Object
addUser
(
@ApiIgnore
@CurrentUser
Long
userId
,
@RequestBody
RoleReq
.
AddRoleReq
role
)
throws
Exception
{
public
Object
addUser
(
@ApiIgnore
@CurrentUser
Long
userId
,
@Valid
@RequestBody
RoleReq
.
AddRoleReq
role
)
throws
Exception
{
SysRole
sysRole
=
sysRoleService
.
findByCode
(
role
.
getRoleCode
());
if
(
sysRole
!=
null
){
return
Result
.
error
(
"该角色已存在!"
);
...
...
@@ -69,7 +70,7 @@ public class RoleController {
@PostMapping
(
"update"
)
@Token
@ApiOperation
(
"修改角色"
)
public
Object
addUser
(
@RequestBody
RoleReq
.
UpdateRoleReq
role
)
throws
Exception
{
public
Object
addUser
(
@
Valid
@
RequestBody
RoleReq
.
UpdateRoleReq
role
)
throws
Exception
{
SysRole
reqRole
=
sysRoleService
.
info
(
role
.
getRoleId
());
SysRole
codeRole
=
sysRoleService
.
findByCode
(
role
.
getRoleCode
());
if
(
reqRole
!=
null
){
...
...
bsoft-admin/src/main/java/com/bsoft/admin/controller/UserController.java
View file @
8d7d7db6
...
...
@@ -18,6 +18,8 @@ import org.springframework.web.bind.annotation.RequestBody;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
springfox.documentation.annotations.ApiIgnore
;
import
javax.validation.Valid
;
import
java.util.List
;
@Api
(
tags
=
"用户API"
,
produces
=
"produces"
,
consumes
=
"consumes"
,
protocols
=
"protocols"
)
...
...
@@ -50,7 +52,7 @@ public class UserController {
@PostMapping
(
"add"
)
@Token
@ApiOperation
(
"添加用户"
)
public
Object
addUser
(
@ApiIgnore@CurrentUser
Long
userId
,
@RequestBody
UserReq
.
AddUserReq
user
)
throws
Exception
{
public
Object
addUser
(
@ApiIgnore@CurrentUser
Long
userId
,
@Valid
@RequestBody
UserReq
.
AddUserReq
user
)
throws
Exception
{
SysUser
sysUser
=
userService
.
findByLoginName
(
user
.
getUserCode
());
if
(
sysUser
!=
null
){
return
Result
.
error
(
"该账号已存在!"
);
...
...
@@ -76,7 +78,7 @@ public class UserController {
@PostMapping
(
"update"
)
@Token
@ApiOperation
(
"修改用户"
)
public
Object
updateUser
(
@RequestBody
UserReq
.
UpdateUserReq
user
)
throws
Exception
{
public
Object
updateUser
(
@
Valid
@
RequestBody
UserReq
.
UpdateUserReq
user
)
throws
Exception
{
SysUser
reqUser
=
userService
.
info
(
user
.
getUserId
());
SysUser
codeUser
=
userService
.
findByLoginName
(
user
.
getUserCode
());
if
(
reqUser
!=
null
){
...
...
@@ -94,16 +96,16 @@ public class UserController {
@PostMapping
(
"roles"
)
@Token
@ApiOperation
(
"查询用户角色"
)
public
Object
getRoleListByUser
(
@
ApiIgnore@CurrentUser
Long
userId
)
throws
Exception
{
List
<
SysRole
>
sysRoleList
=
sysUserRoleRsService
.
getRoleListByUser
(
user
Id
);
public
Object
getRoleListByUser
(
@
RequestBody
UserReq
.
InfoUserReq
user
)
throws
Exception
{
List
<
SysRole
>
sysRoleList
=
sysUserRoleRsService
.
getRoleListByUser
(
user
.
getUserId
()
);
return
Result
.
success
(
sysRoleList
);
}
@PostMapping
(
"menus"
)
@Token
@ApiOperation
(
"查询用户菜单"
)
public
Object
getMenuByUser
(
@
ApiIgnore@CurrentUser
Long
userId
)
throws
Exception
{
List
<
SysMenuList
>
sysMenuList
=
sysMenuService
.
getMenu
(
user
Id
);
public
Object
getMenuByUser
(
@
RequestBody
UserReq
.
InfoUserReq
user
)
throws
Exception
{
List
<
SysMenuList
>
sysMenuList
=
sysMenuService
.
getMenu
(
user
.
getUserId
()
);
return
Result
.
success
(
sysMenuList
);
}
...
...
bsoft-admin/src/main/java/com/bsoft/admin/mapper/SysMenuMapper.java
View file @
8d7d7db6
...
...
@@ -2,6 +2,7 @@ package com.bsoft.admin.mapper;
import
com.bsoft.admin.model.SysMenu
;
import
com.bsoft.admin.model.respmodel.SysMenuList
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
...
...
@@ -19,4 +20,6 @@ public interface SysMenuMapper {
List
<
SysMenuList
>
selectMenuByUser
(
Long
userId
);
List
<
SysMenuList
>
selectParentAll
();
Integer
selectMaxSort
(
@Param
(
"parentId"
)
Long
parentId
);
}
\ No newline at end of file
bsoft-admin/src/main/java/com/bsoft/admin/mapper/SysRoleMenuRsMapper.java
View file @
8d7d7db6
package
com
.
bsoft
.
admin
.
mapper
;
import
com.bsoft.admin.model.SysRoleMenuRs
;
import
com.bsoft.admin.model.respmodel.SysRoleMenuRsList
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
...
...
@@ -16,7 +17,9 @@ public interface SysRoleMenuRsMapper {
int
updateByPrimaryKey
(
SysRoleMenuRs
record
);
List
<
SysRoleMenuRs
>
selectByRole
(
@Param
(
"roleId"
)
Long
roleId
);
List
<
SysRoleMenuRs
List
>
selectByRole
(
@Param
(
"roleId"
)
Long
roleId
);
int
deleteAllByRole
(
@Param
(
"roleId"
)
Long
roleId
);
SysRoleMenuRs
selectByUserWithRole
(
@Param
(
"roleId"
)
Long
roleId
,
@Param
(
"menuId"
)
Long
menuId
);
}
\ No newline at end of file
bsoft-admin/src/main/java/com/bsoft/admin/mapper/SysUserMenuRsMapper.java
View file @
8d7d7db6
package
com
.
bsoft
.
admin
.
mapper
;
import
com.bsoft.admin.model.SysUserMenuRs
;
import
com.bsoft.admin.model.respmodel.SysUserMenuRsList
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
...
...
@@ -16,7 +17,9 @@ public interface SysUserMenuRsMapper {
int
updateByPrimaryKey
(
SysUserMenuRs
record
);
List
<
SysUserMenuRs
>
selectByUser
(
@Param
(
"userId"
)
Long
userId
);
List
<
SysUserMenuRs
List
>
selectByUser
(
@Param
(
"userId"
)
Long
userId
);
int
deleteAllByUser
(
@Param
(
"userId"
)
Long
userId
);
SysUserMenuRs
selectByUserWithMenu
(
@Param
(
"userId"
)
Long
userId
,
@Param
(
"menuId"
)
Long
menuId
);
}
\ No newline at end of file
bsoft-admin/src/main/java/com/bsoft/admin/mapper/SysUserOrgRsMapper.java
View file @
8d7d7db6
package
com
.
bsoft
.
admin
.
mapper
;
import
com.bsoft.admin.model.SysUserOrgRs
;
import
com.bsoft.admin.model.respmodel.SysUserOrgRsList
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
...
...
@@ -16,5 +17,9 @@ public interface SysUserOrgRsMapper {
int
updateByPrimaryKey
(
SysUserOrgRs
record
);
SysUserOrgRs
selectByUser
(
@Param
(
"userId"
)
Long
userId
);
List
<
SysUserOrgRsList
>
selectByUser
(
@Param
(
"userId"
)
Long
userId
);
SysUserOrgRs
selectByUserWithOrg
(
@Param
(
"userId"
)
Long
userId
,
@Param
(
"orgId"
)
Long
orgId
);
int
deleteByUser
(
@Param
(
"userId"
)
Long
userId
);
}
\ No newline at end of file
bsoft-admin/src/main/java/com/bsoft/admin/mapper/SysUserRoleRsMapper.java
View file @
8d7d7db6
...
...
@@ -4,6 +4,7 @@ import com.bsoft.admin.model.SysUserRoleRs;
import
com.bsoft.admin.model.SysRole
;
import
org.apache.ibatis.annotations.Param
;
import
javax.annotation.security.PermitAll
;
import
java.util.List
;
public
interface
SysUserRoleRsMapper
{
...
...
@@ -16,4 +17,8 @@ public interface SysUserRoleRsMapper {
List
<
SysUserRoleRs
>
selectAll
();
int
updateByPrimaryKey
(
SysUserRoleRs
record
);
int
deleteByUser
(
@Param
(
"userId"
)
Long
userId
);
SysUserRoleRs
selectByUser
(
@Param
(
"userId"
)
Long
userId
);
}
\ No newline at end of file
bsoft-admin/src/main/java/com/bsoft/admin/model/reqmodel/CodeAndPwd.java
View file @
8d7d7db6
...
...
@@ -3,14 +3,15 @@ package com.bsoft.admin.model.reqmodel;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
@ApiModel
(
"账号密码"
)
public
class
CodeAndPwd
{
@ApiModelProperty
(
value
=
"账号"
,
required
=
true
)
@Not
Null
(
message
=
"账号 参数必传"
)
@Not
Blank
(
message
=
"账号 参数必传"
)
String
loginName
;
@Not
Null
(
message
=
"密码 参数必传"
)
@Not
Blank
(
message
=
"密码 参数必传"
)
@ApiModelProperty
(
value
=
"密码"
,
required
=
true
)
String
password
;
...
...
bsoft-admin/src/main/java/com/bsoft/admin/model/reqmodel/MenuReq.java
View file @
8d7d7db6
...
...
@@ -2,6 +2,7 @@ package com.bsoft.admin.model.reqmodel;
import
io.swagger.annotations.ApiModelProperty
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
import
java.util.List
;
...
...
@@ -49,7 +50,7 @@ public class MenuReq {
public
static
class
AddMenuReq
{
@ApiModelProperty
(
value
=
"菜单名称"
,
required
=
true
)
@Not
Null
(
message
=
"菜单名称 参数必传"
)
@Not
Blank
(
message
=
"菜单名称 参数必传"
)
private
String
menuName
;
@ApiModelProperty
(
value
=
"菜单路径"
,
required
=
true
)
...
...
@@ -144,7 +145,7 @@ public class MenuReq {
private
Long
menuId
;
@ApiModelProperty
(
value
=
"菜单名称"
,
required
=
true
)
@Not
Null
(
message
=
"菜单名称 参数必传"
)
@Not
Blank
(
message
=
"菜单名称 参数必传"
)
private
String
menuName
;
@ApiModelProperty
(
value
=
"菜单路径"
,
required
=
true
)
...
...
bsoft-admin/src/main/java/com/bsoft/admin/model/reqmodel/OrgReq.java
View file @
8d7d7db6
...
...
@@ -2,7 +2,9 @@ package com.bsoft.admin.model.reqmodel;
import
io.swagger.annotations.ApiModelProperty
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
import
java.util.List
;
public
class
OrgReq
{
public
static
class
GetOrgReq
{
...
...
@@ -48,18 +50,18 @@ public class OrgReq {
public
static
class
AddOrgReq
{
@ApiModelProperty
(
value
=
"组织机构代码"
,
required
=
true
)
@Not
Null
(
message
=
"组织机构代码 参数必传"
)
@Not
Blank
(
message
=
"组织机构代码 参数必传"
)
private
String
orgCode
;
@ApiModelProperty
(
value
=
"机构名称"
,
required
=
true
)
@Not
Null
(
message
=
"机构名称 参数必传"
)
@Not
Blank
(
message
=
"机构名称 参数必传"
)
private
String
orgName
;
@ApiModelProperty
(
value
=
"登记号"
,
required
=
true
)
private
String
orgNo
;
@ApiModelProperty
(
value
=
"机构简称"
,
required
=
true
)
@Not
Null
(
message
=
"机构简称 参数必传"
)
@Not
Blank
(
message
=
"机构简称 参数必传"
)
private
String
orgShortName
;
@ApiModelProperty
(
value
=
"机构分类"
,
required
=
true
)
...
...
@@ -177,22 +179,22 @@ public class OrgReq {
public
static
class
UpdateOrgReq
{
@ApiModelProperty
(
value
=
"机构ID"
,
required
=
true
)
@Not
Null
(
message
=
"机构ID 参数必传"
)
@Not
Blank
(
message
=
"机构ID 参数必传"
)
private
Long
orgId
;
@ApiModelProperty
(
value
=
"组织机构代码"
,
required
=
true
)
@Not
Null
(
message
=
"组织机构代码 参数必传"
)
@Not
Blank
(
message
=
"组织机构代码 参数必传"
)
private
String
orgCode
;
@ApiModelProperty
(
value
=
"机构名称"
,
required
=
true
)
@Not
Null
(
message
=
"机构名称 参数必传"
)
@Not
Blank
(
message
=
"机构名称 参数必传"
)
private
String
orgName
;
@ApiModelProperty
(
value
=
"登记号"
,
required
=
true
)
private
String
orgNo
;
@ApiModelProperty
(
value
=
"机构简称"
,
required
=
true
)
@Not
Null
(
message
=
"机构简称 参数必传"
)
@Not
Blank
(
message
=
"机构简称 参数必传"
)
private
String
orgShortName
;
@ApiModelProperty
(
value
=
"机构分类"
,
required
=
true
)
...
...
@@ -330,7 +332,7 @@ public class OrgReq {
@ApiModelProperty
(
value
=
"机构ID"
,
required
=
true
)
@NotNull
(
message
=
"机构ID 参数必传"
)
private
L
ong
orgId
;
private
L
ist
<
Long
>
org
;
public
Long
getUserId
()
{
return
userId
;
...
...
@@ -340,19 +342,19 @@ public class OrgReq {
this
.
userId
=
userId
;
}
public
L
ong
getOrgId
()
{
return
org
Id
;
public
L
ist
<
Long
>
getOrg
()
{
return
org
;
}
public
void
setOrg
Id
(
Long
orgId
)
{
this
.
org
Id
=
orgId
;
public
void
setOrg
(
List
<
Long
>
org
)
{
this
.
org
=
org
;
}
@Override
public
String
toString
()
{
return
"S
elect
UserOrgReq{"
+
return
"S
ave
UserOrgReq{"
+
"userId="
+
userId
+
", org
Id="
+
orgId
+
", org
="
+
org
+
'}'
;
}
}
...
...
bsoft-admin/src/main/java/com/bsoft/admin/model/reqmodel/RoleReq.java
View file @
8d7d7db6
...
...
@@ -2,6 +2,7 @@ package com.bsoft.admin.model.reqmodel;
import
io.swagger.annotations.ApiModelProperty
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
public
class
RoleReq
{
...
...
@@ -52,7 +53,7 @@ public class RoleReq {
private
Long
roleCode
;
@ApiModelProperty
(
value
=
"角色名称"
,
required
=
true
)
@Not
Null
(
message
=
"角色名称 参数必传"
)
@Not
Blank
(
message
=
"角色名称 参数必传"
)
private
String
roleName
;
public
Long
getRoleCode
()
{
...
...
@@ -111,7 +112,7 @@ public class RoleReq {
private
Long
roleCode
;
@ApiModelProperty
(
value
=
"角色名称"
,
required
=
true
)
@Not
Null
(
message
=
"角色名称 参数必传"
)
@Not
Blank
(
message
=
"角色名称 参数必传"
)
private
String
roleName
;
public
Long
getRoleId
()
{
...
...
bsoft-admin/src/main/java/com/bsoft/admin/model/reqmodel/UserReq.java
View file @
8d7d7db6
...
...
@@ -2,6 +2,7 @@ package com.bsoft.admin.model.reqmodel;
import
io.swagger.annotations.ApiModelProperty
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
public
class
UserReq
{
...
...
@@ -49,15 +50,15 @@ public class UserReq {
public
static
class
AddUserReq
{
@ApiModelProperty
(
value
=
"账号"
,
required
=
true
)
@Not
Null
(
message
=
"账号 参数必传"
)
@Not
Blank
(
message
=
"账号 参数必传"
)
private
String
userCode
;
@ApiModelProperty
(
value
=
"名称"
,
required
=
true
)
@Not
Null
(
message
=
"名称 参数必传"
)
@Not
Blank
(
message
=
"名称 参数必传"
)
private
String
userName
;
@ApiModelProperty
(
value
=
"密码"
,
required
=
true
)
@Not
Null
(
message
=
"密码 参数必传"
)
@Not
Blank
(
message
=
"密码 参数必传"
)
private
String
password
;
@ApiModelProperty
(
value
=
"身份证"
,
required
=
true
)
...
...
@@ -154,19 +155,19 @@ public class UserReq {
public
static
class
UpdateUserReq
{
@ApiModelProperty
(
value
=
"用户ID"
,
required
=
true
)
@Not
Null
(
message
=
"用户ID 参数必传"
)
@Not
Blank
(
message
=
"用户ID 参数必传"
)
private
Long
userId
;
@ApiModelProperty
(
value
=
"账号"
,
required
=
true
)
@Not
Null
(
message
=
"账号 参数必传"
)
@Not
Blank
(
message
=
"账号 参数必传"
)
private
String
userCode
;
@ApiModelProperty
(
value
=
"名称"
,
required
=
true
)
@Not
Null
(
message
=
"名称 参数必传"
)
@Not
Blank
(
message
=
"名称 参数必传"
)
private
String
userName
;
@ApiModelProperty
(
value
=
"密码"
,
required
=
true
)
@Not
Null
(
message
=
"密码 参数必传"
)
@Not
Blank
(
message
=
"密码 参数必传"
)
private
String
password
;
@ApiModelProperty
(
value
=
"身份证"
,
required
=
true
)
...
...
bsoft-admin/src/main/java/com/bsoft/admin/model/respmodel/SysRoleMenuRsList.java
0 → 100644
View file @
8d7d7db6
package
com
.
bsoft
.
admin
.
model
.
respmodel
;
import
com.bsoft.admin.model.SysRoleMenuRs
;
public
class
SysRoleMenuRsList
extends
SysRoleMenuRs
{
private
Long
parentId
;
public
Long
getParentId
()
{
return
parentId
;
}
public
void
setParentId
(
Long
parentId
)
{
this
.
parentId
=
parentId
;
}
@Override
public
String
toString
()
{
return
"SysUserOrgRsList{"
+
"parentId="
+
parentId
+
'}'
;
}
}
bsoft-admin/src/main/java/com/bsoft/admin/model/respmodel/SysUserMenuRsList.java
0 → 100644
View file @
8d7d7db6
package
com
.
bsoft
.
admin
.
model
.
respmodel
;
import
com.bsoft.admin.model.SysUserMenuRs
;
public
class
SysUserMenuRsList
extends
SysUserMenuRs
{
private
Long
parentId
;
public
Long
getParentId
()
{
return
parentId
;
}
public
void
setParentId
(
Long
parentId
)
{
this
.
parentId
=
parentId
;
}
@Override
public
String
toString
()
{
return
"SysUserOrgRsList{"
+
"parentId="
+
parentId
+
'}'
;
}
}
bsoft-admin/src/main/java/com/bsoft/admin/model/respmodel/SysUserOrgRsList.java
0 → 100644
View file @
8d7d7db6
package
com
.
bsoft
.
admin
.
model
.
respmodel
;
import
com.bsoft.admin.model.SysUserOrgRs
;
public
class
SysUserOrgRsList
extends
SysUserOrgRs
{
private
Long
parentId
;
public
Long
getParentId
()
{
return
parentId
;
}
public
void
setParentId
(
Long
parentId
)
{
this
.
parentId
=
parentId
;
}
@Override
public
String
toString
()
{
return
"SysUserOrgRsList{"
+
"parentId="
+
parentId
+
'}'
;
}
}
bsoft-admin/src/main/java/com/bsoft/admin/service/DicOrgService.java
View file @
8d7d7db6
package
com
.
bsoft
.
admin
.
service
;
import
com.bsoft.admin.model.DicOrg
;
import
com.bsoft.admin.model.SysUserOrgRs
;
import
com.bsoft.admin.model.reqmodel.OrgReq
;
import
com.bsoft.admin.model.respmodel.DicOrgList
;
import
com.bsoft.admin.model.respmodel.SysUserOrgRsList
;
import
java.util.List
;
...
...
@@ -11,12 +11,13 @@ public interface DicOrgService {
//顶级机构的父级id
final
static
Integer
ORG_TOP_PARENT_ID
=
0
;
List
<
DicOrgList
>
getAll
(
OrgReq
.
GetOrgReq
org
);
List
<
DicOrgList
>
getParentAll
(
OrgReq
.
GetOrgReq
org
);
List
<
DicOrg
>
getAll
();
DicOrg
info
(
Long
orgId
);
boolean
addOrg
(
Long
userId
,
OrgReq
.
AddOrgReq
org
);
boolean
deleteOrg
(
OrgReq
.
DeleteOrgReq
org
);
boolean
updateOrg
(
OrgReq
.
UpdateOrgReq
org
);
DicOrg
getByName
(
String
orgName
);
SysUserOrgRs
getUserOrg
(
Long
userId
);
List
<
SysUserOrgRsList
>
getUserOrg
(
Long
userId
);
boolean
saveUserOrg
(
Long
userId
,
OrgReq
.
SaveUserOrgReq
org
);
}
bsoft-admin/src/main/java/com/bsoft/admin/service/SysMenuService.java
View file @
8d7d7db6
...
...
@@ -5,6 +5,8 @@ import com.bsoft.admin.model.SysRoleMenuRs;
import
com.bsoft.admin.model.SysUserMenuRs
;
import
com.bsoft.admin.model.reqmodel.MenuReq
;
import
com.bsoft.admin.model.respmodel.SysMenuList
;
import
com.bsoft.admin.model.respmodel.SysRoleMenuRsList
;
import
com.bsoft.admin.model.respmodel.SysUserMenuRsList
;
import
java.util.List
;
...
...
@@ -14,13 +16,14 @@ public interface SysMenuService {
final
static
Integer
MENU_TOP_PARENT_ID
=
0
;
List
<
SysMenuList
>
getMenu
(
Long
userId
)
throws
Exception
;
List
<
SysMenuList
>
getAll
(
MenuReq
.
GetMenuReq
menu
);
List
<
SysMenuList
>
getParentAll
(
MenuReq
.
GetMenuReq
menu
);
List
<
SysMenu
>
getAll
();
SysMenu
info
(
MenuReq
.
InfoMenuReq
menu
);
boolean
addMenu
(
Long
userId
,
MenuReq
.
AddMenuReq
menu
);
boolean
deleteMenu
(
MenuReq
.
DeleteMenuReq
menu
);
boolean
updateMenu
(
MenuReq
.
UpdateMenuReq
menu
);
List
<
SysUserMenuRs
>
getUserMenu
(
Long
userId
);
List
<
SysUserMenuRs
List
>
getUserMenu
(
Long
userId
);
boolean
saveUserMenu
(
Long
userId
,
MenuReq
.
SaveUserMenuReq
menu
);
List
<
SysRoleMenuRs
>
getRoleMenu
(
Long
roleId
);
List
<
SysRoleMenuRs
List
>
getRoleMenu
(
Long
roleId
);
boolean
saveRoleMenu
(
Long
userId
,
MenuReq
.
SaveRoleMenuReq
menu
);
}
bsoft-admin/src/main/java/com/bsoft/admin/service/impl/DicOrgServiceImpl.java
View file @
8d7d7db6
...
...
@@ -7,12 +7,13 @@ import com.bsoft.admin.model.DicOrg;
import
com.bsoft.admin.model.SysUserOrgRs
;
import
com.bsoft.admin.model.reqmodel.OrgReq
;
import
com.bsoft.admin.model.respmodel.DicOrgList
;
import
com.bsoft.admin.model.respmodel.SysUserOrgRsList
;
import
com.bsoft.admin.service.DicOrgService
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.Comparator
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.stream.Collectors
;
...
...
@@ -37,7 +38,7 @@ public class DicOrgServiceImpl implements DicOrgService {
}
public
List
<
DicOrgList
>
getAll
(
OrgReq
.
GetOrgReq
org
){
public
List
<
DicOrgList
>
get
Parent
All
(
OrgReq
.
GetOrgReq
org
){
List
<
DicOrgList
>
list
=
dicOrgMapper
.
selectParentAll
();
if
(
org
.
getOrgName
()!=
null
){
list
=
list
.
stream
().
filter
(
...
...
@@ -48,6 +49,11 @@ public class DicOrgServiceImpl implements DicOrgService {
return
resultList
;
}
public
List
<
DicOrg
>
getAll
(){
List
<
DicOrg
>
list
=
dicOrgMapper
.
selectAll
();
return
list
;
}
public
DicOrg
info
(
Long
orgId
){
DicOrg
dicOrg
=
dicOrgMapper
.
selectByPrimaryKey
(
orgId
);
return
dicOrg
;
...
...
@@ -112,35 +118,38 @@ public class DicOrgServiceImpl implements DicOrgService {
* @return
*/
@Override
public
SysUserOrgRs
getUserOrg
(
Long
userId
){
SysUserOrgRs
sysUserOrgRs
=
sysUserOrgRsMapper
.
selectByUser
(
userId
);
public
List
<
SysUserOrgRsList
>
getUserOrg
(
Long
userId
){
List
<
SysUserOrgRsList
>
sysUserOrgRs
=
sysUserOrgRsMapper
.
selectByUser
(
userId
);
return
sysUserOrgRs
;
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
boolean
saveUserOrg
(
Long
userId
,
OrgReq
.
SaveUserOrgReq
org
){
if
(
org
!=
null
&&
org
.
getOrgId
()!=
null
&&
org
.
getUserId
()!=
null
){
int
result
=
0
;
if
(
org
!=
null
&&
org
.
getOrg
()!=
null
&&
org
.
getOrg
().
size
()>
0
&&
org
.
getUserId
()!=
null
){
sysUserOrgRsMapper
.
deleteByUser
(
org
.
getUserId
());
for
(
Long
orgId:
org
.
getOrg
())
{
//判断是否存在关系数据
SysUserOrgRs
sysUserOrgRs
=
sysUserOrgRsMapper
.
selectByUser
(
org
.
getUserId
()
);
SysUserOrgRs
sysUserOrgRs
=
sysUserOrgRsMapper
.
selectByUserWithOrg
(
org
.
getUserId
(),
orgId
);
if
(
sysUserOrgRs
!=
null
){
//修改
sysUserOrgRs
.
setOrgId
(
org
.
getOrgId
());
result
=
sysUserOrgRsMapper
.
updateByPrimaryKey
(
sysUserOrgRs
);
//开启状态
sysUserOrgRs
.
setState
((
short
)
StateType
.
ON
.
getValue
());
result
+
=
sysUserOrgRsMapper
.
updateByPrimaryKey
(
sysUserOrgRs
);
}
else
{
//添加
sysUserOrgRs
=
new
SysUserOrgRs
();
sysUserOrgRs
.
setOrgId
(
org
.
getOrgId
()
);
sysUserOrgRs
.
setOrgId
(
orgId
);
sysUserOrgRs
.
setUserId
(
org
.
getUserId
());
sysUserOrgRs
.
setCreateDate
(
new
Date
());
sysUserOrgRs
.
setCreateUserid
(
userId
);
sysUserOrgRs
.
setState
((
short
)
StateType
.
ON
.
getValue
());
result
=
sysUserOrgRsMapper
.
insert
(
sysUserOrgRs
);
result
+
=
sysUserOrgRsMapper
.
insert
(
sysUserOrgRs
);
}
return
result
>
0
;
}
return
false
;
}
return
result
>
0
;
}
...
...
bsoft-admin/src/main/java/com/bsoft/admin/service/impl/SysMenuServiceImpl.java
View file @
8d7d7db6
...
...
@@ -10,6 +10,8 @@ import com.bsoft.admin.model.SysRoleMenuRs;
import
com.bsoft.admin.model.SysUserMenuRs
;
import
com.bsoft.admin.model.reqmodel.MenuReq
;
import
com.bsoft.admin.model.respmodel.SysMenuList
;
import
com.bsoft.admin.model.respmodel.SysRoleMenuRsList
;
import
com.bsoft.admin.model.respmodel.SysUserMenuRsList
;
import
com.bsoft.admin.service.SysMenuService
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -54,7 +56,7 @@ public class SysMenuServiceImpl implements SysMenuService {
}
@Override
public
List
<
SysMenuList
>
getAll
(
MenuReq
.
GetMenuReq
menu
){
public
List
<
SysMenuList
>
get
Parent
All
(
MenuReq
.
GetMenuReq
menu
){
List
<
SysMenuList
>
list
=
sysMenuMapper
.
selectParentAll
();
if
(
menu
.
getMenuName
()!=
null
){
list
=
list
.
stream
().
filter
(
...
...
@@ -66,6 +68,12 @@ public class SysMenuServiceImpl implements SysMenuService {
return
resultList
;
}
public
List
<
SysMenu
>
getAll
(){
List
<
SysMenu
>
list
=
sysMenuMapper
.
selectAll
();
return
list
;
}
@Override
public
SysMenu
info
(
MenuReq
.
InfoMenuReq
menu
){
SysMenu
sysMenu
=
sysMenuMapper
.
selectByPrimaryKey
(
menu
.
getMenuId
());
...
...
@@ -84,6 +92,7 @@ public class SysMenuServiceImpl implements SysMenuService {
sysMenu
.
setMenuImage
(
menu
.
getMenuImage
());
sysMenu
.
setPageCode
(
menu
.
getPageCode
());
sysMenu
.
setParentId
(
menu
.
getParentId
());
sysMenu
.
setSort
((
long
)
sysMenuMapper
.
selectMaxSort
(
menu
.
getParentId
()));
sysMenuMapper
.
insert
(
sysMenu
);
return
true
;
}
...
...
@@ -127,8 +136,8 @@ public class SysMenuServiceImpl implements SysMenuService {
* @return
*/
@Override
public
List
<
SysUserMenuRs
>
getUserMenu
(
Long
userId
){
List
<
SysUserMenuRs
>
list
=
sysUserMenuRsMapper
.
selectByUser
(
userId
);
public
List
<
SysUserMenuRs
List
>
getUserMenu
(
Long
userId
){
List
<
SysUserMenuRs
List
>
list
=
sysUserMenuRsMapper
.
selectByUser
(
userId
);
return
list
;
}
...
...
@@ -141,22 +150,26 @@ public class SysMenuServiceImpl implements SysMenuService {
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
boolean
saveUserMenu
(
Long
userId
,
MenuReq
.
SaveUserMenuReq
menu
){
int
result
=
0
;
if
(
menu
!=
null
&&
menu
.
getMenus
()!=
null
&&
menu
.
getMenus
().
size
()>
0
&&
menu
.
getUserId
()!=
null
){
sysUserMenuRsMapper
.
deleteAllByUser
(
menu
.
getUserId
());
int
result
=
0
;
for
(
Long
menuId:
menu
.
getMenus
())
{
SysUserMenuRs
um
=
new
SysUserMenuRs
();
SysUserMenuRs
um
=
sysUserMenuRsMapper
.
selectByUserWithMenu
(
menu
.
getUserId
(),
menuId
);
if
(
um
!=
null
){
um
.
setState
((
short
)
StateType
.
ON
.
getValue
());
result
+=
sysUserMenuRsMapper
.
updateByPrimaryKey
(
um
);
}
else
{
um
=
new
SysUserMenuRs
();
um
.
setCreateDate
(
new
Date
());
um
.
setState
((
short
)
StateType
.
ON
.
getValue
());
um
.
setCreateUserid
(
userId
);
um
.
setUserId
(
menu
.
getUserId
());
um
.
setMenuId
(
menuId
);
sysUserMenuRsMapper
.
insert
(
um
);
result
++;
result
+=
sysUserMenuRsMapper
.
insert
(
um
);
}
return
result
>
0
;
}
return
false
;
}
return
result
>
0
;
}
/**
...
...
@@ -165,30 +178,34 @@ public class SysMenuServiceImpl implements SysMenuService {
* @return
*/
@Override
public
List
<
SysRoleMenuRs
>
getRoleMenu
(
Long
roleId
){
List
<
SysRoleMenuRs
>
list
=
sysRoleMenuRsMapper
.
selectByRole
(
roleId
);
public
List
<
SysRoleMenuRs
List
>
getRoleMenu
(
Long
roleId
){
List
<
SysRoleMenuRs
List
>
list
=
sysRoleMenuRsMapper
.
selectByRole
(
roleId
);
return
list
;
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
boolean
saveRoleMenu
(
Long
userId
,
MenuReq
.
SaveRoleMenuReq
menu
){
int
result
=
0
;
if
(
menu
!=
null
&&
menu
.
getMenus
()!=
null
&&
menu
.
getMenus
().
size
()>
0
&&
menu
.
getRoleId
()!=
null
){
sysRoleMenuRsMapper
.
deleteAllByRole
(
menu
.
getRoleId
());
int
result
=
0
;
for
(
Long
menuId:
menu
.
getMenus
())
{
SysRoleMenuRs
rm
=
new
SysRoleMenuRs
();
SysRoleMenuRs
rm
=
sysRoleMenuRsMapper
.
selectByUserWithRole
(
menu
.
getRoleId
(),
menuId
);
if
(
rm
!=
null
){
rm
.
setState
((
short
)
StateType
.
ON
.
getValue
());
result
+=
sysRoleMenuRsMapper
.
updateByPrimaryKey
(
rm
);
}
else
{
rm
=
new
SysRoleMenuRs
();
rm
.
setCreateDate
(
new
Date
());
rm
.
setState
((
short
)
StateType
.
ON
.
getValue
());
rm
.
setCreateUserid
(
userId
);
rm
.
setRoleId
(
menu
.
getRoleId
());
rm
.
setMenuId
(
menuId
);
sysRoleMenuRsMapper
.
insert
(
rm
);
result
++;
result
+=
sysRoleMenuRsMapper
.
insert
(
rm
);
}
return
result
>
0
;
}
return
false
;
}
return
result
>
0
;
}
...
...
bsoft-admin/src/main/java/com/bsoft/admin/service/impl/SysRoleServiceImpl.java
View file @
8d7d7db6
...
...
@@ -8,6 +8,7 @@ import com.bsoft.admin.model.SysUserRoleRs;
import
com.bsoft.admin.model.reqmodel.RoleReq
;
import
com.bsoft.admin.service.SysRoleService
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
java.util.Date
;
...
...
@@ -86,17 +87,24 @@ public class SysRoleServiceImpl implements SysRoleService {
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
boolean
saveUserRole
(
Long
userId
,
RoleReq
.
SavaUserRoleReq
role
){
int
result
=
0
;
if
(
role
!=
null
&&
role
.
getRoleId
()!=
null
&&
role
.
getUserId
()!=
null
){
SysUserRoleRs
info
=
new
SysUserRoleRs
();
SysUserRoleRs
info
=
sysUserRoleRsMapper
.
selectByUser
(
role
.
getUserId
());
if
(
info
!=
null
){
info
.
setState
((
short
)
StateType
.
ON
.
getValue
());
result
=
sysUserRoleRsMapper
.
updateByPrimaryKey
(
info
);
}
else
{
info
=
new
SysUserRoleRs
();
info
.
setCreateDate
(
new
Date
());
info
.
setCreateUserid
(
userId
);
info
.
setState
((
short
)
StateType
.
ON
.
getValue
());
info
.
setUserId
(
role
.
getUserId
());
info
.
setRoleId
(
role
.
getRoleId
());
sysUserRoleRsMapper
.
insert
(
info
);
return
true
;
result
=
sysUserRoleRsMapper
.
insert
(
info
);
}
return
false
;
}
return
result
>
0
;
}
}
bsoft-admin/src/main/resources/application-test.properties
View file @
8d7d7db6
#### \u5F00\u53D1\u73AF\u5883 ###################################################
spring.datasource.driver-class-name
=
oracle.jdbc.driver.OracleDriver
spring.datasource.username
=
ll
spring.datasource.username
=
CH
spring.datasource.password
=
123456
spring.datasource.url
=
jdbc:oracle:thin:@192.168.18.171:1521:his
...
...
bsoft-admin/src/main/resources/application.properties
View file @
8d7d7db6
spring.application.name
=
bsofta
pi
spring.profiles.active
=
dev
spring.application.name
=
bsofta
dmin
spring.profiles.active
=
test
#server.port=8080
#server.servlet.context-path=/api
mybatis.mapper-locations
=
classpath:mapper/*.xml
...
...
bsoft-admin/src/main/resources/logback-spring.xml
View file @
8d7d7db6
...
...
@@ -8,7 +8,7 @@
<property
name=
"log.prod.level"
value=
"DEBUG"
/>
<property
name=
"log.max.size"
value=
"10MB"
/>
<!-- 日志文件大小 -->
<springProperty
scope=
"context"
name=
"log.profile"
source=
"spring.profiles.active"
defaultValue=
"app"
/>
<property
name=
"log.base"
value=
"/logs/${log.profile}"
/>
<property
name=
"log.base"
value=
"/logs/
admin/
${log.profile}"
/>
<springProperty
scope=
"context"
name=
"log.moduleName"
source=
"spring.application.name"
defaultValue=
"app"
/>
<!--控制台输出 -->
...
...
bsoft-admin/src/main/resources/mapper/DicOrgMapper.xml
View file @
8d7d7db6
...
...
@@ -52,24 +52,27 @@
select ID, CREATE_DATE, CREATE_USERID, "STATE", ORG_CODE, ORG_NAME, ORG_NO, ORG_SHORT_NAME,
ORG_GROUP, ORG_TYPE, ORG_ADDRESS, PARENT_ID
from DIC_ORG
where ID = #{id,jdbcType=DECIMAL}
where ID = #{id,jdbcType=DECIMAL}
and "STATE"=1
</select>
<select
id=
"selectAll"
resultMap=
"BaseResultMap"
>
select ID, CREATE_DATE, CREATE_USERID, "STATE", ORG_CODE, ORG_NAME, ORG_NO, ORG_SHORT_NAME,
ORG_GROUP, ORG_TYPE, ORG_ADDRESS, PARENT_ID
from DIC_ORG
where "STATE"=1
</select>
<select
id=
"selectParentAll"
resultMap=
"DicOrgResultMap"
>
select ID, CREATE_DATE, CREATE_USERID, "STATE", ORG_CODE, ORG_NAME, ORG_NO, ORG_SHORT_NAME,
ORG_GROUP, ORG_TYPE, ORG_ADDRESS, PARENT_ID
from DIC_ORG
where "STATE"=1
</select>
<select
id=
"selectByUser"
resultMap=
"BaseResultMap"
>
SELECT o.*
FROM SYS_USER_ORG_RS uor,DIC_ORG o
where uor.ORG_ID=o.ID and uor.USER_ID= #{userId,jdbcType=DECIMAL}
and o."STATE"=1 and uor."STATE"=1
</select>
<select
id=
"selectByName"
resultMap=
"BaseResultMap"
>
select * from DIC_ORG where ORG_NAME=#{orgName,jdbcType=VARCHAR}
select * from DIC_ORG where ORG_NAME=#{orgName,jdbcType=VARCHAR}
and "STATE"=1
</select>
</mapper>
\ No newline at end of file
bsoft-admin/src/main/resources/mapper/SysMenuMapper.xml
View file @
8d7d7db6
...
...
@@ -81,4 +81,9 @@
SYS_MENU m on umr.MENU_ID = m.ID
where umr.STATE=1 and m.STATE=1 and umr.USER_ID = #{userId,jdbcType=DECIMAL}
</select>
<select
id=
"selectMaxSort"
resultType=
"java.lang.Integer"
>
select nvl( MAX(SORT),0) AS SORT
from SYS_MENU
where PARENT_ID=#{parentId,jdbcType=DECIMAL}
</select>
</mapper>
\ No newline at end of file
bsoft-admin/src/main/resources/mapper/SysRoleMenuRsMapper.xml
View file @
8d7d7db6
...
...
@@ -9,13 +9,16 @@
<result
column=
"MENU_ID"
jdbcType=
"DECIMAL"
property=
"menuId"
/>
<result
column=
"ROLE_ID"
jdbcType=
"DECIMAL"
property=
"roleId"
/>
</resultMap>
<resultMap
id=
"SysRoleMenuRsList"
extends=
"BaseResultMap"
type=
"com.bsoft.admin.model.respmodel.SysRoleMenuRsList"
>
<result
column=
"PARENT_ID"
jdbcType=
"DECIMAL"
property=
"parentId"
/>
</resultMap>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Long"
>
delete from SYS_ROLE_MENU_RS
where ID = #{id,jdbcType=DECIMAL}
</delete>
<insert
id=
"insert"
parameterType=
"com.bsoft.admin.model.SysRoleMenuRs"
>
<selectKey
keyProperty=
"id"
order=
"BEFORE"
resultType=
"java.lang.Long"
>
select SEQ_SYS_ROLE_MENU_RS_ID.nextval from dual
select SEQ_SYS_ROLE_MENU_RS
R
_ID.nextval from dual
</selectKey>
insert into SYS_ROLE_MENU_RS (ID,CREATE_DATE, CREATE_USERID, "STATE",
MENU_ID, ROLE_ID)
...
...
@@ -41,12 +44,19 @@
from SYS_ROLE_MENU_RS
where "STATE"=1
</select>
<select
id=
"selectByRole"
resultMap=
"BaseResultMap"
>
select ID, CREATE_DATE, CREATE_USERID, "STATE", MENU_ID, ROLE_ID
from SYS_ROLE_MENU_RS
where "STATE"=1 and ROLE_ID = #{roleId,jdbcType=DECIMAL}
<select
id=
"selectByRole"
resultMap=
"SysRoleMenuRsList"
>
select MAP.*,m.PARENT_ID
from SYS_ROLE_MENU_RS MAP
join SYS_MENU m on m.ID=MAP.MENU_ID
where MAP."STATE"=1 and MAP.ROLE_ID = #{roleId,jdbcType=DECIMAL}
</select>
<update
id=
"deleteAllByRole"
>
update SYS_ROLE_MENU_RS set "STATE"=0 where ROLE_ID = #{
user
Id,jdbcType=DECIMAL}
update SYS_ROLE_MENU_RS set "STATE"=0 where ROLE_ID = #{
role
Id,jdbcType=DECIMAL}
</update>
<select
id=
"selectByUserWithRole"
resultMap=
"BaseResultMap"
>
select ID, CREATE_DATE, CREATE_USERID, "STATE", MENU_ID, ROLE_ID
from SYS_ROLE_MENU_RS
where ROLE_ID = #{roleId,jdbcType=DECIMAL}
and MENU_ID=#{menuId,jdbcType=DECIMAL}
</select>
</mapper>
\ No newline at end of file
bsoft-admin/src/main/resources/mapper/SysUserMenuRsMapper.xml
View file @
8d7d7db6
...
...
@@ -9,13 +9,16 @@
<result
column=
"USER_ID"
jdbcType=
"DECIMAL"
property=
"userId"
/>
<result
column=
"MENU_ID"
jdbcType=
"DECIMAL"
property=
"menuId"
/>
</resultMap>
<resultMap
id=
"SysUserMenuRsList"
extends=
"BaseResultMap"
type=
"com.bsoft.admin.model.respmodel.SysUserMenuRsList"
>
<result
column=
"PARENT_ID"
jdbcType=
"DECIMAL"
property=
"parentId"
/>
</resultMap>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Long"
>
delete from SYS_USER_MENU_RS
where ID = #{id,jdbcType=DECIMAL}
</delete>
<insert
id=
"insert"
parameterType=
"com.bsoft.admin.model.SysUserMenuRs"
>
<selectKey
keyProperty=
"id"
order=
"BEFORE"
resultType=
"java.lang.Long"
>
select SEQ_SYS_USER_MENU_RS
_ID.nextval from dual
select SEQ_SYS_USER_MENU_RS_ID.nextval from dual
</selectKey>
insert into SYS_USER_MENU_RS (ID,CREATE_DATE, CREATE_USERID, "STATE",
USER_ID, MENU_ID)
...
...
@@ -40,12 +43,19 @@
select ID, CREATE_DATE, CREATE_USERID, "STATE", USER_ID, MENU_ID
from SYS_USER_MENU_RS
</select>
<select
id=
"selectByUser"
resultMap=
"BaseResultMap"
>
select ID, CREATE_DATE, CREATE_USERID, "STATE", USER_ID, MENU_ID
from SYS_USER_MENU_RS
where "STATE"=1 and USER_ID = #{userId,jdbcType=DECIMAL}
<select
id=
"selectByUser"
resultMap=
"SysUserMenuRsList"
>
select MAP.*,m.PARENT_ID
from SYS_USER_MENU_RS MAP
join SYS_MENU m on m.ID=MAP.MENU_ID
where MAP."STATE"=1 and MAP.USER_ID = #{userId,jdbcType=DECIMAL}
</select>
<update
id=
"deleteAllByUser"
>
update SYS_USER_MENU_RS set "STATE"=0 where USER_ID = #{userId,jdbcType=DECIMAL}
</update>
<select
id=
"selectByUserWithMenu"
resultMap=
"BaseResultMap"
>
select ID, CREATE_DATE, CREATE_USERID, "STATE", USER_ID, MENU_ID
from SYS_USER_MENU_RS
where USER_ID = #{userId,jdbcType=DECIMAL}
and MENU_ID=#{menuId,jdbcType=DECIMAL}
</select>
</mapper>
\ No newline at end of file
bsoft-admin/src/main/resources/mapper/SysUserOrgRsMapper.xml
View file @
8d7d7db6
...
...
@@ -9,6 +9,9 @@
<result
column=
"USER_ID"
jdbcType=
"DECIMAL"
property=
"userId"
/>
<result
column=
"ORG_ID"
jdbcType=
"DECIMAL"
property=
"orgId"
/>
</resultMap>
<resultMap
id=
"SysUserOrgRsList"
extends=
"BaseResultMap"
type=
"com.bsoft.admin.model.respmodel.SysUserOrgRsList"
>
<result
column=
"PARENT_ID"
jdbcType=
"DECIMAL"
property=
"parentId"
/>
</resultMap>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Long"
>
delete from SYS_USER_ORG_RS
where ID = #{id,jdbcType=DECIMAL}
...
...
@@ -41,9 +44,20 @@
from SYS_USER_ORG_RS
where "STATE" = 1
</select>
<select
id=
"selectByUser"
resultMap=
"BaseResultMap"
>
<select
id=
"selectByUser"
resultMap=
"SysUserOrgRsList"
>
select map.*,o.PARENT_ID
from SYS_USER_ORG_RS MAP
join DIC_ORG o on o.ID=map.ORG_ID
where MAP."STATE" = 1 and MAP.USER_ID = #{userId,jdbcType=DECIMAL}
</select>
<select
id=
"selectByUserWithOrg"
resultMap=
"BaseResultMap"
>
select ID, CREATE_DATE, CREATE_USERID, "STATE", USER_ID, ORG_ID
from SYS_USER_ORG_RS
where
"STATE" = 1 and USER_ID = #{user
Id,jdbcType=DECIMAL}
where
USER_ID = #{userId,jdbcType=DECIMAL} and ORG_ID=#{org
Id,jdbcType=DECIMAL}
</select>
<update
id=
"deleteByUser"
>
update SYS_USER_ORG_RS
set "STATE" = 0
where USER_ID = #{userId,jdbcType=DECIMAL}
</update>
</mapper>
\ No newline at end of file
bsoft-admin/src/main/resources/mapper/SysUserRoleRsMapper.xml
View file @
8d7d7db6
...
...
@@ -41,4 +41,14 @@
from SYS_USER_ROLE_RS
where "STATE"=1
</select>
<update
id=
"deleteByUser"
>
update SYS_USER_ROLE_RS
set "STATE" = 0
where USER_ID = #{userId,jdbcType=DECIMAL}
</update>
<select
id=
"selectByUser"
resultMap=
"BaseResultMap"
>
select ID, CREATE_DATE, CREATE_USERID, "STATE", USER_ID, ROLE_ID
from SYS_USER_ROLE_RS
where "STATE"=1 and USER_ID = #{userId,jdbcType=DECIMAL}
</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