✨ 添加 OtherTableColumnAliasFunction 用于构建连表的条件查询
This commit is contained in:
@@ -49,6 +49,11 @@ public class LambdaAliasQueryWrapperX<T> extends LambdaQueryWrapperX<T> {
|
||||
*/
|
||||
@Override
|
||||
protected String columnToString(SFunction<T, ?> column) {
|
||||
if (column instanceof OtherTableColumnAliasFunction) {
|
||||
@SuppressWarnings("unchecked")
|
||||
OtherTableColumnAliasFunction<T> otherTableColumnAlias = (OtherTableColumnAliasFunction<T>) column;
|
||||
return otherTableColumnAlias.apply(null);
|
||||
}
|
||||
String columnName = super.columnToString(column, true);
|
||||
return tableAlias == null ? columnName : tableAlias + "." + columnName;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.hccake.extend.mybatis.plus.conditions.query;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||
|
||||
/**
|
||||
* 连表查询时,从其他表获取的查询条件
|
||||
*
|
||||
* @author hccake
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface OtherTableColumnAliasFunction<T> extends SFunction<T, String> {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user