From 133f781d2dd8a16a90025776129394337b0f3916 Mon Sep 17 00:00:00 2001 From: admin <570810310@qq.com> Date: Tue, 18 May 2021 12:43:41 +0800 Subject: [PATCH] https://gitee.com/best_handsome/mybatis-plus-join/issues/I3RS8S --- .../yulichang/wrapper/MPJAbstractLambdaWrapper.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/github/yulichang/wrapper/MPJAbstractLambdaWrapper.java b/src/main/java/com/github/yulichang/wrapper/MPJAbstractLambdaWrapper.java index c0584ac..3748c83 100644 --- a/src/main/java/com/github/yulichang/wrapper/MPJAbstractLambdaWrapper.java +++ b/src/main/java/com/github/yulichang/wrapper/MPJAbstractLambdaWrapper.java @@ -1,6 +1,7 @@ package com.github.yulichang.wrapper; import com.baomidou.mybatisplus.core.toolkit.StringPool; +import com.baomidou.mybatisplus.core.toolkit.support.ColumnCache; import com.baomidou.mybatisplus.core.toolkit.support.SFunction; import com.github.yulichang.toolkit.Constant; import com.github.yulichang.toolkit.LambdaUtils; @@ -24,6 +25,9 @@ public abstract class MPJAbstractLambdaWrapper, Integer> subTable = new HashMap<>(); + private Map columnMap = null; + private boolean initColumnMap = false; + @Override protected String columnToString(X column) { return columnToString((SFunction) column, true); @@ -35,8 +39,12 @@ public abstract class MPJAbstractLambdaWrapper column, boolean onlyColumn) { + if (!initColumnMap) { + columnMap = com.baomidou.mybatisplus.core.toolkit.LambdaUtils.getColumnMap(LambdaUtils.getEntityClass(column)); + initColumnMap = true; + } return Constant.TABLE_ALIAS + getDefault(subTable.get(LambdaUtils.getEntityClass(column))) + StringPool.DOT + - LambdaUtils.getColumn(column); + columnMap.get(LambdaUtils.getName(column)).getColumn(); } protected String getDefault(Integer i) {