public interface Join<Children> extends Serializable
Join
无改动 在mybatis 3.4.2 升级 3.4.3 后有改动 exists 和 not exists 为了保证 mybatis plus 3.4.3之前的也能正常使用
| 限定符和类型 | 方法和说明 |
|---|---|
Children |
apply(boolean condition,
String applySql,
Object... values)
拼接 sql
!!
|
default Children |
apply(String applySql,
Object... values)
ignore
|
Children |
comment(boolean condition,
String comment)
sql 注释(会拼接在 sql 的最后面)
|
default Children |
comment(String comment)
ignore
|
Children |
exists(boolean condition,
String existsSql,
Object... values)
拼接 EXISTS ( sql语句 )
!!
|
default Children |
exists(String existsSql,
Object... values)
ignore
|
Children |
first(boolean condition,
String firstSql)
sql 起始句(会拼接在SQL语句的起始处)
|
default Children |
first(String firstSql)
ignore
|
Children |
last(boolean condition,
String lastSql)
无视优化规则直接拼接到 sql 的最后(有sql注入的风险,请谨慎使用)
例: last("limit 1")
注意只能调用一次,多次调用以最后一次为准
|
default Children |
last(String lastSql)
ignore
|
Children |
notExists(boolean condition,
String existsSql,
Object... values)
拼接 NOT EXISTS ( sql语句 )
!!
|
default Children |
notExists(String existsSql,
Object... values)
ignore
|
default Children |
or()
ignore
|
Children |
or(boolean condition)
拼接 OR
|
default Children or()
Children or(boolean condition)
condition - 执行条件Children apply(boolean condition, String applySql, Object... values)
!! 会有 sql 注入风险 !!
例1: apply("id = 1")
例2: apply("date_format(dateColumn,'%Y-%m-%d') = '2008-08-08'")
例3: apply("date_format(dateColumn,'%Y-%m-%d') = {0}", LocalDate.now())
condition - 执行条件values - 数据数组Children last(boolean condition, String lastSql)
例: last("limit 1")
注意只能调用一次,多次调用以最后一次为准
condition - 执行条件lastSql - sql语句Children comment(boolean condition, String comment)
condition - 执行条件comment - sql注释Children first(boolean condition, String firstSql)
condition - 执行条件firstSql - 起始语句Children exists(boolean condition, String existsSql, Object... values)
!! sql 注入方法 !!
例: exists("select id from table where age = 1")
condition - 执行条件existsSql - sql语句values - 数据数组Copyright © 2023. All rights reserved.