|
@@ -1,26 +1,9 @@
|
|
package org.example.join.model;
|
|
package org.example.join.model;
|
|
|
|
|
|
-import cn.hutool.core.util.StrUtil;
|
|
|
|
-import com.baomidou.mybatisplus.core.toolkit.LambdaUtils;
|
|
|
|
-import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
|
|
|
-import com.baomidou.mybatisplus.core.toolkit.support.LambdaMeta;
|
|
|
|
-import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
|
|
|
-import org.apache.ibatis.reflection.property.PropertyNamer;
|
|
|
|
-
|
|
|
|
public interface IQueryColumn extends IFormat {
|
|
public interface IQueryColumn extends IFormat {
|
|
|
|
|
|
static IQueryColumn field(Object obj) {
|
|
static IQueryColumn field(Object obj) {
|
|
return obj::toString;
|
|
return obj::toString;
|
|
}
|
|
}
|
|
|
|
|
|
- static IQueryColumn field(Object obj, String alias) {
|
|
|
|
- return () -> obj.toString() + StringPool.SPACE + alias;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- static <T> IQueryColumn field(Object obj, SFunction<T, ?> function) {
|
|
|
|
- LambdaMeta meta = LambdaUtils.extract(function);
|
|
|
|
- String alias = StrUtil.toUnderlineCase(PropertyNamer.methodToProperty(meta.getImplMethodName()));
|
|
|
|
- return () -> obj.toString() + StringPool.SPACE + alias;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
}
|
|
}
|