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
e27ca5d7
"source/git@ustchcs.com:wq123/test.git" did not exist on "895a14769bc1cdb32dd69b3cc1db0af7a94862be"
Commit
e27ca5d7
authored
Aug 02, 2020
by
trumansdo
Browse files
去除原有管理系统页面,开始清理调整架构
parent
6833044a
Changes
250
Hide whitespace changes
Inline
Side-by-side
plus-admin/admin-console/src/main/java/com/ibeetl/admin/console/web/AuditConsoleController.java
deleted
100644 → 0
View file @
6833044a
package
com.ibeetl.admin.console.web
;
import
java.util.List
;
import
java.util.Map
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.beetl.sql.core.engine.PageQuery
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
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.ResponseBody
;
import
org.springframework.web.servlet.ModelAndView
;
import
com.ibeetl.admin.console.service.AuditConsoleService
;
import
com.ibeetl.admin.console.web.query.AuditQuery
;
import
com.ibeetl.admin.console.web.query.UserQuery
;
import
com.ibeetl.admin.core.annotation.Function
;
import
com.ibeetl.admin.core.annotation.Query
;
import
com.ibeetl.admin.core.entity.CoreAudit
;
import
com.ibeetl.admin.core.util.AnnotationUtil
;
import
com.ibeetl.admin.core.web.JsonResult
;
/**
* 用户管理接口
*
* @author xiandafu
*/
@Controller
public
class
AuditConsoleController
{
private
final
Log
log
=
LogFactory
.
getLog
(
this
.
getClass
());
private
static
final
String
MODEL
=
"/admin/audit"
;
@Autowired
AuditConsoleService
auditConsoleService
;
/*页面*/
@GetMapping
(
MODEL
+
"/index.do"
)
@Function
(
"trace"
)
public
ModelAndView
index
()
{
ModelAndView
view
=
new
ModelAndView
(
"/admin/audit/index.html"
);
view
.
addObject
(
"search"
,
AuditQuery
.
class
.
getName
());
return
view
;
}
/*Json*/
@PostMapping
(
MODEL
+
"/view.json"
)
@ResponseBody
@Function
(
"trace"
)
public
JsonResult
<
CoreAudit
>
view
(
Long
id
)
{
CoreAudit
audit
=
auditConsoleService
.
queryById
(
id
);
return
JsonResult
.
success
(
audit
);
}
@RequestMapping
(
MODEL
+
"/list.json"
)
@Function
(
"trace"
)
@ResponseBody
public
JsonResult
<
PageQuery
<
CoreAudit
>>
list
(
AuditQuery
condtion
)
{
PageQuery
<
CoreAudit
>
page
=
condtion
.
getPageQuery
();
auditConsoleService
.
queryByCondtion
(
page
);
return
JsonResult
.
success
(
page
);
}
@PostMapping
(
MODEL
+
"/list/condition.json"
)
@Function
(
"trace"
)
@ResponseBody
public
JsonResult
<
List
<
Map
<
String
,
Object
>>>
listCondtion
()
{
List
<
Map
<
String
,
Object
>>
list
=
AnnotationUtil
.
getInstance
().
getAnnotations
(
Query
.
class
,
AuditQuery
.
class
);
return
JsonResult
.
success
(
list
);
}
}
plus-admin/admin-console/src/main/java/com/ibeetl/admin/console/web/DictConsoleController.java
deleted
100644 → 0
View file @
6833044a
package
com.ibeetl.admin.console.web
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
javax.servlet.http.HttpServletResponse
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.beetl.sql.core.engine.PageQuery
;
import
org.jxls.common.Context
;
import
org.jxls.reader.ReaderBuilder
;
import
org.jxls.reader.ReaderConfig
;
import
org.jxls.reader.XLSReadMessage
;
import
org.jxls.reader.XLSReadStatus
;
import
org.jxls.reader.XLSReader
;
import
org.jxls.util.JxlsHelper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.servlet.ModelAndView
;
import
com.ibeetl.admin.console.service.DictConsoleService
;
import
com.ibeetl.admin.console.web.dto.DictExcelImportData
;
import
com.ibeetl.admin.console.web.query.CoreDictQuery
;
import
com.ibeetl.admin.core.annotation.Function
;
import
com.ibeetl.admin.core.entity.CoreDict
;
import
com.ibeetl.admin.core.entity.CoreUser
;
import
com.ibeetl.admin.core.file.FileItem
;
import
com.ibeetl.admin.core.file.FileService
;
import
com.ibeetl.admin.core.service.CorePlatformService
;
import
com.ibeetl.admin.core.util.ConvertUtil
;
import
com.ibeetl.admin.core.util.PlatformException
;
import
com.ibeetl.admin.core.util.ValidateConfig
;
import
com.ibeetl.admin.core.web.JsonResult
;
/** CoreDict 接口 */
@Controller
public
class
DictConsoleController
{
private
final
Log
log
=
LogFactory
.
getLog
(
this
.
getClass
());
private
static
final
String
MODEL
=
"/admin/dict"
;
@Autowired
private
DictConsoleService
dictService
;
@Autowired
FileService
fileService
;
@Autowired
CorePlatformService
platformService
=
null
;
/* 页面 */
@GetMapping
(
MODEL
+
"/index.do"
)
@Function
(
"dict.query"
)
public
ModelAndView
index
()
{
ModelAndView
view
=
new
ModelAndView
(
"/admin/dict/index.html"
);
view
.
addObject
(
"search"
,
CoreDictQuery
.
class
.
getName
());
return
view
;
}
@GetMapping
(
MODEL
+
"/edit.do"
)
@Function
(
"dict.edit"
)
public
ModelAndView
edit
(
Long
id
)
{
ModelAndView
view
=
new
ModelAndView
(
"/admin/dict/edit.html"
);
CoreDict
dict
=
dictService
.
queryById
(
id
);
view
.
addObject
(
"dict"
,
dict
);
return
view
;
}
@GetMapping
(
MODEL
+
"/add.do"
)
@Function
(
"dict.add"
)
public
ModelAndView
add
()
{
ModelAndView
view
=
new
ModelAndView
(
"/admin/dict/add.html"
);
return
view
;
}
/* ajax json */
@PostMapping
(
MODEL
+
"/list.json"
)
@Function
(
"dict.query"
)
@ResponseBody
public
JsonResult
<
PageQuery
>
list
(
CoreDictQuery
condtion
)
{
PageQuery
page
=
condtion
.
getPageQuery
();
dictService
.
queryByCondition
(
page
);
return
JsonResult
.
success
(
page
);
}
@PostMapping
(
MODEL
+
"/add.json"
)
@Function
(
"dict.add"
)
@ResponseBody
public
JsonResult
add
(
@Validated
(
ValidateConfig
.
ADD
.
class
)
CoreDict
dict
)
{
dict
.
setCreateTime
(
new
Date
());
dictService
.
save
(
dict
);
platformService
.
clearDictCache
();
return
JsonResult
.
success
();
}
@PostMapping
(
MODEL
+
"/update.json"
)
@Function
(
"dict.update"
)
@ResponseBody
public
JsonResult
<
String
>
update
(
@Validated
(
ValidateConfig
.
UPDATE
.
class
)
CoreDict
dict
)
{
boolean
success
=
dictService
.
update
(
dict
);
if
(
success
)
{
platformService
.
clearDictCache
();
return
JsonResult
.
success
();
}
else
{
return
JsonResult
.
failMessage
(
"保存失败"
);
}
}
@GetMapping
(
MODEL
+
"/view.json"
)
@Function
(
"dict.query"
)
@ResponseBody
public
JsonResult
<
CoreDict
>
queryInfo
(
Long
id
)
{
CoreDict
dict
=
dictService
.
queryById
(
id
);
return
JsonResult
.
success
(
dict
);
}
@PostMapping
(
MODEL
+
"/delete.json"
)
@Function
(
"dict.delete"
)
@ResponseBody
public
JsonResult
delete
(
String
ids
)
{
List
<
Long
>
dels
=
ConvertUtil
.
str2longs
(
ids
);
dictService
.
batchDelCoreDict
(
dels
);
platformService
.
clearDictCache
();
return
JsonResult
.
success
();
}
@PostMapping
(
MODEL
+
"/excel/export.json"
)
@Function
(
"dict.export"
)
@ResponseBody
public
JsonResult
<
String
>
export
(
HttpServletResponse
response
,
CoreDictQuery
condtion
)
{
String
excelTemplate
=
"excelTemplates/admin/dict/dict_collection_template.xls"
;
PageQuery
<
CoreUser
>
page
=
condtion
.
getPageQuery
();
// 取出全部符合条件的
page
.
setPageSize
(
Integer
.
MAX_VALUE
);
page
.
setPageNumber
(
1
);
page
.
setTotalRow
(
Integer
.
MAX_VALUE
);
List
<
CoreDict
>
dicts
=
dictService
.
queryExcel
(
page
);
try
(
InputStream
is
=
Thread
.
currentThread
().
getContextClassLoader
().
getResourceAsStream
(
excelTemplate
))
{
if
(
is
==
null
)
{
throw
new
PlatformException
(
"模板资源不存在:"
+
excelTemplate
);
}
FileItem
item
=
fileService
.
createFileTemp
(
"dict_collection.xls"
);
OutputStream
os
=
item
.
openOutpuStream
();
Context
context
=
new
Context
();
context
.
putVar
(
"dicts"
,
dicts
);
JxlsHelper
.
getInstance
().
processTemplate
(
is
,
os
,
context
);
os
.
close
();
// 下载参考FileSystemContorller
return
JsonResult
.
success
(
item
.
getPath
());
}
catch
(
IOException
e
)
{
throw
new
PlatformException
(
e
.
getMessage
());
}
}
@PostMapping
(
MODEL
+
"/excel/import.do"
)
@Function
(
"dict.import"
)
@ResponseBody
public
JsonResult
importExcel
(
@RequestParam
(
"file"
)
MultipartFile
file
)
throws
Exception
{
if
(
file
.
isEmpty
())
{
return
JsonResult
.
fail
();
}
InputStream
ins
=
file
.
getInputStream
();
InputStream
inputXML
=
Thread
.
currentThread
()
.
getContextClassLoader
()
.
getResourceAsStream
(
"excelTemplates/admin/dict/dict_mapping.xml"
);
XLSReader
mainReader
=
ReaderBuilder
.
buildFromXML
(
inputXML
);
InputStream
inputXLS
=
ins
;
List
<
DictExcelImportData
>
dicts
=
new
ArrayList
<
DictExcelImportData
>();
Map
beans
=
new
HashMap
();
beans
.
put
(
"list"
,
dicts
);
ReaderConfig
.
getInstance
().
setSkipErrors
(
true
);
XLSReadStatus
readStatus
=
mainReader
.
read
(
inputXLS
,
beans
);
List
<
XLSReadMessage
>
errors
=
readStatus
.
getReadMessages
();
if
(!
errors
.
isEmpty
())
{
StringBuilder
sb
=
new
StringBuilder
();
for
(
XLSReadMessage
msg
:
errors
)
{
sb
.
append
(
parseXLSReadMessage
(
msg
));
sb
.
append
(
","
);
}
sb
.
setLength
(
sb
.
length
()
-
1
);
return
JsonResult
.
failMessage
(
"解析excel出错:"
+
sb
.
toString
());
}
// this.dictService.batchInsert(dicts);//layui对话框不能正确处理http 500错误,改成下面方式
// return JsonResult.success();
try
{
this
.
dictService
.
batchInsert
(
dicts
);
return
JsonResult
.
success
();
}
catch
(
Exception
ex
)
{
return
JsonResult
.
failMessage
(
ex
.
getMessage
());
}
}
/*xlsReader 设计有问题,还需要通过解析msg知道错误位置在哪里*/
private
String
parseXLSReadMessage
(
XLSReadMessage
msg
)
{
// String message = "Can't read cell " + getCellName(mapping, rowShift) + " on " +
// cursor.getSheetName() + " spreadsheet";
String
str
=
msg
.
getMessage
();
int
start
=
"Can't read cell "
.
length
();
int
end
=
str
.
indexOf
(
"on"
);
return
str
.
substring
(
start
,
end
);
}
}
plus-admin/admin-console/src/main/java/com/ibeetl/admin/console/web/FunctionController.java
deleted
100644 → 0
View file @
6833044a
package
com.ibeetl.admin.console.web
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.beetl.sql.core.engine.PageQuery
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.validation.annotation.Validated
;
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.ResponseBody
;
import
org.springframework.web.servlet.ModelAndView
;
import
com.ibeetl.admin.console.service.FunctionConsoleService
;
import
com.ibeetl.admin.console.web.query.FunctionQuery
;
import
com.ibeetl.admin.core.annotation.Function
;
import
com.ibeetl.admin.core.annotation.Query
;
import
com.ibeetl.admin.core.entity.CoreFunction
;
import
com.ibeetl.admin.core.rbac.tree.FunctionItem
;
import
com.ibeetl.admin.core.service.CorePlatformService
;
import
com.ibeetl.admin.core.util.AnnotationUtil
;
import
com.ibeetl.admin.core.util.ConvertUtil
;
import
com.ibeetl.admin.core.util.FormFieldException
;
import
com.ibeetl.admin.core.util.PlatformException
;
import
com.ibeetl.admin.core.util.ValidateConfig
;
import
com.ibeetl.admin.core.web.JsonResult
;
import
com.ibeetl.admin.core.web.dto.FunctionNodeView
;
/**
* 描述: 功能点管理
*
* @author : lijiazhi
*/
@Controller
public
class
FunctionController
{
private
final
Log
log
=
LogFactory
.
getLog
(
this
.
getClass
());
private
static
final
String
MODEL
=
"/admin/function"
;
@Autowired
CorePlatformService
platformService
;
@Autowired
private
FunctionConsoleService
functionConsoleService
;
/*页面*/
@GetMapping
(
MODEL
+
"/index.do"
)
@Function
(
"function"
)
public
ModelAndView
index
()
{
ModelAndView
view
=
new
ModelAndView
(
"/admin/function/index.html"
);
view
.
addObject
(
"search"
,
FunctionQuery
.
class
.
getName
());
return
view
;
}
@GetMapping
(
MODEL
+
"/add.do"
)
@Function
(
"function.add"
)
public
ModelAndView
add
()
{
ModelAndView
view
=
new
ModelAndView
(
"/admin/function/add.html"
);
return
view
;
}
@GetMapping
(
MODEL
+
"/edit.do"
)
@Function
(
"function.edit"
)
public
ModelAndView
edit
(
Integer
id
)
{
ModelAndView
view
=
new
ModelAndView
(
"/admin/function/edit.html"
);
CoreFunction
function
=
functionConsoleService
.
queryById
(
id
);
view
.
addObject
(
"function"
,
function
);
return
view
;
}
/*Json*/
@RequestMapping
(
MODEL
+
"/add.json"
)
@Function
(
"function.add"
)
@ResponseBody
public
JsonResult
<
CoreFunction
>
addFunction
(
@Validated
(
ValidateConfig
.
ADD
.
class
)
CoreFunction
function
)
{
String
code
=
function
.
getCode
();
CoreFunction
dbFunction
=
functionConsoleService
.
getFunction
(
code
);
if
(
dbFunction
!=
null
)
{
throw
new
FormFieldException
(
CoreFunction
.
class
.
getName
(),
"code"
,
"已经存在"
);
}
if
(
function
.
getParentId
()
==
null
)
{
function
.
setParentId
(
0L
);
}
function
.
setCreateTime
(
new
Date
());
functionConsoleService
.
saveFunction
(
function
);
return
JsonResult
.
success
(
function
);
}
@RequestMapping
(
MODEL
+
"/update.json"
)
@Function
(
"function.update"
)
@ResponseBody
public
JsonResult
<?>
updateFunction
(
@Validated
(
ValidateConfig
.
UPDATE
.
class
)
CoreFunction
function
)
{
CoreFunction
dbFunction
=
functionConsoleService
.
getFunction
(
function
.
getCode
());
if
(
dbFunction
!=
null
&&
!
dbFunction
.
getId
().
equals
(
function
.
getId
()))
{
throw
new
FormFieldException
(
CoreFunction
.
class
.
getName
(),
"code"
,
"已经存在"
);
}
if
(
function
.
getParentId
()
==
null
)
{
function
.
setParentId
(
0L
);
}
// function.setCreateTime(dbFunction.getCreateTime());
functionConsoleService
.
updateFunction
(
function
);
return
JsonResult
.
success
();
}
@RequestMapping
(
MODEL
+
"/view.json"
)
@Function
(
"function.query"
)
@ResponseBody
public
JsonResult
<
CoreFunction
>
getFunction
(
Long
id
)
{
CoreFunction
function
=
functionConsoleService
.
getFunction
(
id
);
if
(
function
.
hasParent
())
{
CoreFunction
parent
=
functionConsoleService
.
getFunction
(
function
.
getParentId
());
function
.
set
(
"parentName"
,
parent
.
getName
());
}
else
{
function
.
set
(
"parentName"
,
""
);
}
functionConsoleService
.
queryEntityAfter
(
function
);
return
JsonResult
.
success
(
function
);
}
@RequestMapping
(
MODEL
+
"/delete.json"
)
@Function
(
"function.delete"
)
@ResponseBody
public
JsonResult
deleteFunction
(
Long
id
)
{
CoreFunction
fun
=
functionConsoleService
.
queryById
(
id
);
if
(
fun
==
null
)
{
throw
new
PlatformException
(
"删除失败,没有找到Function "
+
id
+
"!"
);
}
// 删除功能和所有子功能
functionConsoleService
.
deleteFunction
(
id
);
return
JsonResult
.
success
();
}
/**
* 字典列表 分页
*/
@RequestMapping
(
MODEL
+
"/list.json"
)
@Function
(
"function.query"
)
@ResponseBody
public
JsonResult
<
PageQuery
<
CoreFunction
>>
list
(
FunctionQuery
condtion
)
{
PageQuery
page
=
condtion
.
getPageQuery
();
functionConsoleService
.
queryByCondtion
(
page
);
return
JsonResult
.
success
(
page
);
}
@PostMapping
(
MODEL
+
"/list/condition.json"
)
@Function
(
"function.query"
)
@ResponseBody
public
JsonResult
<
List
<
Map
<
String
,
Object
>>>
listCondtion
()
{
List
<
Map
<
String
,
Object
>>
list
=
AnnotationUtil
.
getInstance
().
getAnnotations
(
Query
.
class
,
FunctionQuery
.
class
);
return
JsonResult
.
success
(
list
);
}
private
List
<
Long
>
findChildFunctionIds
(
Long
funtionId
)
{
FunctionItem
funItem
=
platformService
.
buildFunction
().
findChild
(
funtionId
);
List
<
Long
>
children
=
funItem
.
findAllChildrenId
();
children
.
add
(
funtionId
);
return
children
;
}
@RequestMapping
(
MODEL
+
"/batchDel.json"
)
@Function
(
"function.delete"
)
@ResponseBody
public
JsonResult
batchDel
(
String
ids
)
{
List
<
Long
>
dels
=
ConvertUtil
.
str2longs
(
ids
);
functionConsoleService
.
batchDeleteFunction
(
dels
);
return
JsonResult
.
success
();
}
@PostMapping
(
MODEL
+
"/tree.json"
)
@Function
(
"function.query"
)
@ResponseBody
public
JsonResult
<
List
<
FunctionNodeView
>>
tree
()
{
FunctionItem
root
=
this
.
platformService
.
buildFunction
();
List
<
FunctionNodeView
>
tree
=
buildFunctionTree
(
root
);
return
JsonResult
.
success
(
tree
);
}
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-console/src/main/java/com/ibeetl/admin/console/web/MenuController.java
deleted
100644 → 0
View file @
6833044a
package
com.ibeetl.admin.console.web
;
import
com.ibeetl.admin.console.service.MenuConsoleService
;
import
com.ibeetl.admin.console.web.query.MenuQuery
;
import
com.ibeetl.admin.core.annotation.Function
;
import
com.ibeetl.admin.core.annotation.Query
;
import
com.ibeetl.admin.core.entity.CoreMenu
;
import
com.ibeetl.admin.core.rbac.tree.MenuItem
;
import
com.ibeetl.admin.core.service.CorePlatformService
;
import
com.ibeetl.admin.core.util.AnnotationUtil
;
import
com.ibeetl.admin.core.util.ConvertUtil
;
import
com.ibeetl.admin.core.web.JsonResult
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.beetl.sql.core.engine.PageQuery
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.servlet.ModelAndView
;
/** @author lijiazhi */
@Controller
public
class
MenuController
{
private
static
final
String
MODEL
=
"/admin/menu"
;
private
final
Log
log
=
LogFactory
.
getLog
(
this
.
getClass
());
@Autowired
MenuConsoleService
menuService
;
@Autowired
CorePlatformService
platformService
;
/*页面*/
@GetMapping
(
MODEL
+
"/index.do"
)
@Function
(
"menu"
)
public
ModelAndView
index
()
{
ModelAndView
view
=
new
ModelAndView
(
"/admin/menu/index.html"
);
view
.
addObject
(
"search"
,
MenuQuery
.
class
.
getName
());
return
view
;
}
@GetMapping
(
MODEL
+
"/add.do"
)
@Function
(
"menu.add"
)
public
ModelAndView
add
()
{
ModelAndView
view
=
new
ModelAndView
(
"/admin/menu/add.html"
);
return
view
;
}
@GetMapping
(
MODEL
+
"/edit.do"
)
@Function
(
"menu.edit"
)
public
ModelAndView
edit
(
Integer
id
)
{
ModelAndView
view
=
new
ModelAndView
(
"/admin/menu/edit.html"
);
CoreMenu
menu
=
menuService
.
queryById
(
id
);
view
.
addObject
(
"menu"
,
menu
);
return
view
;
}
/*Json*/
/**
* 查询
*
* @return
*/
@PostMapping
(
MODEL
+
"/list/condition.json"
)
@Function
(
"menu.query"
)
@ResponseBody
public
JsonResult
condition
()
{
List
<
Map
<
String
,
Object
>>
list
=
AnnotationUtil
.
getInstance
().
getAnnotations
(
Query
.
class
,
MenuQuery
.
class
);
return
JsonResult
.
success
(
list
);
}
@PostMapping
(
MODEL
+
"/list.json"
)
@Function
(
"menu.query"
)
@ResponseBody
public
JsonResult
<
PageQuery
>
list
(
MenuQuery
condtion
)
{
PageQuery
page
=
condtion
.
getPageQuery
();
menuService
.
queryByCondtion
(
page
);
return
JsonResult
.
success
(
page
);
}
/**
* 添加
*
* @param menu
* @return
*/
@PostMapping
(
MODEL
+
"/save.json"
)
@Function
(
"menu.save"
)
@ResponseBody
public
JsonResult
save
(
@Validated
CoreMenu
menu
)
{
menu
.
setCreateTime
(
new
Date
());
Long
id
=
menuService
.
saveMenu
(
menu
);
return
JsonResult
.
success
(
id
);
}
/**
* 更新
*
* @param fun
* @return
*/
@PostMapping
(
MODEL
+
"/update.json"
)
@Function
(
"menu.update"
)
@ResponseBody
public
JsonResult
update
(
CoreMenu
fun
)
{
menuService
.
updateMenu
(
fun
);
return
JsonResult
.
success
();
}
/**
* 根据id查询菜单信息
*
* @param id 菜单Id
* @return
*/
@PostMapping
(
MODEL
+
"/view.json"
)
@Function
(
"menu.query"
)
@ResponseBody
public
JsonResult
<
CoreMenu
>
view
(
Long
id
)
{
CoreMenu
fun
=
menuService
.
queryById
(
id
);
MenuItem
root
=
this
.
platformService
.
buildMenu
();
MenuItem
child
=
root
.
findChild
(
fun
.
getId
());
CoreMenu
parent
=
child
.
getParent
().
getData
();
fun
.
set
(
"parentMenuName"
,
parent
.
getName
());
return
JsonResult
.
success
(
fun
);
}
/**
* 删除
*
* @param id 菜单id
* @return
*/
@PostMapping
(
MODEL
+
"/delete.json"
)
@Function
(
"menu.delete"
)
@ResponseBody
public
JsonResult
delete
(
Long
id
)
{
menuService
.
deleteMenu
(
id
);
return
JsonResult
.
success
();
}
/**
* 批量删除
*
* @param ids 菜单id集合
* @return
*/
@PostMapping
(
MODEL
+
"/batchDel.json"
)
@Function
(
"menu.delete"
)
@ResponseBody
public
JsonResult
delete
(
String
ids
)
{
List
<
Long
>
dels
=
ConvertUtil
.
str2longs
(
ids
);
menuService
.
batchDeleteMenuId
(
dels
);
return
JsonResult
.
success
();
}
}
plus-admin/admin-console/src/main/java/com/ibeetl/admin/console/web/OrgConsoleController.java
deleted
100644 → 0
View file @
6833044a
package
com.ibeetl.admin.console.web
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.beetl.sql.core.engine.PageQuery
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.servlet.ModelAndView
;
import
com.ibeetl.admin.console.service.OrgConsoleService
;
import
com.ibeetl.admin.console.service.UserConsoleService
;
import
com.ibeetl.admin.console.web.query.OrgQuery
;
import
com.ibeetl.admin.console.web.query.OrgUserQuery
;
import
com.ibeetl.admin.core.annotation.Function
;
import
com.ibeetl.admin.core.annotation.Query
;
import
com.ibeetl.admin.core.entity.CoreOrg
;
import
com.ibeetl.admin.core.entity.CoreUser
;
import
com.ibeetl.admin.core.service.CorePlatformService
;
import
com.ibeetl.admin.core.util.AnnotationUtil
;
import
com.ibeetl.admin.core.util.ConvertUtil
;
import
com.ibeetl.admin.core.util.ValidateConfig
;
import
com.ibeetl.admin.core.web.JsonResult
;
/**
* 描述: 组织机构 controller
*
* @author : xiandafu
*/
@Controller
public
class
OrgConsoleController
{
private
final
Log
log
=
LogFactory
.
getLog
(
this
.
getClass
());
private
static
final
String
MODEL
=
"/admin/org"
;
@Autowired
private
OrgConsoleService
orgConsoleService
;
@Autowired
UserConsoleService
userConsoleService
;
@Autowired
CorePlatformService
platformService
;
/*页面*/
@GetMapping
(
MODEL
+
"/index.do"
)
@Function
(
"org.query"
)
public
ModelAndView
index
()
{
ModelAndView
view
=
new
ModelAndView
(
"/admin/org/index.html"
);
view
.
addObject
(
"search"
,
OrgQuery
.
class
.
getName
());
return
view
;
}
@GetMapping
(
MODEL
+
"/edit.do"
)
@Function
(
"org.edit"
)
public
ModelAndView
edit
(
String
id
)
{
ModelAndView
view
=
new
ModelAndView
(
"/admin/org/edit.html"
);
CoreOrg
org
=
orgConsoleService
.
queryById
(
id
);
view
.
addObject
(
"org"
,
org
);
return
view
;
}
@GetMapping
(
MODEL
+
"/user/list.do"
)
@Function
(
"org.query"
)
public
ModelAndView
getUsers
(
Long
orgId
)
{
ModelAndView
view
=
new
ModelAndView
(
"/admin/org/orgUser.html"
);
CoreOrg
org
=
orgConsoleService
.
queryById
(
orgId
);
view
.
addObject
(
"org"
,
org
);
view
.
addObject
(
"search"
,
OrgUserQuery
.
class
.
getName
());
return
view
;
}
/**
* 组织机构列表 分页
*
* @param condtion 查询条件
* @return
*/
@PostMapping
(
MODEL
+
"/list.json"
)
@Function
(
"org.query"
)
@ResponseBody
public
JsonResult
<
PageQuery
<
CoreOrg
>>
list
(
OrgQuery
condtion
)
{
PageQuery
page
=
condtion
.
getPageQuery
();
orgConsoleService
.
queryByCondtion
(
page
);
return
JsonResult
.
success
(
page
);
}
/**
* 获取列表查询条件
*
* @return
*/
@PostMapping
(
MODEL
+
"/list/condition.json"
)
@Function
(
"org.query"
)
@ResponseBody
public
JsonResult
<
List
<
Map
<
String
,
Object
>>>
listCondtion
()
{
List
<
Map
<
String
,
Object
>>
list
=
AnnotationUtil
.
getInstance
().
getAnnotations
(
Query
.
class
,
OrgQuery
.
class
);
return
JsonResult
.
success
(
list
);
}
/**
* 保存数据
*
* @param org
* @return
*/
@PostMapping
(
MODEL
+
"/save.json"
)
@Function
(
"org.save"
)
@ResponseBody
public
JsonResult
<
Long
>
save
(
@Validated
(
ValidateConfig
.
ADD
.
class
)
CoreOrg
org
,
BindingResult
result
)
{
if
(
result
.
hasErrors
())
{
return
JsonResult
.
failMessage
(
result
.
toString
());
}
org
.
setCreateTime
(
new
Date
());
orgConsoleService
.
save
(
org
);
platformService
.
clearOrgCache
();
return
JsonResult
.
success
(
org
.
getId
());
}
/**
* 更新数据
*
* @param org
* @return
*/
@PostMapping
(
MODEL
+
"/update.json"
)
@Function
(
"org.update"
)
@ResponseBody
public
JsonResult
<
String
>
update
(
@Validated
(
ValidateConfig
.
UPDATE
.
class
)
CoreOrg
org
)
{
boolean
success
=
orgConsoleService
.
updateTemplate
(
org
);
if
(
success
)
{
platformService
.
clearOrgCache
();
return
JsonResult
.
successMessage
(
"保存成功"
);
}
else
{
return
JsonResult
.
failMessage
(
"保存失败"
);
}
}
/**
* 删除组织机构
*
* @param ids 组织id,多个用“,”隔开
* @return
*/
@PostMapping
(
MODEL
+
"/delete.json"
)
@Function
(
"org.delete"
)
@ResponseBody
public
JsonResult
delete
(
String
ids
)
{
if
(
ids
.
endsWith
(
","
))
{
ids
=
StringUtils
.
substringBeforeLast
(
ids
,
","
);
}
List
<
Long
>
idList
=
ConvertUtil
.
str2longs
(
ids
);
orgConsoleService
.
deleteById
(
idList
);
this
.
platformService
.
clearOrgCache
();
return
new
JsonResult
().
success
();
}
@PostMapping
(
MODEL
+
"/user/list.json"
)
@Function
(
"org.query"
)
@ResponseBody
public
JsonResult
<
PageQuery
<
CoreUser
>>
getUsers
(
OrgUserQuery
userQuery
)
{
PageQuery
<
CoreUser
>
page
=
userQuery
.
getPageQuery
();
orgConsoleService
.
queryUserByCondition
(
page
);
return
JsonResult
.
success
(
page
);
}
}
plus-admin/admin-console/src/main/java/com/ibeetl/admin/console/web/RoleConsoleController.java
deleted
100644 → 0
View file @
6833044a
package
com.ibeetl.admin.console.web
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.Map
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.beetl.sql.core.engine.PageQuery
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.servlet.ModelAndView
;
import
com.ibeetl.admin.console.service.FunctionConsoleService
;
import
com.ibeetl.admin.console.service.OrgConsoleService
;
import
com.ibeetl.admin.console.service.RoleConsoleService
;
import
com.ibeetl.admin.console.web.dto.RoleDataAccessFunction
;
import
com.ibeetl.admin.console.web.query.RoleQuery
;
import
com.ibeetl.admin.console.web.query.RoleUserQuery
;
import
com.ibeetl.admin.core.annotation.Function
;
import
com.ibeetl.admin.core.annotation.Query
;
import
com.ibeetl.admin.core.entity.CoreRole
;
import
com.ibeetl.admin.core.entity.CoreUser
;
import
com.ibeetl.admin.core.service.CorePlatformService
;
import
com.ibeetl.admin.core.util.AnnotationUtil
;
import
com.ibeetl.admin.core.util.ConvertUtil
;
import
com.ibeetl.admin.core.util.ValidateConfig
;
import
com.ibeetl.admin.core.web.JsonResult
;
/** 角色 */
@Controller
public
class
RoleConsoleController
{
private
final
Log
log
=
LogFactory
.
getLog
(
this
.
getClass
());
private
static
final
String
MODEL
=
"/admin/role"
;
@Autowired
private
RoleConsoleService
roleConsoleService
;
@Autowired
private
FunctionConsoleService
functionConsoleService
;
@Autowired
CorePlatformService
platformService
;
@Autowired
private
OrgConsoleService
orgConsoleService
;
/* 页面 */
@GetMapping
(
MODEL
+
"/index.do"
)
@Function
(
"role"
)
public
ModelAndView
index
()
{
ModelAndView
view
=
new
ModelAndView
(
"/admin/role/index.html"
);
view
.
addObject
(
"search"
,
RoleQuery
.
class
.
getName
());
return
view
;
}
@GetMapping
(
MODEL
+
"/edit.do"
)
@Function
(
"role.edit"
)
public
ModelAndView
edit
(
String
id
)
{
ModelAndView
view
=
new
ModelAndView
(
"/admin/role/edit.html"
);
CoreRole
role
=
roleConsoleService
.
queryById
(
id
);
view
.
addObject
(
"role"
,
role
);
return
view
;
}
@GetMapping
(
MODEL
+
"/add.do"
)
@Function
(
"role.add"
)
public
ModelAndView
add
()
{
ModelAndView
view
=
new
ModelAndView
(
"/admin/role/add.html"
);
return
view
;
}
@GetMapping
(
MODEL
+
"/user/list.do"
)
@Function
(
"role.user.query"
)
public
ModelAndView
users
(
Long
roleId
)
{
CoreRole
role
=
roleConsoleService
.
queryById
(
roleId
);
ModelAndView
view
=
new
ModelAndView
(
"/admin/role/roleUser.html"
);
view
.
addObject
(
"role"
,
role
);
view
.
addObject
(
"search"
,
RoleUserQuery
.
class
.
getName
());
return
view
;
}
@GetMapping
(
MODEL
+
"/function.do"
)
@Function
(
"role.function.query"
)
public
ModelAndView
functions
()
{
ModelAndView
view
=
new
ModelAndView
(
"/admin/role/function.html"
);
return
view
;
}
@GetMapping
(
MODEL
+
"/data.do"
)
@Function
(
"role.function.query"
)
public
ModelAndView
data
()
{
ModelAndView
view
=
new
ModelAndView
(
"/admin/role/data.html"
);
return
view
;
}
/**
* 列表页、 分页数据
*
* @param condtion
* @return
*/
@PostMapping
(
MODEL
+
"/list.json"
)
@Function
(
"role.query"
)
@ResponseBody
public
JsonResult
<
PageQuery
>
list
(
RoleQuery
condtion
)
{
PageQuery
page
=
condtion
.
getPageQuery
();
roleConsoleService
.
queryByCondtion
(
page
);
return
JsonResult
.
success
(
page
);
}
@GetMapping
(
MODEL
+
"/all.json"
)
@Function
(
"role.query"
)
@ResponseBody
public
JsonResult
<
List
<
CoreRole
>>
all
()
{
List
<
CoreRole
>
list
=
roleConsoleService
.
queryAllPermissionList
();
return
JsonResult
.
success
(
list
);
}
/**
* 获取列表查询条件
*
* @return
*/
@PostMapping
(
MODEL
+
"/list/condition.json"
)
@Function
(
"role.query"
)
@ResponseBody
public
JsonResult
<
List
<
Map
<
String
,
Object
>>>
listCondtion
()
{
List
<
Map
<
String
,
Object
>>
list
=
AnnotationUtil
.
getInstance
().
getAnnotations
(
Query
.
class
,
RoleQuery
.
class
);
return
JsonResult
.
success
(
list
);
}
/**
* 保存
*
* @return
*/
@PostMapping
(
MODEL
+
"/add.json"
)
@Function
(
"role.add"
)
@ResponseBody
public
JsonResult
addRole
(
@Validated
(
ValidateConfig
.
ADD
.
class
)
CoreRole
role
)
{
CoreRole
role1
=
roleConsoleService
.
queryByCode
(
role
.
getCode
());
if
(
role1
!=
null
)
{
return
JsonResult
.
failMessage
(
"用户编号已存在"
);
}
JsonResult
result
=
new
JsonResult
();
role
.
setCreateTime
(
new
Date
());
roleConsoleService
.
save
(
role
);
platformService
.
clearFunctionCache
();
return
result
.
success
();
}
/**
* 更新
*
* @param role
* @return
*/
@PostMapping
(
MODEL
+
"/update.json"
)
@Function
(
"role.edit"
)
@ResponseBody
public
JsonResult
<
String
>
update
(
@Validated
(
ValidateConfig
.
UPDATE
.
class
)
CoreRole
role
)
{
boolean
success
=
roleConsoleService
.
update
(
role
);
if
(
success
)
{
platformService
.
clearFunctionCache
();
return
new
JsonResult
().
success
();
}
else
{
return
JsonResult
.
failMessage
(
"保存失败"
);
}
}
/**
* 查询角色信息
*
* @param id
* @return
*/
@GetMapping
(
MODEL
+
"/view.json"
)
@Function
(
"role.query"
)
@ResponseBody
public
JsonResult
<
CoreRole
>
queryInfo
(
Long
id
)
{
CoreRole
role
=
roleConsoleService
.
queryById
(
id
);
return
JsonResult
.
success
(
role
);
}
/**
* (批量)删除
*
* @param ids 角色id
* @return
*/
@PostMapping
(
MODEL
+
"/delete.json"
)
@Function
(
"role.delete"
)
@ResponseBody
public
JsonResult
delete
(
String
ids
)
{
if
(
ids
.
endsWith
(
","
))
{
ids
=
StringUtils
.
substringBeforeLast
(
ids
,
","
);
}
List
<
Long
>
idList
=
ConvertUtil
.
str2longs
(
ids
);
roleConsoleService
.
deleteById
(
idList
);
return
new
JsonResult
().
success
();
}
/**
* 查询角色下授权用户列表
*
* @param queryCondtion 查询条件
* @return
*/
@PostMapping
(
MODEL
+
"/user/list.json"
)
@Function
(
"role.user.query"
)
@ResponseBody
public
JsonResult
<
PageQuery
<
CoreUser
>>
userList
(
RoleUserQuery
query
)
{
PageQuery
page
=
query
.
getPageQuery
();
PageQuery
<
CoreUser
>
pageQuery
=
roleConsoleService
.
queryRoleUser
(
page
);
return
JsonResult
.
success
(
page
);
}
// /**
// * 给角色添加用户
// * @param userRole 角色用户关系
// * @return
// */
// @PostMapping(MODEL + "/user/save.json")
// @Function("role.user.save")
// @ResponseBody
// public JsonResult saveRoleUser(CoreUserRole userRole) {
// userRole.setCreateTime(new Date());
// userRoleConsoleService.saveSysUserRole(userRole);
// platformService.clearFunctionCache();
// return JsonResult.success();
// }
//
//
// /**
// * 用户授权删除
// * @param ids 记录id
// * @return
// */
// @GetMapping(MODEL + "/user/delete.json")
// @Function("role.user.delete")
// @ResponseBody
// public Object deleteRoleUser(String ids) {
// List<Long> dels = ConvertUtil.str2longs(ids);
// userRoleConsoleService.deleteUserRoles(dels);
// platformService.clearFunctionCache();
// return JsonResult.success();
// }
@PostMapping
(
MODEL
+
"/function/ids.json"
)
@Function
(
"role.function.query"
)
@ResponseBody
public
JsonResult
<
List
<
Long
>>
getFunctionIdByRole
(
Long
roleId
)
{
List
<
Long
>
list
=
functionConsoleService
.
getFunctionByRole
(
roleId
);
return
JsonResult
.
success
(
list
);
}
@GetMapping
(
MODEL
+
"/function/queryFunction.json"
)
@Function
(
"role.function.query"
)
@ResponseBody
public
JsonResult
<
List
<
RoleDataAccessFunction
>>
getQueryFunctionByRole
(
Long
roleId
)
{
List
<
RoleDataAccessFunction
>
list
=
functionConsoleService
.
getQueryFunctionByRole
(
roleId
);
return
JsonResult
.
success
(
list
);
}
@PostMapping
(
MODEL
+
"/function/update.json"
)
@Function
(
"role.function.edit"
)
@ResponseBody
public
JsonResult
updateFunction
(
Long
roleId
,
String
ids
)
{
List
<
Long
>
all
=
ConvertUtil
.
str2longs
(
ids
);
List
<
Long
>
addIds
=
new
ArrayList
<
Long
>();
List
<
Long
>
delIds
=
new
ArrayList
<
Long
>();
List
<
Long
>
dbs
=
functionConsoleService
.
getFunctionByRole
(
roleId
);
Iterator
<
Long
>
it
=
all
.
iterator
();
for
(
Long
id
:
all
)
{
if
(!
dbs
.
contains
(
id
))
{
addIds
.
add
(
id
);
}
}
for
(
Long
id
:
dbs
)
{
if
(!
all
.
contains
(
id
))
{
delIds
.
add
(
id
);
}
}
functionConsoleService
.
updateSysRoleFunction
(
roleId
,
addIds
,
delIds
);
return
JsonResult
.
success
();
}
@PostMapping
(
MODEL
+
"/function/updateDataAccess.json"
)
@Function
(
"role.function.updateDataAccess"
)
@ResponseBody
public
JsonResult
updateFunctionDataAccess
(
Long
roleId
,
Long
fnId
,
Integer
accessType
)
{
RoleDataAccessFunction
data
=
new
RoleDataAccessFunction
();
data
.
setRoleId
(
roleId
);
data
.
setId
(
fnId
);
data
.
setDataAccessType
(
accessType
);
functionConsoleService
.
updateFunctionAccessByRole
(
Arrays
.
asList
(
data
));
return
JsonResult
.
success
();
}
/*后端模板渲染*/
@PostMapping
(
MODEL
+
"/function/dataAccess.do"
)
@Function
(
"role.function.updateDataAccess"
)
public
ModelAndView
datapage
(
Long
roleId
)
{
List
<
RoleDataAccessFunction
>
list
=
functionConsoleService
.
getQueryFunctionByRole
(
roleId
);
ModelAndView
view
=
new
ModelAndView
(
"/admin/role/dataConfigPart.html"
);
view
.
addObject
(
"list"
,
list
);
return
view
;
}
}
plus-admin/admin-console/src/main/java/com/ibeetl/admin/console/web/RoleConsoleElController.java
View file @
e27ca5d7
...
@@ -8,6 +8,7 @@ import com.ibeetl.admin.console.web.query.RoleQuery;
...
@@ -8,6 +8,7 @@ import com.ibeetl.admin.console.web.query.RoleQuery;
import
com.ibeetl.admin.console.web.query.RoleUserQuery
;
import
com.ibeetl.admin.console.web.query.RoleUserQuery
;
import
com.ibeetl.admin.core.annotation.Function
;
import
com.ibeetl.admin.core.annotation.Function
;
import
com.ibeetl.admin.core.annotation.Query
;
import
com.ibeetl.admin.core.annotation.Query
;
import
com.ibeetl.admin.core.annotation.RequestBodyPlus
;
import
com.ibeetl.admin.core.entity.CoreRole
;
import
com.ibeetl.admin.core.entity.CoreRole
;
import
com.ibeetl.admin.core.entity.CoreUser
;
import
com.ibeetl.admin.core.entity.CoreUser
;
import
com.ibeetl.admin.core.entity.ElCascaderData
;
import
com.ibeetl.admin.core.entity.ElCascaderData
;
...
@@ -27,8 +28,11 @@ import org.apache.commons.lang3.StringUtils;
...
@@ -27,8 +28,11 @@ import org.apache.commons.lang3.StringUtils;
import
org.beetl.sql.core.engine.PageQuery
;
import
org.beetl.sql.core.engine.PageQuery
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.servlet.ModelAndView
;
import
org.springframework.web.servlet.ModelAndView
;
...
@@ -51,7 +55,7 @@ public class RoleConsoleElController {
...
@@ -51,7 +55,7 @@ public class RoleConsoleElController {
* @param condtion
* @param condtion
* @return
* @return
*/
*/
@
Pos
tMapping
(
"/list
.json
"
)
@
Ge
tMapping
(
"/list"
)
@Function
(
"role.query"
)
@Function
(
"role.query"
)
public
JsonResult
<
PageQuery
>
list
(
RoleQuery
condtion
)
{
public
JsonResult
<
PageQuery
>
list
(
RoleQuery
condtion
)
{
PageQuery
page
=
condtion
.
getPageQuery
();
PageQuery
page
=
condtion
.
getPageQuery
();
...
@@ -59,7 +63,7 @@ public class RoleConsoleElController {
...
@@ -59,7 +63,7 @@ public class RoleConsoleElController {
return
JsonResult
.
success
(
page
);
return
JsonResult
.
success
(
page
);
}
}
@GetMapping
(
"/all
.json
"
)
@GetMapping
(
"/all"
)
@Function
(
"role.query"
)
@Function
(
"role.query"
)
public
JsonResult
<
List
<
CoreRole
>>
all
()
{
public
JsonResult
<
List
<
CoreRole
>>
all
()
{
List
<
CoreRole
>
list
=
roleConsoleService
.
queryAllPermissionList
();
List
<
CoreRole
>
list
=
roleConsoleService
.
queryAllPermissionList
();
...
@@ -71,7 +75,7 @@ public class RoleConsoleElController {
...
@@ -71,7 +75,7 @@ public class RoleConsoleElController {
*
*
* @return
* @return
*/
*/
@PostMapping
(
"/list/condition
.json
"
)
@PostMapping
(
"/list/condition"
)
@Function
(
"role.query"
)
@Function
(
"role.query"
)
public
JsonResult
<
List
<
Map
<
String
,
Object
>>>
listCondtion
()
{
public
JsonResult
<
List
<
Map
<
String
,
Object
>>>
listCondtion
()
{
List
<
Map
<
String
,
Object
>>
list
=
List
<
Map
<
String
,
Object
>>
list
=
...
@@ -84,9 +88,9 @@ public class RoleConsoleElController {
...
@@ -84,9 +88,9 @@ public class RoleConsoleElController {
*
*
* @return
* @return
*/
*/
@PostMapping
(
"/add
.json
"
)
@PostMapping
(
"/add"
)
@Function
(
"role.add"
)
@Function
(
"role.add"
)
public
JsonResult
addRole
(
@Validated
(
ValidateConfig
.
ADD
.
class
)
CoreRole
role
)
{
public
JsonResult
addRole
(
@Validated
(
ValidateConfig
.
ADD
.
class
)
@RequestBody
CoreRole
role
)
{
CoreRole
role1
=
roleConsoleService
.
queryByCode
(
role
.
getCode
());
CoreRole
role1
=
roleConsoleService
.
queryByCode
(
role
.
getCode
());
if
(
role1
!=
null
)
{
if
(
role1
!=
null
)
{
return
JsonResult
.
failMessage
(
"用户编号已存在"
);
return
JsonResult
.
failMessage
(
"用户编号已存在"
);
...
@@ -95,7 +99,7 @@ public class RoleConsoleElController {
...
@@ -95,7 +99,7 @@ public class RoleConsoleElController {
role
.
setCreateTime
(
new
Date
());
role
.
setCreateTime
(
new
Date
());
roleConsoleService
.
save
(
role
);
roleConsoleService
.
save
(
role
);
platformService
.
clearFunctionCache
();
platformService
.
clearFunctionCache
();
return
r
esult
.
success
();
return
JsonR
esult
.
success
();
}
}
/**
/**
...
@@ -104,15 +108,15 @@ public class RoleConsoleElController {
...
@@ -104,15 +108,15 @@ public class RoleConsoleElController {
* @param role
* @param role
* @return
* @return
*/
*/
@P
os
tMapping
(
"/update
.json
"
)
@P
u
tMapping
(
"/update"
)
@Function
(
"role.edit"
)
@Function
(
"role.edit"
)
public
JsonResult
<
String
>
update
(
@Validated
(
ValidateConfig
.
UPDATE
.
class
)
CoreRole
role
)
{
public
JsonResult
<
String
>
update
(
@Validated
(
ValidateConfig
.
UPDATE
.
class
)
@RequestBody
CoreRole
role
)
{
boolean
success
=
roleConsoleService
.
update
(
role
);
boolean
success
=
roleConsoleService
.
update
(
role
);
if
(
success
)
{
if
(
success
)
{
platformService
.
clearFunctionCache
();
platformService
.
clearFunctionCache
();
return
new
JsonResult
()
.
success
();
return
JsonResult
.
success
();
}
else
{
}
else
{
return
JsonResult
.
failMessage
(
"保存失败"
);
return
JsonResult
.
failMessage
(
"保存失败"
);
}
}
...
@@ -124,7 +128,7 @@ public class RoleConsoleElController {
...
@@ -124,7 +128,7 @@ public class RoleConsoleElController {
* @param id
* @param id
* @return
* @return
*/
*/
@GetMapping
(
"/view
.json
"
)
@GetMapping
(
"/view"
)
@Function
(
"role.query"
)
@Function
(
"role.query"
)
public
JsonResult
<
CoreRole
>
queryInfo
(
Long
id
)
{
public
JsonResult
<
CoreRole
>
queryInfo
(
Long
id
)
{
CoreRole
role
=
roleConsoleService
.
queryById
(
id
);
CoreRole
role
=
roleConsoleService
.
queryById
(
id
);
...
@@ -137,20 +141,15 @@ public class RoleConsoleElController {
...
@@ -137,20 +141,15 @@ public class RoleConsoleElController {
* @param ids 角色id
* @param ids 角色id
* @return
* @return
*/
*/
@
Post
Mapping
(
"/delete
.json
"
)
@
Delete
Mapping
(
"/delete"
)
@Function
(
"role.delete"
)
@Function
(
"role.delete"
)
public
JsonResult
delete
(
String
ids
)
{
public
JsonResult
delete
(
@RequestBodyPlus
(
"ids"
)
List
<
Long
>
ids
)
{
if
(
ids
.
endsWith
(
","
))
{
roleConsoleService
.
deleteById
(
ids
);
ids
=
StringUtils
.
substringBeforeLast
(
ids
,
","
);
return
JsonResult
.
success
();
}
List
<
Long
>
idList
=
ConvertUtil
.
str2longs
(
ids
);
roleConsoleService
.
deleteById
(
idList
);
return
new
JsonResult
().
success
();
}
}
/** 查询角色下授权用户列表 */
/** 查询角色下授权用户列表 */
@PostMapping
(
"/user/list
.json
"
)
@PostMapping
(
"/user/list"
)
@Function
(
"role.user.query"
)
@Function
(
"role.user.query"
)
public
JsonResult
<
PageQuery
<
CoreUser
>>
userList
(
RoleUserQuery
query
)
{
public
JsonResult
<
PageQuery
<
CoreUser
>>
userList
(
RoleUserQuery
query
)
{
PageQuery
page
=
query
.
getPageQuery
();
PageQuery
page
=
query
.
getPageQuery
();
...
@@ -158,21 +157,21 @@ public class RoleConsoleElController {
...
@@ -158,21 +157,21 @@ public class RoleConsoleElController {
return
JsonResult
.
success
(
page
);
return
JsonResult
.
success
(
page
);
}
}
@PostMapping
(
"/function/ids
.json
"
)
@PostMapping
(
"/function/ids"
)
@Function
(
"role.function.query"
)
@Function
(
"role.function.query"
)
public
JsonResult
<
List
<
Long
>>
getFunctionIdByRole
(
Long
roleId
)
{
public
JsonResult
<
List
<
Long
>>
getFunctionIdByRole
(
Long
roleId
)
{
List
<
Long
>
list
=
functionConsoleService
.
getFunctionByRole
(
roleId
);
List
<
Long
>
list
=
functionConsoleService
.
getFunctionByRole
(
roleId
);
return
JsonResult
.
success
(
list
);
return
JsonResult
.
success
(
list
);
}
}
@GetMapping
(
"/function/queryFunction
.json
"
)
@GetMapping
(
"/function/queryFunction"
)
@Function
(
"role.function.query"
)
@Function
(
"role.function.query"
)
public
JsonResult
<
List
<
RoleDataAccessFunction
>>
getQueryFunctionByRole
(
Long
roleId
)
{
public
JsonResult
<
List
<
RoleDataAccessFunction
>>
getQueryFunctionByRole
(
Long
roleId
)
{
List
<
RoleDataAccessFunction
>
list
=
functionConsoleService
.
getQueryFunctionByRole
(
roleId
);
List
<
RoleDataAccessFunction
>
list
=
functionConsoleService
.
getQueryFunctionByRole
(
roleId
);
return
JsonResult
.
success
(
list
);
return
JsonResult
.
success
(
list
);
}
}
@PostMapping
(
"/function/update
.json
"
)
@PostMapping
(
"/function/update"
)
@Function
(
"role.function.edit"
)
@Function
(
"role.function.edit"
)
public
JsonResult
updateFunction
(
Long
roleId
,
String
ids
)
{
public
JsonResult
updateFunction
(
Long
roleId
,
String
ids
)
{
List
<
Long
>
all
=
ConvertUtil
.
str2longs
(
ids
);
List
<
Long
>
all
=
ConvertUtil
.
str2longs
(
ids
);
...
@@ -195,7 +194,7 @@ public class RoleConsoleElController {
...
@@ -195,7 +194,7 @@ public class RoleConsoleElController {
return
JsonResult
.
success
();
return
JsonResult
.
success
();
}
}
@PostMapping
(
"/function/updateDataAccess
.json
"
)
@PostMapping
(
"/function/updateDataAccess"
)
@Function
(
"role.function.updateDataAccess"
)
@Function
(
"role.function.updateDataAccess"
)
public
JsonResult
updateFunctionDataAccess
(
Long
roleId
,
Long
fnId
,
Integer
accessType
)
{
public
JsonResult
updateFunctionDataAccess
(
Long
roleId
,
Long
fnId
,
Integer
accessType
)
{
RoleDataAccessFunction
data
=
new
RoleDataAccessFunction
();
RoleDataAccessFunction
data
=
new
RoleDataAccessFunction
();
...
...
plus-admin/admin-console/src/main/java/com/ibeetl/admin/console/web/UserConsoleController.java
deleted
100644 → 0
View file @
6833044a
package
com.ibeetl.admin.console.web
;
import
com.ibeetl.admin.console.service.OrgConsoleService
;
import
com.ibeetl.admin.console.service.RoleConsoleService
;
import
com.ibeetl.admin.console.service.UserConsoleService
;
import
com.ibeetl.admin.console.web.dto.UserExcelExportData
;
import
com.ibeetl.admin.console.web.query.UserQuery
;
import
com.ibeetl.admin.console.web.query.UserRoleQuery
;
import
com.ibeetl.admin.core.annotation.Function
;
import
com.ibeetl.admin.core.annotation.Query
;
import
com.ibeetl.admin.core.entity.CoreUser
;
import
com.ibeetl.admin.core.entity.CoreUserRole
;
import
com.ibeetl.admin.core.file.FileItem
;
import
com.ibeetl.admin.core.file.FileService
;
import
com.ibeetl.admin.core.service.CorePlatformService
;
import
com.ibeetl.admin.core.service.param.CoreUserParam
;
import
com.ibeetl.admin.core.util.AnnotationUtil
;
import
com.ibeetl.admin.core.util.ConvertUtil
;
import
com.ibeetl.admin.core.util.PlatformException
;
import
com.ibeetl.admin.core.util.ValidateConfig
;
import
com.ibeetl.admin.core.util.enums.GeneralStateEnum
;
import
com.ibeetl.admin.core.web.JsonResult
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
javax.servlet.http.HttpServletResponse
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.beetl.sql.core.engine.PageQuery
;
import
org.jxls.common.Context
;
import
org.jxls.util.JxlsHelper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.servlet.ModelAndView
;
/**
* 用户管理接口
*
* @author xiandafu
*/
@Controller
public
class
UserConsoleController
{
private
final
Log
log
=
LogFactory
.
getLog
(
this
.
getClass
());
private
static
final
String
MODEL
=
"/admin/user"
;
@Autowired
UserConsoleService
userConsoleService
;
@Autowired
CorePlatformService
platformService
;
@Autowired
RoleConsoleService
roleConsoleService
;
@Autowired
OrgConsoleService
orgConsoleService
;
@Autowired
FileService
fileService
;
/* 页面 */
@GetMapping
(
MODEL
+
"/index.do"
)
@Function
(
"user"
)
public
ModelAndView
index
()
{
ModelAndView
view
=
new
ModelAndView
(
"/admin/user/index.html"
);
view
.
addObject
(
"search"
,
UserQuery
.
class
.
getName
());
return
view
;
}
@GetMapping
(
MODEL
+
"/edit.do"
)
@Function
(
"user.edit"
)
public
ModelAndView
edit
(
String
id
)
{
ModelAndView
view
=
new
ModelAndView
(
"/admin/user/edit.html"
);
CoreUser
user
=
userConsoleService
.
queryById
(
id
);
view
.
addObject
(
"user"
,
user
);
return
view
;
}
@GetMapping
(
MODEL
+
"/add.do"
)
@Function
(
"user.add"
)
public
ModelAndView
add
()
{
ModelAndView
view
=
new
ModelAndView
(
"/admin/user/add.html"
);
return
view
;
}
@GetMapping
(
MODEL
+
"/changePassword.do"
)
@Function
(
"user.add"
)
public
ModelAndView
changePassword
(
Long
id
)
{
CoreUser
user
=
userConsoleService
.
queryById
(
id
);
ModelAndView
view
=
new
ModelAndView
(
"/admin/user/changePassword.html"
);
view
.
addObject
(
"user"
,
user
);
return
view
;
}
@GetMapping
(
MODEL
+
"/role/list.do"
)
@Function
(
"user.role"
)
public
ModelAndView
userRoleIndex
(
Long
id
)
{
CoreUser
user
=
userConsoleService
.
queryById
(
id
);
ModelAndView
view
=
new
ModelAndView
(
"/admin/user/userRole.html"
);
view
.
addObject
(
"search"
,
UserRoleQuery
.
class
.
getName
());
view
.
addObject
(
"user"
,
user
);
return
view
;
}
@GetMapping
(
MODEL
+
"/role/add.do"
)
@Function
(
"user.role"
)
public
ModelAndView
userRoleAdd
(
Long
id
)
{
CoreUser
user
=
userConsoleService
.
queryById
(
id
);
ModelAndView
view
=
new
ModelAndView
(
"/admin/user/userRoleAdd.html"
);
view
.
addObject
(
"user"
,
user
);
return
view
;
}
/* Json */
@PostMapping
(
MODEL
+
"/delete.json"
)
@Function
(
"user.delete"
)
@ResponseBody
public
JsonResult
delete
(
String
ids
)
{
List
<
Long
>
dels
=
ConvertUtil
.
str2longs
(
ids
);
userConsoleService
.
batchDelSysUser
(
dels
);
return
JsonResult
.
success
();
}
@PostMapping
(
MODEL
+
"/update.json"
)
@Function
(
"user.update"
)
@ResponseBody
public
JsonResult
update
(
@Validated
(
ValidateConfig
.
UPDATE
.
class
)
CoreUser
user
)
{
boolean
success
=
userConsoleService
.
updateTemplate
(
user
);
if
(
success
)
{
this
.
platformService
.
clearFunctionCache
();
return
JsonResult
.
success
();
}
else
{
return
JsonResult
.
failMessage
(
"保存失败!"
);
}
}
@PostMapping
(
MODEL
+
"/add.json"
)
@Function
(
"user.add"
)
@ResponseBody
public
JsonResult
<
Long
>
add
(
@Validated
(
ValidateConfig
.
ADD
.
class
)
CoreUser
user
)
{
if
(!
platformService
.
isAllowUserName
(
user
.
getCode
()))
{
return
JsonResult
.
failMessage
(
"不允许的注册名字 "
+
user
.
getCode
());
}
user
.
setCreateTime
(
new
Date
());
userConsoleService
.
saveUser
(
user
);
return
JsonResult
.
success
(
user
.
getId
());
}
@PostMapping
(
MODEL
+
"/view.json"
)
@ResponseBody
@Function
(
"user.query"
)
public
JsonResult
<
CoreUser
>
view
(
Long
id
)
{
CoreUser
user
=
userConsoleService
.
queryById
(
id
);
return
JsonResult
.
success
(
user
);
}
@PostMapping
(
MODEL
+
"/list.json"
)
@Function
(
"user.query"
)
@ResponseBody
public
JsonResult
<
PageQuery
<
CoreUser
>>
index
(
UserQuery
condtion
)
{
PageQuery
<
CoreUser
>
page
=
condtion
.
getPageQuery
();
userConsoleService
.
queryByCondtion
(
page
);
return
JsonResult
.
success
(
page
);
}
@PostMapping
(
MODEL
+
"/list/condition.json"
)
@Function
(
"user.query"
)
@ResponseBody
public
JsonResult
<
List
<
Map
<
String
,
Object
>>>
indexCondtion
()
{
List
<
Map
<
String
,
Object
>>
list
=
AnnotationUtil
.
getInstance
().
getAnnotations
(
Query
.
class
,
UserQuery
.
class
);
return
JsonResult
.
success
(
list
);
}
@PostMapping
(
MODEL
+
"/disable.json"
)
@Function
(
"user.disable"
)
@ResponseBody
public
JsonResult
disableUser
(
String
ids
)
{
List
<
Long
>
dels
=
ConvertUtil
.
str2longs
(
ids
);
userConsoleService
.
batchUpdateUserState
(
dels
,
GeneralStateEnum
.
DISABLE
);
for
(
Long
id
:
dels
)
{
CoreUser
user
=
userConsoleService
.
queryById
(
id
);
this
.
platformService
.
restUserSession
(
user
.
getCode
());
}
return
JsonResult
.
success
();
}
/**
* 启用用户操作
*
* @return
*/
@PostMapping
(
MODEL
+
"/enable.json"
)
@Function
(
"user.enable"
)
@ResponseBody
public
JsonResult
enableUser
(
String
ids
)
{
List
<
Long
>
enables
=
ConvertUtil
.
str2longs
(
ids
);
userConsoleService
.
batchUpdateUserState
(
enables
,
GeneralStateEnum
.
ENABLE
);
return
JsonResult
.
success
();
}
/**
* 管理员重置用户密码
*
* @return
*/
@PostMapping
(
MODEL
+
"/changePassword.json"
)
@Function
(
"user.reset"
)
@ResponseBody
public
JsonResult
changePassword
(
Long
id
,
String
password
)
{
userConsoleService
.
resetPassword
(
id
,
password
);
return
new
JsonResult
().
success
();
}
/** 用户所有授权角色列表 */
@PostMapping
(
MODEL
+
"/role/list.json"
)
@Function
(
"user.role"
)
@ResponseBody
public
JsonResult
<
List
<
CoreUserRole
>>
getRoleList
(
UserRoleQuery
roleQuery
)
{
List
<
CoreUserRole
>
list
=
userConsoleService
.
getUserRoles
(
roleQuery
);
return
JsonResult
.
success
(
list
);
}
/**
* 用户添加授权角色页
*
* @return
*/
@PostMapping
(
MODEL
+
"/role/add.json"
)
@Function
(
"user.role"
)
@ResponseBody
public
JsonResult
saveUserRole
(
@Validated
CoreUserRole
userRole
)
{
userRole
.
setCreateTime
(
new
Date
());
this
.
userConsoleService
.
saveUserRole
(
userRole
);
this
.
platformService
.
clearFunctionCache
();
return
JsonResult
.
success
(
userRole
.
getId
());
}
/**
* 删除用户角色授权
*
* @return
*/
@PostMapping
(
MODEL
+
"/role/delete.json"
)
@Function
(
"user.role"
)
@ResponseBody
public
JsonResult
delUserRole
(
String
ids
)
{
List
<
Long
>
dels
=
ConvertUtil
.
str2longs
(
ids
);
userConsoleService
.
deleteUserRoles
(
dels
);
this
.
platformService
.
clearFunctionCache
();
return
JsonResult
.
success
();
}
@PostMapping
(
MODEL
+
"/excel/export.json"
)
@Function
(
"user.export"
)
@ResponseBody
public
JsonResult
<
String
>
export
(
HttpServletResponse
response
,
CoreUserParam
coreUserParam
)
{
String
excelTemplate
=
"excelTemplates/admin/user/user_collection_template.xls"
;
List
<
UserExcelExportData
>
users
=
userConsoleService
.
queryExcel
(
coreUserParam
);
try
(
InputStream
is
=
Thread
.
currentThread
().
getContextClassLoader
().
getResourceAsStream
(
excelTemplate
))
{
if
(
is
==
null
)
{
throw
new
PlatformException
(
"模板资源不存在:"
+
excelTemplate
);
}
FileItem
item
=
fileService
.
createFileTemp
(
"user_collection.xls"
);
OutputStream
os
=
item
.
openOutpuStream
();
Context
context
=
new
Context
();
context
.
putVar
(
"users"
,
users
);
JxlsHelper
.
getInstance
().
processTemplate
(
is
,
os
,
context
);
// 下载参考FileSystemContorller
return
JsonResult
.
success
(
item
.
getPath
());
}
catch
(
IOException
e
)
{
throw
new
PlatformException
(
e
.
getMessage
());
}
}
}
plus-admin/admin-console/src/main/resources/static/js/admin/audit/index.js
deleted
100644 → 0
View file @
6833044a
layui
.
define
([
'
form
'
,
'
laydate
'
,
'
table
'
],
function
(
exports
)
{
var
form
=
layui
.
form
;
var
laydate
=
layui
.
laydate
;
var
table
=
layui
.
table
;
var
auditTable
=
null
;
var
view
=
{
init
:
function
(){
this
.
initTable
();
this
.
initSearchForm
();
window
.
dataReload
=
function
(){
Lib
.
doSearchForm
(
$
(
"
#auditSearchForm
"
),
auditTable
)
}
},
initTable
:
function
(){
auditTable
=
table
.
render
({
elem
:
'
#auditTable
'
,
height
:
'
full-180
'
,
method
:
'
post
'
,
url
:
Common
.
ctxPath
+
'
/admin/audit/list.json
'
//数据接口
,
page
:
{
"
layout
"
:[
'
count
'
,
'
prev
'
,
'
page
'
,
'
next
'
]}
//开启分页
,
limit
:
10
,
cols
:
[
[
//表头
{
type
:
'
checkbox
'
,
fixed
:
'
left
'
,
},
{
field
:
'
id
'
,
title
:
'
id
'
,
width
:
80
,
fixed
:
'
left
'
,
sort
:
true
},{
field
:
'
userName
'
,
title
:
'
用户名
'
,
width
:
120
},{
field
:
'
ip
'
,
title
:
'
访问IP
'
,
width
:
150
},{
field
:
'
functionName
'
,
title
:
'
类型名称
'
,
width
:
120
,
sort
:
true
},
{
field
:
'
functionCode
'
,
title
:
'
类型代号
'
,
width
:
120
,
sort
:
true
},
{
field
:
'
message
'
,
title
:
'
消息
'
,
width
:
150
},
{
field
:
'
success
'
,
title
:
'
访问状态
'
,
width
:
120
,
templet
:
function
(
d
){
return
d
.
success
==
1
?
'
成功
'
:
'
失败
'
;
},
sort
:
true
},
{
field
:
'
createTime
'
,
title
:
'
创建时间
'
,
width
:
180
,
templet
:
function
(
d
){
return
Common
.
getDate
(
d
.
createTime
,
'
yyyy-MM-dd HH:mm:ss
'
);
},
sort
:
true
}
]
]
});
},
initSearchForm
:
function
(){
Lib
.
initSearchForm
(
$
(
"
#auditSearchForm
"
),
auditTable
,
form
);
}
}
exports
(
'
index
'
,
view
);
});
\ No newline at end of file
plus-admin/admin-console/src/main/resources/static/js/admin/dict/add.js
deleted
100644 → 0
View file @
6833044a
layui
.
define
([
'
form
'
,
'
laydate
'
,
'
table
'
,
'
dictApi
'
],
function
(
exports
)
{
var
form
=
layui
.
form
;
var
dictApi
=
layui
.
dictApi
;
var
index
=
layui
.
index
;
var
view
=
{
init
:
function
(){
Lib
.
initGenrealForm
(
$
(
"
#addForm
"
),
form
);
this
.
initSubmit
();
},
initSubmit
:
function
(){
$
(
"
#addButton
"
).
click
(
function
(){
dictApi
.
addDict
(
$
(
"
#addForm
"
),
function
(){
parent
.
window
.
dataReload
();
Common
.
openConfirm
(
"
添加成功,继续添加?
"
,
null
,
function
(){
Lib
.
closeFrame
();
})
});
});
$
(
"
#addButton-cancel
"
).
click
(
function
(){
Lib
.
closeFrame
();
});
}
}
exports
(
'
add
'
,
view
);
});
\ No newline at end of file
plus-admin/admin-console/src/main/resources/static/js/admin/dict/del.js
deleted
100644 → 0
View file @
6833044a
layui
.
define
([
'
table
'
,
'
dictApi
'
],
function
(
exports
)
{
var
dictApi
=
layui
.
dictApi
;
var
table
=
layui
.
table
;
var
view
=
{
init
:
function
(){
},
delBatch
:
function
(){
var
data
=
Common
.
getMoreDataFromTable
(
table
,
"
dictTable
"
);
if
(
data
==
null
){
return
;
}
Common
.
openConfirm
(
"
确认要删除这些数据字典?
"
,
function
(){
var
ids
=
Common
.
concatBatchId
(
data
,
"
id
"
);
dictApi
.
del
(
ids
,
function
(){
Common
.
info
(
"
删除成功
"
);
dataReload
();
})
})
}
}
exports
(
'
del
'
,
view
);
});
\ No newline at end of file
plus-admin/admin-console/src/main/resources/static/js/admin/dict/dictApi.js
deleted
100644 → 0
View file @
6833044a
/*访问后台的代码*/
layui
.
define
([],
function
(
exports
)
{
var
api
=
{
updateDict
:
function
(
form
,
callback
){
Lib
.
submitForm
(
"
/admin/dict/update.json
"
,
form
,{},
callback
)
},
addDict
:
function
(
form
,
callback
){
Lib
.
submitForm
(
"
/admin/dict/add.json
"
,
form
,{},
callback
)
},
del
:
function
(
ids
,
callback
){
Common
.
post
(
"
/admin/dict/delete.json
"
,{
"
ids
"
:
ids
},
function
(){
callback
();
})
},
exportExcel
:
function
(
form
,
callback
){
var
formPara
=
form
.
serializeJson
();
Common
.
post
(
"
/admin/dict/excel/export.json
"
,
formPara
,
function
(
fileId
)
{
callback
(
fileId
);
})
}
};
exports
(
'
dictApi
'
,
api
);
});
\ No newline at end of file
plus-admin/admin-console/src/main/resources/static/js/admin/dict/edit.js
deleted
100644 → 0
View file @
6833044a
layui
.
define
([
'
form
'
,
'
laydate
'
,
'
table
'
,
'
dictApi
'
],
function
(
exports
)
{
var
form
=
layui
.
form
;
var
dictApi
=
layui
.
dictApi
;
var
index
=
layui
.
index
;
var
view
=
{
init
:
function
(){
Lib
.
initGenrealForm
(
$
(
"
#updateForm
"
),
form
);
this
.
initSubmit
();
},
initSubmit
:
function
(){
$
(
"
#updateButton
"
).
click
(
function
(){
dictApi
.
updateDict
(
$
(
"
#updateForm
"
),
function
(){
parent
.
window
.
dataReload
();
Common
.
info
(
"
更新成功
"
);
Lib
.
closeFrame
();
});
});
$
(
"
#updateButton-cancel
"
).
click
(
function
(){
Lib
.
closeFrame
();
});
}
}
exports
(
'
edit
'
,
view
);
});
\ No newline at end of file
plus-admin/admin-console/src/main/resources/static/js/admin/dict/index.js
deleted
100644 → 0
View file @
6833044a
layui
.
define
([
'
form
'
,
'
laydate
'
,
'
table
'
],
function
(
exports
)
{
var
form
=
layui
.
form
;
var
laydate
=
layui
.
laydate
;
var
table
=
layui
.
table
;
var
dictTable
=
null
;
var
view
=
{
init
:
function
()
{
this
.
initTable
();
this
.
initSearchForm
();
this
.
initToolBar
();
window
.
dataReload
=
function
()
{
Lib
.
doSearchForm
(
$
(
"
#searchForm
"
),
dictTable
)
}
},
initTable
:
function
()
{
dictTable
=
table
.
render
({
elem
:
'
#dictTable
'
,
height
:
Lib
.
getTableHeight
(
1
),
method
:
'
post
'
,
url
:
Common
.
ctxPath
+
'
/admin/dict/list.json
'
//数据接口
,
page
:
Lib
.
tablePage
//开启分页
,
limit
:
10
,
cols
:
[
[
//表头
{
type
:
'
checkbox
'
,
fixed
:
'
left
'
,
},
{
field
:
'
id
'
,
title
:
'
id
'
,
width
:
80
,
fixed
:
'
left
'
,
sort
:
true
},
{
field
:
'
value
'
,
title
:
'
字典值1
'
,
fixed
:
'
left
'
,
width
:
120
,
},
{
field
:
'
name
'
,
title
:
'
字典名称
'
,
width
:
180
,
},
{
field
:
'
type
'
,
title
:
'
字典类型
'
,
width
:
180
,
},
{
field
:
'
typeName
'
,
title
:
'
字典类型名称
'
,
width
:
180
,
},
{
field
:
'
sort
'
,
title
:
'
排序
'
,
width
:
60
,
},
{
field
:
'
parent
'
,
title
:
'
父字典
'
,
width
:
100
,
},
{
field
:
'
remark
'
,
title
:
'
备注
'
,
width
:
100
,
},
{
field
:
'
createTime
'
,
title
:
'
创建时间
'
,
width
:
100
,
}
]
]
});
},
initSearchForm
:
function
()
{
Lib
.
initSearchForm
(
$
(
"
#searchForm
"
),
dictTable
,
form
);
},
initToolBar
:
function
()
{
toolbar
=
{
add
:
function
()
{
//获取选中数据
var
url
=
"
/admin/dict/add.do
"
;
Common
.
openDlg
(
url
,
"
字典数据管理>新增
"
);
},
edit
:
function
()
{
//获取选中数目
var
data
=
Common
.
getOneFromTable
(
table
,
"
dictTable
"
);
if
(
data
==
null
)
{
return
;
}
var
url
=
"
/admin/dict/edit.do?id=
"
+
data
.
id
;
Common
.
openDlg
(
url
,
"
字典数据管理>
"
+
data
.
value
+
"
>编辑
"
);
},
del
:
function
()
{
layui
.
use
([
'
del
'
],
function
()
{
var
delView
=
layui
.
del
delView
.
delBatch
();
});
},
exportExcel
:
function
()
{
layui
.
use
([
'
dictApi
'
],
function
()
{
var
dictApi
=
layui
.
dictApi
Common
.
openConfirm
(
"
确认要导出这些字典数据?
"
,
function
()
{
dictApi
.
exportExcel
(
$
(
"
#searchForm
"
),
function
(
fileId
)
{
Lib
.
download
(
fileId
);
})
})
});
},
importExcel
:
function
(){
//上传路径
var
uploadUrl
=
Common
.
ctxPath
+
"
/admin/dict/excel/import.do
"
;
//模板
var
templatePath
=
"
/admin/dict/dict_upload_template.xls
"
;
//公共的简单上传文件处理
var
url
=
"
/core/file/simpleUpload.do?uploadUrl=
"
+
uploadUrl
+
"
&templatePath=
"
+
templatePath
;
Common
.
openDlg
(
url
,
"
字典数据管理>上传
"
);
}
};
$
(
'
.ext-toolbar
'
).
on
(
'
click
'
,
function
()
{
var
type
=
$
(
this
).
data
(
'
type
'
);
toolbar
[
type
]
?
toolbar
[
type
].
call
(
this
)
:
''
;
});
}
}
exports
(
'
index
'
,
view
);
});
\ No newline at end of file
plus-admin/admin-console/src/main/resources/static/js/admin/function/add.js
deleted
100644 → 0
View file @
6833044a
layui
.
define
([
'
form
'
,
'
laydate
'
,
'
table
'
,
'
functionApi
'
],
function
(
exports
)
{
var
form
=
layui
.
form
;
var
functionApi
=
layui
.
functionApi
;
var
index
=
layui
.
index
;
var
view
=
{
init
:
function
(){
Lib
.
initGenrealForm
(
$
(
"
#addForm
"
),
form
);
this
.
initSubmit
();
},
initSubmit
:
function
(){
$
(
"
#saveFunction
"
).
click
(
function
(){
form
.
on
(
'
submit(form)
'
,
function
(){
functionApi
.
addFunction
(
function
(){
Common
.
info
(
"
添加成功
"
);
Lib
.
closeFrame
();
});
parent
.
window
.
dataReload
();
});
});
$
(
"
#saveFunction-cancel
"
).
click
(
function
(){
Lib
.
closeFrame
();
});
}
}
exports
(
'
add
'
,
view
);
});
\ No newline at end of file
plus-admin/admin-console/src/main/resources/static/js/admin/function/del.js
deleted
100644 → 0
View file @
6833044a
layui
.
define
([
'
table
'
,
'
functionApi
'
],
function
(
exports
)
{
var
functionApi
=
layui
.
functionApi
;
var
table
=
layui
.
table
;
var
view
=
{
init
:
function
(){
},
delBatch
:
function
(){
var
data
=
Common
.
getMoreDataFromTable
(
table
,
"
functionTable
"
);
if
(
data
==
null
){
return
;
}
Common
.
openConfirm
(
"
确认要删除这些Function?
"
,
function
(){
var
ids
=
Common
.
concatBatchId
(
data
);
functionApi
.
del
(
ids
,
function
(){
Common
.
info
(
"
删除成功
"
);
dataReload
();
})
})
}
}
exports
(
'
del
'
,
view
);
});
\ No newline at end of file
plus-admin/admin-console/src/main/resources/static/js/admin/function/edit.js
deleted
100644 → 0
View file @
6833044a
layui
.
define
([
'
form
'
,
'
laydate
'
,
'
table
'
,
'
functionApi
'
],
function
(
exports
)
{
var
form
=
layui
.
form
;
var
functionApi
=
layui
.
functionApi
;
var
index
=
layui
.
index
;
var
view
=
{
init
:
function
(){
Lib
.
initGenrealForm
(
$
(
"
#updateForm
"
),
form
);
this
.
initSubmit
();
},
initSubmit
:
function
(){
$
(
"
#saveFunction
"
).
click
(
function
(){
form
.
on
(
'
submit(form)
'
,
function
(){
functionApi
.
updateFunction
(
function
(){
Common
.
info
(
"
更新成功
"
);
Lib
.
closeFrame
();
});
parent
.
window
.
dataReload
();
});
});
$
(
"
#saveFunction-cancel
"
).
click
(
function
(){
Lib
.
closeFrame
();
});
}
}
exports
(
'
edit
'
,
view
);
});
\ No newline at end of file
plus-admin/admin-console/src/main/resources/static/js/admin/function/functionApi.js
deleted
100644 → 0
View file @
6833044a
/*访问后台的代码*/
layui
.
define
([],
function
(
exports
)
{
var
api
=
{
updateFunction
:
function
(
callback
){
Lib
.
submitForm
(
"
/admin/function/update.json
"
,
$
(
'
#updateForm
'
),{},
callback
)
},
addFunction
:
function
(
callback
){
Lib
.
submitForm
(
"
/admin/function/add.json
"
,
$
(
'
#addForm
'
),{},
callback
)
},
del
:
function
(
ids
,
callback
){
Common
.
post
(
"
/admin/function/batchDel.json
"
,{
"
ids
"
:
ids
},
callback
)
}
};
exports
(
'
functionApi
'
,
api
);
});
\ No newline at end of file
plus-admin/admin-console/src/main/resources/static/js/admin/function/index.js
deleted
100644 → 0
View file @
6833044a
layui
.
define
([
'
form
'
,
'
laydate
'
,
'
table
'
],
function
(
exports
)
{
var
form
=
layui
.
form
;
var
laydate
=
layui
.
laydate
;
var
table
=
layui
.
table
;
var
functionTable
=
null
;
var
view
=
{
init
:
function
(){
this
.
initTable
();
this
.
initSearchForm
();
this
.
initToolBar
();
window
.
dataReload
=
function
(){
Lib
.
doSearchForm
(
$
(
"
#functionSearchForm
"
),
functionTable
)
}
},
initTable
:
function
(){
functionTable
=
table
.
render
({
elem
:
'
#functionTable
'
,
height
:
'
full-280
'
,
method
:
'
post
'
,
url
:
Common
.
ctxPath
+
'
/admin/function/list.json
'
//数据接口
,
page
:
{
"
layout
"
:[
'
count
'
,
'
prev
'
,
'
page
'
,
'
next
'
]}
//开启分页
,
limit
:
10
,
cols
:
[
[
//表头
{
type
:
'
checkbox
'
,
fixed
:
'
left
'
,
},
{
field
:
'
id
'
,
title
:
'
id
'
,
width
:
80
,
fixed
:
'
left
'
,
sort
:
true
},
{
field
:
'
code
'
,
title
:
'
功能代码
'
,
width
:
150
},
{
field
:
'
name
'
,
title
:
'
功能名称
'
,
width
:
150
,
sort
:
true
},
{
field
:
'
accessUrl
'
,
title
:
'
访问地址
'
,
width
:
300
,
sort
:
true
},
{
field
:
'
parentFunctionText
'
,
title
:
'
上一级功能
'
,
width
:
120
,
sort
:
true
},{
field
:
'
typeText
'
,
title
:
'
功能类型
'
,
width
:
120
,
sort
:
true
},
{
field
:
'
createTime
'
,
title
:
'
创建时间
'
,
width
:
120
,
templet
:
function
(
d
){
return
Common
.
getDate
(
d
.
createTime
);
},
sort
:
true
}
]
]
});
},
initSearchForm
:
function
(){
Lib
.
initSearchForm
(
$
(
"
#functionSearchForm
"
),
functionTable
,
form
);
},
initToolBar
:
function
(){
toolbar
=
{
add
:
function
()
{
//获取选中数据
var
url
=
"
/admin/function/add.do
"
;
Common
.
openDlg
(
url
,
"
功能点管理>新增
"
);
},
edit
:
function
()
{
//获取选中数目
var
data
=
Common
.
getOneFromTable
(
table
,
"
functionTable
"
);
if
(
data
==
null
){
return
;
}
var
url
=
"
/admin/function/edit.do?id=
"
+
data
.
id
;
Common
.
openDlg
(
url
,
"
功能点管理>编辑
"
);
},
del
:
function
()
{
layui
.
use
([
'
del
'
],
function
(){
var
delView
=
layui
.
del
delView
.
delBatch
();
});
}
};
$
(
'
.ext-toolbar
'
).
on
(
'
click
'
,
function
()
{
var
type
=
$
(
this
).
data
(
'
type
'
);
toolbar
[
type
]
?
toolbar
[
type
].
call
(
this
)
:
''
;
});
}
}
exports
(
'
index
'
,
view
);
});
\ No newline at end of file
plus-admin/admin-console/src/main/resources/static/js/admin/menu/add.js
deleted
100644 → 0
View file @
6833044a
layui
.
define
([
'
form
'
,
'
laydate
'
,
'
table
'
,
'
menuApi
'
],
function
(
exports
)
{
var
form
=
layui
.
form
;
var
menuApi
=
layui
.
menuApi
;
var
index
=
layui
.
index
;
var
view
=
{
init
:
function
(){
Lib
.
initGenrealForm
(
$
(
"
#addForm
"
),
form
);
this
.
initSubmit
();
$
(
'
#parentMenuId
'
).
val
(
0
);
$
(
'
#seq
'
).
val
(
1
);
},
initSubmit
:
function
(){
$
(
"
#saveMenu
"
).
click
(
function
(){
//默认值
if
(
!
$
(
'
#parentMenuId
'
).
val
()){
$
(
'
#parentMenuId
'
).
val
(
0
);
}
menuApi
.
addMenu
(
function
(){
Common
.
info
(
"
添加成功
"
);
parent
.
window
.
dataReload
();
Lib
.
closeFrame
();
});
});
$
(
"
#saveMenu-cancel
"
).
click
(
function
(){
Lib
.
closeFrame
();
});
}
}
exports
(
'
add
'
,
view
);
});
\ No newline at end of file
Prev
1
2
3
4
5
…
13
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