jeecgboot / jeecgboot/JeecgBoot

online java 导入增强优化

Open
#9,735 0 comments 0 reactions 0 assignees View on GitHub
help wanted
Dominant language
Java
Stars
47.8k
Forks
16.2k
PR merge metrics
No merged PRs in 30d

Description

##### 版本号:3.7.3

##### 分支:

##### 问题描述:
导入的excel每条数据都会走增强,如果要判断某条数据是否存在,就需要查库,这样每条都会查库,是不是效率有点低下,有没有其他方案可以代替(想过缓存方案,但没找到导入完成的钩子来刷新缓存)

##### 错误截图:
@Override
public EnhanceDataEnum execute(String tableName, JSONObject json) throws BusinessException {
// 从json中获取excel里面的数据
String name = json.getString("name");
if(name==null || "".equals(name)){
// 常量值为:0 表示丢弃数据
return EnhanceDataEnum.ABANDON;
}

// 拿到excel中的name 去数据库查询
Demo demo = testService.getDataByName(name);
if(demo!=null){
// 假定这个name是demo表的唯一标识,那么如果excel中的name 在数据库中已经存在,则根据excel中的数据走修改逻辑
// 修改逻辑需要设置原数据的ID
json.put("id", demo.getId());
// 常量值为:2 表示需要走修改逻辑
return EnhanceDataEnum.UPDATE;
}

// 常量值为:1 表示走新增逻辑
return EnhanceDataEnum.INSERT;
}

#### 友情提示:
- 未按格式要求发帖、描述过于简单的,会被直接删掉;
- 描述问题请图文并茂,方便我们理解并快速定位问题;
- 如果使用的不是master,请说明你使用的分支;

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue names only the EnhanceDataEnum.execute method and testService.getDataByName call; start by locating the online Excel import enhancement entry point and its import lifecycle. Define and validate an approach that avoids querying the database for every row while preserving ABANDON, UPDATE, and INSERT behavior, and document how any cache or batch state is refreshed after import.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend, databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.