SelectFunc 字段别名

This commit is contained in:
yulichang 2024-01-19 22:51:22 +08:00
parent f45a807339
commit db0d197226

View File

@ -0,0 +1,36 @@
package com.github.yulichang.wrapper.segments;
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 别名func
* <p>
* 仅对selectFunc有效
*
* @author yulichang
* @since 1.4.11
*/
@Getter
@AllArgsConstructor(access = AccessLevel.PRIVATE)
public class Fun<T, R> implements SFunction<T, R> {
private final String alias;
private final SFunction<T, R> func;
@Override
public R apply(T t) {
throw new UnsupportedOperationException();
}
/**
* 别名func
* <p>
* 仅对selectFunc有效
*/
public static <T, R> Fun<T, R> f(String alias, SFunction<T, R> func) {
return new Fun<>(alias, func);
}
}