Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
guns-vip
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
chenjunxiong
guns-vip
Commits
cafc08ae
Commit
cafc08ae
authored
Feb 22, 2018
by
stylefeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
合并dao
parent
a35329e0
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
495 additions
and
613 deletions
+495
-613
guns-admin/src/main/java/com/stylefeng/guns/core/shiro/factory/ShiroFactroy.java
+7
-7
guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/BlackboardController.java
+4
-4
guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/LoginController.java
+6
-6
guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/MenuController.java
+10
-14
guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/NoticeController.java
+5
-9
guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/RoleController.java
+11
-15
guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/UserMgrController.java
+12
-16
guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/MenuDao.java
+0
-78
guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/MenuMapper.java
+65
-0
guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/NoticeDao.java
+0
-17
guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/NoticeMapper.java
+11
-1
guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/RoleDao.java
+0
-51
guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/RoleMapper.java
+38
-0
guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/UserMapper.java
+31
-1
guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/UserMgrDao.java
+0
-59
guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/MenuDao.xml
+0
-163
guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/MenuMapper.xml
+155
-0
guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/NoticeDao.xml
+0
-14
guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/NoticeMapper.xml
+17
-9
guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/RoleDao.xml
+0
-71
guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/RoleMapper.xml
+63
-0
guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/UserMapper.xml
+53
-0
guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/UserMgrDao.xml
+0
-59
guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/MenuServiceImpl.java
+1
-5
guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/RoleServiceImpl.java
+3
-7
guns-admin/src/test/java/com/stylefeng/guns/system/BlackBoardTest.java
+3
-3
guns-admin/src/test/java/com/stylefeng/guns/system/UserTest.java
+0
-4
No files found.
guns-admin/src/main/java/com/stylefeng/guns/core/shiro/factory/ShiroFactroy.java
View file @
cafc08ae
...
...
@@ -2,12 +2,12 @@ package com.stylefeng.guns.core.shiro.factory;
import
com.stylefeng.guns.core.common.constant.factory.ConstantFactory
;
import
com.stylefeng.guns.core.common.constant.state.ManagerStatus
;
import
com.stylefeng.guns.modular.system.model.User
;
import
com.stylefeng.guns.core.shiro.ShiroUser
;
import
com.stylefeng.guns.core.util.Convert
;
import
com.stylefeng.guns.core.util.SpringContextHolder
;
import
com.stylefeng.guns.modular.system.dao.MenuDao
;
import
com.stylefeng.guns.modular.system.dao.UserMgrDao
;
import
com.stylefeng.guns.modular.system.dao.MenuMapper
;
import
com.stylefeng.guns.modular.system.dao.UserMapper
;
import
com.stylefeng.guns.modular.system.model.User
;
import
org.apache.shiro.authc.CredentialsException
;
import
org.apache.shiro.authc.LockedAccountException
;
import
org.apache.shiro.authc.SimpleAuthenticationInfo
;
...
...
@@ -27,10 +27,10 @@ import java.util.List;
public
class
ShiroFactroy
implements
IShiro
{
@Autowired
private
UserM
grDao
userMgrDao
;
private
UserM
apper
userMapper
;
@Autowired
private
Menu
Dao
menuDao
;
private
Menu
Mapper
menuMapper
;
public
static
IShiro
me
()
{
return
SpringContextHolder
.
getBean
(
IShiro
.
class
);
...
...
@@ -39,7 +39,7 @@ public class ShiroFactroy implements IShiro {
@Override
public
User
user
(
String
account
)
{
User
user
=
userM
grDao
.
getByAccount
(
account
);
User
user
=
userM
apper
.
getByAccount
(
account
);
// 账号不存在
if
(
null
==
user
)
{
...
...
@@ -77,7 +77,7 @@ public class ShiroFactroy implements IShiro {
@Override
public
List
<
String
>
findPermissionsByRoleId
(
Integer
roleId
)
{
return
menu
Dao
.
getResUrlsByRoleId
(
roleId
);
return
menu
Mapper
.
getResUrlsByRoleId
(
roleId
);
}
@Override
...
...
guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/BlackboardController.java
View file @
cafc08ae
package
com
.
stylefeng
.
guns
.
modular
.
system
.
controller
;
import
com.stylefeng.guns.core.base.controller.BaseController
;
import
com.stylefeng.guns.modular.system.dao.Notice
Dao
;
import
com.stylefeng.guns.modular.system.dao.Notice
Mapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
...
...
@@ -21,15 +21,15 @@ import java.util.Map;
public
class
BlackboardController
extends
BaseController
{
@Autowired
Notice
Dao
noticeDao
;
Notice
Mapper
noticeMapper
;
/**
* 跳转到黑板
*/
@RequestMapping
(
""
)
public
String
blackboard
(
Model
model
)
{
List
<
Map
<
String
,
Object
>>
notices
=
notice
Dao
.
list
(
null
);
model
.
addAttribute
(
"noticeList"
,
notices
);
List
<
Map
<
String
,
Object
>>
notices
=
notice
Mapper
.
list
(
null
);
model
.
addAttribute
(
"noticeList"
,
notices
);
return
"/blackboard.html"
;
}
}
guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/LoginController.java
View file @
cafc08ae
package
com
.
stylefeng
.
guns
.
modular
.
system
.
controller
;
import
com.google.code.kaptcha.Constants
;
import
com.stylefeng.guns.core.common.exception.InvalidKaptchaException
;
import
com.stylefeng.guns.modular.system.dao.UserMapper
;
import
com.stylefeng.guns.modular.system.model.User
;
import
com.stylefeng.guns.core.base.controller.BaseController
;
import
com.stylefeng.guns.core.common.exception.InvalidKaptchaException
;
import
com.stylefeng.guns.core.log.LogManager
;
import
com.stylefeng.guns.core.log.factory.LogTaskFactory
;
import
com.stylefeng.guns.core.node.MenuNode
;
...
...
@@ -13,7 +11,9 @@ import com.stylefeng.guns.core.shiro.ShiroUser;
import
com.stylefeng.guns.core.util.ApiMenuFilter
;
import
com.stylefeng.guns.core.util.KaptchaUtil
;
import
com.stylefeng.guns.core.util.ToolUtil
;
import
com.stylefeng.guns.modular.system.dao.MenuDao
;
import
com.stylefeng.guns.modular.system.dao.MenuMapper
;
import
com.stylefeng.guns.modular.system.dao.UserMapper
;
import
com.stylefeng.guns.modular.system.model.User
;
import
org.apache.shiro.authc.UsernamePasswordToken
;
import
org.apache.shiro.subject.Subject
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -36,7 +36,7 @@ import static com.stylefeng.guns.core.support.HttpKit.getIp;
public
class
LoginController
extends
BaseController
{
@Autowired
Menu
Dao
menuDao
;
Menu
Mapper
menuMapper
;
@Autowired
UserMapper
userMapper
;
...
...
@@ -53,7 +53,7 @@ public class LoginController extends BaseController {
model
.
addAttribute
(
"tips"
,
"该用户没有角色,无法登陆"
);
return
"/login.html"
;
}
List
<
MenuNode
>
menus
=
menu
Dao
.
getMenusByRoleIds
(
roleList
);
List
<
MenuNode
>
menus
=
menu
Mapper
.
getMenusByRoleIds
(
roleList
);
List
<
MenuNode
>
titles
=
MenuNode
.
buildTitle
(
menus
);
titles
=
ApiMenuFilter
.
build
(
titles
);
...
...
guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/MenuController.java
View file @
cafc08ae
package
com
.
stylefeng
.
guns
.
modular
.
system
.
controller
;
import
com.stylefeng.guns.core.base.controller.BaseController
;
import
com.stylefeng.guns.core.base.tips.Tip
;
import
com.stylefeng.guns.core.common.annotion.BussinessLog
;
import
com.stylefeng.guns.core.common.annotion.Permission
;
import
com.stylefeng.guns.core.common.constant.Const
;
...
...
@@ -7,16 +9,13 @@ import com.stylefeng.guns.core.common.constant.dictmap.MenuDict;
import
com.stylefeng.guns.core.common.constant.factory.ConstantFactory
;
import
com.stylefeng.guns.core.common.constant.state.MenuStatus
;
import
com.stylefeng.guns.core.common.exception.BizExceptionEnum
;
import
com.stylefeng.guns.modular.system.dao.MenuMapper
;
import
com.stylefeng.guns.modular.system.model.Menu
;
import
com.stylefeng.guns.core.base.controller.BaseController
;
import
com.stylefeng.guns.core.base.tips.Tip
;
import
com.stylefeng.guns.core.exception.GunsException
;
import
com.stylefeng.guns.core.log.LogObjectHolder
;
import
com.stylefeng.guns.core.node.ZTreeNode
;
import
com.stylefeng.guns.core.support.BeanKit
;
import
com.stylefeng.guns.core.util.ToolUtil
;
import
com.stylefeng.guns.modular.system.dao.MenuDao
;
import
com.stylefeng.guns.modular.system.dao.MenuMapper
;
import
com.stylefeng.guns.modular.system.model.Menu
;
import
com.stylefeng.guns.modular.system.service.IMenuService
;
import
com.stylefeng.guns.modular.system.warpper.MenuWarpper
;
import
org.springframework.stereotype.Controller
;
...
...
@@ -48,9 +47,6 @@ public class MenuController extends BaseController {
MenuMapper
menuMapper
;
@Resource
MenuDao
menuDao
;
@Resource
IMenuService
menuService
;
/**
...
...
@@ -125,7 +121,7 @@ public class MenuController extends BaseController {
@RequestMapping
(
value
=
"/list"
)
@ResponseBody
public
Object
list
(
@RequestParam
(
required
=
false
)
String
menuName
,
@RequestParam
(
required
=
false
)
String
level
)
{
List
<
Map
<
String
,
Object
>>
menus
=
this
.
menu
Dao
.
selectMenus
(
menuName
,
level
);
List
<
Map
<
String
,
Object
>>
menus
=
this
.
menu
Mapper
.
selectMenus
(
menuName
,
level
);
return
super
.
warpObject
(
new
MenuWarpper
(
menus
));
}
...
...
@@ -193,7 +189,7 @@ public class MenuController extends BaseController {
@RequestMapping
(
value
=
"/menuTreeList"
)
@ResponseBody
public
List
<
ZTreeNode
>
menuTreeList
()
{
List
<
ZTreeNode
>
roleTreeList
=
this
.
menu
Dao
.
menuTreeList
();
List
<
ZTreeNode
>
roleTreeList
=
this
.
menu
Mapper
.
menuTreeList
();
return
roleTreeList
;
}
...
...
@@ -203,7 +199,7 @@ public class MenuController extends BaseController {
@RequestMapping
(
value
=
"/selectMenuTreeList"
)
@ResponseBody
public
List
<
ZTreeNode
>
selectMenuTreeList
()
{
List
<
ZTreeNode
>
roleTreeList
=
this
.
menu
Dao
.
menuTreeList
();
List
<
ZTreeNode
>
roleTreeList
=
this
.
menu
Mapper
.
menuTreeList
();
roleTreeList
.
add
(
ZTreeNode
.
createParent
());
return
roleTreeList
;
}
...
...
@@ -214,12 +210,12 @@ public class MenuController extends BaseController {
@RequestMapping
(
value
=
"/menuTreeListByRoleId/{roleId}"
)
@ResponseBody
public
List
<
ZTreeNode
>
menuTreeListByRoleId
(
@PathVariable
Integer
roleId
)
{
List
<
Long
>
menuIds
=
this
.
menu
Dao
.
getMenuIdsByRoleId
(
roleId
);
List
<
Long
>
menuIds
=
this
.
menu
Mapper
.
getMenuIdsByRoleId
(
roleId
);
if
(
ToolUtil
.
isEmpty
(
menuIds
))
{
List
<
ZTreeNode
>
roleTreeList
=
this
.
menu
Dao
.
menuTreeList
();
List
<
ZTreeNode
>
roleTreeList
=
this
.
menu
Mapper
.
menuTreeList
();
return
roleTreeList
;
}
else
{
List
<
ZTreeNode
>
roleTreeListByUserId
=
this
.
menu
Dao
.
menuTreeListByMenuIds
(
menuIds
);
List
<
ZTreeNode
>
roleTreeListByUserId
=
this
.
menu
Mapper
.
menuTreeListByMenuIds
(
menuIds
);
return
roleTreeListByUserId
;
}
}
...
...
guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/NoticeController.java
View file @
cafc08ae
package
com
.
stylefeng
.
guns
.
modular
.
system
.
controller
;
import
com.stylefeng.guns.core.base.controller.BaseController
;
import
com.stylefeng.guns.core.common.annotion.BussinessLog
;
import
com.stylefeng.guns.core.common.constant.dictmap.NoticeMap
;
import
com.stylefeng.guns.core.common.constant.factory.ConstantFactory
;
import
com.stylefeng.guns.core.common.exception.BizExceptionEnum
;
import
com.stylefeng.guns.modular.system.dao.NoticeMapper
;
import
com.stylefeng.guns.modular.system.model.Notice
;
import
com.stylefeng.guns.core.base.controller.BaseController
;
import
com.stylefeng.guns.core.exception.GunsException
;
import
com.stylefeng.guns.core.log.LogObjectHolder
;
import
com.stylefeng.guns.core.shiro.ShiroKit
;
import
com.stylefeng.guns.core.util.ToolUtil
;
import
com.stylefeng.guns.modular.system.dao.NoticeDao
;
import
com.stylefeng.guns.modular.system.dao.NoticeMapper
;
import
com.stylefeng.guns.modular.system.model.Notice
;
import
com.stylefeng.guns.modular.system.warpper.NoticeWrapper
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
...
...
@@ -40,9 +39,6 @@ public class NoticeController extends BaseController {
@Resource
private
NoticeMapper
noticeMapper
;
@Resource
private
NoticeDao
noticeDao
;
/**
* 跳转到通知列表首页
*/
...
...
@@ -75,7 +71,7 @@ public class NoticeController extends BaseController {
*/
@RequestMapping
(
"/hello"
)
public
String
hello
()
{
List
<
Map
<
String
,
Object
>>
notices
=
notice
Dao
.
list
(
null
);
List
<
Map
<
String
,
Object
>>
notices
=
notice
Mapper
.
list
(
null
);
super
.
setAttr
(
"noticeList"
,
notices
);
return
"/blackboard.html"
;
}
...
...
@@ -86,7 +82,7 @@ public class NoticeController extends BaseController {
@RequestMapping
(
value
=
"/list"
)
@ResponseBody
public
Object
list
(
String
condition
)
{
List
<
Map
<
String
,
Object
>>
list
=
this
.
notice
Dao
.
list
(
condition
);
List
<
Map
<
String
,
Object
>>
list
=
this
.
notice
Mapper
.
list
(
condition
);
return
super
.
warpObject
(
new
NoticeWrapper
(
list
));
}
...
...
guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/RoleController.java
View file @
cafc08ae
package
com
.
stylefeng
.
guns
.
modular
.
system
.
controller
;
import
com.stylefeng.guns.core.base.controller.BaseController
;
import
com.stylefeng.guns.core.base.tips.Tip
;
import
com.stylefeng.guns.core.cache.CacheKit
;
import
com.stylefeng.guns.core.common.annotion.BussinessLog
;
import
com.stylefeng.guns.core.common.annotion.Permission
;
import
com.stylefeng.guns.core.common.constant.Const
;
...
...
@@ -7,19 +10,15 @@ import com.stylefeng.guns.core.common.constant.cache.Cache;
import
com.stylefeng.guns.core.common.constant.dictmap.RoleDict
;
import
com.stylefeng.guns.core.common.constant.factory.ConstantFactory
;
import
com.stylefeng.guns.core.common.exception.BizExceptionEnum
;
import
com.stylefeng.guns.modular.system.dao.RoleMapper
;
import
com.stylefeng.guns.modular.system.dao.UserMapper
;
import
com.stylefeng.guns.modular.system.model.Role
;
import
com.stylefeng.guns.modular.system.model.User
;
import
com.stylefeng.guns.core.base.controller.BaseController
;
import
com.stylefeng.guns.core.base.tips.Tip
;
import
com.stylefeng.guns.core.cache.CacheKit
;
import
com.stylefeng.guns.core.exception.GunsException
;
import
com.stylefeng.guns.core.log.LogObjectHolder
;
import
com.stylefeng.guns.core.node.ZTreeNode
;
import
com.stylefeng.guns.core.util.Convert
;
import
com.stylefeng.guns.core.util.ToolUtil
;
import
com.stylefeng.guns.modular.system.dao.RoleDao
;
import
com.stylefeng.guns.modular.system.dao.RoleMapper
;
import
com.stylefeng.guns.modular.system.dao.UserMapper
;
import
com.stylefeng.guns.modular.system.model.Role
;
import
com.stylefeng.guns.modular.system.model.User
;
import
com.stylefeng.guns.modular.system.service.IRoleService
;
import
com.stylefeng.guns.modular.system.warpper.RoleWarpper
;
import
org.springframework.stereotype.Controller
;
...
...
@@ -54,9 +53,6 @@ public class RoleController extends BaseController {
RoleMapper
roleMapper
;
@Resource
RoleDao
roleDao
;
@Resource
IRoleService
roleService
;
/**
...
...
@@ -113,7 +109,7 @@ public class RoleController extends BaseController {
@RequestMapping
(
value
=
"/list"
)
@ResponseBody
public
Object
list
(
@RequestParam
(
required
=
false
)
String
roleName
)
{
List
<
Map
<
String
,
Object
>>
roles
=
this
.
role
Dao
.
selectRoles
(
super
.
getPara
(
"roleName"
));
List
<
Map
<
String
,
Object
>>
roles
=
this
.
role
Mapper
.
selectRoles
(
super
.
getPara
(
"roleName"
));
return
super
.
warpObject
(
new
RoleWarpper
(
roles
));
}
...
...
@@ -212,7 +208,7 @@ public class RoleController extends BaseController {
@RequestMapping
(
value
=
"/roleTreeList"
)
@ResponseBody
public
List
<
ZTreeNode
>
roleTreeList
()
{
List
<
ZTreeNode
>
roleTreeList
=
this
.
role
Dao
.
roleTreeList
();
List
<
ZTreeNode
>
roleTreeList
=
this
.
role
Mapper
.
roleTreeList
();
roleTreeList
.
add
(
ZTreeNode
.
createParent
());
return
roleTreeList
;
}
...
...
@@ -226,11 +222,11 @@ public class RoleController extends BaseController {
User
theUser
=
this
.
userMapper
.
selectById
(
userId
);
String
roleid
=
theUser
.
getRoleid
();
if
(
ToolUtil
.
isEmpty
(
roleid
))
{
List
<
ZTreeNode
>
roleTreeList
=
this
.
role
Dao
.
roleTreeList
();
List
<
ZTreeNode
>
roleTreeList
=
this
.
role
Mapper
.
roleTreeList
();
return
roleTreeList
;
}
else
{
String
[]
strArray
=
Convert
.
toStrArray
(
","
,
roleid
);
List
<
ZTreeNode
>
roleTreeListByUserId
=
this
.
role
Dao
.
roleTreeListByRoleId
(
strArray
);
List
<
ZTreeNode
>
roleTreeListByUserId
=
this
.
role
Mapper
.
roleTreeListByRoleId
(
strArray
);
return
roleTreeListByUserId
;
}
}
...
...
guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/UserMgrController.java
View file @
cafc08ae
package
com
.
stylefeng
.
guns
.
modular
.
system
.
controller
;
import
com.stylefeng.guns.config.properties.GunsProperties
;
import
com.stylefeng.guns.core.base.controller.BaseController
;
import
com.stylefeng.guns.core.base.tips.Tip
;
import
com.stylefeng.guns.core.common.annotion.BussinessLog
;
import
com.stylefeng.guns.core.common.annotion.Permission
;
import
com.stylefeng.guns.core.common.constant.Const
;
...
...
@@ -7,11 +10,6 @@ import com.stylefeng.guns.core.common.constant.dictmap.UserDict;
import
com.stylefeng.guns.core.common.constant.factory.ConstantFactory
;
import
com.stylefeng.guns.core.common.constant.state.ManagerStatus
;
import
com.stylefeng.guns.core.common.exception.BizExceptionEnum
;
import
com.stylefeng.guns.modular.system.dao.UserMapper
;
import
com.stylefeng.guns.modular.system.model.User
;
import
com.stylefeng.guns.config.properties.GunsProperties
;
import
com.stylefeng.guns.core.base.controller.BaseController
;
import
com.stylefeng.guns.core.base.tips.Tip
;
import
com.stylefeng.guns.core.datascope.DataScope
;
import
com.stylefeng.guns.core.db.Db
;
import
com.stylefeng.guns.core.exception.GunsException
;
...
...
@@ -19,8 +17,9 @@ import com.stylefeng.guns.core.log.LogObjectHolder;
import
com.stylefeng.guns.core.shiro.ShiroKit
;
import
com.stylefeng.guns.core.shiro.ShiroUser
;
import
com.stylefeng.guns.core.util.ToolUtil
;
import
com.stylefeng.guns.modular.system.dao.UserM
grDao
;
import
com.stylefeng.guns.modular.system.dao.UserM
apper
;
import
com.stylefeng.guns.modular.system.factory.UserFactory
;
import
com.stylefeng.guns.modular.system.model.User
;
import
com.stylefeng.guns.modular.system.transfer.UserDto
;
import
com.stylefeng.guns.modular.system.warpper.UserWarpper
;
import
org.springframework.stereotype.Controller
;
...
...
@@ -54,9 +53,6 @@ public class UserMgrController extends BaseController {
private
GunsProperties
gunsProperties
;
@Resource
private
UserMgrDao
managerDao
;
@Resource
private
UserMapper
userMapper
;
/**
...
...
@@ -164,11 +160,11 @@ public class UserMgrController extends BaseController {
@ResponseBody
public
Object
list
(
@RequestParam
(
required
=
false
)
String
name
,
@RequestParam
(
required
=
false
)
String
beginTime
,
@RequestParam
(
required
=
false
)
String
endTime
,
@RequestParam
(
required
=
false
)
Integer
deptid
)
{
if
(
ShiroKit
.
isAdmin
())
{
List
<
Map
<
String
,
Object
>>
users
=
managerDao
.
selectUsers
(
null
,
name
,
beginTime
,
endTime
,
deptid
);
List
<
Map
<
String
,
Object
>>
users
=
userMapper
.
selectUsers
(
null
,
name
,
beginTime
,
endTime
,
deptid
);
return
new
UserWarpper
(
users
).
warp
();
}
else
{
DataScope
dataScope
=
new
DataScope
(
ShiroKit
.
getDeptDataScope
());
List
<
Map
<
String
,
Object
>>
users
=
managerDao
.
selectUsers
(
dataScope
,
name
,
beginTime
,
endTime
,
deptid
);
List
<
Map
<
String
,
Object
>>
users
=
userMapper
.
selectUsers
(
dataScope
,
name
,
beginTime
,
endTime
,
deptid
);
return
new
UserWarpper
(
users
).
warp
();
}
}
...
...
@@ -186,7 +182,7 @@ public class UserMgrController extends BaseController {
}
// 判断账号是否重复
User
theUser
=
managerDao
.
getByAccount
(
user
.
getAccount
());
User
theUser
=
userMapper
.
getByAccount
(
user
.
getAccount
());
if
(
theUser
!=
null
)
{
throw
new
GunsException
(
BizExceptionEnum
.
USER_ALREADY_REG
);
}
...
...
@@ -244,7 +240,7 @@ public class UserMgrController extends BaseController {
throw
new
GunsException
(
BizExceptionEnum
.
CANT_DELETE_ADMIN
);
}
assertAuth
(
userId
);
this
.
managerDao
.
setStatus
(
userId
,
ManagerStatus
.
DELETED
.
getCode
());
this
.
userMapper
.
setStatus
(
userId
,
ManagerStatus
.
DELETED
.
getCode
());
return
SUCCESS_TIP
;
}
...
...
@@ -296,7 +292,7 @@ public class UserMgrController extends BaseController {
throw
new
GunsException
(
BizExceptionEnum
.
CANT_FREEZE_ADMIN
);
}
assertAuth
(
userId
);
this
.
managerDao
.
setStatus
(
userId
,
ManagerStatus
.
FREEZED
.
getCode
());
this
.
userMapper
.
setStatus
(
userId
,
ManagerStatus
.
FREEZED
.
getCode
());
return
SUCCESS_TIP
;
}
...
...
@@ -312,7 +308,7 @@ public class UserMgrController extends BaseController {
throw
new
GunsException
(
BizExceptionEnum
.
REQUEST_NULL
);
}
assertAuth
(
userId
);
this
.
managerDao
.
setStatus
(
userId
,
ManagerStatus
.
OK
.
getCode
());
this
.
userMapper
.
setStatus
(
userId
,
ManagerStatus
.
OK
.
getCode
());
return
SUCCESS_TIP
;
}
...
...
@@ -332,7 +328,7 @@ public class UserMgrController extends BaseController {
throw
new
GunsException
(
BizExceptionEnum
.
CANT_CHANGE_ADMIN
);
}
assertAuth
(
userId
);
this
.
managerDao
.
setRoles
(
userId
,
roleIds
);
this
.
userMapper
.
setRoles
(
userId
,
roleIds
);
return
SUCCESS_TIP
;
}
...
...
guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/MenuDao.java
deleted
100644 → 0
View file @
a35329e0
package
com
.
stylefeng
.
guns
.
modular
.
system
.
dao
;
import
com.stylefeng.guns.core.node.MenuNode
;
import
com.stylefeng.guns.core.node.ZTreeNode
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Map
;
/**
* 菜单相关的dao
*
* @author fengshuonan
* @date 2017年2月12日 下午8:43:52
*/
public
interface
MenuDao
{
/**
* 根据条件查询菜单
*
* @return
* @date 2017年2月12日 下午9:14:34
*/
List
<
Map
<
String
,
Object
>>
selectMenus
(
@Param
(
"condition"
)
String
condition
,
@Param
(
"level"
)
String
level
);
/**
* 根据条件查询菜单
*
* @return
* @date 2017年2月12日 下午9:14:34
*/
List
<
Long
>
getMenuIdsByRoleId
(
@Param
(
"roleId"
)
Integer
roleId
);
/**
* 获取菜单列表树
*
* @return
* @date 2017年2月19日 下午1:33:51
*/
List
<
ZTreeNode
>
menuTreeList
();
/**
* 获取菜单列表树
*
* @return
* @date 2017年2月19日 下午1:33:51
*/
List
<
ZTreeNode
>
menuTreeListByMenuIds
(
List
<
Long
>
menuIds
);
/**
* 删除menu关联的relation
*
* @param menuId
* @return
* @date 2017年2月19日 下午4:10:59
*/
int
deleteRelationByMenu
(
Long
menuId
);
/**
* 获取资源url通过角色id
*
* @param roleId
* @return
* @date 2017年2月19日 下午7:12:38
*/
List
<
String
>
getResUrlsByRoleId
(
Integer
roleId
);
/**
* 根据角色获取菜单
*
* @param roleIds
* @return
* @date 2017年2月19日 下午10:35:40
*/
List
<
MenuNode
>
getMenusByRoleIds
(
List
<
Integer
>
roleIds
);
}
guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/MenuMapper.java
View file @
cafc08ae
package
com
.
stylefeng
.
guns
.
modular
.
system
.
dao
;
import
com.baomidou.mybatisplus.mapper.BaseMapper
;
import
com.stylefeng.guns.core.node.MenuNode
;
import
com.stylefeng.guns.core.node.ZTreeNode
;
import
com.stylefeng.guns.modular.system.model.Menu
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Map
;
/**
* <p>
...
...
@@ -13,4 +19,62 @@ import com.stylefeng.guns.modular.system.model.Menu;
*/
public
interface
MenuMapper
extends
BaseMapper
<
Menu
>
{
/**
* 根据条件查询菜单
*
* @return
* @date 2017年2月12日 下午9:14:34
*/
List
<
Map
<
String
,
Object
>>
selectMenus
(
@Param
(
"condition"
)
String
condition
,
@Param
(
"level"
)
String
level
);
/**
* 根据条件查询菜单
*
* @return
* @date 2017年2月12日 下午9:14:34
*/
List
<
Long
>
getMenuIdsByRoleId
(
@Param
(
"roleId"
)
Integer
roleId
);
/**
* 获取菜单列表树
*
* @return
* @date 2017年2月19日 下午1:33:51
*/
List
<
ZTreeNode
>
menuTreeList
();
/**
* 获取菜单列表树
*
* @return
* @date 2017年2月19日 下午1:33:51
*/
List
<
ZTreeNode
>
menuTreeListByMenuIds
(
List
<
Long
>
menuIds
);
/**
* 删除menu关联的relation
*
* @param menuId
* @return
* @date 2017年2月19日 下午4:10:59
*/
int
deleteRelationByMenu
(
Long
menuId
);
/**
* 获取资源url通过角色id
*
* @param roleId
* @return
* @date 2017年2月19日 下午7:12:38
*/
List
<
String
>
getResUrlsByRoleId
(
Integer
roleId
);
/**
* 根据角色获取菜单
*
* @param roleIds
* @return
* @date 2017年2月19日 下午10:35:40
*/
List
<
MenuNode
>
getMenusByRoleIds
(
List
<
Integer
>
roleIds
);
}
\ No newline at end of file
guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/NoticeDao.java
deleted
100644 → 0
View file @
a35329e0
package
com
.
stylefeng
.
guns
.
modular
.
system
.
dao
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Map
;
/**
* 通知dao
*
* @author fengshuonan
* @date 2017-05-09 23:03
*/
public
interface
NoticeDao
{
List
<
Map
<
String
,
Object
>>
list
(
@Param
(
"condition"
)
String
condition
);
}
guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/NoticeMapper.java
View file @
cafc08ae
...
...
@@ -2,10 +2,14 @@ package com.stylefeng.guns.modular.system.dao;
import
com.baomidou.mybatisplus.mapper.BaseMapper
;
import
com.stylefeng.guns.modular.system.model.Notice
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Map
;
/**
* <p>
* 通知表 Mapper 接口
* 通知表 Mapper 接口
* </p>
*
* @author stylefeng
...
...
@@ -13,4 +17,9 @@ import com.stylefeng.guns.modular.system.model.Notice;
*/
public
interface
NoticeMapper
extends
BaseMapper
<
Notice
>
{
/**
* 获取通知列表
*/
List
<
Map
<
String
,
Object
>>
list
(
@Param
(
"condition"
)
String
condition
);
}
\ No newline at end of file
guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/RoleDao.java
deleted
100644 → 0
View file @
a35329e0
package
com
.
stylefeng
.
guns
.
modular
.
system
.
dao
;
import
com.stylefeng.guns.core.node.ZTreeNode
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Map
;
/**
* 角色相关的dao
*
* @author fengshuonan
* @date 2017年2月12日 下午8:43:52
*/
public
interface
RoleDao
{
/**
* 根据条件查询角色列表
*
* @return
* @date 2017年2月12日 下午9:14:34
*/
List
<
Map
<
String
,
Object
>>
selectRoles
(
@Param
(
"condition"
)
String
condition
);
/**
* 删除某个角色的所有权限
*
* @param roleId 角色id
* @return
* @date 2017年2月13日 下午7:57:51
*/
int
deleteRolesById
(
@Param
(
"roleId"
)
Integer
roleId
);
/**
* 获取角色列表树
*
* @return
* @date 2017年2月18日 上午10:32:04
*/
List
<
ZTreeNode
>
roleTreeList
();
/**
* 获取角色列表树
*
* @return
* @date 2017年2月18日 上午10:32:04
*/
List
<
ZTreeNode
>
roleTreeListByRoleId
(
String
[]
roleId
);
}
guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/RoleMapper.java
View file @
cafc08ae
package
com
.
stylefeng
.
guns
.
modular
.
system
.
dao
;
import
com.baomidou.mybatisplus.mapper.BaseMapper
;
import
com.stylefeng.guns.core.node.ZTreeNode
;
import
com.stylefeng.guns.modular.system.model.Role
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Map
;
/**
* <p>
...
...
@@ -13,4 +18,36 @@ import com.stylefeng.guns.modular.system.model.Role;
*/
public
interface
RoleMapper
extends
BaseMapper
<
Role
>
{
/**
* 根据条件查询角色列表
*
* @return
* @date 2017年2月12日 下午9:14:34
*/
List
<
Map
<
String
,
Object
>>
selectRoles
(
@Param
(
"condition"
)
String
condition
);
/**
* 删除某个角色的所有权限
*
* @param roleId 角色id
* @return
* @date 2017年2月13日 下午7:57:51
*/
int
deleteRolesById
(
@Param
(
"roleId"
)
Integer
roleId
);
/**
* 获取角色列表树
*
* @return
* @date 2017年2月18日 上午10:32:04
*/
List
<
ZTreeNode
>
roleTreeList
();
/**
* 获取角色列表树
*
* @return
* @date 2017年2月18日 上午10:32:04
*/
List
<
ZTreeNode
>
roleTreeListByRoleId
(
String
[]
roleId
);
}
\ No newline at end of file
guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/UserMapper.java
View file @
cafc08ae
package
com
.
stylefeng
.
guns
.
modular
.
system
.
dao
;
import
com.baomidou.mybatisplus.mapper.BaseMapper
;
import
com.stylefeng.guns.core.datascope.DataScope
;
import
com.stylefeng.guns.modular.system.model.User
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Map
;
/**
* <p>
* 管理员表 Mapper 接口
* 管理员表 Mapper 接口
* </p>
*
* @author stylefeng
...
...
@@ -13,4 +18,28 @@ import com.stylefeng.guns.modular.system.model.User;
*/
public
interface
UserMapper
extends
BaseMapper
<
User
>
{
/**
* 修改用户状态
*/
int
setStatus
(
@Param
(
"userId"
)
Integer
userId
,
@Param
(
"status"
)
int
status
);
/**
* 修改密码
*/
int
changePwd
(
@Param
(
"userId"
)
Integer
userId
,
@Param
(
"pwd"
)
String
pwd
);
/**
* 根据条件查询用户列表
*/
List
<
Map
<
String
,
Object
>>
selectUsers
(
@Param
(
"dataScope"
)
DataScope
dataScope
,
@Param
(
"name"
)
String
name
,
@Param
(
"beginTime"
)
String
beginTime
,
@Param
(
"endTime"
)
String
endTime
,
@Param
(
"deptid"
)
Integer
deptid
);
/**
* 设置用户的角色
*/
int
setRoles
(
@Param
(
"userId"
)
Integer
userId
,
@Param
(
"roleIds"
)
String
roleIds
);
/**
* 通过账号获取用户
*/
User
getByAccount
(
@Param
(
"account"
)
String
account
);
}
\ No newline at end of file
guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/UserMgrDao.java
deleted
100644 → 0
View file @
a35329e0
package
com
.
stylefeng
.
guns
.
modular
.
system
.
dao
;
import
com.stylefeng.guns.modular.system.model.User
;
import
com.stylefeng.guns.core.datascope.DataScope
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Map
;
/**
* 管理员的dao
*
* @author fengshuonan
* @date 2017年2月12日 下午8:43:52
*/
public
interface
UserMgrDao
{
/**
* 修改用户状态
*
* @param user
* @date 2017年2月12日 下午8:42:31
*/
int
setStatus
(
@Param
(
"userId"
)
Integer
userId
,
@Param
(
"status"
)
int
status
);
/**
* 修改密码
*
* @param userId
* @param pwd
* @date 2017年2月12日 下午8:54:19
*/
int
changePwd
(
@Param
(
"userId"
)
Integer
userId
,
@Param
(
"pwd"
)
String
pwd
);
/**
* 根据条件查询用户列表
*
* @return
* @date 2017年2月12日 下午9:14:34
*/
List
<
Map
<
String
,
Object
>>
selectUsers
(
@Param
(
"dataScope"
)
DataScope
dataScope
,
@Param
(
"name"
)
String
name
,
@Param
(
"beginTime"
)
String
beginTime
,
@Param
(
"endTime"
)
String
endTime
,
@Param
(
"deptid"
)
Integer
deptid
);
/**
* 设置用户的角色
*
* @return
* @date 2017年2月13日 下午7:31:30
*/
int
setRoles
(
@Param
(
"userId"
)
Integer
userId
,
@Param
(
"roleIds"
)
String
roleIds
);
/**
* 通过账号获取用户
*
* @param account
* @return
* @date 2017年2月17日 下午11:07:46
*/
User
getByAccount
(
@Param
(
"account"
)
String
account
);
}
guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/MenuDao.xml
deleted
100644 → 0
View file @
a35329e0
<?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.stylefeng.guns.modular.system.dao.MenuDao"
>
<sql
id=
"Base_Column_List"
>
id, code, pcode, name, icon, url, num, levels,pcodes,
tips, status,isopen,ismenu
</sql>
<select
id=
"selectMenus"
resultType=
"map"
>
select
<include
refid=
"Base_Column_List"
/>
from sys_menu
where status = 1
<if
test=
"condition != null and condition != ''"
>
and (name like CONCAT('%',#{condition},'%') or code like CONCAT('%',#{condition},'%'))
</if>
<if
test=
"level != null and level != ''"
>
and levels = #{level}
</if>
</select>
<select
id=
"getMenuIdsByRoleId"
resultType=
"long"
>
select menuid from
sys_relation where roleid = #{roleId}
</select>
<select
id=
"menuTreeList"
resultType=
"com.stylefeng.guns.core.node.ZTreeNode"
>
SELECT
m1.id AS id,
(
CASE
WHEN (m2.id = 0 OR m2.id IS NULL) THEN
0
ELSE
m2.id
END
) AS pId,
m1. NAME
AS NAME,
(
CASE
WHEN (m2.id = 0 OR m2.id IS NULL) THEN
'true'
ELSE
'false'
END
) as isOpen
FROM
sys_menu m1
LEFT join sys_menu m2 ON m1.pcode = m2. CODE
ORDER BY
m1.id ASC
</select>
<select
id=
"menuTreeListByMenuIds"
resultType=
"com.stylefeng.guns.core.node.ZTreeNode"
>
SELECT
m1.id AS id,
(
CASE
WHEN (m2.id = 0 OR m2.id IS NULL) THEN
0
ELSE
m2.id
END
) AS pId,
m1. NAME AS NAME,
(
CASE
WHEN (m2.id = 0 OR m2.id IS
NULL) THEN
'true'
ELSE
'false'
END
) as isOpen,
(
CASE
WHEN (m3.ID = 0 OR m3.ID
IS NULL) THEN
'false'
ELSE
'true'
END
) "checked"
FROM
sys_menu m1
LEFT JOIN
sys_menu m2
ON m1.pcode = m2. CODE
left join (
SELECT
ID
FROM
sys_menu
WHERE
ID IN
<foreach
collection=
"list"
index=
"index"
item=
"i"
open=
"("
separator=
","
close=
")"
>
#{i}
</foreach>
) m3 on m1.id = m3.id
ORDER BY
m1.id ASC
</select>
<delete
id=
"deleteRelationByMenu"
>
delete from sys_relation where menuid = #{menuId}
</delete>
<select
id=
"getResUrlsByRoleId"
resultType=
"string"
>
select url from
sys_relation rel
inner join sys_menu m on rel.menuid = m.id
where rel.roleid = #{roleId}
</select>
<select
id=
"getMenusByRoleIds"
resultType=
"com.stylefeng.guns.core.node.MenuNode"
>
SELECT
m1.id AS id,
m1.icon AS icon,
(
CASE
WHEN (m2.id = 0 OR m2.id IS NULL) THEN
0
ELSE
m2.id
END
) AS parentId,
m1.NAME as name,
m1.url as url,
m1.levels as levels,
m1.ismenu as ismenu,
m1.num as num
FROM
sys_menu m1
LEFT join sys_menu m2 ON m1.pcode = m2. CODE
INNER JOIN (
SELECT
ID
FROM
sys_menu
WHERE
ID IN (
SELECT
menuid
FROM
sys_relation rela
WHERE
rela.roleid IN
<foreach
collection=
"list"
index=
"index"
item=
"i"
open=
"("
separator=
","
close=
")"
>
#{i}
</foreach>
)
) m3 ON m1.id = m3.id
where m1.ismenu = 1
order by levels,num asc
</select>
</mapper>
\ No newline at end of file
guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/MenuMapper.xml
View file @
cafc08ae
...
...
@@ -19,4 +19,159 @@
<result
column=
"isopen"
property=
"isopen"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, code, pcode, name, icon, url, num, levels,pcodes,
tips, status,isopen,ismenu
</sql>
<select
id=
"selectMenus"
resultType=
"map"
>
select
<include
refid=
"Base_Column_List"
/>
from sys_menu
where status = 1
<if
test=
"condition != null and condition != ''"
>
and (name like CONCAT('%',#{condition},'%') or code like CONCAT('%',#{condition},'%'))
</if>
<if
test=
"level != null and level != ''"
>
and levels = #{level}
</if>
</select>
<select
id=
"getMenuIdsByRoleId"
resultType=
"long"
>
select menuid from
sys_relation where roleid = #{roleId}
</select>
<select
id=
"menuTreeList"
resultType=
"com.stylefeng.guns.core.node.ZTreeNode"
>
SELECT
m1.id AS id,
(
CASE
WHEN (m2.id = 0 OR m2.id IS NULL) THEN
0
ELSE
m2.id
END
) AS pId,
m1. NAME
AS NAME,
(
CASE
WHEN (m2.id = 0 OR m2.id IS NULL) THEN
'true'
ELSE
'false'
END
) as isOpen
FROM
sys_menu m1
LEFT join sys_menu m2 ON m1.pcode = m2. CODE
ORDER BY
m1.id ASC
</select>
<select
id=
"menuTreeListByMenuIds"
resultType=
"com.stylefeng.guns.core.node.ZTreeNode"
>
SELECT
m1.id AS id,
(
CASE
WHEN (m2.id = 0 OR m2.id IS NULL) THEN
0
ELSE
m2.id
END
) AS pId,
m1. NAME AS NAME,
(
CASE
WHEN (m2.id = 0 OR m2.id IS
NULL) THEN
'true'
ELSE
'false'
END
) as isOpen,
(
CASE
WHEN (m3.ID = 0 OR m3.ID
IS NULL) THEN
'false'
ELSE
'true'
END
) "checked"
FROM
sys_menu m1
LEFT JOIN
sys_menu m2
ON m1.pcode = m2. CODE
left join (
SELECT
ID
FROM
sys_menu
WHERE
ID IN
<foreach
collection=
"list"
index=
"index"
item=
"i"
open=
"("
separator=
","
close=
")"
>
#{i}
</foreach>
) m3 on m1.id = m3.id
ORDER BY
m1.id ASC
</select>
<delete
id=
"deleteRelationByMenu"
>
delete from sys_relation where menuid = #{menuId}
</delete>
<select
id=
"getResUrlsByRoleId"
resultType=
"string"
>
select url from
sys_relation rel
inner join sys_menu m on rel.menuid = m.id
where rel.roleid = #{roleId}
</select>
<select
id=
"getMenusByRoleIds"
resultType=
"com.stylefeng.guns.core.node.MenuNode"
>
SELECT
m1.id AS id,
m1.icon AS icon,
(
CASE
WHEN (m2.id = 0 OR m2.id IS NULL) THEN
0
ELSE
m2.id
END
) AS parentId,
m1.NAME as name,
m1.url as url,
m1.levels as levels,
m1.ismenu as ismenu,
m1.num as num
FROM
sys_menu m1
LEFT join sys_menu m2 ON m1.pcode = m2. CODE
INNER JOIN (
SELECT
ID
FROM
sys_menu
WHERE
ID IN (
SELECT
menuid
FROM
sys_relation rela
WHERE
rela.roleid IN
<foreach
collection=
"list"
index=
"index"
item=
"i"
open=
"("
separator=
","
close=
")"
>
#{i}
</foreach>
)
) m3 ON m1.id = m3.id
where m1.ismenu = 1
order by levels,num asc
</select>
</mapper>
guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/NoticeDao.xml
deleted
100644 → 0
View file @
a35329e0
<?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.stylefeng.guns.modular.system.dao.NoticeDao"
>
<select
id=
"list"
resultType=
"map"
>
select * from sys_notice
<if
test=
"condition != null and condition != ''"
>
where title like CONCAT('%',#{condition},'%') or content like CONCAT('%',#{condition},'%')
</if>
order by createtime DESC
</select>
</mapper>
\ No newline at end of file
guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/NoticeMapper.xml
View file @
cafc08ae
...
...
@@ -2,14 +2,22 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.stylefeng.guns.modular.system.dao.NoticeMapper"
>
<!-- 通用查询映射结果 -->
<resultMap
id=
"BaseResultMap"
type=
"com.stylefeng.guns.modular.system.model.Notice"
>
<id
column=
"id"
property=
"id"
/>
<result
column=
"title"
property=
"title"
/>
<result
column=
"type"
property=
"type"
/>
<result
column=
"content"
property=
"content"
/>
<result
column=
"createtime"
property=
"createtime"
/>
<result
column=
"creater"
property=
"creater"
/>
</resultMap>
<!-- 通用查询映射结果 -->
<resultMap
id=
"BaseResultMap"
type=
"com.stylefeng.guns.modular.system.model.Notice"
>
<id
column=
"id"
property=
"id"
/>
<result
column=
"title"
property=
"title"
/>
<result
column=
"type"
property=
"type"
/>
<result
column=
"content"
property=
"content"
/>
<result
column=
"createtime"
property=
"createtime"
/>
<result
column=
"creater"
property=
"creater"
/>
</resultMap>
<select
id=
"list"
resultType=
"map"
>
select * from sys_notice
<if
test=
"condition != null and condition != ''"
>
where title like CONCAT('%',#{condition},'%') or content like CONCAT('%',#{condition},'%')
</if>
order by createtime DESC
</select>
</mapper>
guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/RoleDao.xml
deleted
100644 → 0
View file @
a35329e0
<?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.stylefeng.guns.modular.system.dao.RoleDao"
>
<sql
id=
"Base_Column_List"
>
id, num, pid, name, deptid, tips, version
</sql>
<select
id=
"selectRoles"
resultType=
"map"
>
select
<include
refid=
"Base_Column_List"
/>
from sys_role
<if
test=
"condition != null"
>
where name like CONCAT('%',#{condition},'%')
</if>
</select>
<delete
id=
"deleteRolesById"
>
delete from sys_relation where roleid = #{roleId}
</delete>
<select
id=
"roleTreeList"
resultType=
"com.stylefeng.guns.core.node.ZTreeNode"
>
select id "id",pId
"pId",name as "name",(case when (pId=0 or pId is null) then 'true'
else 'false' end) "open" from sys_role
</select>
<select
id=
"roleTreeListByRoleId"
resultType=
"com.stylefeng.guns.core.node.ZTreeNode"
>
SELECT
r.id "id",
pId "pId",
NAME AS "name",
(
CASE
WHEN (pId = 0 OR pId IS NULL) THEN
'true'
ELSE
'false'
END
) "open",
(
CASE
WHEN (r1.ID = 0 OR r1.ID IS NULL) THEN
'false'
ELSE
'true'
END
) "checked"
FROM
sys_role r
LEFT JOIN (
SELECT
ID
FROM
sys_role
WHERE
ID IN
<foreach
collection=
"array"
index=
"index"
item=
"i"
open=
"("
separator=
","
close=
")"
>
#{i}
</foreach>
) r1 ON r.ID = r1.ID
ORDER BY
pId,
num ASC
</select>
</mapper>
\ No newline at end of file
guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/RoleMapper.xml
View file @
cafc08ae
...
...
@@ -13,4 +13,67 @@
<result
column=
"version"
property=
"version"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, num, pid, name, deptid, tips, version
</sql>
<select
id=
"selectRoles"
resultType=
"map"
>
select
<include
refid=
"Base_Column_List"
/>
from sys_role
<if
test=
"condition != null"
>
where name like CONCAT('%',#{condition},'%')
</if>
</select>
<delete
id=
"deleteRolesById"
>
delete from sys_relation where roleid = #{roleId}
</delete>
<select
id=
"roleTreeList"
resultType=
"com.stylefeng.guns.core.node.ZTreeNode"
>
select id "id",pId
"pId",name as "name",(case when (pId=0 or pId is null) then 'true'
else 'false' end) "open" from sys_role
</select>
<select
id=
"roleTreeListByRoleId"
resultType=
"com.stylefeng.guns.core.node.ZTreeNode"
>
SELECT
r.id "id",
pId "pId",
NAME AS "name",
(
CASE
WHEN (pId = 0 OR pId IS NULL) THEN
'true'
ELSE
'false'
END
) "open",
(
CASE
WHEN (r1.ID = 0 OR r1.ID IS NULL) THEN
'false'
ELSE
'true'
END
) "checked"
FROM
sys_role r
LEFT JOIN (
SELECT
ID
FROM
sys_role
WHERE
ID IN
<foreach
collection=
"array"
index=
"index"
item=
"i"
open=
"("
separator=
","
close=
")"
>
#{i}
</foreach>
) r1 ON r.ID = r1.ID
ORDER BY
pId,
num ASC
</select>
</mapper>
guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/UserMapper.xml
View file @
cafc08ae
...
...
@@ -21,4 +21,57 @@
<result
column=
"version"
property=
"version"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, account, name, birthday, sex, email, avatar,
phone, roleid,
deptid, status,
createtime, version
</sql>
<sql
id=
"Base_Column_List_With_Pwd"
>
id, account, name, birthday,password, sex, email, avatar,
phone, roleid,salt,
deptid, status,
createtime, version
</sql>
<select
id=
"selectUsers"
resultType=
"map"
>
select
<include
refid=
"Base_Column_List"
/>
from sys_user
where status != 3
<if
test=
"name != null and name != ''"
>
and (phone like CONCAT('%',#{name},'%')
or account like CONCAT('%',#{name},'%')
or name like CONCAT('%',#{name},'%'))
</if>
<if
test=
"deptid != null and deptid != 0"
>
and (deptid = #{deptid} or deptid in ( select id from sys_dept where pids like CONCAT('%[', #{deptid}, ']%') ))
</if>
<if
test=
"beginTime != null and beginTime != '' and endTime != null and endTime != ''"
>
and (createTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59'))
</if>
</select>
<update
id=
"setStatus"
>
update sys_user set status = #{status} where id =
#{userId}
</update>
<update
id=
"changePwd"
>
update sys_user set password = #{pwd} where id =
#{userId}
</update>
<update
id=
"setRoles"
>
update sys_user set roleid = #{roleIds} where id =
#{userId}
</update>
<select
id=
"getByAccount"
resultType=
"user"
>
select
<include
refid=
"Base_Column_List_With_Pwd"
/>
from sys_user where account = #{account} and status != 3
</select>
</mapper>
guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/UserMgrDao.xml
deleted
100644 → 0
View file @
a35329e0
<?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.stylefeng.guns.modular.system.dao.UserMgrDao"
>
<sql
id=
"Base_Column_List"
>
id, account, name, birthday, sex, email, avatar,
phone, roleid,
deptid, status,
createtime, version
</sql>
<sql
id=
"Base_Column_List_With_Pwd"
>
id, account, name, birthday,password, sex, email, avatar,
phone, roleid,salt,
deptid, status,
createtime, version
</sql>
<select
id=
"selectUsers"
resultType=
"map"
>
select
<include
refid=
"Base_Column_List"
/>
from sys_user
where status != 3
<if
test=
"name != null and name != ''"
>
and (phone like CONCAT('%',#{name},'%')
or account like CONCAT('%',#{name},'%')
or name like CONCAT('%',#{name},'%'))
</if>
<if
test=
"deptid != null and deptid != 0"
>
and (deptid = #{deptid} or deptid in ( select id from sys_dept where pids like CONCAT('%[', #{deptid}, ']%') ))
</if>
<if
test=
"beginTime != null and beginTime != '' and endTime != null and endTime != ''"
>
and (createTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59'))
</if>
</select>
<update
id=
"setStatus"
>
update sys_user set status = #{status} where id =
#{userId}
</update>
<update
id=
"changePwd"
>
update sys_user set password = #{pwd} where id =
#{userId}
</update>
<update
id=
"setRoles"
>
update sys_user set roleid = #{roleIds} where id =
#{userId}
</update>
<select
id=
"getByAccount"
resultType=
"user"
>
select
<include
refid=
"Base_Column_List_With_Pwd"
/>
from sys_user where account = #{account} and status != 3
</select>
</mapper>
\ No newline at end of file
guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/MenuServiceImpl.java
View file @
cafc08ae
...
...
@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.mapper.EntityWrapper;
import
com.baomidou.mybatisplus.mapper.Wrapper
;
import
com.stylefeng.guns.modular.system.dao.MenuMapper
;
import
com.stylefeng.guns.modular.system.model.Menu
;
import
com.stylefeng.guns.modular.system.dao.MenuDao
;
import
com.stylefeng.guns.modular.system.service.IMenuService
;
import
org.springframework.stereotype.Service
;
...
...
@@ -23,9 +22,6 @@ public class MenuServiceImpl implements IMenuService {
@Resource
MenuMapper
menuMapper
;
@Resource
MenuDao
menuDao
;
@Override
public
void
delMenu
(
Long
menuId
)
{
...
...
@@ -33,7 +29,7 @@ public class MenuServiceImpl implements IMenuService {
this
.
menuMapper
.
deleteById
(
menuId
);
//删除关联的relation
this
.
menu
Dao
.
deleteRelationByMenu
(
menuId
);
this
.
menu
Mapper
.
deleteRelationByMenu
(
menuId
);
}
@Override
...
...
guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/RoleServiceImpl.java
View file @
cafc08ae
package
com
.
stylefeng
.
guns
.
modular
.
system
.
service
.
impl
;
import
com.stylefeng.guns.core.util.Convert
;
import
com.stylefeng.guns.modular.system.dao.RelationMapper
;
import
com.stylefeng.guns.modular.system.dao.RoleMapper
;
import
com.stylefeng.guns.modular.system.model.Relation
;
import
com.stylefeng.guns.core.util.Convert
;
import
com.stylefeng.guns.modular.system.dao.RoleDao
;
import
com.stylefeng.guns.modular.system.service.IRoleService
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -18,9 +17,6 @@ public class RoleServiceImpl implements IRoleService {
RoleMapper
roleMapper
;
@Resource
RoleDao
roleDao
;
@Resource
RelationMapper
relationMapper
;
@Override
...
...
@@ -28,7 +24,7 @@ public class RoleServiceImpl implements IRoleService {
public
void
setAuthority
(
Integer
roleId
,
String
ids
)
{
// 删除该角色所有的权限
this
.
role
Dao
.
deleteRolesById
(
roleId
);
this
.
role
Mapper
.
deleteRolesById
(
roleId
);
// 添加新的权限
for
(
Long
id
:
Convert
.
toLongArray
(
true
,
Convert
.
toStrArray
(
","
,
ids
)))
{
...
...
@@ -46,7 +42,7 @@ public class RoleServiceImpl implements IRoleService {
this
.
roleMapper
.
deleteById
(
roleId
);
// 删除该角色所有的权限
this
.
role
Dao
.
deleteRolesById
(
roleId
);
this
.
role
Mapper
.
deleteRolesById
(
roleId
);
}
}
guns-admin/src/test/java/com/stylefeng/guns/system/BlackBoardTest.java
View file @
cafc08ae
package
com
.
stylefeng
.
guns
.
system
;
import
com.stylefeng.guns.base.BaseJunit
;
import
com.stylefeng.guns.modular.system.dao.Notice
Dao
;
import
com.stylefeng.guns.modular.system.dao.Notice
Mapper
;
import
org.junit.Test
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -19,11 +19,11 @@ import static org.junit.Assert.assertTrue;
public
class
BlackBoardTest
extends
BaseJunit
{
@Autowired
Notice
Dao
noticeDao
;
Notice
Mapper
noticeMapper
;
@Test
public
void
blackBoardTest
()
{
List
<
Map
<
String
,
Object
>>
notices
=
notice
Dao
.
list
(
null
);
List
<
Map
<
String
,
Object
>>
notices
=
notice
Mapper
.
list
(
null
);
assertTrue
(
notices
.
size
()
>
0
);
}
}
guns-admin/src/test/java/com/stylefeng/guns/system/UserTest.java
View file @
cafc08ae
...
...
@@ -2,7 +2,6 @@ package com.stylefeng.guns.system;
import
com.stylefeng.guns.base.BaseJunit
;
import
com.stylefeng.guns.modular.system.dao.UserMapper
;
import
com.stylefeng.guns.modular.system.dao.UserMgrDao
;
import
org.junit.Test
;
import
javax.annotation.Resource
;
...
...
@@ -16,9 +15,6 @@ import javax.annotation.Resource;
public
class
UserTest
extends
BaseJunit
{
@Resource
UserMgrDao
userMgrDao
;
@Resource
UserMapper
userMapper
;
@Test
...
...
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