File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed
app/src/main/java/com/tinyengine/it/config/filter
base/src/main/java/com/tinyengine/it/service/app/impl Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -50,3 +50,4 @@ public CorsFilter corsFilter()
5050 }
5151
5252}
53+
Original file line number Diff line number Diff line change @@ -414,17 +414,17 @@ public FileResult bulkInsertOrUpdate(List<I18nEntry> entries) {
414414 int addNum = 0 ;
415415 int updateNum = 0 ;
416416 for (I18nEntry entry : entries ) {
417- // 构建查询条件,假设 key 作为唯一键
417+
418418 // 查询数据库中是否存在该记录
419- I18nEntryDto existingEntry = i18nEntryMapper .findI18nEntriesByKeyAndLang (entry . getKey (), entry . getLang () );
419+ List < I18nEntryDto > i18nEntryList = i18nEntryMapper .queryI18nEntryByCondition (entry );
420420
421- if (existingEntry == null ) {
421+ if (i18nEntryList . isEmpty () ) {
422422 // 插入新记录
423423 i18nEntryMapper .createI18nEntry (entry );
424424 addNum = addNum + 1 ;
425425 } else {
426426 // 更新记录
427- entry .setId (existingEntry .getId ());
427+ entry .setId (i18nEntryList . get ( 0 ) .getId ());
428428 i18nEntryMapper .updateI18nEntryById (entry );
429429 updateNum = updateNum + 1 ;
430430 }
You can’t perform that action at this time.
0 commit comments