Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bigsys
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Administrator
bigsys
Commits
c82cdacc
Commit
c82cdacc
authored
Sep 11, 2017
by
fangzhipeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
继续修改vue权限功能
parent
1da63fd5
Changes
35
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
35 changed files
with
2046 additions
and
137 deletions
+2046
-137
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/config/MyRealm.java
...src/main/java/com/bigsys/auth/project/config/MyRealm.java
+7
-1
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/config/ShiroConfig.java
...main/java/com/bigsys/auth/project/config/ShiroConfig.java
+13
-0
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/controller/MenuController.java
...va/com/bigsys/auth/project/controller/MenuController.java
+1
-1
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/controller/RoleController.java
...va/com/bigsys/auth/project/controller/RoleController.java
+47
-0
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/db/dao/RoleMapper.java
.../main/java/com/bigsys/auth/project/db/dao/RoleMapper.java
+30
-0
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/db/dao/RoleMapper.xml
...c/main/java/com/bigsys/auth/project/db/dao/RoleMapper.xml
+181
-0
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/db/dao/RoleMenuMapper.java
...n/java/com/bigsys/auth/project/db/dao/RoleMenuMapper.java
+30
-0
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/db/dao/RoleMenuMapper.xml
...in/java/com/bigsys/auth/project/db/dao/RoleMenuMapper.xml
+181
-0
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/db/model/Role.java
.../src/main/java/com/bigsys/auth/project/db/model/Role.java
+46
-0
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/db/model/RoleExample.java
...in/java/com/bigsys/auth/project/db/model/RoleExample.java
+410
-0
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/db/model/RoleMenu.java
.../main/java/com/bigsys/auth/project/db/model/RoleMenu.java
+33
-0
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/db/model/RoleMenuExample.java
...ava/com/bigsys/auth/project/db/model/RoleMenuExample.java
+400
-0
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/model/RoleMenus.java
...rc/main/java/com/bigsys/auth/project/model/RoleMenus.java
+24
-0
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/service/RoleMenuService.java
...java/com/bigsys/auth/project/service/RoleMenuService.java
+14
-0
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/service/RoleService.java
...ain/java/com/bigsys/auth/project/service/RoleService.java
+21
-0
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/service/UserService.java
...ain/java/com/bigsys/auth/project/service/UserService.java
+1
-0
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/service/impl/RoleMenuServiceImpl.java
...bigsys/auth/project/service/impl/RoleMenuServiceImpl.java
+54
-0
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/service/impl/RoleServiceImpl.java
...com/bigsys/auth/project/service/impl/RoleServiceImpl.java
+75
-0
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/service/impl/UserServiceImpl.java
...com/bigsys/auth/project/service/impl/UserServiceImpl.java
+8
-0
bigsys-auth/bigsys-auth-project/src/test/resources/generatorConfig.xml
...igsys-auth-project/src/test/resources/generatorConfig.xml
+6
-3
bigsys-auth/bigsys-auth-project/vue/.babelrc
bigsys-auth/bigsys-auth-project/vue/.babelrc
+1
-1
bigsys-auth/bigsys-auth-project/vue/index.html
bigsys-auth/bigsys-auth-project/vue/index.html
+15
-0
bigsys-auth/bigsys-auth-project/vue/package-lock.json
bigsys-auth/bigsys-auth-project/vue/package-lock.json
+12
-0
bigsys-auth/bigsys-auth-project/vue/package.json
bigsys-auth/bigsys-auth-project/vue/package.json
+3
-0
bigsys-auth/bigsys-auth-project/vue/src/mock/menus.js
bigsys-auth/bigsys-auth-project/vue/src/mock/menus.js
+10
-10
bigsys-auth/bigsys-auth-project/vue/src/router/index.js
bigsys-auth/bigsys-auth-project/vue/src/router/index.js
+2
-9
bigsys-auth/bigsys-auth-project/vue/src/store/getter.js
bigsys-auth/bigsys-auth-project/vue/src/store/getter.js
+2
-2
bigsys-auth/bigsys-auth-project/vue/src/store/index.js
bigsys-auth/bigsys-auth-project/vue/src/store/index.js
+69
-7
bigsys-auth/bigsys-auth-project/vue/src/store/modules/login.js
...s-auth/bigsys-auth-project/vue/src/store/modules/login.js
+0
-26
bigsys-auth/bigsys-auth-project/vue/src/store/modules/sidebar.js
...auth/bigsys-auth-project/vue/src/store/modules/sidebar.js
+0
-29
bigsys-auth/bigsys-auth-project/vue/src/store/modules/users.js
...s-auth/bigsys-auth-project/vue/src/store/modules/users.js
+0
-44
bigsys-auth/bigsys-auth-project/vue/src/views/Login.vue
bigsys-auth/bigsys-auth-project/vue/src/views/Login.vue
+5
-2
bigsys-auth/bigsys-auth-project/vue/src/views/layout/Navbar.vue
...-auth/bigsys-auth-project/vue/src/views/layout/Navbar.vue
+6
-1
bigsys-auth/bigsys-auth-project/vue/src/views/pages/role.vue
bigsys-auth/bigsys-auth-project/vue/src/views/pages/role.vue
+254
-0
bigsys-auth/bigsys-auth-project/vue/src/views/pages/user.vue
bigsys-auth/bigsys-auth-project/vue/src/views/pages/user.vue
+85
-1
No files found.
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/config/MyRealm.java
View file @
c82cdacc
package
com
.
bigsys
.
auth
.
project
.
config
;
import
com.bigsys.auth.project.db.model.User
;
import
com.bigsys.auth.project.service.UserService
;
import
org.apache.shiro.authc.AuthenticationException
;
import
org.apache.shiro.authc.AuthenticationInfo
;
import
org.apache.shiro.authc.AuthenticationToken
;
...
...
@@ -15,6 +17,9 @@ import javax.annotation.Resource;
@Component
(
"myRealm"
)
public
class
MyRealm
extends
AuthorizingRealm
{
@Resource
private
UserService
userService
;
@Override
protected
AuthorizationInfo
doGetAuthorizationInfo
(
PrincipalCollection
principalCollection
)
{
return
null
;
...
...
@@ -22,7 +27,8 @@ public class MyRealm extends AuthorizingRealm{
@Override
protected
AuthenticationInfo
doGetAuthenticationInfo
(
AuthenticationToken
authenticationToken
)
throws
AuthenticationException
{
SimpleAuthenticationInfo
info
=
new
SimpleAuthenticationInfo
(
authenticationToken
.
getPrincipal
(),
authenticationToken
.
getCredentials
(),
this
.
getClass
().
getName
());
User
user
=
userService
.
getUser
((
String
)
authenticationToken
.
getPrincipal
());
SimpleAuthenticationInfo
info
=
new
SimpleAuthenticationInfo
(
user
,
authenticationToken
.
getCredentials
(),
this
.
getClass
().
getName
());
return
info
;
}
}
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/config/ShiroConfig.java
View file @
c82cdacc
package
com
.
bigsys
.
auth
.
project
.
config
;
import
com.bigsys.auth.project.db.model.User
;
import
com.bigsys.auth.project.util.response.BSResponse
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
org.apache.shiro.SecurityUtils
;
import
org.apache.shiro.authc.AuthenticationToken
;
import
org.apache.shiro.mgt.SecurityManager
;
import
org.apache.shiro.realm.Realm
;
...
...
@@ -13,6 +17,8 @@ import org.springframework.context.annotation.Configuration;
import
javax.annotation.Resource
;
import
javax.servlet.ServletRequest
;
import
javax.servlet.ServletResponse
;
import
java.io.OutputStream
;
import
java.nio.charset.Charset
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
...
...
@@ -83,6 +89,13 @@ public class ShiroConfig {
return
new
FormAuthenticationFilter
()
{
@Override
protected
boolean
onLoginSuccess
(
AuthenticationToken
token
,
Subject
subject
,
ServletRequest
request
,
ServletResponse
response
)
throws
Exception
{
response
.
setContentType
(
"application/json"
);
response
.
setCharacterEncoding
(
"utf-8"
);
User
user
=
(
User
)
SecurityUtils
.
getSubject
().
getPrincipal
();
BSResponse
bsResponse
=
BSResponse
.
ok
(
user
);
response
.
setContentLength
(
new
ObjectMapper
().
writeValueAsString
(
bsResponse
).
getBytes
(
"utf-8"
).
length
);
OutputStream
outputStream
=
response
.
getOutputStream
();
outputStream
.
write
(
new
ObjectMapper
().
writeValueAsString
(
bsResponse
).
getBytes
(
"utf-8"
));
return
false
;
}
};
...
...
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/controller/MenuController.java
View file @
c82cdacc
...
...
@@ -15,7 +15,7 @@ import java.util.List;
@RequestMapping
(
value
=
"/menu"
)
public
class
MenuController
{
String
menu
=
"[{\"name\":\"aa\",\"hasSub\":true,\"menus\":[{\"name\":\"bb\",\"link\":\"/index\",\"hasSub\":false}]},{\"name\":\"aa\",\"link\":\"/\",\"hasSub\":false},{\"name\":\"aa\",\"link\":\"/\",\"hasSub\":false},{\"name\":\"系统管理\",\"link\":\"/\",\"hasSub\":true,\"menus\":[{\"name\":\"角色管理\",\"link\":\"/role/index\",\"hasSub\":false},{\"name\":\"权限管理\",\"link\":\"/auth/index\",\"hasSub\":false},{\"name\":\"用户管理\",\"link\":\"/user/index\",\"hasSub\":false}]}]"
;
String
menu
=
"[{\"name\":\"aa\",\"hasSub\":true,\"menus\":[{\"name\":\"bb\",\"link\":\"/index\",\"hasSub\":false}]},{\"name\":\"aa\",\"link\":\"/\",\"hasSub\":false},{\"name\":\"aa\",\"link\":\"/\",\"hasSub\":false},{\"name\":\"系统管理\",\"link\":\"/\",\"hasSub\":true,\"menus\":[{\"name\":\"角色管理\",\"link\":\"/role/index\",\"hasSub\":false},{\"name\":\"权限管理\",\"link\":\"/auth/index\",\"hasSub\":false},{\"name\":\"用户管理\",\"link\":\"/user/index\",\"hasSub\":false}
,{\"name\":\"菜单管理\",\"link\":\"/user/index\",\"hasSub\":false}
]}]"
;
@RequestMapping
(
value
=
"/getMenus"
)
public
BSResponse
getMenus
(
String
userId
)
{
...
...
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/controller/RoleController.java
View file @
c82cdacc
package
com
.
bigsys
.
auth
.
project
.
controller
;
import
com.bigsys.auth.project.db.model.Role
;
import
com.bigsys.auth.project.model.RoleMenus
;
import
com.bigsys.auth.project.service.RoleMenuService
;
import
com.bigsys.auth.project.service.RoleService
;
import
com.bigsys.auth.project.util.response.BSResponse
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.annotation.Resource
;
import
java.util.List
;
@RestController
@RequestMapping
(
value
=
"/role"
)
public
class
RoleController
{
@Resource
private
RoleService
roleService
;
@Resource
private
RoleMenuService
roleMenusService
;
@RequestMapping
(
value
=
"/addRole"
)
public
BSResponse
addRole
(
@RequestBody
Role
role
)
{
roleService
.
insert
(
role
);
return
BSResponse
.
ok
();
}
@RequestMapping
(
value
=
"/deleteRole"
)
public
BSResponse
deleteRole
(
String
id
)
{
roleService
.
deleteRole
(
id
);
return
BSResponse
.
ok
();
}
@RequestMapping
(
value
=
"/getRole"
)
public
BSResponse
getRole
()
{
List
<
Role
>
role
=
roleService
.
getRoles
();
return
BSResponse
.
ok
(
role
);
}
@RequestMapping
(
value
=
"/addRoleMenus"
)
public
BSResponse
addRoleMenu
(
@RequestBody
RoleMenus
roleMenus
)
{
roleMenusService
.
addRoleMenus
(
roleMenus
);
return
BSResponse
.
ok
();
}
@RequestMapping
(
value
=
"/getRoleMenus"
)
public
BSResponse
getRoleMenus
(
String
role
)
{
List
<
String
>
links
=
roleMenusService
.
getRoleMenus
(
role
);
return
BSResponse
.
ok
(
links
);
}
}
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/db/dao/RoleMapper.java
0 → 100644
View file @
c82cdacc
package
com
.
bigsys
.
auth
.
project
.
db
.
dao
;
import
com.bigsys.auth.project.db.model.Role
;
import
com.bigsys.auth.project.db.model.RoleExample
;
import
java.util.List
;
import
org.apache.ibatis.annotations.Param
;
public
interface
RoleMapper
{
long
countByExample
(
RoleExample
example
);
int
deleteByExample
(
RoleExample
example
);
int
deleteByPrimaryKey
(
String
id
);
int
insert
(
Role
record
);
int
insertSelective
(
Role
record
);
List
<
Role
>
selectByExample
(
RoleExample
example
);
Role
selectByPrimaryKey
(
String
id
);
int
updateByExampleSelective
(
@Param
(
"record"
)
Role
record
,
@Param
(
"example"
)
RoleExample
example
);
int
updateByExample
(
@Param
(
"record"
)
Role
record
,
@Param
(
"example"
)
RoleExample
example
);
int
updateByPrimaryKeySelective
(
Role
record
);
int
updateByPrimaryKey
(
Role
record
);
}
\ No newline at end of file
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/db/dao/RoleMapper.xml
0 → 100644
View file @
c82cdacc
<?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=
"com.bigsys.auth.project.db.dao.RoleMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.bigsys.auth.project.db.model.Role"
>
<id
column=
"id"
jdbcType=
"VARCHAR"
property=
"id"
/>
<result
column=
"name"
jdbcType=
"VARCHAR"
property=
"name"
/>
<result
column=
"parentId"
jdbcType=
"VARCHAR"
property=
"parentId"
/>
</resultMap>
<sql
id=
"Example_Where_Clause"
>
<where>
<foreach
collection=
"oredCriteria"
item=
"criteria"
separator=
"or"
>
<if
test=
"criteria.valid"
>
<trim
prefix=
"("
prefixOverrides=
"and"
suffix=
")"
>
<foreach
collection=
"criteria.criteria"
item=
"criterion"
>
<choose>
<when
test=
"criterion.noValue"
>
and ${criterion.condition}
</when>
<when
test=
"criterion.singleValue"
>
and ${criterion.condition} #{criterion.value}
</when>
<when
test=
"criterion.betweenValue"
>
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when
test=
"criterion.listValue"
>
and ${criterion.condition}
<foreach
close=
")"
collection=
"criterion.value"
item=
"listItem"
open=
"("
separator=
","
>
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql
id=
"Update_By_Example_Where_Clause"
>
<where>
<foreach
collection=
"example.oredCriteria"
item=
"criteria"
separator=
"or"
>
<if
test=
"criteria.valid"
>
<trim
prefix=
"("
prefixOverrides=
"and"
suffix=
")"
>
<foreach
collection=
"criteria.criteria"
item=
"criterion"
>
<choose>
<when
test=
"criterion.noValue"
>
and ${criterion.condition}
</when>
<when
test=
"criterion.singleValue"
>
and ${criterion.condition} #{criterion.value}
</when>
<when
test=
"criterion.betweenValue"
>
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when
test=
"criterion.listValue"
>
and ${criterion.condition}
<foreach
close=
")"
collection=
"criterion.value"
item=
"listItem"
open=
"("
separator=
","
>
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql
id=
"Base_Column_List"
>
id, name, parentId
</sql>
<select
id=
"selectByExample"
parameterType=
"com.bigsys.auth.project.db.model.RoleExample"
resultMap=
"BaseResultMap"
>
select
<if
test=
"distinct"
>
distinct
</if>
<include
refid=
"Base_Column_List"
/>
from bigsys_role
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
<if
test=
"orderByClause != null"
>
order by ${orderByClause}
</if>
</select>
<select
id=
"selectByPrimaryKey"
parameterType=
"java.lang.String"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from bigsys_role
where id = #{id,jdbcType=VARCHAR}
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.String"
>
delete from bigsys_role
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete
id=
"deleteByExample"
parameterType=
"com.bigsys.auth.project.db.model.RoleExample"
>
delete from bigsys_role
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
</delete>
<insert
id=
"insert"
parameterType=
"com.bigsys.auth.project.db.model.Role"
>
insert into bigsys_role (id, name, parentId
)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{parentId,jdbcType=VARCHAR}
)
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.bigsys.auth.project.db.model.Role"
>
insert into bigsys_role
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
id,
</if>
<if
test=
"name != null"
>
name,
</if>
<if
test=
"parentId != null"
>
parentId,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
#{id,jdbcType=VARCHAR},
</if>
<if
test=
"name != null"
>
#{name,jdbcType=VARCHAR},
</if>
<if
test=
"parentId != null"
>
#{parentId,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select
id=
"countByExample"
parameterType=
"com.bigsys.auth.project.db.model.RoleExample"
resultType=
"java.lang.Long"
>
select count(*) from bigsys_role
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
</select>
<update
id=
"updateByExampleSelective"
parameterType=
"map"
>
update bigsys_role
<set>
<if
test=
"record.id != null"
>
id = #{record.id,jdbcType=VARCHAR},
</if>
<if
test=
"record.name != null"
>
name = #{record.name,jdbcType=VARCHAR},
</if>
<if
test=
"record.parentId != null"
>
parentId = #{record.parentId,jdbcType=VARCHAR},
</if>
</set>
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
</update>
<update
id=
"updateByExample"
parameterType=
"map"
>
update bigsys_role
set id = #{record.id,jdbcType=VARCHAR},
name = #{record.name,jdbcType=VARCHAR},
parentId = #{record.parentId,jdbcType=VARCHAR}
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
</update>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"com.bigsys.auth.project.db.model.Role"
>
update bigsys_role
<set>
<if
test=
"name != null"
>
name = #{name,jdbcType=VARCHAR},
</if>
<if
test=
"parentId != null"
>
parentId = #{parentId,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"com.bigsys.auth.project.db.model.Role"
>
update bigsys_role
set name = #{name,jdbcType=VARCHAR},
parentId = #{parentId,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>
\ No newline at end of file
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/db/dao/RoleMenuMapper.java
0 → 100644
View file @
c82cdacc
package
com
.
bigsys
.
auth
.
project
.
db
.
dao
;
import
com.bigsys.auth.project.db.model.RoleMenu
;
import
com.bigsys.auth.project.db.model.RoleMenuExample
;
import
java.util.List
;
import
org.apache.ibatis.annotations.Param
;
public
interface
RoleMenuMapper
{
long
countByExample
(
RoleMenuExample
example
);
int
deleteByExample
(
RoleMenuExample
example
);
int
deleteByPrimaryKey
(
Integer
id
);
int
insert
(
RoleMenu
record
);
int
insertSelective
(
RoleMenu
record
);
List
<
RoleMenu
>
selectByExample
(
RoleMenuExample
example
);
RoleMenu
selectByPrimaryKey
(
Integer
id
);
int
updateByExampleSelective
(
@Param
(
"record"
)
RoleMenu
record
,
@Param
(
"example"
)
RoleMenuExample
example
);
int
updateByExample
(
@Param
(
"record"
)
RoleMenu
record
,
@Param
(
"example"
)
RoleMenuExample
example
);
int
updateByPrimaryKeySelective
(
RoleMenu
record
);
int
updateByPrimaryKey
(
RoleMenu
record
);
}
\ No newline at end of file
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/db/dao/RoleMenuMapper.xml
0 → 100644
View file @
c82cdacc
<?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=
"com.bigsys.auth.project.db.dao.RoleMenuMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.bigsys.auth.project.db.model.RoleMenu"
>
<id
column=
"id"
jdbcType=
"INTEGER"
property=
"id"
/>
<result
column=
"role"
jdbcType=
"VARCHAR"
property=
"role"
/>
<result
column=
"menu"
jdbcType=
"VARCHAR"
property=
"menu"
/>
</resultMap>
<sql
id=
"Example_Where_Clause"
>
<where>
<foreach
collection=
"oredCriteria"
item=
"criteria"
separator=
"or"
>
<if
test=
"criteria.valid"
>
<trim
prefix=
"("
prefixOverrides=
"and"
suffix=
")"
>
<foreach
collection=
"criteria.criteria"
item=
"criterion"
>
<choose>
<when
test=
"criterion.noValue"
>
and ${criterion.condition}
</when>
<when
test=
"criterion.singleValue"
>
and ${criterion.condition} #{criterion.value}
</when>
<when
test=
"criterion.betweenValue"
>
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when
test=
"criterion.listValue"
>
and ${criterion.condition}
<foreach
close=
")"
collection=
"criterion.value"
item=
"listItem"
open=
"("
separator=
","
>
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql
id=
"Update_By_Example_Where_Clause"
>
<where>
<foreach
collection=
"example.oredCriteria"
item=
"criteria"
separator=
"or"
>
<if
test=
"criteria.valid"
>
<trim
prefix=
"("
prefixOverrides=
"and"
suffix=
")"
>
<foreach
collection=
"criteria.criteria"
item=
"criterion"
>
<choose>
<when
test=
"criterion.noValue"
>
and ${criterion.condition}
</when>
<when
test=
"criterion.singleValue"
>
and ${criterion.condition} #{criterion.value}
</when>
<when
test=
"criterion.betweenValue"
>
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when
test=
"criterion.listValue"
>
and ${criterion.condition}
<foreach
close=
")"
collection=
"criterion.value"
item=
"listItem"
open=
"("
separator=
","
>
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql
id=
"Base_Column_List"
>
id, role, menu
</sql>
<select
id=
"selectByExample"
parameterType=
"com.bigsys.auth.project.db.model.RoleMenuExample"
resultMap=
"BaseResultMap"
>
select
<if
test=
"distinct"
>
distinct
</if>
<include
refid=
"Base_Column_List"
/>
from bigsys_role_menu
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
<if
test=
"orderByClause != null"
>
order by ${orderByClause}
</if>
</select>
<select
id=
"selectByPrimaryKey"
parameterType=
"java.lang.Integer"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from bigsys_role_menu
where id = #{id,jdbcType=INTEGER}
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Integer"
>
delete from bigsys_role_menu
where id = #{id,jdbcType=INTEGER}
</delete>
<delete
id=
"deleteByExample"
parameterType=
"com.bigsys.auth.project.db.model.RoleMenuExample"
>
delete from bigsys_role_menu
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
</delete>
<insert
id=
"insert"
parameterType=
"com.bigsys.auth.project.db.model.RoleMenu"
>
insert into bigsys_role_menu (id, role, menu
)
values (#{id,jdbcType=INTEGER}, #{role,jdbcType=VARCHAR}, #{menu,jdbcType=VARCHAR}
)
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.bigsys.auth.project.db.model.RoleMenu"
>
insert into bigsys_role_menu
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
id,
</if>
<if
test=
"role != null"
>
role,
</if>
<if
test=
"menu != null"
>
menu,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
#{id,jdbcType=INTEGER},
</if>
<if
test=
"role != null"
>
#{role,jdbcType=VARCHAR},
</if>
<if
test=
"menu != null"
>
#{menu,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select
id=
"countByExample"
parameterType=
"com.bigsys.auth.project.db.model.RoleMenuExample"
resultType=
"java.lang.Long"
>
select count(*) from bigsys_role_menu
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
</select>
<update
id=
"updateByExampleSelective"
parameterType=
"map"
>
update bigsys_role_menu
<set>
<if
test=
"record.id != null"
>
id = #{record.id,jdbcType=INTEGER},
</if>
<if
test=
"record.role != null"
>
role = #{record.role,jdbcType=VARCHAR},
</if>
<if
test=
"record.menu != null"
>
menu = #{record.menu,jdbcType=VARCHAR},
</if>
</set>
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
</update>
<update
id=
"updateByExample"
parameterType=
"map"
>
update bigsys_role_menu
set id = #{record.id,jdbcType=INTEGER},
role = #{record.role,jdbcType=VARCHAR},
menu = #{record.menu,jdbcType=VARCHAR}
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
</update>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"com.bigsys.auth.project.db.model.RoleMenu"
>
update bigsys_role_menu
<set>
<if
test=
"role != null"
>
role = #{role,jdbcType=VARCHAR},
</if>
<if
test=
"menu != null"
>
menu = #{menu,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"com.bigsys.auth.project.db.model.RoleMenu"
>
update bigsys_role_menu
set role = #{role,jdbcType=VARCHAR},
menu = #{menu,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
\ No newline at end of file
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/db/model/Role.java
0 → 100644
View file @
c82cdacc
package
com
.
bigsys
.
auth
.
project
.
db
.
model
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
Role
{
private
String
id
;
private
String
name
;
private
String
parentId
;
private
List
<
Role
>
roles
=
new
ArrayList
<>();
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
==
null
?
null
:
id
.
trim
();
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
==
null
?
null
:
name
.
trim
();
}
public
String
getParentId
()
{
return
parentId
;
}
public
void
setParentId
(
String
parentId
)
{
this
.
parentId
=
parentId
==
null
?
null
:
parentId
.
trim
();
}
public
List
<
Role
>
getRoles
()
{
return
roles
;
}
public
void
setRoles
(
List
<
Role
>
roles
)
{
this
.
roles
=
roles
;
}
}
\ No newline at end of file
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/db/model/RoleExample.java
0 → 100644
View file @
c82cdacc
This diff is collapsed.
Click to expand it.
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/db/model/RoleMenu.java
0 → 100644
View file @
c82cdacc
package
com
.
bigsys
.
auth
.
project
.
db
.
model
;
public
class
RoleMenu
{
private
Integer
id
;
private
String
role
;
private
String
menu
;
public
Integer
getId
()
{
return
id
;
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
public
String
getRole
()
{
return
role
;
}
public
void
setRole
(
String
role
)
{
this
.
role
=
role
==
null
?
null
:
role
.
trim
();
}
public
String
getMenu
()
{
return
menu
;
}
public
void
setMenu
(
String
menu
)
{
this
.
menu
=
menu
==
null
?
null
:
menu
.
trim
();
}
}
\ No newline at end of file
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/db/model/RoleMenuExample.java
0 → 100644
View file @
c82cdacc
This diff is collapsed.
Click to expand it.
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/model/RoleMenus.java
0 → 100644
View file @
c82cdacc
package
com
.
bigsys
.
auth
.
project
.
model
;
import
java.util.List
;
public
class
RoleMenus
{
private
String
id
;
private
List
<
String
>
links
;
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
List
<
String
>
getLinks
()
{
return
links
;
}
public
void
setLinks
(
List
<
String
>
links
)
{
this
.
links
=
links
;
}
}
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/service/RoleMenuService.java
0 → 100644
View file @
c82cdacc
package
com
.
bigsys
.
auth
.
project
.
service
;
import
com.bigsys.auth.project.db.model.RoleMenu
;
import
com.bigsys.auth.project.db.model.RoleMenuExample
;
import
com.bigsys.auth.project.model.RoleMenus
;
import
com.bigsys.auth.project.util.service.BaseService
;
import
java.util.List
;
public
interface
RoleMenuService
extends
BaseService
<
Integer
,
RoleMenu
,
RoleMenuExample
,
RoleMenuExample
.
Criteria
>
{
void
addRoleMenus
(
RoleMenus
roleMenus
);
List
<
String
>
getRoleMenus
(
String
role
);
}
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/service/RoleService.java
0 → 100644
View file @
c82cdacc
package
com
.
bigsys
.
auth
.
project
.
service
;
import
com.bigsys.auth.project.db.model.Role
;
import
com.bigsys.auth.project.db.model.RoleExample
;
import
com.bigsys.auth.project.util.service.BaseService
;
import
java.util.List
;
public
interface
RoleService
extends
BaseService
<
String
,
Role
,
RoleExample
,
RoleExample
.
Criteria
>{
/**
* 获取嵌套结构的role列表
*/
List
<
Role
>
getRoles
();
/**
* 有子角色的话一同删除
* @param id
*/
void
deleteRole
(
String
id
);
}
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/service/UserService.java
View file @
c82cdacc
...
...
@@ -11,4 +11,5 @@ public interface UserService extends BaseService<String, User, UserExample, User
PageInfo
<
User
>
page
(
User
condition
,
PageInfo
<
User
>
pager
);
User
getUser
(
String
username
);
}
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/service/impl/RoleMenuServiceImpl.java
0 → 100644
View file @
c82cdacc
package
com
.
bigsys
.
auth
.
project
.
service
.
impl
;
import
com.bigsys.auth.project.db.dao.RoleMenuMapper
;
import
com.bigsys.auth.project.db.model.RoleMenu
;
import
com.bigsys.auth.project.db.model.RoleMenuExample
;
import
com.bigsys.auth.project.model.RoleMenus
;
import
com.bigsys.auth.project.service.RoleMenuService
;
import
com.bigsys.auth.project.util.service.BaseServiceImpl
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@Service
(
"roleMenuService"
)
public
class
RoleMenuServiceImpl
extends
BaseServiceImpl
<
Integer
,
RoleMenu
,
RoleMenuExample
,
RoleMenuExample
.
Criteria
>
implements
RoleMenuService
{
@Resource
private
RoleMenuMapper
roleMenuMapper
;
@Override
public
Object
getDao
()
{
return
roleMenuMapper
;
}
@Override
public
Class
getExample
()
{
return
RoleMenuExample
.
class
;
}
@Override
public
void
addRoleMenus
(
RoleMenus
roleMenus
)
{
deleteByExample
((
a
,
b
)
->
{
b
.
andRoleEqualTo
(
roleMenus
.
getId
());
});
for
(
String
link
:
roleMenus
.
getLinks
())
{
RoleMenu
roleMenu
=
new
RoleMenu
();
roleMenu
.
setMenu
(
link
);
roleMenu
.
setRole
(
roleMenus
.
getId
());
insert
(
roleMenu
);
}
}
@Override
public
List
<
String
>
getRoleMenus
(
String
role
)
{
List
<
RoleMenu
>
roleMenus
=
selectByExample
((
a
,
b
)
->
{
b
.
andRoleEqualTo
(
role
);
});
List
<
String
>
menus
=
roleMenus
.
stream
()
.
map
(
roleMenu
->
roleMenu
.
getMenu
())
.
collect
(
Collectors
.
toList
());
return
menus
;
}
}
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/service/impl/RoleServiceImpl.java
0 → 100644
View file @
c82cdacc
package
com
.
bigsys
.
auth
.
project
.
service
.
impl
;
import
com.bigsys.auth.project.db.dao.RoleMapper
;
import
com.bigsys.auth.project.db.model.Role
;
import
com.bigsys.auth.project.db.model.RoleExample
;
import
com.bigsys.auth.project.service.RoleService
;
import
com.bigsys.auth.project.util.service.BaseServiceImpl
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@Service
(
"roleService"
)
public
class
RoleServiceImpl
extends
BaseServiceImpl
<
String
,
Role
,
RoleExample
,
RoleExample
.
Criteria
>
implements
RoleService
{
@Resource
private
RoleMapper
roleMapper
;
@Override
public
Object
getDao
()
{
return
roleMapper
;
}
@Override
public
Class
getExample
()
{
return
RoleExample
.
class
;
}
@Override
public
List
<
Role
>
getRoles
()
{
List
<
Role
>
roles
=
selectByExample
((
a
,
b
)
->
{});
Map
<
String
,
List
<
Role
>>
roleMap
=
new
HashMap
<>();
for
(
Role
role
:
roles
)
{
if
(
roleMap
.
get
(
role
.
getParentId
())
==
null
)
{
roleMap
.
put
(
role
.
getParentId
(),
new
ArrayList
<>());
}
roleMap
.
get
(
role
.
getParentId
()).
add
(
role
);
}
Role
role
=
roleMap
.
get
(
null
).
get
(
0
);
fillRole
(
role
,
roleMap
);
List
<
Role
>
roleWrapper
=
new
ArrayList
<>();
roleWrapper
.
add
(
role
);
return
roleWrapper
;
}
@Override
public
void
deleteRole
(
String
id
)
{
doDeleteRole
(
id
);
}
private
void
doDeleteRole
(
String
id
)
{
List
<
Role
>
subRoles
=
selectByExample
((
a
,
b
)
->
{
b
.
andParentIdEqualTo
(
id
);
});
deleteByPrimaryKey
(
id
);
if
(
subRoles
.
size
()
>
0
)
{
for
(
Role
subRole
:
subRoles
)
{
doDeleteRole
(
subRole
.
getId
());
}
}
}
private
void
fillRole
(
Role
role
,
Map
<
String
,
List
<
Role
>>
roleMap
)
{
if
(
roleMap
.
get
(
role
.
getId
())
==
null
)
{
//叶子节点
return
;
}
role
.
setRoles
(
roleMap
.
get
(
role
.
getId
()));
for
(
Role
subRole
:
roleMap
.
get
(
role
.
getId
()))
{
fillRole
(
subRole
,
roleMap
);
}
}
}
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/service/impl/UserServiceImpl.java
View file @
c82cdacc
...
...
@@ -12,6 +12,7 @@ import org.thymeleaf.util.StringUtils;
import
javax.annotation.Resource
;
import
java.util.Date
;
import
java.util.List
;
@Service
(
"userService"
)
public
class
UserServiceImpl
extends
BaseServiceImpl
<
String
,
User
,
UserExample
,
UserExample
.
Criteria
>
implements
UserService
{
...
...
@@ -52,6 +53,13 @@ public class UserServiceImpl extends BaseServiceImpl<String, User, UserExample,
return
pager
;
}
@Override
public
User
getUser
(
String
username
)
{
List
<
User
>
users
=
selectByExample
((
a
,
b
)
->
{
b
.
andNameLike
(
username
);
});
return
users
.
get
(
0
);
}
}
bigsys-auth/bigsys-auth-project/src/test/resources/generatorConfig.xml
View file @
c82cdacc
...
...
@@ -45,9 +45,12 @@
<columnOverride column="recordTime" javaType="String"></columnOverride>
</table> -->
<table
tableName=
"bigsys_app_info"
domainObjectName=
"AppInfo"
>
</table>
<table
tableName=
"bigsys_user"
domainObjectName=
"User"
>
<!--<table tableName="bigsys_app_info" domainObjectName="AppInfo">-->
<!--</table>-->
<!--<table tableName="bigsys_user" domainObjectName="User">-->
<!--<property name="useActualColumnNames" value="true"/>-->
<!--</table>-->
<table
tableName=
"bigsys_role_menu"
domainObjectName=
"RoleMenu"
>
<property
name=
"useActualColumnNames"
value=
"true"
/>
</table>
<!--<table tableName="sub_line" domainObjectName="SubLine">-->
...
...
bigsys-auth/bigsys-auth-project/vue/.babelrc
View file @
c82cdacc
...
...
@@ -8,7 +8,7 @@
}],
"stage-2"
],
"plugins": ["transform-runtime"],
"plugins": ["transform-runtime"
, "transform-vue-jsx"
],
"env": {
"test": {
"presets": ["env", "stage-2"],
...
...
bigsys-auth/bigsys-auth-project/vue/index.html
View file @
c82cdacc
...
...
@@ -12,6 +12,21 @@
text-decoration
:
none
;
}
</style>
<script>
Array
.
prototype
.
indexOf
=
function
(
val
)
{
for
(
var
i
=
0
;
i
<
this
.
length
;
i
++
)
{
if
(
this
[
i
]
==
val
)
return
i
}
return
-
1
}
Array
.
prototype
.
remove
=
function
(
val
)
{
var
index
=
this
.
indexOf
(
val
)
if
(
index
>
-
1
)
{
this
.
splice
(
index
,
1
)
}
}
</script>
</head>
<body>
<div
id=
"app"
></div>
...
...
bigsys-auth/bigsys-auth-project/vue/package-lock.json
View file @
c82cdacc
...
...
@@ -378,6 +378,12 @@
"integrity"
:
"sha1-nufoM3KQ2pUoggGmpX9BcDF4MN4="
,
"dev"
:
true
},
"babel-plugin-syntax-jsx"
:
{
"version"
:
"6.18.0"
,
"resolved"
:
"http://registry.npm.taobao.org/babel-plugin-syntax-jsx/download/babel-plugin-syntax-jsx-6.18.0.tgz"
,
"integrity"
:
"sha1-CvMqmm4Tyno/1QaeYtew9Y0NiUY="
,
"dev"
:
true
},
"babel-plugin-syntax-object-rest-spread"
:
{
"version"
:
"6.13.0"
,
"resolved"
:
"http://registry.npm.taobao.org/babel-plugin-syntax-object-rest-spread/download/babel-plugin-syntax-object-rest-spread-6.13.0.tgz"
,
...
...
@@ -576,6 +582,12 @@
"integrity"
:
"sha1-1fr3qleKZbvlkc9e2uBKDGcCB1g="
,
"dev"
:
true
},
"babel-plugin-transform-vue-jsx"
:
{
"version"
:
"3.5.0"
,
"resolved"
:
"http://registry.npm.taobao.org/babel-plugin-transform-vue-jsx/download/babel-plugin-transform-vue-jsx-3.5.0.tgz"
,
"integrity"
:
"sha1-axrSk1GtdTkZQDZ18L+LKkPhdnE="
,
"dev"
:
true
},
"babel-preset-env"
:
{
"version"
:
"1.6.0"
,
"resolved"
:
"http://registry.npm.taobao.org/babel-preset-env/download/babel-preset-env-1.6.0.tgz"
,
...
...
bigsys-auth/bigsys-auth-project/vue/package.json
View file @
c82cdacc
...
...
@@ -24,6 +24,9 @@
"babel-eslint"
:
"^7.1.1"
,
"babel-loader"
:
"^7.1.1"
,
"babel-plugin-transform-runtime"
:
"^6.22.0"
,
"babel-helper-vue-jsx-merge-props"
:
"^2.0.2"
,
"babel-plugin-syntax-jsx"
:
"^6.18.0"
,
"babel-plugin-transform-vue-jsx"
:
"^3.5.0"
,
"babel-preset-env"
:
"^1.3.2"
,
"babel-preset-stage-2"
:
"^6.22.0"
,
"babel-register"
:
"^6.22.0"
,
...
...
bigsys-auth/bigsys-auth-project/vue/src/mock/menus.js
View file @
c82cdacc
...
...
@@ -6,19 +6,22 @@ export default [
{
name
:
'
bb
'
,
link
:
'
/index
'
,
hasSub
:
false
hasSub
:
false
,
menus
:
[]
}
]
},
{
name
:
'
aa
'
,
link
:
'
/
'
,
hasSub
:
false
hasSub
:
false
,
menus
:
[]
},
{
name
:
'
aa
'
,
link
:
'
/
'
,
hasSub
:
false
hasSub
:
false
,
menus
:
[]
},
{
name
:
'
系统管理
'
,
...
...
@@ -28,17 +31,14 @@ export default [
{
name
:
'
角色管理
'
,
link
:
'
/sys/role
'
,
hasSub
:
false
},
{
name
:
'
权限管理
'
,
link
:
'
/sys/auth
'
,
hasSub
:
false
hasSub
:
false
,
menus
:
[]
},
{
name
:
'
用户管理
'
,
link
:
'
/sys/user
'
,
hasSub
:
false
hasSub
:
false
,
menus
:
[]
}
]
}
...
...
bigsys-auth/bigsys-auth-project/vue/src/router/index.js
View file @
c82cdacc
...
...
@@ -9,6 +9,7 @@ import Layout from '../views/layout/Layout'
import
Login
from
'
../views/Login
'
import
MyTable
from
'
../views/components/MyTable
'
import
user
from
'
../views/pages/user
'
import
role
from
'
../views/pages/role
'
import
error404
from
'
../views/pages/404
'
/**
...
...
@@ -20,14 +21,6 @@ import error404 from '../views/pages/404'
**/
export
const
constantRouterMap
=
[
{
path
:
'
/sys
'
,
component
:
Layout
,
name
:
'
权限管理
'
,
redirect
:
'
/404
'
,
children
:
[
{
path
:
'
auth
'
,
component
:
MyTable
,
name
:
'
主页1
'
}
]
},
{
path
:
'
/sys
'
,
component
:
Layout
,
redirect
:
'
/404
'
,
...
...
@@ -49,7 +42,7 @@ export const constantRouterMap = [
redirect
:
'
/404
'
,
name
:
'
角色
'
,
children
:
[
{
path
:
'
role
'
,
component
:
MyTab
le
,
name
:
'
主页3
'
}
{
path
:
'
role
'
,
component
:
ro
le
,
name
:
'
主页3
'
}
]
},
{
path
:
'
/404
'
,
...
...
bigsys-auth/bigsys-auth-project/vue/src/store/getter.js
View file @
c82cdacc
const
getters
=
{
menus
:
state
=>
state
.
sidebar
.
menus
,
users
:
state
=>
state
.
users
.
users
menus
:
state
=>
state
.
menus
,
users
:
state
=>
state
.
users
}
export
default
getters
bigsys-auth/bigsys-auth-project/vue/src/store/index.js
View file @
c82cdacc
import
Vue
from
'
vue
'
import
Vuex
from
'
vuex
'
import
sidebar
from
'
./modules/sidebar
'
import
users
from
'
./modules/users
'
import
getters
from
'
./getter
'
import
loginStore
from
'
./modules/login
'
import
loginapi
from
'
../api/login
'
import
fullmenus
from
'
../mock/menus
'
import
{
inittdata
}
from
'
../mock/table
'
import
userapi
from
'
../api/user
'
Vue
.
use
(
Vuex
)
const
store
=
new
Vuex
.
Store
({
modules
:
{
sidebar
,
users
,
loginStore
state
:
{
isLogin
:
window
.
sessionStorage
.
getItem
(
'
isLogin
'
),
menus
:
[],
users
:
inittdata
,
username
:
''
,
role
:
''
,
token
:
''
},
mutations
:
{
LOGIN
(
state
,
data
)
{
this
.
isLogin
=
true
state
.
username
=
data
.
data
.
name
window
.
sessionStorage
.
setItem
(
'
username
'
,
data
.
data
.
name
)
},
SET_MENUS
(
state
,
data
)
{
state
.
menus
=
data
},
ADD_USER
(
state
,
data
)
{
state
.
users
.
push
(
data
)
}
},
actions
:
{
GET_MENUS
({
commit
})
{
return
new
Promise
((
resolve
,
reject
)
=>
{
commit
(
'
SET_MENUS
'
,
fullmenus
)
resolve
()
})
},
LOGIN
({
commit
},
data
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
loginapi
.
login
(
data
).
then
((
response
)
=>
{
commit
(
'
LOGIN
'
,
response
.
data
)
resolve
()
}).
catch
((
error
)
=>
{
reject
(
error
)
})
})
},
ADD_USER
({
commit
},
data
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
userapi
.
addUser
(
data
).
then
(
function
(
response
)
{
resolve
(
response
)
}).
catch
(
function
(
error
)
{
reject
(
error
)
})
})
},
GET_USER_PAGE
({
commit
},
data
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
userapi
.
page
(
data
).
then
(
function
(
response
)
{
resolve
(
response
.
data
)
}).
catch
(
function
(
error
)
{
reject
(
error
)
})
})
},
DELETE_USER
({
commit
},
id
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
userapi
.
delete
(
id
).
then
((
response
)
=>
{
resolve
(
response
.
data
)
}).
catch
((
error
)
=>
{
reject
(
error
)
})
})
}
},
getters
})
...
...
bigsys-auth/bigsys-auth-project/vue/src/store/modules/login.js
deleted
100644 → 0
View file @
1da63fd5
import
loginapi
from
'
../../api/login
'
const
loginStore
=
{
state
:
{
isLogin
:
false
},
mutations
:
{
LOGIN
(
state
,
data
)
{
this
.
isLogin
=
true
}
},
actions
:
{
LOGIN
({
commit
},
data
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
loginapi
.
login
(
data
).
then
((
response
)
=>
{
commit
(
'
LOGIN
'
,
response
.
data
)
resolve
()
}).
catch
((
error
)
=>
{
reject
(
error
)
})
})
}
}
}
export
default
loginStore
bigsys-auth/bigsys-auth-project/vue/src/store/modules/sidebar.js
deleted
100644 → 0
View file @
1da63fd5
import
{
getMenus
}
from
'
../../api/Sidebar
'
const
sidebar
=
{
state
:
{
menus
:
[]
},
mutations
:
{
SET_MENUS
(
state
,
data
)
{
state
.
menus
=
data
}
},
actions
:
{
GET_MENUS
({
commit
})
{
getMenus
().
then
((
res
)
=>
{
commit
(
'
SET_MENUS
'
,
res
)
})
},
TEST
({
commit
},
data
)
{
debugger
console
.
log
(
data
)
return
new
Promise
(
function
(
resolve
,
reject
)
{
// resolve()
reject
()
})
}
}
}
export
default
sidebar
bigsys-auth/bigsys-auth-project/vue/src/store/modules/users.js
deleted
100644 → 0
View file @
1da63fd5
import
{
inittdata
}
from
'
../../mock/table
'
import
userapi
from
'
../../api/user
'
const
sidebar
=
{
state
:
{
users
:
inittdata
},
mutations
:
{
ADD_USER
(
state
,
data
)
{
state
.
users
.
push
(
data
)
}
},
actions
:
{
ADD_USER
({
commit
},
data
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
userapi
.
addUser
(
data
).
then
(
function
(
response
)
{
resolve
(
response
)
}).
catch
(
function
(
error
)
{
reject
(
error
)
})
})
},
GET_USER_PAGE
({
commit
},
data
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
userapi
.
page
(
data
).
then
(
function
(
response
)
{
resolve
(
response
.
data
)
}).
catch
(
function
(
error
)
{
reject
(
error
)
})
})
},
DELETE_USER
({
commit
},
id
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
userapi
.
delete
(
id
).
then
((
response
)
=>
{
resolve
(
response
.
data
)
}).
catch
((
error
)
=>
{
reject
(
error
)
})
})
}
}
}
export
default
sidebar
bigsys-auth/bigsys-auth-project/vue/src/views/Login.vue
View file @
c82cdacc
...
...
@@ -13,7 +13,6 @@
</el-form-item>
<el-button
type=
"primary"
style=
"width:100%;margin-bottom:30px;"
:loading=
"loading"
@
click.native.prevent=
"handleLogin"
>
登录
</el-button>
<div
class=
'tips'
>
账号:admin 密码随便填
</div>
<div
class=
'tips'
>
账号:editor 密码随便填
</div>
...
...
@@ -59,7 +58,11 @@
this
.
loading
=
true
this
.
$store
.
dispatch
(
'
LOGIN
'
,
this
.
loginForm
).
then
(()
=>
{
this
.
loading
=
false
this
.
$router
.
push
({
path
:
'
/sys/user
'
})
this
.
$store
.
dispatch
(
'
GET_MENUS
'
).
then
(()
=>
{
this
.
$router
.
push
({
path
:
'
/sys/user
'
})
}).
catch
((
error
)
=>
{
console
.
log
(
error
)
})
// this.showDialog = true
}).
catch
(()
=>
{
this
.
loading
=
false
...
...
bigsys-auth/bigsys-auth-project/vue/src/views/layout/Navbar.vue
View file @
c82cdacc
<
template
>
<el-menu
:default-active=
"activeIndex2"
class=
"el-menu-demo navbar"
style=
"position: fixed; left: 180px; right: 0px; z-index: 10000;"
mode=
"horizontal"
@
select=
"handleSelect"
>
<el-submenu
index=
"1"
style=
"float: right;"
>
<template
slot=
"title"
>
方志鹏
</
template
>
<template
slot=
"title"
>
{{
username
}}
</
template
>
<router-link
to=
"/login"
><el-menu-item
index=
"2-1"
>
退出
</el-menu-item></router-link>
<el-menu-item
index=
"2-2"
@
click=
"editPwd"
>
修改密码
</el-menu-item>
</el-submenu>
...
...
@@ -16,6 +16,11 @@
activeIndex2
:
'
1
'
}
},
computed
:
{
username
()
{
return
window
.
sessionStorage
.
getItem
(
'
username
'
)
}
},
methods
:
{
handleSelect
(
key
,
keyPath
)
{
console
.
log
(
key
,
keyPath
)
...
...
bigsys-auth/bigsys-auth-project/vue/src/views/pages/role.vue
0 → 100644
View file @
c82cdacc
<
template
>
<div>
<el-tree
:data=
"data2"
:props=
"defaultProps"
show-checkbox
node-key=
"id"
ref=
"role"
default-expand-all
:expand-on-click-node=
"false"
:render-content=
"renderContent"
>
</el-tree>
<el-button
@
click=
"getCheckedNodes"
>
测试
</el-button>
<el-dialog
title=
"编辑角色访问权限"
:visible.sync=
"dialogVisible"
size=
"tiny"
:before-close=
"handleClose"
>
<el-tree
:data=
"data3"
:props=
"menuProps"
show-checkbox
node-key=
"id"
ref=
"menu"
default-expand-all
:expand-on-click-node=
"false"
>
</el-tree>
<span
slot=
"footer"
class=
"dialog-footer"
>
<el-button
@
click=
"dialogVisible = false"
>
取 消
</el-button>
<el-button
type=
"primary"
@
click=
"addMenus()"
>
确 定
</el-button>
</span>
</el-dialog>
<el-dialog
title=
"新增角色"
:visible.sync=
"newChildDialog"
size=
"tiny"
:before-close=
"handleClose"
>
<el-input
placeholder=
"请输入Id"
v-model=
"newChild.id"
>
<template
slot=
"prepend"
>
Id
</
template
>
</el-input>
<el-input
placeholder=
"请输入名称"
@
keyup.enter.native=
"addNewChild()"
v-model=
"newChild.name"
>
<
template
slot=
"prepend"
>
名称
</
template
>
</el-input>
<span
slot=
"footer"
class=
"dialog-footer"
>
<el-button
@
click=
"newChildDialog = false"
>
取 消
</el-button>
<el-button
type=
"primary"
@
click=
"addNewChild()"
>
确 定
</el-button>
</span>
</el-dialog>
</div>
</template>
<
script
>
import
ElButton
from
'
element-ui/packages/button/index
'
import
ElInput
from
'
../../../node_modules/element-ui/packages/input/src/input
'
import
menus
from
'
../../mock/menus
'
import
axios
from
'
axios
'
let
id
=
1000
export
default
{
components
:
{
ElButton
,
ElInput
},
data
()
{
return
{
data2
:
[],
data3
:
menus
,
defaultProps
:
{
children
:
'
roles
'
,
label
:
'
name
'
},
menuProps
:
{
children
:
'
menus
'
,
label
:
'
name
'
},
dialogVisible
:
false
,
newChildDialog
:
false
,
curStore
:
{},
curData
:
{},
newChild
:
{
name
:
''
},
checked
:
false
}
},
created
()
{
axios
.
get
(
'
/api/role/getRole
'
).
then
((
response
)
=>
{
this
.
data2
=
response
.
data
.
data
})
var
addId
=
(
menus
)
=>
{
menus
.
forEach
((
menu
)
=>
{
menu
.
id
=
id
++
if
(
menu
.
hasSub
)
{
addId
(
menu
.
menus
)
}
})
}
},
methods
:
{
getCheckedNodes
()
{
console
.
log
(
this
.
$refs
.
role
.
getCheckedNodes
())
},
getCheckedKeys
()
{
console
.
log
(
this
.
$refs
.
role
.
getCheckedKeys
())
},
append
(
store
,
data
)
{
store
.
append
({
id
:
id
++
,
label
:
'
testtest
'
,
children
:
[]},
data
)
},
addMenus
()
{
console
.
log
(
this
.
$refs
.
menu
.
getCheckedNodes
())
var
data
=
this
.
$refs
.
menu
.
getCheckedNodes
()
var
params
=
{}
params
.
links
=
[]
params
.
id
=
this
.
curData
.
id
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
if
(
!
data
[
i
].
hasSub
)
{
params
.
links
.
push
(
data
[
i
].
link
)
}
}
axios
.
post
(
'
/api/role/addRoleMenus
'
,
params
).
then
((
response
)
=>
{
this
.
dialogVisible
=
false
})
},
remove
(
store
,
data
)
{
if
(
data
.
label
===
'
admin
'
)
{
alert
(
'
根管理员禁止删除!
'
)
return
}
axios
.
get
(
'
/api/role/deleteRole?id=
'
+
data
.
id
).
then
((
response
)
=>
{
store
.
remove
(
data
)
})
},
handleClose
()
{
console
.
log
(
'
窗口关闭了
'
)
this
.
dialogVisible
=
false
},
addNewChild
()
{
var
data
=
{}
data
.
name
=
this
.
newChild
.
name
data
.
roles
=
[]
data
.
id
=
this
.
newChild
.
id
data
.
parentId
=
this
.
curData
.
id
axios
.
post
(
'
/api/role/addRole
'
,
data
).
then
((
response
)
=>
{
this
.
curStore
.
append
(
data
,
this
.
curData
)
this
.
newChildDialog
=
false
})
},
renderContent
(
createElement
,
{
node
,
data
,
store
})
{
var
that
=
this
return
createElement
(
'
span
'
,
[
createElement
(
'
span
'
,
{
domProps
:
{
innerHTML
:
node
.
label
+
'
'
}}),
createElement
(
ElButton
,
{
props
:
{
size
:
'
mini
'
,
type
:
'
success
'
},
on
:
{
click
()
{
if
(
data
.
id
===
'
admin
'
)
{
alert
(
'
不能编辑根管理员角色!
'
)
return
}
that
.
curData
=
data
if
(
data
.
parentId
===
'
admin
'
)
{
that
.
data3
=
menus
that
.
dialogVisible
=
true
return
}
var
roleMenus
=
axios
.
get
(
'
/api/role/getRoleMenus?role=
'
+
data
.
parentId
)
var
authedMenus
=
axios
.
get
(
'
/api/role/getRoleMenus?role=
'
+
data
.
id
)
axios
.
all
([
roleMenus
,
authedMenus
]).
then
((
response
)
=>
{
var
hit
=
(
resmenu
,
link
)
=>
{
for
(
let
i
=
0
;
i
<
resmenu
.
length
;
i
++
)
{
if
(
link
===
resmenu
[
i
])
{
return
true
}
}
return
false
}
var
solveMenu
=
(
copymenu
,
menus
,
resmenu
)
=>
{
menus
.
forEach
((
menu
)
=>
{
var
newmenu
=
{}
newmenu
.
id
=
id
++
newmenu
.
link
=
menu
.
link
newmenu
.
name
=
menu
.
name
newmenu
.
hasSub
=
menu
.
hasSub
if
(
!
menu
.
hasSub
&&
hit
(
resmenu
,
menu
.
link
))
{
copymenu
.
push
(
newmenu
)
}
else
if
(
menu
.
hasSub
)
{
newmenu
.
menus
=
[]
solveMenu
(
newmenu
.
menus
,
menu
.
menus
,
resmenu
)
if
(
newmenu
.
menus
.
length
>
0
)
{
copymenu
.
push
(
newmenu
)
}
}
})
}
var
solveCheckedMenu
=
(
copymenu
,
ids
,
checkedMenu
)
=>
{
console
.
log
(
copymenu
)
copymenu
.
forEach
((
menu
)
=>
{
if
(
!
menu
.
hasSub
&&
hit
(
checkedMenu
,
menu
.
link
))
{
ids
.
push
(
menu
.
id
)
}
else
if
(
menu
.
hasSub
)
{
solveCheckedMenu
(
menu
.
menus
,
ids
,
checkedMenu
)
}
})
}
var
resmenu
=
response
[
0
].
data
.
data
if
(
data
.
parentId
===
'
admin
'
)
{
resmenu
=
menus
}
var
copymenu
=
[]
solveMenu
(
copymenu
,
menus
,
resmenu
)
that
.
data3
=
copymenu
var
ids
=
[]
var
checkedMenu
=
response
[
1
].
data
.
data
solveCheckedMenu
(
copymenu
,
ids
,
checkedMenu
)
that
.
dialogVisible
=
true
setTimeout
(()
=>
{
that
.
$refs
.
menu
.
setCheckedKeys
(
ids
)
})
})
}
}
},
[
'
编辑角色
'
]
),
createElement
(
'
span
'
,
{
domProps
:
{
innerHTML
:
'
'
}}),
createElement
(
ElButton
,
{
props
:
{
size
:
'
mini
'
,
type
:
'
info
'
},
on
:
{
click
()
{
that
.
curStore
=
store
that
.
curData
=
data
that
.
newChildDialog
=
true
}
}
},
[
'
添加角色
'
]),
createElement
(
'
span
'
,
{
domProps
:
{
innerHTML
:
'
'
}}),
createElement
(
ElButton
,
{
props
:
{
size
:
'
mini
'
,
type
:
'
danger
'
},
on
:
{
click
()
{
if
(
data
.
id
===
'
admin
'
)
{
alert
(
'
不能删除根管理员!
'
)
return
}
that
.
remove
(
store
,
data
)
}
}
},
[
'
删除角色
'
])
])
}
}
}
</
script
>
bigsys-auth/bigsys-auth-project/vue/src/views/pages/user.vue
View file @
c82cdacc
...
...
@@ -54,17 +54,47 @@
<el-form
:label-position=
"labelPosition"
label-width=
"80px"
:model=
"formLabelAlign"
>
<el-input
v-model=
"formLabelAlign.id"
type=
"hidden"
></el-input>
<el-form-item
label=
"用户名"
>
<el-input
v-model=
"formLabelAlign.username"
></el-input>
</el-form-item>
<el-form-item
label=
"昵称"
>
<el-input
v-model=
"formLabelAlign.name"
></el-input>
</el-form-item>
<el-form-item
label=
"电话"
>
<el-input
v-model=
"formLabelAlign.phone"
@
keyup.enter.native=
"saveUser"
></el-input>
</el-form-item>
<el-form-item
label=
"角色"
>
<el-select
v-model=
"formLabelAlign.roleId"
@
click.native=
"selectRole"
multiple
placeholder=
"请选择"
>
<el-option
style=
"display: none"
v-for=
"item in options"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
>
</el-option>
</el-select>
</el-form-item>
</el-form>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
@
click=
"dialogFormVisible = false"
>
取 消
</el-button>
<el-button
type=
"primary"
@
click=
"saveUser()"
>
确 定
</el-button>
</div>
</el-dialog>
<el-dialog
title=
"选择角色"
:visible.sync=
"dialogRoleVisible"
>
<el-tree
:data=
"role"
:props=
"roleProps"
show-checkbox
:check-strictly=
"true"
@
check-change=
"addRole"
node-key=
"id"
ref=
"role"
default-expand-all
:expand-on-click-node=
"false"
>
</el-tree>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
@
click=
"dialogRoleVisible = false"
>
取 消
</el-button>
<el-button
type=
"primary"
@
click=
"saveUser()"
>
确 定
</el-button>
</div>
</el-dialog>
</div>
</template>
...
...
@@ -79,12 +109,24 @@
</
style
>
<
script
>
import
ElButton
from
'
../../../node_modules/element-ui/packages/button/src/button
'
import
axios
from
'
axios
'
import
ElFormItem
from
'
../../../node_modules/element-ui/packages/form/src/form-item
'
export
default
{
components
:
{
ElFormItem
,
ElButton
},
created
()
{
this
.
initData
()
},
computed
:
{
lineRole
()
{
return
this
.
formLabelAlign
.
role
}
},
data
()
{
return
{
options
:
[],
pageNum
:
1
,
pageSize
:
10
,
total
:
0
,
...
...
@@ -93,15 +135,53 @@
phone
:
''
,
title
:
'
新增用户
'
,
dialogFormVisible
:
false
,
dialogRoleVisible
:
false
,
labelPosition
:
'
right
'
,
roleProps
:
{
label
:
'
name
'
,
children
:
'
roles
'
},
role
:
[],
formLabelAlign
:
{
id
:
''
,
username
:
''
,
name
:
''
,
phone
:
''
phone
:
''
,
roleId
:
[]
}
}
},
methods
:
{
addRole
(
data
,
isCheck
,
subDatas
)
{
console
.
log
(
subDatas
)
// checkParentIsCheck(data)
// checkChildrenIsCheck(data)
if
(
isCheck
)
{
this
.
formLabelAlign
.
roleId
.
push
(
data
.
id
)
}
else
{
this
.
formLabelAlign
.
roleId
.
remove
(
data
.
id
)
}
},
selectRole
()
{
axios
.
get
(
'
/api/role/getRole
'
).
then
((
response
)
=>
{
this
.
role
=
response
.
data
.
data
this
.
options
=
[]
var
addOptions
=
(
role
)
=>
{
role
.
forEach
((
item
)
=>
{
this
.
options
.
push
({
label
:
item
.
name
,
value
:
item
.
id
})
if
(
item
.
roles
.
length
>
0
)
{
addOptions
(
item
.
roles
)
}
})
}
addOptions
(
this
.
role
)
console
.
log
(
this
.
options
)
this
.
dialogRoleVisible
=
true
setTimeout
(()
=>
{
this
.
$refs
.
role
.
setCheckedKeys
(
this
.
formLabelAlign
.
roleId
)
})
})
},
initData
()
{
console
.
log
(
'
初始化数据中。。。
'
)
this
.
pageNum
=
1
...
...
@@ -130,15 +210,19 @@
addUser
()
{
this
.
title
=
'
新增用户
'
this
.
formLabelAlign
.
id
=
''
this
.
formLabelAlign
.
username
=
''
this
.
formLabelAlign
.
name
=
''
this
.
formLabelAlign
.
phone
=
''
this
.
formLabelAlign
.
roleId
=
[]
this
.
dialogFormVisible
=
true
},
modifyUser
:
function
(
user
)
{
this
.
title
=
'
修改用户
'
this
.
formLabelAlign
.
id
=
user
.
id
this
.
formLabelAlign
.
username
=
user
.
username
this
.
formLabelAlign
.
name
=
user
.
name
this
.
formLabelAlign
.
phone
=
user
.
phone
this
.
formLabelAlign
.
roleId
=
user
.
roleId
this
.
dialogFormVisible
=
true
},
deleteUser
(
id
)
{
...
...
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