Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Springboot Plus
Commits
67bb8798
Commit
67bb8798
authored
Aug 15, 2020
by
trumansdo
Browse files
done: 完成代码生成以外的功能
todo: 代码生成、前端架构调整、样式调整
parent
e27ca5d7
Changes
59
Show whitespace changes
Inline
Side-by-side
plus-admin/admin-core/src/main/java/com/ibeetl/admin/core/entity/DictType.java
View file @
67bb8798
package
com.ibeetl.admin.core.entity
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* 用于数据表格的显示<br/>
* pojo中字典字段必须使用该类定义<br>
* 由{@link com.ibeetl.admin.core.service.CoreBaseService#
processDict
Field} 方法转换<br/>
* 由{@link com.ibeetl.admin.core.service.CoreBaseService#
handleDictType
Field} 方法转换<br/>
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public
class
DictType
{
private
String
value
;
...
...
@@ -18,6 +20,7 @@ public class DictType {
public
DictType
(
String
value
)
{
this
.
value
=
value
;
}
public
DictType
(
String
type
,
String
value
)
{
this
(
value
);
this
.
type
=
type
;
...
...
plus-admin/admin-core/src/main/java/com/ibeetl/admin/core/entity/ElCascaderData.java
View file @
67bb8798
...
...
@@ -12,4 +12,5 @@ public class ElCascaderData {
private
String
label
;
private
Object
value
;
private
List
<
ElCascaderData
>
children
;
private
Object
tail
;
}
plus-admin/admin-core/src/main/java/com/ibeetl/admin/core/service/CoreBaseService.java
View file @
67bb8798
...
...
@@ -28,7 +28,8 @@ import org.springframework.beans.factory.annotation.Autowired;
*/
public
class
CoreBaseService
<
T
>
{
@Autowired
protected
CoreDictService
dictUtil
;
@Autowired
protected
CoreDictService
coreDictService
;
protected
SQLManagerBaseDao
sqlManagerBaseDao
;
...
...
@@ -36,57 +37,58 @@ public class CoreBaseService<T> {
@Autowired
public
void
setSqlManagerBaseDao
(
SQLManagerBaseDao
sqlManagerBaseDao
)
{
this
.
sqlManagerBaseDao
=
sqlManagerBaseDao
;
this
.
sqlManager
=
this
.
sqlManagerBaseDao
.
getSQLManager
();
}
/**
* 根据id查询对象,如果主键ID不存在
*
* @param id
* @return
*/
public
T
queryById
(
Object
id
)
{
T
t
=
sqlManager
.
single
(
getCurrentEntityClassz
(),
id
);
queryEntityAfter
((
Object
)
t
);
handleStrDictValueField
((
Object
)
t
);
return
t
;
}
/**
* 根据id查询
*
* @param classz 返回的对象类型
* @param id 主键id
* @return
* @param classz
* 返回的对象类型
* @param id
* 主键id
*/
public
T
queryById
(
Class
<
T
>
classz
,
Object
id
)
{
T
t
=
sqlManager
.
unique
(
classz
,
id
);
queryEntityAfter
((
Object
)
t
);
handleStrDictValueField
((
Object
)
t
);
return
t
;
}
/**
* 新增一条数据
*
* @param model
实体类
*
@return
* @param model
*
实体类
*/
public
boolean
save
(
T
model
)
{
return
sqlManager
.
insert
(
model
,
true
)
>
0
;
}
/**
* 删除数据(一般为逻辑删除,更新del_flag字段为1)
*
* @param ids
* @return
*/
public
boolean
deleteById
(
List
<
Long
>
ids
)
{
if
(
ids
==
null
||
ids
.
isEmpty
())
{
throw
new
PlatformException
(
"删除数据ID不能为空"
);
}
for
(
Long
id
:
ids
)
{}
for
(
Long
id
:
ids
)
{
}
List
<
Object
>
list
=
new
ArrayList
<>();
for
(
Long
id
:
ids
)
{
...
...
@@ -114,43 +116,42 @@ public class CoreBaseService<T> {
int
ret
=
sqlManager
.
updateTemplateById
(
getCurrentEntityClassz
(),
map
);
return
ret
==
1
;
}
/**
* 根据id删除数据
*
* @param id
主键值
*
@return
* @param id
*
主键值
*/
public
int
forceDelete
(
Long
id
)
{
return
sqlManager
.
deleteById
(
getCurrentEntityClassz
(),
id
);
}
/**
* 根据id删除数据
*
* @param id
主键值
*
@return
* @param id
*
主键值
*/
public
int
forceDelete
(
Class
<
T
>
classz
,
Long
id
)
{
return
sqlManager
.
deleteById
(
classz
,
id
);
}
/**
* 更新,只更新不为空的字段
*
* @param model
* @return
*/
public
boolean
updateTemplate
(
T
model
)
{
return
sqlManager
.
updateTemplateById
(
model
)
>
0
;
}
/**
* 更新所有字段
*
* @param model
* @return
*/
public
boolean
update
(
T
model
)
{
return
sqlManager
.
updateById
(
model
)
>
0
;
}
...
...
@@ -161,17 +162,24 @@ public class CoreBaseService<T> {
*/
@SuppressWarnings
(
"unchecked"
)
private
Class
<
T
>
getCurrentEntityClassz
()
{
return
(
Class
<
T
>)
((
ParameterizedType
)
getClass
().
getGenericSuperclass
()).
getActualTypeArguments
()[
0
];
}
public
void
queryListAfter
(
List
list
)
{
for
(
Object
bean
:
list
)
{
queryEntityAfter
(
bean
);
public
void
handleStrDictValueFields
(
Collection
<?>
collection
)
{
for
(
Object
bean
:
collection
)
{
handleStrDictValueField
(
bean
);
}
}
public
void
queryEntityAfter
(
Object
bean
)
{
/**
* 处理字典字符值,将字典名存放在{@link TailBean}中。字典需要{@link Dict}注解
* @param bean
*/
public
void
handleStrDictValueField
(
Object
bean
)
{
if
(
bean
==
null
)
{
return
;
}
...
...
@@ -193,7 +201,7 @@ public class CoreBaseService<T> {
String
display
=
""
;
Object
fieldValue
=
field
.
get
(
ext
);
if
(
fieldValue
!=
null
)
{
CoreDict
dbDict
=
dictUtil
.
findCoreDict
(
dict
.
type
(),
fieldValue
.
toString
());
CoreDict
dbDict
=
coreDictService
.
findCoreDict
(
dict
.
type
(),
fieldValue
.
toString
());
display
=
dbDict
!=
null
?
dbDict
.
getName
()
:
null
;
}
ext
.
set
(
field
.
getName
()
+
dict
.
suffix
(),
display
);
...
...
@@ -206,17 +214,24 @@ public class CoreBaseService<T> {
}
while
(
c
!=
TailBean
.
class
);
}
public
void
processObjectsDictField
(
PageQuery
pageQuery
)
{
this
.
processObjectsDictField
(
pageQuery
.
getList
());
public
void
handleDictTypeFields
(
PageQuery
pageQuery
)
{
this
.
handleDictTypeFields
(
pageQuery
.
getList
());
}
public
void
processObjectsDictField
(
Collection
collection
)
{
public
void
handleDictTypeFields
(
Collection
<?>
collection
)
{
for
(
Object
o
:
collection
)
{
this
.
processDict
Field
(
o
);
this
.
handleDictType
Field
(
o
);
}
}
public
void
processDictField
(
Object
object
)
{
/**
* 处理{@link DictType} 类型字段,将字典的name ,value,type存放在{@link TailBean}。字典需要{@link Dict}注解
* @param object
*/
public
void
handleDictTypeField
(
Object
object
)
{
Field
[]
fields
=
ReflectUtil
.
getFields
(
object
.
getClass
());
for
(
Field
field
:
fields
)
{
Class
<?>
fieldDeclaringClass
=
field
.
getType
();
...
...
@@ -234,4 +249,5 @@ public class CoreBaseService<T> {
ReflectUtil
.
setFieldValue
(
object
,
field
,
dictType
);
}
}
}
plus-admin/admin-core/src/main/java/com/ibeetl/admin/core/web/CoreDictController.java
deleted
100644 → 0
View file @
e27ca5d7
package
com.ibeetl.admin.core.web
;
import
java.util.List
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
com.ibeetl.admin.core.entity.CoreDict
;
import
com.ibeetl.admin.core.service.CoreDictService
;
import
com.ibeetl.admin.core.service.CorePlatformService
;
@Controller
@SuppressWarnings
(
"unchecked"
)
public
class
CoreDictController
{
private
final
Log
log
=
LogFactory
.
getLog
(
this
.
getClass
());
private
static
final
String
MODEL
=
"/core/dict"
;
@Autowired
CorePlatformService
platformService
;
@Autowired
CoreDictService
dictService
;
/**
* 查看字典类型对应的列表
*
* @param type
* @return
*/
@RequestMapping
(
MODEL
+
"/view.json"
)
@ResponseBody
public
JsonResult
<
List
<
CoreDict
>>
view
(
String
type
)
{
List
<
CoreDict
>
list
=
dictService
.
findAllByType
(
type
);
return
JsonResult
.
success
(
list
);
}
/**
* 查看字典值的子字典
*
* @param value
* @return
*/
@RequestMapping
(
MODEL
+
"/viewChildren.json"
)
@ResponseBody
public
JsonResult
<
List
<
CoreDict
>>
viewChild
(
String
group
,
String
value
)
{
CoreDict
dict
=
dictService
.
findCoreDict
(
group
,
value
);
List
<
CoreDict
>
list
=
dictService
.
findChildByParent
(
dict
.
getId
(),
null
);
return
JsonResult
.
success
(
list
);
}
}
plus-admin/admin-core/src/main/java/com/ibeetl/admin/core/web/CoreUserController.java
deleted
100644 → 0
View file @
e27ca5d7
package
com.ibeetl.admin.core.web
;
import
static
com
.
ibeetl
.
admin
.
core
.
util
.
HttpRequestLocal
.
ACCESS_CURRENT_ORG
;
import
static
com
.
ibeetl
.
admin
.
core
.
util
.
HttpRequestLocal
.
ACCESS_USER_ORGS
;
import
com.ibeetl.admin.core.conf.PasswordConfig.PasswordEncryptService
;
import
com.ibeetl.admin.core.entity.CoreOrg
;
import
com.ibeetl.admin.core.entity.CoreUser
;
import
com.ibeetl.admin.core.rbac.UserLoginInfo
;
import
com.ibeetl.admin.core.rbac.tree.FunctionItem
;
import
com.ibeetl.admin.core.rbac.tree.MenuItem
;
import
com.ibeetl.admin.core.rbac.tree.OrgItem
;
import
com.ibeetl.admin.core.service.CorePlatformService
;
import
com.ibeetl.admin.core.service.CoreUserService
;
import
com.ibeetl.admin.core.util.HttpRequestLocal
;
import
com.ibeetl.admin.core.web.dto.FunctionNodeView
;
import
com.ibeetl.admin.core.web.dto.MenuNodeView
;
import
com.ibeetl.admin.core.web.dto.SystemMenuView
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.Optional
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
@Controller
@SuppressWarnings
(
"unchecked"
)
public
class
CoreUserController
{
private
final
Log
log
=
LogFactory
.
getLog
(
this
.
getClass
());
private
static
final
String
MODEL
=
"/core/user"
;
@Autowired
CorePlatformService
platformService
;
@Autowired
CoreUserService
userService
;
@Autowired
HttpRequestLocal
httpRequestLocal
;
@Autowired
PasswordEncryptService
passwordEncryptService
;
@PostMapping
(
MODEL
+
"/login.json"
)
@ResponseBody
public
JsonResult
<
UserLoginInfo
>
login
(
String
code
,
String
password
)
{
UserLoginInfo
info
=
userService
.
login
(
code
,
password
);
if
(
info
==
null
)
{
return
JsonResult
.
failMessage
(
"用户名密码错"
);
}
CoreUser
user
=
info
.
getUser
();
CoreOrg
currentOrg
=
info
.
getOrgs
().
get
(
0
);
for
(
CoreOrg
org
:
info
.
getOrgs
())
{
Long
orgId
=
user
.
getOrgId
();
if
(
org
.
getId
().
equals
(
orgId
))
{
currentOrg
=
org
;
break
;
}
}
info
.
setCurrentOrg
(
currentOrg
);
// 记录登录信息到session
this
.
platformService
.
setLoginUser
(
info
.
getUser
(),
info
.
getCurrentOrg
(),
info
.
getOrgs
());
return
JsonResult
.
success
(
info
);
}
/**
* 用户所在部门
*
* @return
*/
@PostMapping
(
MODEL
+
"/myOrgs.json"
)
@ResponseBody
public
JsonResult
<
List
<
CoreOrg
>>
myOrgs
()
{
List
<
CoreOrg
>
orgs
=
(
List
<
CoreOrg
>)
httpRequestLocal
.
getSessionValue
(
ACCESS_USER_ORGS
);
return
JsonResult
.
success
(
orgs
);
}
/**
* 切换部门
*
* @param orgId
* @return
*/
@PostMapping
(
MODEL
+
"/setOrg.json"
)
@ResponseBody
public
JsonResult
login
(
Long
orgId
)
{
CoreUser
user
=
platformService
.
getCurrentUser
();
// 检查是否存在orgId
List
<
CoreOrg
>
orgs
=
platformService
.
getCurrentOrgs
();
CoreOrg
currentOrg
=
null
;
for
(
CoreOrg
org
:
orgs
)
{
if
(
orgId
==
org
.
getId
())
{
currentOrg
=
org
;
break
;
}
}
if
(
currentOrg
==
null
)
{
// 非法切换
return
JsonResult
.
failMessage
(
"切换到不存在的部门"
);
}
httpRequestLocal
.
setSessionValue
(
ACCESS_CURRENT_ORG
,
currentOrg
);
return
JsonResult
.
success
();
}
@PostMapping
(
MODEL
+
"/changePassword.json"
)
@ResponseBody
public
JsonResult
chnagePassword
(
String
password
,
String
newPassword
)
{
CoreUser
temp
=
platformService
.
getCurrentUser
();
CoreUser
realUser
=
userService
.
getUserById
(
temp
.
getId
());
String
pwd
=
passwordEncryptService
.
password
(
password
);
if
(
realUser
.
getPassword
().
equals
(
pwd
))
{
realUser
.
setPassword
(
passwordEncryptService
.
password
(
newPassword
));
userService
.
update
(
realUser
);
return
JsonResult
.
success
();
}
else
{
return
JsonResult
.
failMessage
(
"密码错误"
);
}
}
/**
* 用户能查看的菜单
*
* @return
*/
@PostMapping
(
MODEL
+
"/menu/menuTree.json"
)
@ResponseBody
public
JsonResult
<
List
<
MenuNodeView
>>
menus
()
{
CoreUser
currentUser
=
platformService
.
getCurrentUser
();
Long
orgId
=
platformService
.
getCurrentOrgId
();
MenuItem
item
=
platformService
.
getMenuItem
(
currentUser
.
getId
(),
orgId
);
List
<
MenuNodeView
>
view
=
this
.
build
(
item
);
return
JsonResult
.
success
(
view
);
}
/**
* 获取系统
*
* @return
*/
@PostMapping
(
MODEL
+
"/menu/system.json"
)
@ResponseBody
public
JsonResult
<
List
<
SystemMenuView
>>
getSystem
()
{
CoreUser
currentUser
=
platformService
.
getCurrentUser
();
Long
orgId
=
platformService
.
getCurrentOrgId
();
MenuItem
menuItem
=
platformService
.
getMenuItem
(
currentUser
.
getId
(),
orgId
);
List
<
MenuItem
>
list
=
menuItem
.
getChildren
();
List
<
SystemMenuView
>
systems
=
new
ArrayList
<
SystemMenuView
>();
for
(
MenuItem
item
:
list
)
{
systems
.
add
(
new
SystemMenuView
(
item
.
getId
(),
item
.
getData
().
getCode
(),
item
.
getData
().
getName
()));
}
return
JsonResult
.
success
(
systems
);
}
/**
* 获取系统对应的菜单树
*
* @return
*/
@PostMapping
(
MODEL
+
"/menu/systemMenu.json"
)
@ResponseBody
public
JsonResult
<
List
<
MenuNodeView
>>
getMenuBySystem
(
long
systemId
)
{
CoreUser
currentUser
=
platformService
.
getCurrentUser
();
Long
orgId
=
platformService
.
getCurrentOrgId
();
MenuItem
menuItem
=
platformService
.
getMenuItem
(
currentUser
.
getId
(),
orgId
);
MenuItem
item
=
menuItem
.
findChild
(
systemId
);
List
<
MenuNodeView
>
view
=
this
.
build
(
item
);
return
JsonResult
.
success
(
view
);
}
/**
* 用户所在公司的组织机构树
*
* @return
*/
@PostMapping
(
MODEL
+
"/org.json"
)
@ResponseBody
public
JsonResult
<
OrgItem
>
getUserCompany
()
{
OrgItem
orgItem
=
platformService
.
getUserOrgTree
();
return
JsonResult
.
success
(
orgItem
);
}
/**
* 获取系统的菜单树
*
* @return
*/
@PostMapping
(
MODEL
+
"/menu/tree.json"
)
@ResponseBody
public
JsonResult
<
List
<
MenuNodeView
>>
getMenuTree
()
{
MenuItem
menuItem
=
platformService
.
buildMenu
();
List
<
MenuNodeView
>
view
=
this
.
build
(
menuItem
);
return
JsonResult
.
success
(
view
);
}
/**
* 获取功能点树
*
* @return
*/
@PostMapping
(
MODEL
+
"/function/tree.json"
)
@ResponseBody
public
JsonResult
<
List
<
FunctionNodeView
>>
getFunctionTree
()
{
FunctionItem
root
=
this
.
platformService
.
buildFunction
();
List
<
FunctionNodeView
>
tree
=
buildFunctionTree
(
root
);
return
JsonResult
.
success
(
tree
);
}
private
List
<
MenuNodeView
>
build
(
MenuItem
node
)
{
List
<
MenuItem
>
list
=
node
.
getChildren
();
if
(
list
.
size
()
==
0
)
{
return
Collections
.
EMPTY_LIST
;
}
List
<
MenuNodeView
>
views
=
new
ArrayList
<
MenuNodeView
>(
list
.
size
());
for
(
MenuItem
item
:
list
)
{
MenuNodeView
view
=
new
MenuNodeView
();
view
.
setCode
(
item
.
getData
().
getCode
());
view
.
setName
(
item
.
getData
().
getName
());
view
.
setIcon
(
item
.
getData
().
getIcon
());
view
.
setId
(
item
.
getData
().
getId
());
view
.
setPath
((
String
)
item
.
getData
().
get
(
"accessUrl"
));
List
<
MenuNodeView
>
children
=
this
.
build
(
item
);
view
.
setChildren
(
children
);
views
.
add
(
view
);
}
return
views
;
}
private
List
<
FunctionNodeView
>
buildFunctionTree
(
FunctionItem
node
)
{
List
<
FunctionItem
>
list
=
node
.
getChildren
();
if
(
list
.
size
()
==
0
)
{
return
Collections
.
EMPTY_LIST
;
}
List
<
FunctionNodeView
>
views
=
new
ArrayList
<
FunctionNodeView
>(
list
.
size
());
for
(
FunctionItem
item
:
list
)
{
FunctionNodeView
view
=
new
FunctionNodeView
();
view
.
setCode
(
item
.
getData
().
getCode
());
view
.
setName
(
item
.
getData
().
getName
());
view
.
setId
(
item
.
getData
().
getId
());
view
.
setAccessUrl
(
item
.
getData
().
getAccessUrl
());
List
<
FunctionNodeView
>
children
=
this
.
buildFunctionTree
(
item
);
view
.
setChildren
(
children
);
views
.
add
(
view
);
}
return
views
;
}
}
plus-admin/admin-core/src/main/java/com/ibeetl/admin/core/web/IndexController.java
deleted
100644 → 0
View file @
e27ca5d7
package
com.ibeetl.admin.core.web
;
import
cn.hutool.core.map.MapUtil
;
import
com.ibeetl.admin.core.annotation.RequestBodyPlus
;
import
com.ibeetl.admin.core.entity.CoreOrg
;
import
com.ibeetl.admin.core.entity.CoreUser
;
import
com.ibeetl.admin.core.rbac.UserLoginInfo
;
import
com.ibeetl.admin.core.rbac.tree.MenuItem
;
import
com.ibeetl.admin.core.service.CorePlatformService
;
import
com.ibeetl.admin.core.service.CoreUserService
;
import
com.ibeetl.admin.core.util.HttpRequestLocal
;
import
com.ibeetl.admin.core.util.JoseJwtUtil
;
import
com.ibeetl.admin.core.util.PlatformException
;
import
java.util.Enumeration
;
import
java.util.Map
;
import
java.util.Optional
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpSession
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.servlet.ModelAndView
;
@Controller
public
class
IndexController
{
@Autowired
CorePlatformService
platformService
;
@Autowired
CoreUserService
userService
;
@Autowired
HttpRequestLocal
httpRequestLocal
;
@RequestMapping
(
"/"
)
public
ModelAndView
login
()
{
ModelAndView
view
=
new
ModelAndView
(
"/login.html"
);
return
view
;
}
@PostMapping
(
"/login.do"
)
public
ModelAndView
login
(
String
code
,
String
password
)
{
UserLoginInfo
info
=
userService
.
login
(
code
,
password
);
if
(
info
==
null
)
{
throw
new
PlatformException
(
"用户名密码错"
);
}
CoreUser
user
=
info
.
getUser
();
CoreOrg
currentOrg
=
info
.
getOrgs
().
get
(
0
);
for
(
CoreOrg
org
:
info
.
getOrgs
())
{
Long
orgId
=
user
.
getOrgId
();
if
(
org
.
getId
().
equals
(
orgId
))
{
currentOrg
=
org
;
break
;
}
}
info
.
setCurrentOrg
(
currentOrg
);
// 记录登录信息到session
this
.
platformService
.
setLoginUser
(
info
.
getUser
(),
info
.
getCurrentOrg
(),
info
.
getOrgs
());
ModelAndView
view
=
new
ModelAndView
(
"redirect:/index.do"
);
return
view
;
}
@RequestMapping
(
"/index.do"
)
public
ModelAndView
index
()
{
ModelAndView
view
=
new
ModelAndView
(
"/index.html"
);
CoreUser
currentUser
=
platformService
.
getCurrentUser
();
Long
orgId
=
platformService
.
getCurrentOrgId
();
MenuItem
menuItem
=
platformService
.
getMenuItem
(
currentUser
.
getId
(),
orgId
);
view
.
addObject
(
"menus"
,
menuItem
);
return
view
;
}
@RequestMapping
(
"/logout.do"
)
public
ModelAndView
logout
(
HttpServletRequest
request
)
{
HttpSession
session
=
request
.
getSession
();
Enumeration
eum
=
session
.
getAttributeNames
();
while
(
eum
.
hasMoreElements
())
{
String
key
=
(
String
)
eum
.
nextElement
();
session
.
removeAttribute
(
key
);
}
ModelAndView
view
=
new
ModelAndView
(
"redirect:/"
);
return
view
;
}
@RequestMapping
(
"/changeOrg.do"
)
public
ModelAndView
changeOrg
(
HttpServletRequest
request
,
Long
orgId
)
{
platformService
.
changeOrg
(
orgId
);
ModelAndView
view
=
new
ModelAndView
(
"redirect:/index.do"
);
return
view
;
}
}
plus-admin/admin-core/src/main/java/com/ibeetl/admin/core/web/UserLoginElController.java
View file @
67bb8798
...
...
@@ -18,8 +18,10 @@ import java.util.Optional;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
@RequestMapping
(
"core/user"
)
@RestController
public
class
UserLoginElController
{
...
...
@@ -32,7 +34,7 @@ public class UserLoginElController {
return
JsonResult
.
success
(
roleRoutesService
.
getRoutes
());
}
@GetMapping
(
"/
user/
info"
)
@GetMapping
(
"/info"
)
public
JsonResult
info
()
{
CoreOrg
currentOrg
=
HttpRequestLocal
.
getAccessCurrentOrg
();
CoreUser
currentUser
=
HttpRequestLocal
.
getAccessCurrentUser
();
...
...
@@ -45,7 +47,7 @@ public class UserLoginElController {
return
JsonResult
.
success
(
userRoleInfo
);
}
@PostMapping
(
"/
user/
login"
)
@PostMapping
(
"/login"
)
public
JsonResult
loginEle
(
@RequestBodyPlus
(
"username"
)
String
username
,
@RequestBodyPlus
(
"password"
)
String
password
)
{
UserLoginInfo
info
=
coreUserService
.
login
(
username
,
password
);
...
...
@@ -73,7 +75,7 @@ public class UserLoginElController {
return
JsonResult
.
success
(
resultMap
);
}
@PostMapping
(
"/
user/
logout"
)
@PostMapping
(
"/logout"
)
public
JsonResult
logout
()
{
HttpRequestLocal
.
clearAllSession
();
return
JsonResult
.
success
();
...
...
plus-admin/admin-core/src/main/resources/sql/core/coreFunction.md
View file @
67bb8798
...
...
@@ -13,9 +13,9 @@ select menu.id,
func
.
COMPONENT
component
,
role_menu
.
ROLE_ID
from
core_menu
menu
left
join
core_function
func
on
func
.
ID
=
menu
.
FUNCTION_ID
and
menu
.
DEL_FLAG
=
0
left
join
core_function
func
on
func
.
ID
=
menu
.
FUNCTION_ID
left
join
core_role_menu
role_menu
on
role_menu
.
MENU_ID
=
menu
.
id
where
menu
.
DEL_FLAG
=
0
```
@ mapping("RouteMapping");
...
...
ve-admin/admin-web/src/api/dicts.js
→
ve-admin/admin-web/src/api/
admin_
dicts.js
View file @
67bb8798
/*
* @Author: 一日看尽长安花
* @since: 2019-09-04 20:55:14
* @LastEditTime: 2020-0
7-26 15:22:32
* @LastEditTime: 2020-0
8-02 14:13:21
* @LastEditors: 一日看尽长安花
* @Description:
*/
...
...
ve-admin/admin-web/src/api/func.js
→
ve-admin/admin-web/src/api/
admin_
func
s
.js
View file @
67bb8798
/*
* @Author: 一日看尽长安花
* @since: 2020-05-31 14:38:23
* @LastEditTime: 2020-0
6
-0
7
1
8:30:54
* @LastEditTime: 2020-0
8
-0
2
1
4:15:21
* @LastEditors: 一日看尽长安花
* @Description:
*/
...
...
@@ -13,7 +13,7 @@ import request from '@/utils/request';
*/
export
function
funcs
(
params
)
{
return
request
({
url
:
'
/functions
'
,
url
:
'
/
admin/
functions
'
,
method
:
'
get
'
,
params
});
...
...
@@ -25,7 +25,7 @@ export function funcs(params) {
*/
export
function
createFuncNode
(
params
)
{
return
request
({
url
:
'
/functions
'
,
url
:
'
/
admin/
functions
'
,
method
:
'
post
'
,
params
});
...
...
@@ -36,7 +36,7 @@ export function createFuncNode(params) {
*/
export
function
updateFuncNode
(
params
)
{
return
request
({
url
:
'
/functions
'
,
url
:
'
/
admin/
functions
'
,
method
:
'
put
'
,
params
});
...
...
@@ -47,7 +47,7 @@ export function updateFuncNode(params) {
*/
export
function
delFuncNodesByParent
(
params
)
{
return
request
({
url
:
'
/functions
'
,
url
:
'
/
admin/
functions
'
,
method
:
'
delete
'
,
params
});
...
...
ve-admin/admin-web/src/api/menu.js
→
ve-admin/admin-web/src/api/
admin_
menu
s
.js
View file @
67bb8798
/*
* @Author: 一日看尽长安花
* @since: 2020-05-31 14:38:23
* @LastEditTime: 2020-0
6-13 12:42:08
* @LastEditTime: 2020-0
8-02 14:14:29
* @LastEditors: 一日看尽长安花
* @Description:
*/
...
...
@@ -13,7 +13,7 @@ import request from '@/utils/request';
*/
export
function
menus
(
params
)
{
return
request
({
url
:
'
/menus
'
,
url
:
'
/
admin/
menus
'
,
method
:
'
get
'
,
params
});
...
...
@@ -25,7 +25,7 @@ export function menus(params) {
*/
export
function
createMenuItem
(
params
)
{
return
request
({
url
:
'
/menus
'
,
url
:
'
/
admin/
menus
'
,
method
:
'
post
'
,
params
});
...
...
@@ -36,7 +36,7 @@ export function createMenuItem(params) {
*/
export
function
updateMenuItem
(
params
)
{
return
request
({
url
:
'
/menus
'
,
url
:
'
/
admin/
menus
'
,
method
:
'
put
'
,
params
});
...
...
@@ -47,7 +47,7 @@ export function updateMenuItem(params) {
*/
export
function
delMenuItemsByParent
(
params
)
{
return
request
({
url
:
'
/menus
'
,
url
:
'
/
admin/
menus
'
,
method
:
'
delete
'
,
params
});
...
...
ve-admin/admin-web/src/api/admin_orgs.js
0 → 100644
View file @
67bb8798
/*
* @Author: 一日看尽长安花
* @since: 2019-09-04 20:55:14
* @LastEditTime: 2020-08-02 14:12:55
* @LastEditors: 一日看尽长安花
* @Description:
*/
import
request
from
'
@/utils/request
'
;
export
function
getOrgs
(
params
)
{
return
request
({
url
:
'
/admin/orgs/list
'
,
method
:
'
get
'
,
params
});
}
export
function
getOrgById
(
params
)
{
return
request
({
url
:
`/admin/orgs/
${
params
.
id
}
`
,
method
:
'
get
'
});
}
export
function
saveOrgData
(
data
)
{
return
request
({
url
:
'
/admin/orgs/add
'
,
method
:
'
post
'
,
data
});
}
export
function
updateOrgData
(
data
)
{
return
request
({
url
:
'
/admin/orgs/update
'
,
method
:
'
put
'
,
data
});
}
export
function
deleteOrgData
(
data
)
{
return
request
({
url
:
'
/admin/orgs/delete
'
,
method
:
'
delete
'
,
data
});
}
ve-admin/admin-web/src/api/roles.js
→
ve-admin/admin-web/src/api/
admin_
roles.js
View file @
67bb8798
/*
* @Author: 一日看尽长安花
* @since: 2019-09-04 20:55:14
* @LastEditTime: 2020-08-
02 12:57:52
* @LastEditTime: 2020-08-
15 21:07:35
* @LastEditors: 一日看尽长安花
* @Description:
*/
...
...
@@ -14,6 +14,23 @@ export function getRoles(params) {
params
});
}
export
function
getFunctionIdsByRole
(
params
)
{
return
request
({
url
:
'
/admin/roles/function/ids
'
,
method
:
'
get
'
,
params
});
}
export
function
updateRoleFunctions
(
data
)
{
return
request
({
url
:
'
/admin/roles/function/update
'
,
method
:
'
put
'
,
data
});
}
export
function
getRoleById
(
params
)
{
return
request
({
url
:
`/admin/roles/
${
params
.
id
}
`
,
...
...
@@ -36,6 +53,7 @@ export function updateRoleData(data) {
data
});
}
export
function
deleteRoleData
(
data
)
{
return
request
({
url
:
'
/admin/roles/delete
'
,
...
...
@@ -43,3 +61,19 @@ export function deleteRoleData(data) {
data
});
}
export
function
getRoleDataFunctions
(
params
)
{
return
request
({
url
:
'
/admin/roles/data_function/list
'
,
method
:
'
get
'
,
params
});
}
export
function
saveRoleDataFunction
(
data
)
{
return
request
({
url
:
'
/admin/roles/data_function/updateDataAccess
'
,
method
:
'
post
'
,
data
});
}
ve-admin/admin-web/src/api/user.js
→
ve-admin/admin-web/src/api/
admin_
user
s
.js
View file @
67bb8798
/*
* @Author: 一日看尽长安花
* @since: 2019-09-04 20:55:14
* @LastEditTime: 2020-0
4-27 14:58:13
* @LastEditTime: 2020-0
8-02 14:10:48
* @LastEditors: 一日看尽长安花
* @Description:
*/
...
...
@@ -9,7 +9,7 @@ import request from '@/utils/request';
export
function
login
(
data
)
{
return
request
({
url
:
'
/user/login
'
,
url
:
'
/
core/
user/login
'
,
method
:
'
post
'
,
data
});
...
...
@@ -17,7 +17,7 @@ export function login(data) {
/*用于vue-store中使用,获取当前用户的信息*/
export
function
getInfo
(
token
)
{
return
request
({
url
:
'
/user/info
'
,
url
:
'
/
core/
user/info
'
,
method
:
'
get
'
// params: { token }
});
...
...
@@ -25,7 +25,7 @@ export function getInfo(token) {
export
function
logout
()
{
return
request
({
url
:
'
/user/logout
'
,
url
:
'
/
core/
user/logout
'
,
method
:
'
post
'
});
}
...
...
@@ -36,7 +36,7 @@ export function logout() {
*/
export
function
users
(
params
)
{
return
request
({
url
:
'
/users
'
,
url
:
'
/
admin/
users
'
,
method
:
'
get
'
,
params
});
...
...
@@ -47,21 +47,21 @@ export function users(params) {
*/
export
function
getUserById
(
params
)
{
return
request
({
url
:
`/users/
${
params
.
id
}
`
,
url
:
`/
admin/
users/
${
params
.
id
}
`
,
method
:
'
get
'
});
}
export
function
usersMetadata
()
{
return
request
({
url
:
'
/users/metadata
'
,
url
:
'
/
admin/
users/metadata
'
,
method
:
'
get
'
});
}
export
function
saveUserData
(
data
)
{
return
request
({
url
:
'
/users
'
,
url
:
'
/
admin/
users
'
,
method
:
'
post
'
,
data
});
...
...
@@ -69,7 +69,7 @@ export function saveUserData(data) {
export
function
updateUserData
(
data
)
{
return
request
({
url
:
'
/users
'
,
url
:
'
/
admin/
users
'
,
method
:
'
put
'
,
data
});
...
...
@@ -80,7 +80,7 @@ export function updateUserData(data) {
*/
export
function
deleteUserData
(
data
)
{
return
request
({
url
:
'
/users
'
,
url
:
'
/
admin/
users
'
,
method
:
'
delete
'
,
data
});
...
...
@@ -91,7 +91,7 @@ export function deleteUserData(data) {
*/
export
function
exportExcelUserData
(
data
)
{
return
request
({
url
:
'
/users/excel/export
'
,
url
:
'
/
admin/
users/excel/export
'
,
method
:
'
post
'
,
data
});
...
...
@@ -102,7 +102,7 @@ export function exportExcelUserData(data) {
*/
export
function
getUserRoles
(
params
)
{
return
request
({
url
:
'
/users/roles
'
,
url
:
'
/
admin/
users/roles
'
,
method
:
'
get
'
,
params
});
...
...
@@ -113,7 +113,7 @@ export function getUserRoles(params) {
*/
export
function
addUserRoles
(
data
)
{
return
request
({
url
:
'
/users/roles
'
,
url
:
'
/
admin/
users/roles
'
,
method
:
'
post
'
,
data
});
...
...
@@ -125,7 +125,7 @@ export function addUserRoles(data) {
*/
export
function
deleteUserRoles
(
data
)
{
return
request
({
url
:
'
/users/roles
'
,
url
:
'
/
admin/
users/roles
'
,
method
:
'
delete
'
,
data
});
...
...
@@ -137,7 +137,7 @@ export function deleteUserRoles(data) {
*/
export
function
changePassword
(
data
)
{
return
request
({
url
:
'
/users/changePassword
'
,
url
:
'
/
admin/
users/changePassword
'
,
method
:
'
post
'
,
data
});
...
...
ve-admin/admin-web/src/api/dict.js
→
ve-admin/admin-web/src/api/
core_
dict.js
View file @
67bb8798
/*
* @Author: 一日看尽长安花
* @since: 2019-09-04 20:55:14
* @LastEditTime
: 2020-0
2
-0
4
14:
50:26
* @LastEditors
: 一日看尽长安花
* @LastEditTime: 2020-0
8
-0
2
14:
16:39
* @LastEditors: 一日看尽长安花
* @Description:
*/
import
request
from
'
@/utils/request
'
;
...
...
ve-admin/admin-web/src/api/file.js
→
ve-admin/admin-web/src/api/
core_
file.js
View file @
67bb8798
File moved
ve-admin/admin-web/src/api/org.js
→
ve-admin/admin-web/src/api/
core_
org.js
View file @
67bb8798
File moved
ve-admin/admin-web/src/api/role.js
→
ve-admin/admin-web/src/api/
core_
role.js
View file @
67bb8798
/*
* @Author: 一日看尽长安花
* @since: 2019-12-01 11:03:53
* @LastEditTime: 2020-08-02 14:08:43
* @LastEditors: 一日看尽长安花
* @Description:
*/
import
request
from
'
@/utils/request
'
;
export
function
getRoutes
()
{
return
request
({
url
:
'
/routes
'
,
url
:
'
/
core/user/
routes
'
,
method
:
'
get
'
});
}
...
...
ve-admin/admin-web/src/components/Upload/FileUpload.vue
View file @
67bb8798
...
...
@@ -47,7 +47,7 @@
<
script
>
import
{
v4
as
uuidv4
}
from
'
uuid
'
;
import
request
from
'
@/utils/request
'
;
import
{
getFileList
}
from
'
@/api/file
'
;
import
{
getFileList
}
from
'
@/api/
core_
file
'
;
export
default
{
name
:
'
FileUpload
'
,
...
...
ve-admin/admin-web/src/services/dict.js
View file @
67bb8798
...
...
@@ -5,7 +5,7 @@
* @LastEditors: 一日看尽长安花
* @Description: 与业务有关的非纯api的js
*/
import
{
layzyLoadDicts
,
immaditeLoadDicts
}
from
'
@/api/dict
'
;
import
{
layzyLoadDicts
,
immaditeLoadDicts
}
from
'
@/api/
core_
dict
'
;
import
{
assignIn
,
get
,
omit
}
from
'
lodash
'
;
/**
...
...
Prev
1
2
3
Next
Write
Preview
Supports
Markdown
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