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
30e90259
Commit
30e90259
authored
Feb 28, 2018
by
李家智
Browse files
bug fix
parent
28497287
Changes
68
Hide whitespace changes
Inline
Side-by-side
admin-console/src/main/resources/templates/admin/blog/edit.html
deleted
100644 → 0
View file @
28497287
<!--# layout("/common/layout.html",{"jsBase":"/js/admin/blog/"}){ -->
<form
class=
"layui-form layui-form-pane"
id=
"updateForm"
action=
"/admin/blog/update.json"
>
<div
class=
"layui-row"
>
<div
class=
"layui-form-item"
>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
title
</label>
<div
class=
"layui-input-inline"
>
<input
type=
"text"
name=
"title"
value=
"${blog.title}"
class=
"layui-input"
>
</div>
</div>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
content
</label>
<div
class=
"layui-input-inline"
>
<input
type=
"text"
name=
"content"
value=
"${blog.content}"
class=
"layui-input"
>
</div>
</div>
</div>
</div>
<div
class=
"layui-row"
>
<div
class=
"layui-form-item"
>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
createTime
</label>
<div
class=
"layui-input-inline"
>
<input
type=
"text"
name=
"createTime"
value=
"${blog.createTime}"
class=
"layui-input"
>
</div>
</div>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
createUserId
</label>
<div
class=
"layui-input-inline"
>
<input
type=
"text"
name=
"createUserId"
value=
"${blog.createUserId}"
class=
"layui-input"
>
</div>
</div>
</div>
</div>
<div
class=
"layui-row"
>
<div
class=
"layui-form-item"
>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
type
</label>
<div
class=
"layui-input-inline"
>
<input
type=
"text"
name=
"type"
value=
"${blog.type}"
class=
"layui-input"
>
</div>
</div>
</div>
</div>
<input
type=
"hidden"
name=
"id"
value=
${blog.id}
/>
<layui:submitButtons
id=
"updateButton"
/>
</form>
<!--#} -->
<script>
layui
.
use
([
'
edit
'
],
function
(){
var
blogEdit
=
layui
.
edit
blogEdit
.
init
();
});
</script>
admin-console/src/main/resources/templates/admin/blog/index.html
deleted
100644 → 0
View file @
28497287
<!--#layout("/common/layout.html",{"jsBase":"/js/admin/blog/"}){ -->
<layui:searchForm
formId=
"searchForm"
condition=
"${search}"
>
</layui:searchForm>
<div
class=
"layui-btn-group"
>
<layui:accessButton
function=
"blog.add"
action=
"add"
>
增加
</layui:accessButton>
<layui:accessButton
function=
"blog.edit"
action=
"edit"
>
编辑
</layui:accessButton>
<layui:accessButton
function=
"blog.del"
action=
"del"
>
删除
</layui:accessButton>
</div>
<table
id=
"blogTable"
lay-filter=
"blogTable"
></table>
<!--#} -->
<script>
layui
.
use
([
'
index
'
],
function
(){
var
index
=
layui
.
index
index
.
init
();
});
</script>
admin-console/src/main/resources/templates/admin/cmsBlog/add.html
deleted
100644 → 0
View file @
28497287
<!--# layout("/common/layout.html",{"jsBase":"/js/admin/cmsBlog/"}){ -->
<form
class=
"layui-form layui-form-pane"
id=
"addForm"
>
<div
class=
"layui-row"
>
<div
class=
"layui-form-item"
>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
title
</label>
<div
class=
"layui-input-inline"
>
<input
type=
"text"
name=
"title"
class=
"layui-input"
>
</div>
</div>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
content
</label>
<div
class=
"layui-input-inline"
>
<input
type=
"text"
name=
"content"
class=
"layui-input"
>
</div>
</div>
</div>
</div>
<div
class=
"layui-row"
>
<div
class=
"layui-form-item"
>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
createTime
</label>
<div
class=
"layui-input-inline"
>
<input
type=
"text"
name=
"createTime"
class=
"layui-input"
>
</div>
</div>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
createUserId
</label>
<div
class=
"layui-input-inline"
>
<input
type=
"text"
name=
"createUserId"
class=
"layui-input"
>
</div>
</div>
</div>
</div>
<div
class=
"layui-row"
>
<div
class=
"layui-form-item"
>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
type
</label>
<div
class=
"layui-input-inline"
>
<input
type=
"text"
name=
"type"
class=
"layui-input"
>
</div>
</div>
</div>
</div>
<layui:submitButtons
id=
"addButton"
/>
</form>
<!--#} -->
<script>
layui
.
use
([
'
add
'
],
function
(){
var
cmsBlogAdd
=
layui
.
add
cmsBlogAdd
.
init
();
});
</script>
admin-console/src/main/resources/templates/admin/cmsBlog/edit.html
deleted
100644 → 0
View file @
28497287
<!--# layout("/common/layout.html",{"jsBase":"/js/admin/cmsBlog/"}){ -->
<form
class=
"layui-form layui-form-pane"
id=
"updateForm"
>
<div
class=
"layui-row"
>
<div
class=
"layui-form-item"
>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
title
</label>
<div
class=
"layui-input-inline"
>
<input
type=
"text"
name=
"title"
value=
"${cmsBlog.title}"
class=
"layui-input"
>
</div>
</div>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
content
</label>
<div
class=
"layui-input-inline"
>
<input
type=
"text"
name=
"content"
value=
"${cmsBlog.content}"
class=
"layui-input"
>
</div>
</div>
</div>
</div>
<div
class=
"layui-row"
>
<div
class=
"layui-form-item"
>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
createTime
</label>
<div
class=
"layui-input-inline"
>
<input
type=
"text"
name=
"createTime"
value=
"${cmsBlog.createTime}"
class=
"layui-input"
>
</div>
</div>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
createUserId
</label>
<div
class=
"layui-input-inline"
>
<input
type=
"text"
name=
"createUserId"
value=
"${cmsBlog.createUserId}"
class=
"layui-input"
>
</div>
</div>
</div>
</div>
<div
class=
"layui-row"
>
<div
class=
"layui-form-item"
>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
type
</label>
<div
class=
"layui-input-inline"
>
<input
type=
"text"
name=
"type"
value=
"${cmsBlog.type}"
class=
"layui-input"
>
</div>
</div>
</div>
</div>
<input
type=
"hidden"
name=
"id"
value=
${cmsBlog.id}
/>
<layui:submitButtons
id=
"updateButton"
/>
</form>
<!--#} -->
<script>
layui
.
use
([
'
edit
'
],
function
(){
var
cmsBlogEdit
=
layui
.
edit
cmsBlogEdit
.
init
();
});
</script>
admin-console/src/main/resources/templates/admin/cmsBlog/index.html
deleted
100644 → 0
View file @
28497287
<!--#layout("/common/layout.html",{"jsBase":"/js/admin/cmsBlog/"}){ -->
<layui:searchForm
formId=
"searchForm"
condition=
"${search}"
>
</layui:searchForm>
<div
class=
"layui-btn-group"
>
<layui:accessButton
function=
"cmsBlog.add"
action=
"add"
>
增加
</layui:accessButton>
<layui:accessButton
function=
"cmsBlog.edit"
action=
"edit"
>
编辑
</layui:accessButton>
<layui:accessButton
function=
"cmsBlog.del"
action=
"del"
>
删除
</layui:accessButton>
</div>
<table
id=
"cmsBlogTable"
lay-filter=
"cmsBlogTable"
></table>
<!--#} -->
<script>
layui
.
use
([
'
index
'
],
function
(){
var
index
=
layui
.
index
index
.
init
();
});
</script>
admin-console/src/main/resources/templates/admin/dict/add.html
View file @
30e90259
<!--# layout("/common/layout.html",{"jsBase":"/js/admin/dict/"}){ -->
<form
class=
"layui-form layui-form-pane"
id=
"addForm"
action=
"/admin/dict/add.json"
>
<form
class=
"layui-form layui-form-pane"
id=
"addForm"
>
<div
class=
"layui-row"
>
<div
class=
"layui-form-item"
>
...
...
admin-console/src/main/resources/templates/admin/dict/edit.html
View file @
30e90259
<!--# layout("/common/layout.html",{"jsBase":"/js/admin/dict/"}){ -->
<form
class=
"layui-form layui-form-pane"
id=
"updateForm"
action=
"/admin/dict/update.json"
>
<form
class=
"layui-form layui-form-pane"
id=
"updateForm"
>
<div
class=
"layui-row"
>
<div
class=
"layui-form-item"
>
...
...
admin-core/src/main/java/com/ibeetl/admin/core/conf/BeetlConf.java
View file @
30e90259
...
...
@@ -21,9 +21,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import
com.ibeetl.admin.core.rbac.DataAccess
;
import
com.ibeetl.admin.core.rbac.DataAccessFactory
;
import
com.ibeetl.admin.core.service.CorePlatformService
;
import
com.ibeetl.admin.core.util.beetl.DictQueryByValueFunction
;
import
com.ibeetl.admin.core.util.beetl.DictQueryFunction
;
import
com.ibeetl.admin.core.util.beetl.DictUpQueryFunction
;
import
com.ibeetl.admin.core.util.beetl.FunAccessUrlFunction
;
import
com.ibeetl.admin.core.util.beetl.FunFunction
;
import
com.ibeetl.admin.core.util.beetl.MenuFunction
;
...
...
@@ -52,11 +50,8 @@ public class BeetlConf {
@Autowired
DictQueryFunction
dictDownQueryFunction
;
@Autowired
DictUpQueryFunction
dictUpQueryFunction
;
@Autowired
DictQueryByValueFunction
dictQueryByValueFunction
;
@Autowired
RoleFunction
roleFunction
;
...
...
@@ -100,11 +95,10 @@ public class BeetlConf {
groupTemplate
.
registerFunction
(
"core.funAccessUrl"
,
funAccessUrlFunction
);
groupTemplate
.
registerFunction
(
"core.menuName"
,
menuFunction
);
groupTemplate
.
registerFunction
(
"core.searchCondtion"
,
searchCondtionFunction
);
groupTemplate
.
registerFunction
(
"core.dictDownQuery"
,
dictDownQueryFunction
);
groupTemplate
.
registerFunction
(
"core.dictLevel"
,
dictUpQueryFunction
);
groupTemplate
.
registerFunction
(
"core.dictListByValue"
,
dictQueryByValueFunction
);
groupTemplate
.
registerFunction
(
"core.roles"
,
roleFunction
);
groupTemplate
.
registerFormat
(
"xss"
,
new
XXSDefenderFormat
());
groupTemplate
.
registerFunctionPackage
(
"dict"
,
dictDownQueryFunction
);
// 模板页面判断是否有按钮权限,比如canAccess
groupTemplate
.
registerFunction
(
"canAccess"
,
new
Function
()
{
...
...
admin-core/src/main/java/com/ibeetl/admin/core/dao/CoreDictDao.java
View file @
30e90259
...
...
@@ -37,7 +37,7 @@ public interface CoreDictDao extends BaseMapper<CoreDict> {
* @param id 父节点id
* @return
*/
List
<
CoreDict
>
findChildByParent
(
String
parentValue
);
List
<
CoreDict
>
findChildByParent
(
Long
id
);
int
bathDelByValue
(
List
<
String
>
values
);
}
admin-core/src/main/java/com/ibeetl/admin/core/entity/CoreDict.java
View file @
30e90259
...
...
@@ -19,7 +19,11 @@ import com.ibeetl.admin.core.util.ValidateConfig;
*/
public
class
CoreDict
extends
BaseEntity
{
@AssignID
@NotNull
(
message
=
"ID不能为空"
,
groups
=
ValidateConfig
.
UPDATE
.
class
)
@SeqID
(
name
=
ORACLE_CORE_SEQ_NAME
)
@AutoID
private
Long
id
;
private
String
value
;
// 数据值
//删除标识
@JsonIgnore
...
...
@@ -37,11 +41,20 @@ public class CoreDict extends BaseEntity {
@NotBlank
(
message
=
"字典值名称不能为空"
)
private
String
name
;
// 标签名
private
Integer
sort
;
// 排序
private
Stri
ng
parent
;
//父Id
private
Lo
ng
parent
;
//父Id
private
String
remark
;
//备注
public
Long
getId
()
{
return
id
;
}
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
}
public
String
getType
()
{
public
String
getType
()
{
return
type
;
}
...
...
@@ -81,11 +94,11 @@ public class CoreDict extends BaseEntity {
this
.
sort
=
sort
;
}
public
Stri
ng
getParent
()
{
public
Lo
ng
getParent
()
{
return
parent
;
}
public
void
setParent
(
Stri
ng
parent
)
{
public
void
setParent
(
Lo
ng
parent
)
{
this
.
parent
=
parent
;
}
...
...
admin-core/src/main/java/com/ibeetl/admin/core/entity/CoreUser.java
View file @
30e90259
...
...
@@ -12,6 +12,7 @@ import org.beetl.sql.core.annotatoin.SeqID;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.ibeetl.admin.core.annotation.Dict
;
import
com.ibeetl.admin.core.util.ValidateConfig
;
import
com.ibeetl.admin.core.util.enums.CoreDictType
;
/*
* 用户实体
...
...
@@ -51,14 +52,14 @@ public class CoreUser extends BaseEntity {
@JsonIgnore
private
String
password
;
@Dict
@Dict
(
type
=
CoreDictType
.
USER_STATE
)
private
String
state
;
//扩展例子
@Dict
(
type
=
"job_type"
)
private
String
jobType0
;
@Dict
@Dict
(
type
=
"job_type"
)
private
String
jobType1
;
...
...
admin-core/src/main/java/com/ibeetl/admin/core/service/BaseService.java
View file @
30e90259
...
...
@@ -3,20 +3,16 @@ package com.ibeetl.admin.core.service;
import
java.lang.reflect.Field
;
import
java.lang.reflect.ParameterizedType
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map.Entry
;
import
org.beetl.sql.core.SQLManager
;
import
org.beetl.sql.core.TailBean
;
import
org.beetl.sql.core.db.KeyHolder
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
com.ibeetl.admin.core.annotation.Dict
;
import
com.ibeetl.admin.core.util.DictUtil
;
import
com.ibeetl.admin.core.util.FieldDict
;
import
com.ibeetl.admin.core.entity.CoreDict
;
import
com.ibeetl.admin.core.util.PlatformException
;
import
com.ibeetl.admin.core.util.enums.DelFlagEnum
;
...
...
@@ -27,7 +23,7 @@ import com.ibeetl.admin.core.util.enums.DelFlagEnum;
public
class
BaseService
<
T
>
{
@Autowired
protected
DictUtil
dictUtil
;
protected
CoreDictService
dictUtil
;
@Autowired
protected
SQLManager
sqlManager
;
...
...
@@ -153,16 +149,7 @@ public class BaseService<T> {
private
Class
<
T
>
getCurrentEntityClassz
()
{
return
(
Class
<
T
>)
((
ParameterizedType
)
getClass
().
getGenericSuperclass
()).
getActualTypeArguments
()[
0
];
}
public
void
queryListAfter
(
List
list
,
FieldDict
[]
more
){
for
(
Object
bean
:
list
)
{
queryEntityAfter
(
bean
,
more
);
}
}
public
void
queryEntityAfter
(
Object
bean
){
this
.
queryEntityAfter
(
bean
,
null
);
}
public
void
queryListAfter
(
List
list
)
{
for
(
Object
bean
:
list
)
{
...
...
@@ -170,7 +157,7 @@ public class BaseService<T> {
}
}
public
void
queryEntityAfter
(
Object
bean
,
FieldDict
[]
more
)
{
public
void
queryEntityAfter
(
Object
bean
)
{
if
(
bean
==
null
)
{
return
;
}
...
...
@@ -190,7 +177,8 @@ public class BaseService<T> {
String
display
=
""
;
Object
fieldValue
=
field
.
get
(
ext
);
if
(
fieldValue
!=
null
)
{
display
=
dictUtil
.
getDictName
(
fieldValue
.
toString
());
CoreDict
dbDict
=
dictUtil
.
findCoreDict
(
dict
.
type
(),
fieldValue
.
toString
());
display
=
dbDict
!=
null
?
dbDict
.
getName
():
null
;
}
ext
.
set
(
field
.
getName
()
+
dict
.
suffix
(),
display
);
}
catch
(
Exception
e
)
{
...
...
@@ -200,21 +188,6 @@ public class BaseService<T> {
}
}
if
(
more
==
null
){
return
;
}
for
(
FieldDict
desc:
more
){
Object
fieldValue
=
ext
.
get
(
desc
.
getField
());
String
display
=
""
;
if
(
fieldValue
!=
null
)
{
display
=
dictUtil
.
getDictName
(
fieldValue
.
toString
());
}
ext
.
set
(
desc
.
getDisplayField
(),
display
);
}
}
}
admin-core/src/main/java/com/ibeetl/admin/core/service/CoreDictService.java
View file @
30e90259
...
...
@@ -36,35 +36,7 @@ public class CoreDictService extends BaseService<CoreDict> {
@Autowired
CoreDictService
self
;
/**
* 新增一条数据,返回int型主键值
* @param model 实体类
* @return
*/
public
String
saveReturnId
(
CoreDict
model
)
{
dictDao
.
insert
(
model
);
platformService
.
clearDictCache
();
return
model
.
getValue
();
}
/**
* 更新
* @param model 要更新的对象
* @return
*/
public
boolean
update
(
CoreDict
model
)
{
int
count
=
dictDao
.
updateTemplateById
(
model
);
if
(
count
>
0
)
{
platformService
.
clearDictCache
();
}
return
count
>
0
;
}
/**
* 根据类型获取字典集合
* @param type 字典类型,
...
...
@@ -75,108 +47,67 @@ public class CoreDictService extends BaseService<CoreDict> {
return
dictDao
.
findAllList
(
type
);
}
@Cacheable
(
value
=
CorePlatformService
.
DICT_CACHE_CHILDREN
)
public
List
<
CoreDict
>
findChildrenByValue
(
String
value
)
{
return
self
.
findChildByParent
(
value
);
}
@Cacheable
(
value
=
CorePlatformService
.
DICT_CACHE_VALUE
)
public
CoreDict
findCoreDict
(
String
value
)
{
CoreDict
dict
=
dictDao
.
unique
(
value
);
return
dict
;
}
/**
* 级联字典,查询字典值后的所有子孙字典
* 级联字典查询,必须提供一个字典类型
* @param group
* @param value
* @return
*/
public
List
<
List
<
CoreDict
>>
batchFindChidren
(
String
value
){
List
<
List
<
CoreDict
>>
all
=
new
ArrayList
();
List
<
CoreDict
>
list
=
self
.
findChildrenByValue
(
value
);
if
(
list
.
isEmpty
())
{
return
all
;
}
else
{
all
.
add
(
list
);
addChildren
(
all
,
list
.
get
(
0
));
}
return
all
;
}
private
void
addChildren
(
List
<
List
<
CoreDict
>>
all
,
CoreDict
first
)
{
List
<
CoreDict
>
list
=
self
.
findChildrenByValue
(
first
.
getValue
());
if
(
list
.
size
()==
0
)
{
return
;
}
else
{
all
.
add
(
list
);
addChildren
(
all
,
list
.
get
(
0
));
}
@Cacheable
(
value
=
CorePlatformService
.
DICT_CACHE_CHILDREN
)
public
List
<
CoreDict
>
findAllByGroup
(
String
type
,
String
value
)
{
List
<
CoreDict
>
list
=
self
.
findAllByType
(
type
);
return
_search
(
list
,
value
);
}
/**
* 级
连字典数据,根据字典类型,获取每一级的字典第一项,用于页面展示,参考DictUpQueryFunction
* @param
typ
e
* 级
联字段下一级的字段列表
* @param
parentValu
e
* @return
*/
public
List
<
CoreDict
>
findDefalutLevel
(
String
type
){
CoreDict
dict
=
self
.
findAllByType
(
type
).
get
(
0
);
if
(
dict
==
null
)
{
throw
new
PlatformException
(
"字典不存在 ,type="
+
type
);
}
List
<
CoreDict
>
level
=
new
ArrayList
<
CoreDict
>();
level
.
add
(
dict
);
while
(
dict
!=
null
)
{
dict
=
self
.
getFirstCoreDictByParent
(
dict
.
getValue
());
if
(
dict
!=
null
)
{
level
.
add
(
dict
);
}
else
{
break
;
}
}
return
level
;
@Cacheable
(
value
=
CorePlatformService
.
DICT_CACHE_CHILDREN
)
public
List
<
CoreDict
>
findChildByParent
(
Long
id
)
{
return
dictDao
.
findChildByParent
(
id
);
}
/**
* 级联字典,根据最末端的值,向上找到级联的每个字典
* @param value
* @return
*/
public
List
<
CoreDict
>
findLevelByValue
(
String
value
){
List
<
CoreDict
>
level
=
new
ArrayList
<
CoreDict
>();
CoreDict
dict
=
self
.
findCoreDict
(
value
);
if
(
dict
==
null
)
{
throw
new
PlatformException
(
"字典不存在,value= "
+
value
);
}
level
.
add
(
dict
);
while
(
dict
!=
null
)
{
String
strParentId
=
dict
.
getParent
();
if
(
StringUtils
.
isEmpty
(
strParentId
))
{
break
;
}
dict
=
self
.
findCoreDict
(
strParentId
);
level
.
add
(
0
,
dict
);
}
return
level
;
@Cacheable
(
value
=
CorePlatformService
.
DICT_CACHE_VALUE
)
public
CoreDict
findCoreDict
(
String
type
,
String
value
)
{
List
<
CoreDict
>
list
=
self
.
findAllByGroup
(
type
,
value
);
if
(
list
==
null
)
{
return
null
;
}
for
(
CoreDict
dict:
list
)
{
if
(
dict
.
getValue
().
equals
(
value
))
{
return
dict
;
}
}
return
null
;
}
public
CoreDict
getFirstCoreDict
(
String
type
)
{
CoreDict
dict
=
(
CoreDict
)
dictDao
.
createQuery
().
lambda
().
andEq
(
CoreDict:
:
getType
,
type
).
desc
(
CoreDict:
:
getSort
).
single
();
return
dict
;
}
public
CoreDict
getFirstCoreDictByParent
(
String
value
)
{
List
<
CoreDict
>
list
=
self
.
findChildrenByValue
(
value
);
if
(
list
.
size
()==
0
)
{
return
null
;
}
return
list
.
get
(
0
);
}
/*递归查找*/
private
List
<
CoreDict
>
_search
(
List
<
CoreDict
>
list
,
String
value
)
{
for
(
CoreDict
dict:
list
)
{
if
(
dict
.
getValue
().
equals
(
value
))
{
return
list
;
}
else
{
List
<
CoreDict
>
children
=
findChildByParent
(
dict
.
getId
());
if
(
children
.
isEmpty
())
{
continue
;
}
else
{
List
<
CoreDict
>
ret
=
_search
(
children
,
value
);
if
(
ret
!=
null
)
{
return
ret
;
}
}
}
}
return
null
;
}
/**
* 查询字段类型列表
...
...
@@ -186,14 +117,7 @@ public class CoreDictService extends BaseService<CoreDict> {
return
dictDao
.
findTypeList
(
DelFlagEnum
.
NORMAL
.
getValue
());
}
/**
* 级联字段下一级的字段列表
* @param parentValue
* @return
*/
public
List
<
CoreDict
>
findChildByParent
(
String
parentValue
)
{
return
dictDao
.
findChildByParent
(
parentValue
);
}
...
...
admin-core/src/main/java/com/ibeetl/admin/core/service/CorePlatformService.java
View file @
30e90259
...
...
@@ -52,6 +52,7 @@ public class CorePlatformService {
//字典列表
public
static
final
String
DICT_CACHE_TYPE
=
"cache:core:dictType"
;
public
static
final
String
DICT_CACHE_VALUE
=
"cache:core:dictValue"
;
public
static
final
String
DICT_CACHE_SAME_LEVEL
=
"cache:core:ditcSameLevel"
;
public
static
final
String
DICT_CACHE_CHILDREN
=
"cache:core:dictChildren"
;
public
static
final
String
USER_FUNCTION_ACCESS_CACHE
=
"cache:core:userFunctionAccess"
;
public
static
final
String
USER_FUNCTION_CHIDREN_CACHE
=
"ccache:core:functionChildren"
;
...
...
@@ -369,7 +370,7 @@ public class CorePlatformService {
//没有做任何事情,交给spring cache来处理了
}
@CacheEvict
(
cacheNames
=
{
CorePlatformService
.
DICT_CACHE_
CHILDREN
,
CorePlatformService
.
DICT_CACHE_TYPE
,
CorePlatformService
.
DICT_CACHE_VALUE
},
allEntries
=
true
)
@CacheEvict
(
cacheNames
=
{
CorePlatformService
.
DICT_CACHE_
SAME_LEVEL
,
CorePlatformService
.
DICT_CACHE_TYPE
,
CorePlatformService
.
DICT_CACHE_VALUE
},
allEntries
=
true
)
public
void
clearDictCache
()
{
}
...
...
admin-core/src/main/java/com/ibeetl/admin/core/util/DictUtil.java
deleted
100644 → 0
View file @
28497287
package
com.ibeetl.admin.core.util
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
com.ibeetl.admin.core.entity.CoreDict
;
import
com.ibeetl.admin.core.service.CoreDictService
;
/**
* 描述:
* @author : xiandafu
*/
@Component
public
class
DictUtil
{
@Autowired
CoreDictService
platformDictService
;
/**
* 根据字典值和类型,得到字典显示内容
* @param value 字典值
* @param type 字典类型 参考 @link{com.}
* @param defaultValue
* @return
*/
public
String
getDictName
(
String
value
)
{
CoreDict
dict
=
platformDictService
.
findCoreDict
(
value
);
return
dict
.
getName
();
}
}
admin-core/src/main/java/com/ibeetl/admin/core/util/FieldDict.java
deleted
100644 → 0
View file @
28497287
package
com.ibeetl.admin.core.util
;
import
com.ibeetl.admin.core.annotation.Dict
;
public
class
FieldDict
{
String
defaultValue
=
""
;
String
suffix
;
String
type
;
String
field
;
public
FieldDict
(
String
field
,
String
type
){
this
(
field
,
type
,
"Text"
,
null
);
}
public
FieldDict
(
String
field
,
Dict
dict
){
this
(
field
,
dict
.
type
(),
dict
.
suffix
(),
dict
.
defaultDisplay
());
}
public
FieldDict
(
String
field
,
String
type
,
String
suffix
,
String
defaultValue
){
this
.
field
=
field
;
this
.
type
=
type
;
this
.
suffix
=
suffix
;
this
.
defaultValue
=
defaultValue
;
}
public
String
getDefaultValue
()
{
return
defaultValue
;
}
public
void
setDefaultValue
(
String
defaultValue
)
{
this
.
defaultValue
=
defaultValue
;
}
public
String
getSuffix
()
{
return
suffix
;
}
public
void
setSuffix
(
String
suffix
)
{
this
.
suffix
=
suffix
;
}
public
String
getType
()
{
return
type
;
}
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
public
String
getField
()
{
return
field
;
}
public
void
setField
(
String
field
)
{
this
.
field
=
field
;
}
public
String
getDisplayField
(){
return
this
.
field
+
this
.
suffix
;
}
}
admin-core/src/main/java/com/ibeetl/admin/core/util/beetl/DictQueryByValueFunction.java
deleted
100644 → 0
View file @
28497287
package
com.ibeetl.admin.core.util.beetl
;
import
java.util.List
;
import
org.beetl.core.Context
;
import
org.beetl.core.Function
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
com.ibeetl.admin.core.entity.CoreDict
;
import
com.ibeetl.admin.core.service.CoreDictService
;
@Component
public
class
DictQueryByValueFunction
implements
Function
{
@Autowired
CoreDictService
dictService
;
@Override
public
List
<
CoreDict
>
call
(
Object
[]
paras
,
Context
arg1
)
{
String
value
=(
String
)
paras
[
0
];
CoreDict
dict
=
dictService
.
findCoreDict
(
value
);
if
(
dict
==
null
)
{
throw
new
RuntimeException
(
"未能发现数据字典 "
+
value
);
}
List
<
CoreDict
>
list
=
dictService
.
findAllByType
(
dict
.
getType
());
return
list
;
}
}
admin-core/src/main/java/com/ibeetl/admin/core/util/beetl/DictQueryFunction.java
View file @
30e90259
...
...
@@ -2,8 +2,6 @@ package com.ibeetl.admin.core.util.beetl;
import
java.util.List
;
import
org.apache.commons.lang3.StringUtils
;
import
org.beetl.core.Context
;
import
org.beetl.core.Function
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
...
...
@@ -11,18 +9,19 @@ import org.springframework.stereotype.Component;
import
com.ibeetl.admin.core.entity.CoreDict
;
import
com.ibeetl.admin.core.service.CoreDictService
;
@Component
public
class
DictQueryFunction
implements
Function
{
public
class
DictQueryFunction
{
@Autowired
CoreDictService
dictService
;
@Override
public
List
<
CoreDict
>
call
(
Object
[]
paras
,
Context
arg1
)
{
String
type
=(
String
)
paras
[
0
];
public
List
<
CoreDict
>
dictDownQuery
(
String
type
)
{
return
dictService
.
findAllByType
(
type
);
}
public
List
<
CoreDict
>
dictListByValue
(
String
group
,
String
value
){
return
dictService
.
findAllByGroup
(
group
,
value
);
}
}
admin-core/src/main/java/com/ibeetl/admin/core/util/beetl/DictUpQueryFunction.java
deleted
100644 → 0
View file @
28497287
package
com.ibeetl.admin.core.util.beetl
;
import
java.util.List
;
import
org.apache.commons.lang3.StringUtils
;
import
org.beetl.core.Context
;
import
org.beetl.core.Function
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
com.ibeetl.admin.core.entity.CoreDict
;
import
com.ibeetl.admin.core.service.CoreDictService
;
@Component
public
class
DictUpQueryFunction
implements
Function
{
@Autowired
CoreDictService
dictService
;
@Override
public
List
<
CoreDict
>
call
(
Object
[]
paras
,
Context
arg1
)
{
String
type
=(
String
)
paras
[
0
];
String
value
=(
String
)
paras
[
1
];
if
(
StringUtils
.
isEmpty
(
value
))
{
return
dictService
.
findDefalutLevel
(
type
);
}
else
{
return
dictService
.
findLevelByValue
(
value
);
}
}
}
admin-core/src/main/java/com/ibeetl/admin/core/web/CoreDictController.java
View file @
30e90259
package
com.ibeetl.admin.core.web
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
...
...
@@ -15,7 +13,6 @@ 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
;
import
com.ibeetl.admin.core.util.DictUtil
;
@Controller
@SuppressWarnings
(
"unchecked"
)
...
...
@@ -29,8 +26,6 @@ public class CoreDictController {
@Autowired
CoreDictService
dictService
;
@Autowired
DictUtil
dictUtil
;
/**
...
...
@@ -53,43 +48,12 @@ public class CoreDictController {
@RequestMapping
(
MODEL
+
"/viewChildren.json"
)
@ResponseBody
public
JsonResult
<
List
<
CoreDict
>>
viewChild
(
String
value
)
{
List
<
CoreDict
>
list
=
dictService
.
findChildrenByValue
(
value
);
public
JsonResult
<
List
<
CoreDict
>>
viewChild
(
String
group
,
String
value
)
{
CoreDict
dict
=
dictService
.
findCoreDict
(
group
,
value
);
List
<
CoreDict
>
list
=
dictService
.
findChildByParent
(
dict
.
getId
());
return
JsonResult
.
success
(
list
);
}
/**
* 查看字典值的所有后代字典
* @param value
* @return
*/
@RequestMapping
(
MODEL
+
"/batchViewChildren.json"
)
@ResponseBody
public
JsonResult
<
List
<
List
<
CoreDict
>>>
batchViewChildren
(
String
value
)
{
List
<
List
<
CoreDict
>>
list
=
dictService
.
batchFindChidren
(
value
);
return
JsonResult
.
success
(
list
);
}
/**
* 批量获取字典数据
* @param types
* @return
*/
@RequestMapping
(
MODEL
+
"/batchView.json"
)
@ResponseBody
public
JsonResult
<
Map
<
String
,
List
<
CoreDict
>>>
batchView
(
String
types
)
{
String
[]
strs
=
types
.
split
(
","
);
//按照顺序返回
Map
<
String
,
List
<
CoreDict
>>
map
=
new
LinkedHashMap
<
String
,
List
<
CoreDict
>>();
for
(
int
i
=
0
;
i
<
strs
.
length
;
i
++)
{
List
<
CoreDict
>
list
=
dictService
.
findAllByType
(
strs
[
i
]);
map
.
put
(
strs
[
i
],
list
);
}
return
JsonResult
.
success
(
map
);
}
}
Prev
1
2
3
4
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