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
9815183f
Commit
9815183f
authored
Dec 17, 2019
by
zengchao
Browse files
doing: 正在处理前端UI中的下拉选择器的逻辑
parent
0666fbe8
Changes
9
Hide whitespace changes
Inline
Side-by-side
plus-admin/admin-core/src/main/java/com/ibeetl/admin/core/dao/CoreDictDao.java
View file @
9815183f
package
com.ibeetl.admin.core.dao
;
import
com.ibeetl.admin.core.entity.DictType
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -21,6 +22,15 @@ public interface CoreDictDao extends BaseMapper<CoreDict> {
*/
List
<
CoreDict
>
findAllList
(
String
type
);
/**
* 查询某个类型下的字典集合<br/>
* 主要用于提供给前端的下拉选择菜单使用,业务上请使用返回值为{@link CoreDict}的方法
*
* @param type 字典类型
* @return
*/
List
<
DictType
>
findAllDictType
(
String
type
);
/**
* 查询字段类型列表
*
...
...
plus-admin/admin-core/src/main/java/com/ibeetl/admin/core/service/CoreBaseService.java
View file @
9815183f
...
...
@@ -5,6 +5,7 @@ import cn.hutool.core.lang.Assert;
import
cn.hutool.core.util.ClassUtil
;
import
cn.hutool.core.util.ReflectUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.ibeetl.admin.core.dao.SQLManagerBaseDao
;
import
com.ibeetl.admin.core.entity.DictType
;
import
com.ibeetl.admin.core.util.AnnotationUtil
;
import
com.ibeetl.admin.core.util.FileDownloadUtil
;
...
...
@@ -43,8 +44,7 @@ public class CoreBaseService<T> {
@Autowired
protected
CoreDictService
dictUtil
;
@Autowired
@Qualifier
(
"baseDataSourceSqlManagerFactoryBean"
)
protected
SQLManager
sqlManager
;
protected
SQLManagerBaseDao
sqlManager
;
/**
* 根据id查询对象,如果主键ID不存在
...
...
@@ -53,7 +53,7 @@ public class CoreBaseService<T> {
* @return
*/
public
T
queryById
(
Object
id
)
{
T
t
=
sqlManager
.
single
(
getCurrentEntityClassz
(),
id
);
T
t
=
sqlManager
.
getSQLManager
().
single
(
getCurrentEntityClassz
(),
id
);
queryEntityAfter
((
Object
)
t
);
return
t
;
}
...
...
@@ -66,7 +66,7 @@ public class CoreBaseService<T> {
* @return
*/
public
T
queryById
(
Class
<
T
>
classz
,
Object
id
)
{
T
t
=
sqlManager
.
unique
(
classz
,
id
);
T
t
=
sqlManager
.
getSQLManager
().
unique
(
classz
,
id
);
queryEntityAfter
((
Object
)
t
);
return
t
;
}
...
...
@@ -78,7 +78,7 @@ public class CoreBaseService<T> {
* @return
*/
public
boolean
save
(
T
model
)
{
return
sqlManager
.
insert
(
model
,
true
)
>
0
;
return
sqlManager
.
getSQLManager
().
insert
(
model
,
true
)
>
0
;
}
/**
...
...
@@ -103,7 +103,7 @@ public class CoreBaseService<T> {
list
.
add
(
map
);
}
int
[]
count
=
sqlManager
.
updateBatchTemplateById
(
getCurrentEntityClassz
(),
list
);
int
[]
count
=
sqlManager
.
getSQLManager
().
updateBatchTemplateById
(
getCurrentEntityClassz
(),
list
);
int
successCount
=
0
;
for
(
int
successFlag
:
count
)
{
successCount
+=
successFlag
;
...
...
@@ -117,7 +117,7 @@ public class CoreBaseService<T> {
// always id,delFlag for pojo
map
.
put
(
"id"
,
id
);
map
.
put
(
"delFlag"
,
DelFlagEnum
.
DELETED
.
getValue
());
int
ret
=
sqlManager
.
updateTemplateById
(
getCurrentEntityClassz
(),
map
);
int
ret
=
sqlManager
.
getSQLManager
().
updateTemplateById
(
getCurrentEntityClassz
(),
map
);
return
ret
==
1
;
}
/**
...
...
@@ -127,7 +127,7 @@ public class CoreBaseService<T> {
* @return
*/
public
int
forceDelete
(
Long
id
)
{
return
sqlManager
.
deleteById
(
getCurrentEntityClassz
(),
id
);
return
sqlManager
.
getSQLManager
().
deleteById
(
getCurrentEntityClassz
(),
id
);
}
/**
...
...
@@ -137,7 +137,7 @@ public class CoreBaseService<T> {
* @return
*/
public
int
forceDelete
(
Class
<
T
>
classz
,
Long
id
)
{
return
sqlManager
.
deleteById
(
classz
,
id
);
return
sqlManager
.
getSQLManager
().
deleteById
(
classz
,
id
);
}
/**
...
...
@@ -147,7 +147,7 @@ public class CoreBaseService<T> {
* @return
*/
public
boolean
updateTemplate
(
T
model
)
{
return
sqlManager
.
updateTemplateById
(
model
)
>
0
;
return
sqlManager
.
getSQLManager
().
updateTemplateById
(
model
)
>
0
;
}
/**
...
...
@@ -157,7 +157,7 @@ public class CoreBaseService<T> {
* @return
*/
public
boolean
update
(
T
model
)
{
return
sqlManager
.
updateById
(
model
)
>
0
;
return
sqlManager
.
getSQLManager
().
updateById
(
model
)
>
0
;
}
/**
...
...
plus-admin/admin-core/src/main/java/com/ibeetl/admin/core/service/CoreDictService.java
View file @
9815183f
...
...
@@ -46,7 +46,7 @@ public class CoreDictService extends CoreBaseService<CoreDict> {
/**
* 级联字典查询,必须提供一个字典类型
*
* @param
group
* @param
type
* @param value
* @return
*/
...
...
@@ -59,7 +59,7 @@ public class CoreDictService extends CoreBaseService<CoreDict> {
/**
* 级联字段下一级的字段列表
*
* @param parentValue
* @param
id : 父级的
parentValue
* @return
*/
@Cacheable
(
value
=
CorePlatformService
.
DICT_CACHE_CHILDREN
)
...
...
plus-admin/admin-core/src/main/java/com/ibeetl/admin/core/service/DictTypeService.java
0 → 100644
View file @
9815183f
package
com.ibeetl.admin.core.service
;
import
com.ibeetl.admin.core.dao.CoreDictDao
;
import
com.ibeetl.admin.core.entity.DictType
;
import
java.util.List
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
@Slf4j
@Service
public
class
DictTypeService
{
@Autowired
private
CoreDictDao
dictDao
;
public
List
<
DictType
>
findAllList
(
String
type
)
{
return
dictDao
.
findAllDictType
(
type
);
}
}
plus-admin/admin-core/src/main/java/com/ibeetl/admin/core/web/DictDataElController.java
0 → 100644
View file @
9815183f
package
com.ibeetl.admin.core.web
;
import
com.ibeetl.admin.core.entity.CoreDict
;
import
com.ibeetl.admin.core.entity.DictType
;
import
com.ibeetl.admin.core.service.CoreDictService
;
import
com.ibeetl.admin.core.service.CorePlatformService
;
import
com.ibeetl.admin.core.service.DictTypeService
;
import
java.util.List
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* 字典数据获取
*
* @author 一日看尽长安花
*/
@Slf4j
@RestController
@RequestMapping
(
value
=
"/core/dicts"
)
public
class
DictDataElController
{
@Autowired
CorePlatformService
platformService
;
@Autowired
CoreDictService
dictService
;
@Autowired
DictTypeService
dictTypeService
;
/**
* 查看字典类型对应的列表
*
* @param type
* @return
*/
@GetMapping
public
JsonResult
<
List
<
DictType
>>
dictList
(
String
type
)
{
List
<
DictType
>
list
=
dictTypeService
.
findAllList
(
type
);
return
JsonResult
.
success
(
list
);
}
}
plus-admin/admin-core/src/main/resources/sql/core/coreDict.md
View file @
9815183f
...
...
@@ -5,6 +5,14 @@ findAllList
and type = #type#
@}
ORDER BY type, sort DESC
findAllDictType
===
select
*
from core_dict where del_flag = 0
@if(!isEmpty(type)){
and type = #type#
@}
ORDER BY type, sort DESC
findTypeList
===
...
...
ve-admin/admin-web/src/components/TableViews/DataTable.vue
View file @
9815183f
<!--
* @Author: 一日看尽长安花
* @since: 2019-10-12 16:14:37
* @LastEditTime: 2019-1
1-24 10:52:05
* @LastEditTime: 2019-1
2-17 14:07:33
* @LastEditors: 一日看尽长安花
* @Description:
-->
...
...
@@ -25,7 +25,7 @@
<el-table-column
v-for=
"(val, key) in metedata"
:key=
"key"
:prop=
"key"
:prop=
"
val.type === 'dict' ? key + '.name' :
key"
:label=
"val.name"
:sortable=
"val.sortable"
:show-overflow-tooltip=
"true"
...
...
ve-admin/admin-web/src/components/TableViews/EditDialog.vue
View file @
9815183f
<!--
* @Author: 一日看尽长安花
* @since: 2019-10-12 16:14:37
* @LastEditTime: 2019-1
0
-17 1
7
:41:1
5
* @LastEditTime: 2019-1
2
-17 1
4
:41:
2
1
* @LastEditors: 一日看尽长安花
* @Description:
-->
...
...
@@ -174,4 +174,4 @@ export default {
}
};
</
script
>
<
style
scoped
></
style
>
<
style
></
style
>
ve-admin/admin-web/src/components/TableViews/SearchPane.vue
View file @
9815183f
<!--
* @Author: 一日看尽长安花
* @since: 2019-10-12 16:14:37
* @LastEditTime: 2019-1
1-25 22:58:49
* @LastEditTime: 2019-1
2-17 14:41:14
* @LastEditors: 一日看尽长安花
* @Description:
-->
...
...
@@ -129,7 +129,7 @@ export default {
}
};
</
script
>
<
style
scoped
>
<
style
>
.filter-container
{
margin-top
:
1rem
;
}
...
...
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