opt:回传倒出优化

This commit is contained in:
zhangzq
2025-02-13 14:54:48 +08:00
parent aa2db05f2b
commit 76449d22b6
3 changed files with 14 additions and 4 deletions

View File

@@ -1,6 +1,7 @@
package org.nl.config;
import com.alibaba.druid.pool.DruidDataSource;
import com.github.pagehelper.parser.CountSqlParser;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
@@ -12,7 +13,7 @@ import javax.sql.DataSource;
//@Configuration
@Slf4j
public class DataBaseConfig {
public static CountSqlParser countSqlParser = new CountSqlParser();
@Primary
@Bean(name = "dataSource")
@ConfigurationProperties(prefix = "spring.datasource.druid")

View File

@@ -1,11 +1,20 @@
package org.nl.config;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import com.yomahub.tlog.id.TLogIdGenerator;
import java.util.UUID;
public class TlogIdGenerator extends TLogIdGenerator {
@Override
public String generateTraceId() {
return IdUtil.getSnowflake(1, 1).nextIdStr();
String idStr;
try {
idStr = IdUtil.getSnowflake(1, 1).nextIdStr();
}catch (Exception ex){
idStr = String.valueOf(System.currentTimeMillis());
}
return idStr;
}
}

View File

@@ -2,6 +2,7 @@ package org.nl.modules.wql.core.engine.syntax;
import com.github.pagehelper.parser.CountSqlParser;
import lombok.extern.slf4j.Slf4j;
import org.nl.config.DataBaseConfig;
import org.nl.modules.wql.WQLCore;
import org.nl.modules.wql.core.DataType;
import org.nl.modules.wql.core.bean.ErrorBean;
@@ -411,8 +412,7 @@ public class wqlSELECT extends IWQL {
//对sql进行特殊处理找出和第一个select配对的from并把中间全部换为1
// String page_sql = change_1(wo.wp.sSQL);
String page_sql = wo.wp.sSQL;
CountSqlParser countSqlParser = new CountSqlParser();
String countSql = countSqlParser.getSmartCountSql(page_sql, "0");
String countSql = DataBaseConfig.countSqlParser.getSmartCountSql(page_sql, "0");
wo.wp.sSQL = countSql;
}
}