提交 c1d5dcdc 编写于 作者: ibizdev's avatar ibizdev

ibiz4j 发布系统代码 [ibz-dict,字典]

上级 87b2577d
...@@ -51,6 +51,9 @@ public class DictCatalogServiceImpl extends ServiceImpl<DictCatalogMapper, DictC ...@@ -51,6 +51,9 @@ public class DictCatalogServiceImpl extends ServiceImpl<DictCatalogMapper, DictC
@Autowired @Autowired
@Lazy @Lazy
protected cn.ibizlab.core.dict.service.IDictOptionService dictoptionService; protected cn.ibizlab.core.dict.service.IDictOptionService dictoptionService;
@Autowired
@Lazy
IDictCatalogService proxyService;
protected int batchSize = 500; protected int batchSize = 500;
...@@ -136,21 +139,49 @@ public class DictCatalogServiceImpl extends ServiceImpl<DictCatalogMapper, DictC ...@@ -136,21 +139,49 @@ public class DictCatalogServiceImpl extends ServiceImpl<DictCatalogMapper, DictC
if (null == et) { if (null == et) {
return false; return false;
} else { } else {
return checkKey(et) ? this.update(et) : this.create(et); return checkKey(et) ? proxyService.update(et) : proxyService.create(et);
} }
} }
@Override @Override
@Transactional @Transactional
public boolean saveBatch(Collection<DictCatalog> list) { public boolean saveBatch(Collection<DictCatalog> list) {
saveOrUpdateBatch(list,batchSize); List<DictCatalog> create = new ArrayList<>();
List<DictCatalog> update = new ArrayList<>();
for (DictCatalog et : list) {
if (ObjectUtils.isEmpty(et.getId()) || ObjectUtils.isEmpty(getById(et.getId()))) {
create.add(et);
} else {
update.add(et);
}
}
if (create.size() > 0) {
proxyService.createBatch(create);
}
if (update.size() > 0) {
proxyService.updateBatch(update);
}
return true; return true;
} }
@Override @Override
@Transactional @Transactional
public void saveBatch(List<DictCatalog> list) { public void saveBatch(List<DictCatalog> list) {
saveOrUpdateBatch(list,batchSize); List<DictCatalog> create = new ArrayList<>();
List<DictCatalog> update = new ArrayList<>();
for (DictCatalog et : list) {
if (ObjectUtils.isEmpty(et.getId()) || ObjectUtils.isEmpty(getById(et.getId()))) {
create.add(et);
} else {
update.add(et);
}
}
if (create.size() > 0) {
proxyService.createBatch(create);
}
if (update.size() > 0) {
proxyService.updateBatch(update);
}
} }
......
...@@ -51,6 +51,9 @@ public class DictOptionServiceImpl extends ServiceImpl<DictOptionMapper, DictOpt ...@@ -51,6 +51,9 @@ public class DictOptionServiceImpl extends ServiceImpl<DictOptionMapper, DictOpt
@Autowired @Autowired
@Lazy @Lazy
protected cn.ibizlab.core.dict.service.IDictCatalogService dictcatalogService; protected cn.ibizlab.core.dict.service.IDictCatalogService dictcatalogService;
@Autowired
@Lazy
IDictOptionService proxyService;
protected int batchSize = 500; protected int batchSize = 500;
...@@ -141,7 +144,7 @@ public class DictOptionServiceImpl extends ServiceImpl<DictOptionMapper, DictOpt ...@@ -141,7 +144,7 @@ public class DictOptionServiceImpl extends ServiceImpl<DictOptionMapper, DictOpt
if (null == et) { if (null == et) {
return false; return false;
} else { } else {
return checkKey(et) ? this.update(et) : this.create(et); return checkKey(et) ? proxyService.update(et) : proxyService.create(et);
} }
} }
...@@ -149,7 +152,21 @@ public class DictOptionServiceImpl extends ServiceImpl<DictOptionMapper, DictOpt ...@@ -149,7 +152,21 @@ public class DictOptionServiceImpl extends ServiceImpl<DictOptionMapper, DictOpt
@Transactional @Transactional
public boolean saveBatch(Collection<DictOption> list) { public boolean saveBatch(Collection<DictOption> list) {
list.forEach(item->fillParentData(item)); list.forEach(item->fillParentData(item));
saveOrUpdateBatch(list,batchSize); List<DictOption> create = new ArrayList<>();
List<DictOption> update = new ArrayList<>();
for (DictOption et : list) {
if (ObjectUtils.isEmpty(et.getValueKey()) || ObjectUtils.isEmpty(getById(et.getValueKey()))) {
create.add(et);
} else {
update.add(et);
}
}
if (create.size() > 0) {
proxyService.createBatch(create);
}
if (update.size() > 0) {
proxyService.updateBatch(update);
}
return true; return true;
} }
...@@ -157,7 +174,21 @@ public class DictOptionServiceImpl extends ServiceImpl<DictOptionMapper, DictOpt ...@@ -157,7 +174,21 @@ public class DictOptionServiceImpl extends ServiceImpl<DictOptionMapper, DictOpt
@Transactional @Transactional
public void saveBatch(List<DictOption> list) { public void saveBatch(List<DictOption> list) {
list.forEach(item->fillParentData(item)); list.forEach(item->fillParentData(item));
saveOrUpdateBatch(list,batchSize); List<DictOption> create = new ArrayList<>();
List<DictOption> update = new ArrayList<>();
for (DictOption et : list) {
if (ObjectUtils.isEmpty(et.getValueKey()) || ObjectUtils.isEmpty(getById(et.getValueKey()))) {
create.add(et);
} else {
update.add(et);
}
}
if (create.size() > 0) {
proxyService.createBatch(create);
}
if (update.size() > 0) {
proxyService.updateBatch(update);
}
} }
......
...@@ -31,9 +31,6 @@ ...@@ -31,9 +31,6 @@
<mybatis-plus.version>3.3.1</mybatis-plus.version> <mybatis-plus.version>3.3.1</mybatis-plus.version>
<mybatis-plus-dynamic-datasource.version>3.0.0</mybatis-plus-dynamic-datasource.version> <mybatis-plus-dynamic-datasource.version>3.0.0</mybatis-plus-dynamic-datasource.version>
<!-- Liquibase -->
<liquibase.version>3.6.3</liquibase.version>
<!-- Swagger2 --> <!-- Swagger2 -->
<springfox-swagger.version>2.9.2</springfox-swagger.version> <springfox-swagger.version>2.9.2</springfox-swagger.version>
...@@ -60,7 +57,7 @@ ...@@ -60,7 +57,7 @@
<jsonwebtoken-jjwt.version>0.9.1</jsonwebtoken-jjwt.version> <jsonwebtoken-jjwt.version>0.9.1</jsonwebtoken-jjwt.version>
<!--Liquibase数据库版本更新工具--> <!--Liquibase数据库版本更新工具-->
<liquibase.version>3.8.7</liquibase.version> <liquibase.version>3.9.0</liquibase.version>
<!--H2内存数据库--> <!--H2内存数据库-->
<h2.version>1.4.200</h2.version> <h2.version>1.4.200</h2.version>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册