All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.yulichang.wrapper.interfaces.QueryJoin Maven / Gradle / Ivy

There is a newer version: 1.5.2
Show newest version
package com.github.yulichang.wrapper.interfaces;

import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
import com.github.yulichang.interfaces.MPJBaseJoin;
import com.github.yulichang.query.interfaces.StringJoin;
import com.github.yulichang.toolkit.Constant;
import com.github.yulichang.wrapper.MPJAbstractLambdaWrapper;

import java.util.function.BiConsumer;

/**
 * @author yulichang
 */
@SuppressWarnings("unused")
public interface QueryJoin extends MPJBaseJoin, StringJoin {

    /**
     * left join
     *
     * @param clazz 关联的实体类
     * @param left  条件
     * @param right 条件
     */
    default  Children leftJoin(Class clazz, SFunction left, SFunction right) {
        return join(Constant.LEFT_JOIN, clazz, left, right);
    }

    /**
     * left join 多条件
     * 

* 例 leftJoin(UserDO.class, on -> on.eq(UserDO::getId,UserAddressDO::getUserId).le().gt()...) * * @param clazz 关联实体类 * @param function 条件` */ default Children leftJoin(Class clazz, WrapperFunction> function) { return join(Constant.LEFT_JOIN, clazz, function); } /** * left join * * @param clazz 关联的实体类 * @param left 条件 * @param right 条件 */ default Children leftJoin(Class clazz, SFunction left, SFunction right, WrapperFunction ext) { return join(Constant.LEFT_JOIN, clazz, left, right, ext); } /** * left join 多条件 *

* 例 leftJoin(UserDO.class, on -> on.eq(UserDO::getId,UserAddressDO::getUserId).le().gt()...) * * @param clazz 关联实体类 * @param consumer 条件 */ default Children leftJoin(Class clazz, BiConsumer, Children> consumer) { return join(Constant.LEFT_JOIN, clazz, consumer); } /** * left join * * @param clazz 关联的实体类 * @param left 条件 * @param right 条件 */ default Children leftJoin(Class clazz, String alias, SFunction left, SFunction right) { return join(Constant.LEFT_JOIN, clazz, alias, left, right); } /** * left join 多条件 *

* 例 leftJoin(UserDO.class, on -> on.eq(UserDO::getId,UserAddressDO::getUserId).le().gt()...) * * @param clazz 关联实体类 * @param function 条件 */ default Children leftJoin(Class clazz, String alias, WrapperFunction> function) { return join(Constant.LEFT_JOIN, clazz, alias, function); } /** * left join * * @param clazz 关联的实体类 * @param left 条件 * @param right 条件 */ default Children leftJoin(Class clazz, String alias, SFunction left, SFunction right, WrapperFunction ext) { return join(Constant.LEFT_JOIN, clazz, alias, left, right, ext); } /** * left join 多条件 *

* 例 leftJoin(UserDO.class, on -> on.eq(UserDO::getId,UserAddressDO::getUserId).le().gt()...) * * @param clazz 关联实体类 * @param consumer 条件 */ default Children leftJoin(Class clazz, String alias, BiConsumer, Children> consumer) { return join(Constant.LEFT_JOIN, clazz, alias, consumer); } /** * ignore 参考 left join */ default Children rightJoin(Class clazz, SFunction left, SFunction right) { return join(Constant.RIGHT_JOIN, clazz, left, right); } /** * ignore 参考 left join */ default Children rightJoin(Class clazz, WrapperFunction> function) { return join(Constant.RIGHT_JOIN, clazz, function); } /** * ignore 参考 left join */ default Children rightJoin(Class clazz, SFunction left, SFunction right, WrapperFunction ext) { return join(Constant.RIGHT_JOIN, clazz, left, right, ext); } /** * ignore 参考 left join */ default Children rightJoin(Class clazz, BiConsumer, Children> consumer) { return join(Constant.RIGHT_JOIN, clazz, consumer); } /** * ignore 参考 left join */ default Children rightJoin(Class clazz, String alias, SFunction left, SFunction right) { return join(Constant.RIGHT_JOIN, clazz, alias, left, right); } /** * ignore 参考 left join */ default Children rightJoin(Class clazz, String alias, WrapperFunction> function) { return join(Constant.RIGHT_JOIN, clazz, alias, function); } /** * ignore 参考 left join */ default Children rightJoin(Class clazz, String alias, SFunction left, SFunction right, WrapperFunction ext) { return join(Constant.RIGHT_JOIN, clazz, alias, left, right, ext); } /** * ignore 参考 left join */ default Children rightJoin(Class clazz, String alias, BiConsumer, Children> consumer) { return join(Constant.RIGHT_JOIN, clazz, alias, consumer); } /** * ignore 参考 left join */ default Children innerJoin(Class clazz, SFunction left, SFunction right) { return join(Constant.INNER_JOIN, clazz, on -> on.eq(left, right)); } /** * ignore 参考 left join */ default Children innerJoin(Class clazz, WrapperFunction> function) { return join(Constant.INNER_JOIN, clazz, function); } /** * ignore 参考 left join */ default Children innerJoin(Class clazz, SFunction left, SFunction right, WrapperFunction ext) { return join(Constant.INNER_JOIN, clazz, left, right, ext); } /** * ignore 参考 left join */ default Children innerJoin(Class clazz, BiConsumer, Children> consumer) { return join(Constant.INNER_JOIN, clazz, consumer); } /** * ignore 参考 left join */ default Children innerJoin(Class clazz, String alias, SFunction left, SFunction right) { return join(Constant.INNER_JOIN, clazz, alias, on -> on.eq(left, right)); } /** * ignore 参考 left join */ default Children innerJoin(Class clazz, String alias, WrapperFunction> function) { return join(Constant.INNER_JOIN, clazz, alias, function); } /** * ignore 参考 left join */ default Children innerJoin(Class clazz, String alias, SFunction left, SFunction right, WrapperFunction ext) { return join(Constant.INNER_JOIN, clazz, alias, left, right, ext); } /** * ignore 参考 left join */ default Children innerJoin(Class clazz, String alias, BiConsumer, Children> consumer) { return join(Constant.INNER_JOIN, clazz, alias, consumer); } /** * ignore 参考 left join */ default Children fullJoin(Class clazz, SFunction left, SFunction right) { return join(Constant.FULL_JOIN, clazz, left, right); } /** * ignore 参考 left join */ default Children fullJoin(Class clazz, WrapperFunction> function) { return join(Constant.FULL_JOIN, clazz, function); } /** * ignore 参考 left join */ default Children fullJoin(Class clazz, SFunction left, SFunction right, WrapperFunction ext) { return join(Constant.FULL_JOIN, clazz, left, right, ext); } /** * ignore 参考 left join */ default Children fullJoin(Class clazz, BiConsumer, Children> consumer) { return join(Constant.FULL_JOIN, clazz, consumer); } /** * ignore 参考 left join */ default Children fullJoin(Class clazz, String alias, SFunction left, SFunction right) { return join(Constant.FULL_JOIN, clazz, alias, left, right); } /** * ignore 参考 left join */ default Children fullJoin(Class clazz, String alias, WrapperFunction> function) { return join(Constant.FULL_JOIN, clazz, alias, function); } /** * ignore 参考 left join */ default Children fullJoin(Class clazz, String alias, SFunction left, SFunction right, WrapperFunction ext) { return join(Constant.FULL_JOIN, clazz, alias, left, right, ext); } /** * ignore 参考 left join */ default Children fullJoin(Class clazz, String alias, BiConsumer, Children> consumer) { return join(Constant.FULL_JOIN, clazz, alias, consumer); } /** * 自定义连表关键词 * 调用此方法 keyword 前后需要带空格 比如 " LEFT JOIN " " RIGHT JOIN " *

* 查询基类 可以直接调用此方法实现以上所有功能 * * @param keyWord 连表关键字 * @param clazz 连表实体类 * @param left 关联条件 * @param right 扩展 用于关联表的 select 和 where */ default Children join(String keyWord, Class clazz, SFunction left, SFunction right) { return join(keyWord, clazz, on -> on.eq(left, right)); } /** * 自定义连表关键词 *

* 例 leftJoin(UserDO.class, on -> on.eq(UserDO::getId,UserAddressDO::getUserId).le().gt()...) * * @param clazz 关联实体类 * @param function 条件 */ default Children join(String keyWord, Class clazz, WrapperFunction> function) { return join(keyWord, clazz, (on, e) -> function.apply(on)); } /** * 自定义连表关键词 * * @param clazz 关联的实体类 * @param left 条件 * @param right 条件 */ default Children join(String keyWord, Class clazz, SFunction left, SFunction right, WrapperFunction ext) { return join(keyWord, clazz, (on, e) -> { on.eq(left, right); ext.apply(e); }); } /** * 自定义连表关键词 * 调用此方法 keyword 前后需要带空格 比如 " LEFT JOIN " " RIGHT JOIN " *

* 查询基类 可以直接调用此方法实现以上所有功能 * * @param keyWord 连表关键字 * @param clazz 连表实体类 * @param left 关联条件 * @param right 扩展 用于关联表的 select 和 where */ default Children join(String keyWord, Class clazz, String alias, SFunction left, SFunction right) { return join(keyWord, clazz, alias, on -> on.eq(left, right)); } /** * 自定义连表关键词 *

* 例 leftJoin(UserDO.class, on -> on.eq(UserDO::getId,UserAddressDO::getUserId).le().gt()...) * * @param clazz 关联实体类 * @param function 条件 */ default Children join(String keyWord, Class clazz, String alias, WrapperFunction> function) { return join(keyWord, clazz, alias, (on, e) -> function.apply(on)); } /** * 自定义连表关键词 * * @param clazz 关联的实体类 * @param left 条件 * @param right 条件 */ default Children join(String keyWord, Class clazz, String alias, SFunction left, SFunction right, WrapperFunction ext) { return join(keyWord, clazz, alias, (on, e) -> { on.eq(left, right); ext.apply(e); }); } /** * 内部使用, 不建议直接调用 */ default Children join(String keyWord, Class clazz, BiConsumer, Children> consumer) { return join(keyWord, clazz, null, consumer); } /** * 内部使用, 不建议直接调用 */ Children join(String keyWord, Class clazz, String alias, BiConsumer, Children> consumer); }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy