Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mvel解析xml内的sql语句性能不太好,希望能优化 #81

Open
chenmu5241 opened this issue May 26, 2023 · 0 comments
Open

mvel解析xml内的sql语句性能不太好,希望能优化 #81

chenmu5241 opened this issue May 26, 2023 · 0 comments

Comments

@chenmu5241
Copy link

我有1000多条数据想使用insert into table (id,name) values(1,''a),(,'b')这种批量sql执行,所以用了模板做的,竟然需要20多秒,不知道有办法优化吗

VALUES
@foreach{item : list,index:list.size()}
(
@if{item.id == null} null @else{} '@{item.id}' @EnD{},
@if{item.createTeamId == null} null @else{} '@{item.createTeamId}' @EnD{},
@if{item.createTeamName == null} null @else{} '@{item.createTeamName}' @EnD{},
@if{item.createTime == null} null @else{} '@{cn.hutool.core.date.DateUtil.format(item.createTime,"yyyy-MM-dd HH:mm:ss")}' @EnD{},
@if{item.creatorId == null} null @else{} '@{item.creatorId}' @EnD{},
@if{item.creatorName == null} null @else{} '@{item.creatorName}' @EnD{},
@if{item.status == null} null @else{} @{item.status} @EnD{},
@if{item.tenantId == null} null @else{} '@{item.tenantId}' @EnD{},
@if{item.tenantName == null} null @else{} '@{item.tenantName}' @EnD{},
@if{item.updateTime == null} null @else{} '@{cn.hutool.core.date.DateUtil.format(item.updateTime,"yyyy-MM-dd HH:mm:ss")}' @EnD{},
@if{item.updatorId == null} null @else{} '@{item.updatorId}' @EnD{},
@if{item.updatorName == null} null @else{} '@{item.updatorName}' @EnD{},
@if{item.address == null} null @else{} '@{item.address}' @EnD{},
@if{item.area == null} null @else{} '@{item.area}' @EnD{},
@if{item.categoryCode == null} null @else{} '@{item.categoryCode}' @EnD{},
@if{item.categoryName == null} null @else{} '@{item.categoryName}' @EnD{},
@if{item.classifyCode == null} null @else{} '@{item.classifyCode}' @EnD{},
@if{item.classifyName == null} null @else{} '@{item.classifyName}' @EnD{},
@if{item.facilityTypeCode == null} null @else{} '@{item.facilityTypeCode}' @EnD{},
@if{item.facilityTypeName == null} null @else{} '@{item.facilityTypeName}' @EnD{},
@if{item.isCharacteristic == null} null @else{} @{item.isCharacteristic} @EnD{},
@if{item.isCharacteristicName == null} null @else{} '@{item.isCharacteristicName}' @EnD{},
@if{item.latitude == null} null @else{} '@{item.latitude}' @EnD{},
@if{item.levelCode == null} null @else{} '@{item.levelCode}' @EnD{},
@if{item.levelName == null} null @else{} '@{item.levelName}' @EnD{},
@if{item.longitude == null} null @else{} '@{item.longitude}' @EnD{},
@if{item.mobile == null} null @else{} '@{item.mobile}' @EnD{},
@if{item.name == null} null @else{} '@{item.name}' @EnD{},
@if{item.remark == null} null @else{} '@{item.remark}' @EnD{},
@if{item.streetCode == null} null @else{} '@{item.streetCode}' @EnD{},
@if{item.streetName == null} null @else{} '@{item.streetName}' @EnD{},
@if{item.tag == null} null @else{} '@{item.tag}' @EnD{},
@if{item.telphone == null} null @else{} '@{item.telphone}' @EnD{},
@if{item.uploadBatchId == null} null @else{} '@{item.uploadBatchId}' @EnD{},
@if{item.approvalTime == null} null @else{} '@{cn.hutool.core.date.DateUtil.format(item.approvalTime,"yyyy-MM-dd HH:mm:ss")}' @EnD{},
@if{item.approverName == null} null @else{} '@{item.approverName}' @EnD{},
@if{item.approverUserId == null} null @else{} '@{item.approverUserId}' @EnD{},
@if{item.businessId == null} null @else{} '@{item.businessId}' @EnD{},
@if{item.checkRemark == null} null @else{} '@{item.checkRemark}' @EnD{},
@if{item.isLast == null} null @else{} @{item.isLast} @EnD{},
@if{item.optType == null} null @else{} '@{item.optType}' @EnD{},
@if{item.state == null} null @else{} @{item.state} @EnD{},
@if{item.buildingArea == null} null @else{} '@{item.buildingArea}' @EnD{},
@if{item.qualityCode == null} null @else{} '@{item.qualityCode}' @EnD{},
@if{item.qualityName == null} null @else{} '@{item.qualityName}' @EnD{}
)
@if{index != list.size()-1},@EnD{}
@EnD{}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant