Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzdict
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzdict
提交
ba098688
提交
ba098688
编写于
4月 19, 2020
作者:
ibizdev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ibizdev提交
上级
a75527e8
变更
11
隐藏空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
85 行增加
和
534 行删除
+85
-534
main-grid-base.vue
app_web/src/widgets/ibzdict/main-grid/main-grid-base.vue
+1
-1
main-grid-base.vue
app_web/src/widgets/ibzdictitem/main-grid/main-grid-base.vue
+1
-1
IBZDict.java
...re/src/main/java/cn/ibizlab/core/dict/domain/IBZDict.java
+12
-28
IBZDictItem.java
...rc/main/java/cn/ibizlab/core/dict/domain/IBZDictItem.java
+0
-169
IBZDictItemSearchContext.java
...cn/ibizlab/core/dict/filter/IBZDictItemSearchContext.java
+0
-47
IBZDictSearchContext.java
...ava/cn/ibizlab/core/dict/filter/IBZDictSearchContext.java
+4
-33
IBZDictRepository.java
...va/cn/ibizlab/core/dict/repository/IBZDictRepository.java
+11
-0
IIBZDictItemService.java
...ava/cn/ibizlab/core/dict/service/IIBZDictItemService.java
+0
-28
IIBZDictService.java
...in/java/cn/ibizlab/core/dict/service/IIBZDictService.java
+2
-3
IBZDictItemServiceImpl.java
...bizlab/core/dict/service/impl/IBZDictItemServiceImpl.java
+0
-154
IBZDictServiceImpl.java
...cn/ibizlab/core/dict/service/impl/IBZDictServiceImpl.java
+54
-70
未找到文件。
app_web/src/widgets/ibzdict/main-grid/main-grid-base.vue
浏览文件 @
ba098688
...
...
@@ -33,7 +33,7 @@
<
template
v-if=
"getColumnState('updatedate')"
>
<el-table-column
show-overflow-tooltip
:prop=
"'updatedate'"
:label=
"$t('ibzdict.main_grid.columns.updatedate')"
:width=
"250"
:align=
"'left'"
:sortable=
"'custom'"
>
<template
v-slot=
"
{row,column}">
<app-format-data
format=
"
%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS
"
:data=
"row.updatedate"
></app-format-data>
<app-format-data
format=
"
YYYY-MM-DD hh:mm:ss
"
:data=
"row.updatedate"
></app-format-data>
</
template
>
</el-table-column>
</template>
...
...
app_web/src/widgets/ibzdictitem/main-grid/main-grid-base.vue
浏览文件 @
ba098688
...
...
@@ -68,7 +68,7 @@
<
template
v-if=
"getColumnState('updatedate')"
>
<el-table-column
show-overflow-tooltip
:prop=
"'updatedate'"
:label=
"$t('ibzdictitem.main_grid.columns.updatedate')"
:width=
"250"
:align=
"'left'"
:sortable=
"'custom'"
>
<template
v-slot=
"
{row,column}">
<app-format-data
format=
"
%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS
"
:data=
"row.updatedate"
></app-format-data>
<app-format-data
format=
"
YYYY-MM-DD hh:mm:ss
"
:data=
"row.updatedate"
></app-format-data>
</
template
>
</el-table-column>
</template>
...
...
ibzdict-core/src/main/java/cn/ibizlab/core/dict/domain/IBZDict.java
浏览文件 @
ba098688
...
...
@@ -19,69 +19,59 @@ import java.io.Serializable;
import
lombok.Data
;
import
com.baomidou.mybatisplus.annotation.*
;
import
org.springframework.data.mongodb.core.mapping.Document
;
/**
*
实体[数据字典]
*
大数据 [数据字典] 对象
*/
@Data
@TableName
(
value
=
"IBZDICT"
,
resultMap
=
"IBZDictResultMap"
)
public
class
IBZDict
extends
EntityBase
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
@Document
(
collection
=
"ibzdict"
)
public
class
IBZDict
implements
Serializable
{
/**
* 字典标识
*/
@DEField
(
isKeyField
=
true
)
@TableId
(
value
=
"ibzdictid"
,
type
=
IdType
.
UUID
)
private
String
dictid
;
private
String
dictId
;
/**
* 字典名称
*/
@TableField
(
value
=
"ibzdictname"
)
private
String
dictname
;
private
String
dictName
;
/**
* 逻辑有效标志
*/
@DEField
(
preType
=
DEPredefinedFieldType
.
LOGICVALID
)
@TableLogic
(
value
=
"1"
,
delval
=
"0"
)
@TableField
(
value
=
"enable"
)
private
Integer
enable
;
/**
* 建立时间
*/
@DEField
(
preType
=
DEPredefinedFieldType
.
CREATEDATE
)
@TableField
(
value
=
"createdate"
,
fill
=
FieldFill
.
INSERT
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
locale
=
"zh"
,
timezone
=
"GMT+8"
)
@JSONField
(
format
=
"yyyy-MM-dd HH:mm:ss"
)
private
Timestamp
create
d
ate
;
private
Timestamp
create
D
ate
;
/**
* 更新时间
*/
@DEField
(
preType
=
DEPredefinedFieldType
.
UPDATEDATE
)
@TableField
(
value
=
"updatedate"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
locale
=
"zh"
,
timezone
=
"GMT+8"
)
@JSONField
(
format
=
"yyyy-MM-dd HH:mm:ss"
)
private
Timestamp
update
d
ate
;
private
Timestamp
update
D
ate
;
/**
* 建立人
*/
@DEField
(
preType
=
DEPredefinedFieldType
.
CREATEMAN
)
@TableField
(
value
=
"createman"
,
fill
=
FieldFill
.
INSERT
)
private
String
createman
;
private
String
createMan
;
/**
* 更新人
*/
@DEField
(
preType
=
DEPredefinedFieldType
.
UPDATEMAN
)
@TableField
(
value
=
"updateman"
)
private
String
updateman
;
private
String
updateMan
;
...
...
@@ -90,16 +80,10 @@ public class IBZDict extends EntityBase implements Serializable {
*/
@JsonIgnore
@JSONField
(
serialize
=
false
)
@TableField
(
exist
=
false
)
private
List
<
cn
.
ibizlab
.
core
.
dict
.
domain
.
IBZDictItem
>
items
;
/**
* 设置 [字典名称]
*/
public
void
setDictname
(
String
dictname
){
this
.
dictname
=
dictname
;
this
.
modify
(
"ibzdictname"
,
dictname
);
}
}
ibzdict-core/src/main/java/cn/ibizlab/core/dict/domain/IBZDictItem.java
浏览文件 @
ba098688
...
...
@@ -19,172 +19,3 @@ import java.io.Serializable;
import
lombok.Data
;
import
com.baomidou.mybatisplus.annotation.*
;
/**
* 实体[字典项目]
*/
@Data
@TableName
(
value
=
"IBZDICTITEM"
,
resultMap
=
"IBZDictItemResultMap"
)
public
class
IBZDictItem
extends
EntityBase
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 字典项目标识
*/
@DEField
(
isKeyField
=
true
)
@TableId
(
value
=
"ibzdictitemid"
,
type
=
IdType
.
UUID
)
private
String
itemid
;
/**
* 栏目显示值
*/
@TableField
(
value
=
"ibzdictitemname"
)
private
String
itemname
;
/**
* 栏目值
*/
@TableField
(
value
=
"dictitemval"
)
private
String
itemval
;
/**
* 字典标识
*/
@TableField
(
value
=
"dictid"
)
private
String
dictid
;
/**
* 父栏目值
*/
@TableField
(
value
=
"pitemval"
)
private
String
pitemval
;
/**
* 过滤项
*/
@TableField
(
value
=
"itemfilter"
)
private
String
itemfilter
;
/**
* 栏目样式
*/
@DEField
(
defaultValue
=
"itemcls"
,
defaultValueType
=
DEFieldDefaultValueType
.
PARAM
)
@TableField
(
value
=
"itemcls"
)
private
String
itemcls
;
/**
* 图标
*/
@DEField
(
defaultValue
=
"no,png"
)
@TableField
(
value
=
"itemicon"
)
private
String
itemicon
;
/**
* 排序
*/
@TableField
(
value
=
"showorder"
)
private
Integer
showorder
;
/**
* 建立时间
*/
@DEField
(
preType
=
DEPredefinedFieldType
.
CREATEDATE
)
@TableField
(
value
=
"createdate"
,
fill
=
FieldFill
.
INSERT
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
locale
=
"zh"
,
timezone
=
"GMT+8"
)
@JSONField
(
format
=
"yyyy-MM-dd HH:mm:ss"
)
private
Timestamp
createdate
;
/**
* 更新时间
*/
@DEField
(
defaultValueType
=
DEFieldDefaultValueType
.
CURTIME
,
preType
=
DEPredefinedFieldType
.
UPDATEDATE
)
@TableField
(
value
=
"updatedate"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
locale
=
"zh"
,
timezone
=
"GMT+8"
)
@JSONField
(
format
=
"yyyy-MM-dd HH:mm:ss"
)
private
Timestamp
updatedate
;
/**
* 建立人
*/
@DEField
(
preType
=
DEPredefinedFieldType
.
CREATEMAN
)
@TableField
(
value
=
"createman"
,
fill
=
FieldFill
.
INSERT
)
private
String
createman
;
/**
* 更新人
*/
@DEField
(
defaultValue
=
"SRFPERSONID"
,
defaultValueType
=
DEFieldDefaultValueType
.
SESSION
,
preType
=
DEPredefinedFieldType
.
UPDATEMAN
)
@TableField
(
value
=
"updateman"
)
private
String
updateman
;
/**
* 字典
*/
@JsonIgnore
@JSONField
(
serialize
=
false
)
@TableField
(
exist
=
false
)
private
IBZDict
dict
;
/**
* 设置 [栏目显示值]
*/
public
void
setItemname
(
String
itemname
){
this
.
itemname
=
itemname
;
this
.
modify
(
"ibzdictitemname"
,
itemname
);
}
/**
* 设置 [栏目值]
*/
public
void
setItemval
(
String
itemval
){
this
.
itemval
=
itemval
;
this
.
modify
(
"dictitemval"
,
itemval
);
}
/**
* 设置 [字典标识]
*/
public
void
setDictid
(
String
dictid
){
this
.
dictid
=
dictid
;
this
.
modify
(
"dictid"
,
dictid
);
}
/**
* 设置 [父栏目值]
*/
public
void
setPitemval
(
String
pitemval
){
this
.
pitemval
=
pitemval
;
this
.
modify
(
"pitemval"
,
pitemval
);
}
/**
* 设置 [过滤项]
*/
public
void
setItemfilter
(
String
itemfilter
){
this
.
itemfilter
=
itemfilter
;
this
.
modify
(
"itemfilter"
,
itemfilter
);
}
/**
* 设置 [栏目样式]
*/
public
void
setItemcls
(
String
itemcls
){
this
.
itemcls
=
itemcls
;
this
.
modify
(
"itemcls"
,
itemcls
);
}
/**
* 设置 [图标]
*/
public
void
setItemicon
(
String
itemicon
){
this
.
itemicon
=
itemicon
;
this
.
modify
(
"itemicon"
,
itemicon
);
}
/**
* 设置 [排序]
*/
public
void
setShoworder
(
Integer
showorder
){
this
.
showorder
=
showorder
;
this
.
modify
(
"showorder"
,
showorder
);
}
}
ibzdict-core/src/main/java/cn/ibizlab/core/dict/filter/IBZDictItemSearchContext.java
浏览文件 @
ba098688
...
...
@@ -20,52 +20,5 @@ import org.springframework.util.StringUtils;
import
cn.ibizlab.util.service.MybatisSearchContext
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
cn.ibizlab.core.dict.domain.IBZDictItem
;
/**
* 关系型数据实体[IBZDictItem] 查询条件对象
*/
@Slf4j
@Data
public
class
IBZDictItemSearchContext
extends
MybatisSearchContext
{
private
QueryWrapper
<
IBZDictItem
>
selectCond
=
new
QueryWrapper
();
private
String
n_ibzdictitemname_like
;
//[栏目显示值]
public
void
setN_ibzdictitemname_like
(
String
n_ibzdictitemname_like
)
{
this
.
n_ibzdictitemname_like
=
n_ibzdictitemname_like
;
if
(!
StringUtils
.
isEmpty
(
this
.
n_ibzdictitemname_like
)){
this
.
selectCond
.
like
(
"ibzdictitemname"
,
n_ibzdictitemname_like
);
}
}
private
String
n_dictitemval_like
;
//[栏目值]
public
void
setN_dictitemval_like
(
String
n_dictitemval_like
)
{
this
.
n_dictitemval_like
=
n_dictitemval_like
;
if
(!
StringUtils
.
isEmpty
(
this
.
n_dictitemval_like
)){
this
.
selectCond
.
like
(
"dictitemval"
,
n_dictitemval_like
);
}
}
private
String
n_dictid_eq
;
//[字典标识]
public
void
setN_dictid_eq
(
String
n_dictid_eq
)
{
this
.
n_dictid_eq
=
n_dictid_eq
;
if
(!
StringUtils
.
isEmpty
(
this
.
n_dictid_eq
)){
this
.
selectCond
.
eq
(
"dictid"
,
n_dictid_eq
);
}
}
/**
* 启用快速搜索
*/
public
void
setQuery
(
String
query
)
{
this
.
query
=
query
;
if
(!
StringUtils
.
isEmpty
(
query
)){
this
.
selectCond
.
or
().
like
(
"ibzdictitemname"
,
query
);
}
}
}
ibzdict-core/src/main/java/cn/ibizlab/core/dict/filter/IBZDictSearchContext.java
浏览文件 @
ba098688
...
...
@@ -20,45 +20,16 @@ import org.springframework.util.StringUtils;
import
cn.ibizlab.util.service.MybatisSearchContext
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
cn.ibizlab.core.dict.domain.IBZDict
;
import
cn.ibizlab.util.service.SearchContextBase
;
/**
*
关系型
数据实体[IBZDict] 查询条件对象
*
NoSQL
数据实体[IBZDict] 查询条件对象
*/
@Slf4j
@Data
public
class
IBZDictSearchContext
extends
MybatisSearchContext
{
private
QueryWrapper
<
IBZDict
>
selectCond
=
new
QueryWrapper
();
public
class
IBZDictSearchContext
extends
SearchContextBase
{
private
String
n_ibzdictid_like
;
//[字典标识]
public
void
setN_ibzdictid_like
(
String
n_ibzdictid_like
)
{
this
.
n_ibzdictid_like
=
n_ibzdictid_like
;
if
(!
StringUtils
.
isEmpty
(
this
.
n_ibzdictid_like
)){
this
.
selectCond
.
like
(
"ibzdictid"
,
n_ibzdictid_like
);
}
}
private
String
n_ibzdictname_like
;
//[字典名称]
public
void
setN_ibzdictname_like
(
String
n_ibzdictname_like
)
{
this
.
n_ibzdictname_like
=
n_ibzdictname_like
;
if
(!
StringUtils
.
isEmpty
(
this
.
n_ibzdictname_like
)){
this
.
selectCond
.
like
(
"ibzdictname"
,
n_ibzdictname_like
);
}
}
/**
* 启用快速搜索
*/
public
void
setQuery
(
String
query
)
{
this
.
query
=
query
;
if
(!
StringUtils
.
isEmpty
(
query
)){
this
.
selectCond
.
or
().
like
(
"ibzdictname"
,
query
);
}
}
}
ibzdict-core/src/main/java/cn/ibizlab/core/dict/repository/IBZDictRepository.java
0 → 100644
浏览文件 @
ba098688
package
cn
.
ibizlab
.
core
.
dict
.
repository
;
import
org.springframework.data.mongodb.repository.MongoRepository
;
import
cn.ibizlab.core.dict.domain.IBZDict
;
import
org.springframework.stereotype.Repository
;
@Repository
public
interface
IBZDictRepository
extends
MongoRepository
<
IBZDict
,
String
>{
}
ibzdict-core/src/main/java/cn/ibizlab/core/dict/service/IIBZDictItemService.java
浏览文件 @
ba098688
...
...
@@ -16,31 +16,3 @@ import cn.ibizlab.core.dict.domain.IBZDictItem;
import
cn.ibizlab.core.dict.filter.IBZDictItemSearchContext
;
import
com.baomidou.mybatisplus.extension.service.IService
;
/**
* 实体[IBZDictItem] 服务对象接口
*/
public
interface
IIBZDictItemService
extends
IService
<
IBZDictItem
>{
IBZDictItem
get
(
String
key
)
;
IBZDictItem
getDraft
(
IBZDictItem
et
)
;
boolean
save
(
IBZDictItem
et
)
;
void
saveBatch
(
List
<
IBZDictItem
>
list
,
int
batchSize
)
;
boolean
checkKey
(
IBZDictItem
et
)
;
boolean
remove
(
String
key
)
;
void
removeBatch
(
Collection
<
String
>
idList
,
int
batchSize
)
;
boolean
create
(
IBZDictItem
et
)
;
void
createBatch
(
List
<
IBZDictItem
>
list
,
int
batchSize
)
;
boolean
update
(
IBZDictItem
et
)
;
void
updateBatch
(
List
<
IBZDictItem
>
list
,
int
batchSize
)
;
Page
<
IBZDictItem
>
searchDefault
(
IBZDictItemSearchContext
context
)
;
List
<
IBZDictItem
>
selectByDictid
(
String
dictid
)
;
void
saveByDictid
(
String
dictid
,
List
<
IBZDictItem
>
list
)
;
void
removeByDictid
(
String
dictid
)
;
}
ibzdict-core/src/main/java/cn/ibizlab/core/dict/service/IIBZDictService.java
浏览文件 @
ba098688
...
...
@@ -16,12 +16,10 @@ import cn.ibizlab.core.dict.domain.IBZDict;
import
cn.ibizlab.core.dict.filter.IBZDictSearchContext
;
import
com.baomidou.mybatisplus.extension.service.IService
;
/**
* 实体[IBZDict] 服务对象接口
*/
public
interface
IIBZDictService
extends
IService
<
IBZDict
>
{
public
interface
IIBZDictService
{
IBZDict
get
(
String
key
)
;
boolean
create
(
IBZDict
et
)
;
...
...
@@ -40,3 +38,4 @@ public interface IIBZDictService extends IService<IBZDict>{
}
ibzdict-core/src/main/java/cn/ibizlab/core/dict/service/impl/IBZDictItemServiceImpl.java
浏览文件 @
ba098688
...
...
@@ -20,7 +20,6 @@ import org.springframework.stereotype.Service;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageImpl
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.transaction.annotation.Transactional
;
import
cn.ibizlab.core.dict.domain.IBZDictItem
;
import
cn.ibizlab.core.dict.filter.IBZDictItemSearchContext
;
import
cn.ibizlab.core.dict.service.IIBZDictItemService
;
...
...
@@ -29,156 +28,3 @@ import cn.ibizlab.util.helper.CachedBeanCopier;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
cn.ibizlab.core.dict.mapper.IBZDictItemMapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.Wrapper
;
import
org.springframework.util.ObjectUtils
;
/**
* 实体[字典项目] 服务对象接口实现
*/
@Slf4j
@Service
public
class
IBZDictItemServiceImpl
extends
ServiceImpl
<
IBZDictItemMapper
,
IBZDictItem
>
implements
IIBZDictItemService
{
@Override
@Transactional
public
IBZDictItem
get
(
String
key
)
{
IBZDictItem
et
=
getById
(
key
);
if
(
et
==
null
){
et
=
new
IBZDictItem
();
et
.
setItemid
(
key
);
}
return
et
;
}
@Override
public
IBZDictItem
getDraft
(
IBZDictItem
et
)
{
return
et
;
}
@Override
@Transactional
public
boolean
save
(
IBZDictItem
et
)
{
return
saveOrUpdate
(
et
)
;
}
@Override
@Transactional
(
rollbackFor
=
{
Exception
.
class
}
)
public
boolean
saveOrUpdate
(
IBZDictItem
et
)
{
if
(
null
==
et
)
{
return
false
;
}
else
{
return
checkKey
(
et
)
?
this
.
update
(
et
)
:
this
.
create
(
et
);
}
}
@Override
public
void
saveBatch
(
List
<
IBZDictItem
>
list
,
int
batchSize
)
{
saveOrUpdateBatch
(
list
,
batchSize
);
}
@Override
public
boolean
checkKey
(
IBZDictItem
et
)
{
return
(!
ObjectUtils
.
isEmpty
(
et
.
getItemid
()))&&(!
Objects
.
isNull
(
this
.
getById
(
et
.
getItemid
())));
}
@Override
@Transactional
public
boolean
remove
(
String
key
)
{
if
(!
removeById
(
key
))
return
false
;
return
true
;
}
@Override
public
void
removeBatch
(
Collection
<
String
>
idList
,
int
batchSize
)
{
removeByIds
(
idList
);
}
@Override
@Transactional
public
boolean
create
(
IBZDictItem
et
)
{
if
(!
this
.
retBool
(
this
.
baseMapper
.
insert
(
et
)))
return
false
;
CachedBeanCopier
.
copy
(
get
(
et
.
getItemid
()),
et
);
return
true
;
}
@Override
public
void
createBatch
(
List
<
IBZDictItem
>
list
,
int
batchSize
)
{
saveBatch
(
list
,
batchSize
);
}
@Override
@Transactional
public
boolean
update
(
IBZDictItem
et
)
{
if
(!
update
(
et
,(
Wrapper
)
et
.
getUpdateWrapper
(
true
).
eq
(
"ibzdictitemid"
,
et
.
getItemid
())))
return
false
;
CachedBeanCopier
.
copy
(
get
(
et
.
getItemid
()),
et
);
return
true
;
}
@Override
public
void
updateBatch
(
List
<
IBZDictItem
>
list
,
int
batchSize
)
{
updateBatchById
(
list
,
batchSize
);
}
@Override
public
List
<
IBZDictItem
>
selectByDictid
(
String
dictid
)
{
return
baseMapper
.
selectByDictid
(
dictid
);
}
@Override
public
void
saveByDictid
(
String
dictid
,
List
<
IBZDictItem
>
list
)
{
if
(
list
==
null
)
return
;
Set
<
String
>
delIds
=
new
HashSet
<
String
>();
List
<
IBZDictItem
>
_update
=
new
ArrayList
<
IBZDictItem
>();
List
<
IBZDictItem
>
_create
=
new
ArrayList
<
IBZDictItem
>();
for
(
IBZDictItem
before:
selectByDictid
(
dictid
)){
delIds
.
add
(
before
.
getItemid
());
}
for
(
IBZDictItem
sub:
list
)
{
sub
.
setDictid
(
dictid
);
if
(
ObjectUtils
.
isEmpty
(
sub
.
getItemid
()))
sub
.
setItemid
((
String
)
sub
.
getDefaultKey
(
true
));
if
(
delIds
.
contains
(
sub
.
getItemid
()))
{
delIds
.
remove
(
sub
.
getItemid
());
_update
.
add
(
sub
);
}
else
_create
.
add
(
sub
);
}
if
(
_update
.
size
()>
0
)
this
.
updateBatch
(
_update
,
500
);
if
(
_create
.
size
()>
0
)
this
.
createBatch
(
_create
,
500
);
if
(
delIds
.
size
()>
0
)
this
.
removeBatch
(
delIds
,
500
);
}
@Override
public
void
removeByDictid
(
String
dictid
)
{
this
.
remove
(
new
QueryWrapper
<
IBZDictItem
>().
eq
(
"ibzdictid"
,
dictid
));
}
/**
* 查询集合 DEFAULT
*/
@Override
public
Page
<
IBZDictItem
>
searchDefault
(
IBZDictItemSearchContext
context
)
{
com
.
baomidou
.
mybatisplus
.
extension
.
plugins
.
pagination
.
Page
<
IBZDictItem
>
pages
=
baseMapper
.
searchDefault
(
context
.
getPage
(),
context
,
context
.
getSelectCond
());
return
new
PageImpl
<
IBZDictItem
>(
pages
.
getRecords
(),
context
.
getPageable
(),
pages
.
getTotal
());
}
}
ibzdict-core/src/main/java/cn/ibizlab/core/dict/service/impl/IBZDictServiceImpl.java
浏览文件 @
ba098688
...
...
@@ -20,7 +20,6 @@ import org.springframework.stereotype.Service;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageImpl
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.transaction.annotation.Transactional
;
import
cn.ibizlab.core.dict.domain.IBZDict
;
import
cn.ibizlab.core.dict.filter.IBZDictSearchContext
;
import
cn.ibizlab.core.dict.service.IIBZDictService
;
...
...
@@ -29,120 +28,105 @@ import cn.ibizlab.util.helper.CachedBeanCopier;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
cn.ibizlab.core.dict.mapper.IBZDictMapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.Wrapper
;
import
org.springframework.util.ObjectUtils
;
import
cn.ibizlab.core.dict.repository.IBZDictRepository
;
/**
* 实体[数据字典] 服务对象接口实现
*/
@Slf4j
@Service
public
class
IBZDictServiceImpl
extends
ServiceImpl
<
IBZDictMapper
,
IBZDict
>
implements
IIBZDictService
{
public
class
IBZDictServiceImpl
implements
IIBZDictService
{
@Autowired
IBZDictRepository
repository
;
@Autowired
private
cn
.
ibizlab
.
core
.
dict
.
service
.
IIBZDictItemService
i
bzdicti
temService
;
private
cn
.
ibizlab
.
core
.
dict
.
service
.
IIBZDictItemService
i
BZDictI
temService
;
@Override
@Transactional
public
IBZDict
get
(
String
key
)
{
IBZDict
et
=
getById
(
key
);
if
(
et
==
null
){
et
=
new
IBZDict
();
et
.
setDictid
(
key
);
}
return
et
;
public
IBZDict
get
(
String
dictid
)
{
return
repository
.
findById
(
dictid
).
get
();
}
@Override
@Transactional
public
boolean
create
(
IBZDict
et
)
{
if
(!
this
.
retBool
(
this
.
baseMapper
.
insert
(
et
)))
return
false
;
CachedBeanCopier
.
copy
(
get
(
et
.
getDictid
()),
et
);
return
true
;
public
IBZDict
get
(
IBZDict
et
)
{
return
null
;
}
@Override
public
void
createBatch
(
List
<
IBZDict
>
list
,
int
batchSize
)
{
saveBatch
(
list
,
batchSize
);
public
boolean
create
(
IBZDict
et
)
{
repository
.
insert
(
et
);
return
true
;
}
@Override
public
boolean
checkKey
(
IBZDict
et
)
{
return
(!
ObjectUtils
.
isEmpty
(
et
.
getDictid
()))&&(!
Objects
.
isNull
(
this
.
getById
(
et
.
getDictid
())))
;
return
true
;
}
@Override
public
IBZDict
getDraft
(
IBZDict
et
)
{
return
et
;
}
@Override
@Transactional
public
boolean
update
(
IBZDict
et
)
{
if
(!
update
(
et
,(
Wrapper
)
et
.
getUpdateWrapper
(
true
).
eq
(
"ibzdictid"
,
et
.
getDictid
())))
return
false
;
CachedBeanCopier
.
copy
(
get
(
et
.
getDictid
()),
et
);
repository
.
save
(
et
);
return
true
;
}
@Override
public
void
updateBatch
(
List
<
IBZDict
>
list
,
int
batchSize
)
{
updateBatchById
(
list
,
batchSize
);
}
@Override
@Transactional
public
boolean
remove
(
String
key
)
{
ibzdictitemService
.
removeByDictid
(
key
)
;
if
(!
removeById
(
key
))
return
false
;
public
boolean
remove
(
String
dictid
)
{
repository
.
deleteById
(
dictid
);
return
true
;
}
@Override
public
void
removeBatch
(
Collection
<
String
>
idList
,
int
batchSize
)
{
removeByIds
(
idList
);
}
@Override
@Transactional
public
boolean
save
(
IBZDict
et
)
{
return
saveOrUpdate
(
et
)
;
}
/**
* 查询集合 DEFAULT
*/
@Override
@Transactional
(
rollbackFor
=
{
Exception
.
class
}
)
public
boolean
saveOrUpdate
(
IBZDict
et
)
{
if
(
null
==
et
)
{
return
false
;
}
else
{
return
checkKey
(
et
)
?
this
.
update
(
et
)
:
this
.
create
(
et
);
}
public
Page
<
IBZDict
>
searchDefault
(
IBZDictSearchContext
context
)
{
List
<
IBZDict
>
iBZDicts
=
repository
.
findAll
();
return
new
PageImpl
<
IBZDict
>(
iBZDicts
,
context
.
getPageable
(),
iBZDicts
.
size
());
}
@Override
public
void
saveBatch
(
List
<
IBZDict
>
list
,
int
batchSize
)
{
saveOrUpdateBatch
(
list
,
batchSize
);
}
//更新嵌套[字典项目]
private
void
_updateItems
(
IBZDict
newIBZDict
,
IBZDict
oldIBZDict
){
Map
<
String
,
cn
.
ibizlab
.
core
.
dict
.
domain
.
IBZDictItem
>
oldMapItems
=
new
HashMap
<
String
,
cn
.
ibizlab
.
core
.
dict
.
domain
.
IBZDictItem
>()
;
List
<
cn
.
ibizlab
.
core
.
dict
.
domain
.
IBZDictItem
>
oldItems
=
oldIBZDict
.
getItems
();
if
(
ObjectUtils
.
isEmpty
(
oldItems
)
||
oldItems
.
size
()==
0
){
return
;
}
for
(
cn
.
ibizlab
.
core
.
dict
.
domain
.
IBZDictItem
iBZDictItem
:
oldItems
){
oldMapItems
.
put
(
iBZDictItem
.
getItemId
(),
iBZDictItem
);
}
Map
<
String
,
cn
.
ibizlab
.
core
.
dict
.
domain
.
IBZDictItem
>
newMapItems
=
new
HashMap
<
String
,
cn
.
ibizlab
.
core
.
dict
.
domain
.
IBZDictItem
>()
;
List
<
cn
.
ibizlab
.
core
.
dict
.
domain
.
IBZDictItem
>
newItems
=
newIBZDict
.
getItems
()
;
for
(
cn
.
ibizlab
.
core
.
dict
.
domain
.
IBZDictItem
iBZDictItem
:
newItems
){
iBZDictItem
.
setDictId
(
newIBZDict
.
getDictId
());
if
(
iBZDictItem
.
getItemId
()
==
null
){
iBZDictItemService
.
create
(
iBZDictItem
)
;
continue
;
}
newMapItems
.
put
(
iBZDictItem
.
getItemId
(),
iBZDictItem
)
;
if
(
oldMapItems
.
containsKey
(
iBZDictItem
.
getItemId
()))
{
iBZDictItemService
.
update
(
iBZDictItem
);
}
else
{
iBZDictItemService
.
create
(
iBZDictItem
);
}
}
/**
* 查询集合 DEFAULT
*/
@Override
public
Page
<
IBZDict
>
searchDefault
(
IBZDictSearchContext
context
)
{
com
.
baomidou
.
mybatisplus
.
extension
.
plugins
.
pagination
.
Page
<
IBZDict
>
pages
=
baseMapper
.
searchDefault
(
context
.
getPage
(),
context
,
context
.
getSelectCond
());
return
new
PageImpl
<
IBZDict
>(
pages
.
getRecords
(),
context
.
getPageable
(),
pages
.
getTotal
());
//删除多余数据
for
(
String
key
:
oldMapItems
.
keySet
()){
if
(!
newMapItems
.
containsKey
(
key
))
iBZDictItemService
.
remove
(
key
)
;
}
}
}
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录