com.github.yulichang.wrapper.interfaces.FuncStr Maven / Gradle / Ivy
Show all versions of mybatis-plus-join-core Show documentation
/*
* Copyright (c) 2011-2022, baomidou ([email protected]).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.yulichang.wrapper.interfaces;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
/**
* copy {@link com.baomidou.mybatisplus.core.conditions.interfaces.Func}
*
* @since 1.3.12
*/
@SuppressWarnings("ALL")
public interface FuncStr extends Serializable {
/**
* ignore
*/
default Children isNull(R column) {
return isNull(true, column);
}
/**
* 字段 IS NULL
* 例: isNull("name")
*
* @param condition 执行条件
* @param column 字段
* @return children
*/
Children isNull(boolean condition, R column);
/**
* ignore
*/
default Children isNotNull(R column) {
return isNotNull(true, column);
}
/**
* 字段 IS NOT NULL
* 例: isNotNull("name")
*
* @param condition 执行条件
* @param column 字段
* @return children
*/
Children isNotNull(boolean condition, R column);
/**
* ignore
*/
default Children in(R column, Collection> coll) {
return in(true, column, coll);
}
/**
* 字段 IN (value.get(0), value.get(1), ...)
* 例: in("id", Arrays.asList(1, 2, 3, 4, 5))
*
* 注意!集合为空若存在逻辑错误,请在 condition 条件中判断
* 如果集合为 empty 则不会进行 sql 拼接
*
* @param condition 执行条件
* @param column 字段
* @param coll 数据集合
* @return children
*/
Children in(boolean condition, R column, Collection> coll);
/**
* ignore
*/
default Children in(R column, Object... values) {
return in(true, column, values);
}
/**
* 字段 IN (v0, v1, ...)
* 例: in("id", 1, 2, 3, 4, 5)
*
* 注意!数组为空若存在逻辑错误,请在 condition 条件中判断
* 如果动态数组为 empty 则不会进行 sql 拼接
*
* @param condition 执行条件
* @param column 字段
* @param values 数据数组
* @return children
*/
Children in(boolean condition, R column, Object... values);
/**
* ignore
*/
default Children notIn(R column, Collection> coll) {
return notIn(true, column, coll);
}
/**
* 字段 NOT IN (value.get(0), value.get(1), ...)
* 例: notIn("id", Arrays.asList(1, 2, 3, 4, 5))
*
* @param condition 执行条件
* @param column 字段
* @param coll 数据集合
* @return children
*/
Children notIn(boolean condition, R column, Collection> coll);
/**
* ignore
*/
default Children notIn(R column, Object... value) {
return notIn(true, column, value);
}
/**
* 字段 NOT IN (v0, v1, ...)
* 例: notIn("id", 1, 2, 3, 4, 5)
*
* @param condition 执行条件
* @param column 字段
* @param values 数据数组
* @return children
*/
Children notIn(boolean condition, R column, Object... values);
/**
* ignore
*/
default Children inSql(R column, String inValue) {
return inSql(true, column, inValue);
}
/**
* 字段 IN ( sql语句 )
* !! sql 注入方式的 in 方法 !!
* 例1: inSql("id", "1, 2, 3, 4, 5, 6")
* 例2: inSql("id", "select id from table where id < 3")
*
* @param condition 执行条件
* @param column 字段
* @param inValue sql语句
* @return children
*/
Children inSql(boolean condition, R column, String inValue);
/**
* 字段 > ( sql语句 )
* 例1: gtSql("id", "1, 2, 3, 4, 5, 6")
* 例1: gtSql("id", "select id from table where name = 'JunJun'")
*
* @param condition
* @param column
* @param inValue
* @return
*/
Children gtSql(boolean condition, R column, String inValue);
/**
* ignore
*/
default Children gtSql(R column, String inValue) {
return gtSql(true, column, inValue);
}
/**
* 字段 >= ( sql语句 )
* 例1: geSql("id", "1, 2, 3, 4, 5, 6")
* 例1: geSql("id", "select id from table where name = 'JunJun'")
*
* @param condition
* @param column
* @param inValue
* @return
*/
Children geSql(boolean condition, R column, String inValue);
/**
* ignore
*/
default Children geSql(R column, String inValue) {
return geSql(true, column, inValue);
}
/**
* 字段 < ( sql语句 )
* 例1: ltSql("id", "1, 2, 3, 4, 5, 6")
* 例1: ltSql("id", "select id from table where name = 'JunJun'")
*
* @param condition
* @param column
* @param inValue
* @return
*/
Children ltSql(boolean condition, R column, String inValue);
/**
* ignore
*/
default Children ltSql(R column, String inValue) {
return ltSql(true, column, inValue);
}
/**
* 字段 <= ( sql语句 )
* 例1: leSql("id", "1, 2, 3, 4, 5, 6")
* 例1: leSql("id", "select id from table where name = 'JunJun'")
*
* @param condition
* @param column
* @param inValue
* @return
*/
Children leSql(boolean condition, R column, String inValue);
/**
* ignore
*/
default Children leSql(R column, String inValue) {
return leSql(true, column, inValue);
}
/**
* ignore
*/
default Children notInSql(R column, String inValue) {
return notInSql(true, column, inValue);
}
/**
* 字段 NOT IN ( sql语句 )
* !! sql 注入方式的 not in 方法 !!
* 例1: notInSql("id", "1, 2, 3, 4, 5, 6")
* 例2: notInSql("id", "select id from table where id < 3")
*
* @param condition 执行条件
* @param column 字段
* @param inValue sql语句 ---> 1,2,3,4,5,6 或者 select id from table where id < 3
* @return children
*/
Children notInSql(boolean condition, R column, String inValue);
/**
* 分组:GROUP BY 字段, ...
* 例: groupBy("id")
*
* @param condition 执行条件
* @param column 单个字段
* @return children
*/
Children groupBy(boolean condition, R column);
default Children groupBy(R column) {
return groupBy(true, column);
}
/**
* 分组:GROUP BY 字段, ...
* 例: groupBy(Arrays.asList("id", "name"))
*
* @param condition 执行条件
* @param columns 字段数组
* @return children
*/
Children groupByStr(boolean condition, List columns);
default Children groupByStr(List columns) {
return groupByStr(true, columns);
}
default Children groupBy(R column, R... columns) {
return groupBy(true, column, columns);
}
/**
* 分组:GROUP BY 字段, ...
*/
Children groupBy(boolean condition, R column, R... columns);
/**
* 排序:ORDER BY 字段, ... ASC
* 例: orderByAsc(true, "id")
*
* @param condition 执行条件
* @param column 单个字段
* @return children
*/
default Children orderByAsc(boolean condition, R column) {
return orderBy(condition, true, column);
}
default Children orderByAsc(R column) {
return orderByAsc(true, column);
}
/**
* 排序:ORDER BY 字段, ... ASC
* 例: orderByAsc(true, Arrays.asList("id", "name"))
*
* @param condition 执行条件
* @param columns 字段数组
* @return children
*/
default Children orderByAscStr(boolean condition, List columns) {
return orderByStr(condition, true, columns);
}
default Children orderByAscStr(List columns) {
return orderByAscStr(true, columns);
}
default Children orderByAsc(R column, R... columns) {
return orderByAsc(true, column, columns);
}
/**
* 排序:ORDER BY 字段, ... ASC
*/
default Children orderByAsc(boolean condition, R column, R... columns) {
return orderBy(condition, true, column, columns);
}
/**
* 排序:ORDER BY 字段, ... DESC
* 例: orderByDesc(true, "id")
*
* @param condition 执行条件
* @param column 字段
* @return children
*/
default Children orderByDesc(boolean condition, R column) {
return orderBy(condition, false, column);
}
default Children orderByDesc(R column) {
return orderByDesc(true, column);
}
/**
* 排序:ORDER BY 字段, ... DESC
* 例: orderByDesc(true, Arrays.asList("id", "name"))
*
* @param condition 执行条件
* @param columns 字段列表
* @return children
*/
default Children orderByDescStr(boolean condition, List columns) {
return orderByStr(condition, false, columns);
}
default Children orderByDescStr(List columns) {
return orderByDescStr(true, columns);
}
default Children orderByDesc(R column, R... columns) {
return orderByDesc(true, column, columns);
}
/**
* 排序:ORDER BY 字段, ... DESC
*/
default Children orderByDesc(boolean condition, R column, R... columns) {
return orderBy(condition, false, column, columns);
}
/**
* 排序:ORDER BY 字段, ...
* 例: orderBy(true, "id")
*
* @param condition 执行条件
* @param isAsc 是否是 ASC 排序
* @param column 单个字段
* @return children
*/
Children orderBy(boolean condition, boolean isAsc, R column);
/**
* 排序:ORDER BY 字段, ...
* 例: orderBy(true, Arrays.asList("id", "name"))
*
* @param condition 执行条件
* @param isAsc 是否是 ASC 排序
* @param columns 字段列表
* @return children
*/
Children orderByStr(boolean condition, boolean isAsc, List columns);
/**
* 排序:ORDER BY 字段, ...
*/
Children orderBy(boolean condition, boolean isAsc, R column, R... columns);
}