| 限定符和类型 | 字段和说明 |
|---|---|
static short |
LIKE_A |
static short |
LIKE_L |
static short |
LIKE_R |
protected static String |
MASTER_ALIAS |
| 限定符 | 构造器和说明 |
|---|---|
protected |
SqlGrammar(Class<?> entity,
String alias) |
| 限定符和类型 | 方法和说明 |
|---|---|
SqlGrammar |
and(SqlGrammar grammar)
获取grammar所有的条件 把 xxx = ?
|
SqlGrammar |
asc(Property property) |
SqlGrammar |
avg(Property property) |
SqlGrammar |
avg(Property property,
String alias) |
SqlGrammar |
between(Property property,
Object lo,
Object hi) |
String |
buildSql(SqlCommandType type)
通过现有的SqlGrammar对象生成SQL语句
|
SqlGrammar |
clone() |
SqlGrammar |
column(Property property)
生成sql语句的投影列
|
SqlGrammar |
column(Property property,
Property alias)
生成sql语句的投影列
|
SqlGrammar |
column(Property property,
String alias)
生成sql语句的投影列
|
SqlGrammar |
columnAll(Class<?> tableClass)
生成sql语句的投影列, 例如 a.* , _this
|
protected String |
convert2SqlName(Class<?> tableClass,
String propertyName)
把javaBean属性转换成相对应的表的列名
|
protected String |
convert2SqlName(Property property)
把javaBean属性转换成相对应的表的列名
|
SqlGrammar |
count(Property property) |
SqlGrammar |
count(Property property,
String alias) |
SqlGrammar |
countDistinct(Property property) |
SqlGrammar |
countDistinct(Property property,
String alias) |
void |
countSql(boolean isCountSql) |
SqlGrammar |
databaseId(String databaseId) |
SqlGrammar |
desc(Property property) |
SqlGrammar |
distinct(Property property) |
SqlGrammar |
distinct(Property property,
String alias) |
SqlGrammar |
eq(Property property,
Object value)
判断property == value
|
SqlGrammar |
eqAst(Property property,
Object value)
ast(Assert)参数value值
判断property == value, 当value == null 抛异常
|
SqlGrammar |
fetchSize(Integer fetchSize) |
SqlGrammar |
ge(Property property,
Object value)
great equal( >= )
|
StringBuilder |
getCondition() |
String |
getDatabaseId() |
Class<?> |
getEntity() |
Integer |
getFetchSize() |
StringBuilder |
getGroup() |
StringBuilder |
getHaving() |
List<Join> |
getJoins() |
String |
getKeyColumn() |
String |
getKeyProperty() |
String |
getLang() |
Integer |
getLimitSize() |
Integer |
getLimitStart() |
LockMode |
getLockMode()
jdbc控制参数
|
StringBuilder |
getOrder() |
Integer |
getPageNo() |
Integer |
getPageSize() |
Integer |
getPartIndex() |
Integer |
getPartSize() |
StringBuilder |
getProjection() |
String |
getResultSets() |
StringBuilder |
getUpdateSql() |
SqlGrammar |
group(Property property) |
SqlGrammar |
gt(Property property,
Object value)
great than( > )
|
SqlGrammar |
having(SqlGrammar grammar) |
SqlGrammar |
in(Property property,
Collection value) |
SqlGrammar |
in(Property property,
Object[] values)
values = null 时不增加此条件,但能为 [](空数组)
|
static SqlGrammar |
instance(Class<?> entity) |
static SqlGrammar |
instance(Class<?> entity,
String alias) |
boolean |
isCountSql() |
SqlGrammar |
isNotNull(Property property) |
SqlGrammar |
isNotNull(Property property,
boolean condition)
如果condition为true时,添加property is not null 条件
|
SqlGrammar |
isNull(Property property) |
SqlGrammar |
isNull(Property property,
boolean condition)
如果condition为true时,添加property is null 条件
|
boolean |
isResultOrdered() |
SqlGrammar |
join(Join join)
如果用到关联查询时,此方法必须放在上面,instance方法下面紧接着就是此方法。
|
SqlGrammar |
join(Property property,
String tableAlias)
默认使用INNER_JOIN
如果用到关联查询时,此方法必须放在上面,instance方法下面紧接着就是此方法。
|
SqlGrammar |
join(Property property,
String tableAlias,
JoinType joinType)
如果用到关联查询时,此方法必须放在上面,instance方法下面紧接着就是此方法。
|
SqlGrammar |
keyColumn(String keyColumn) |
SqlGrammar |
keyProperty(String keyProperty) |
SqlGrammar |
lang(String lang) |
SqlGrammar |
le(Property property,
Object value)
less equal( <= )
|
SqlGrammar |
like(Property property,
String value)
如果value等于null或空字符窜则此条件不添加进SQL
当value等于空字符窜时,效果等于查询出不为null的数据
|
SqlGrammar |
like(Property property,
String value,
short type)
如果value等于null或空字符窜则此条件不添加进SQL
当value等于空字符窜时,效果等于查询出不为null的数据
|
SqlGrammar |
limit(Integer pageNo,
Integer pageSize) |
SqlGrammar |
limit(Integer pageNo,
Integer pageSize,
Integer partIndex,
Integer partSize) |
SqlGrammar |
limitByIndex(Integer limitSize) |
SqlGrammar |
limitByIndex(Integer limitStart,
Integer limitSize) |
SqlGrammar |
lockMode(LockMode lockMode) |
SqlGrammar |
lt(Property property,
Object value)
less than( < )
|
SqlGrammar |
max(Property property) |
SqlGrammar |
max(Property property,
String alias) |
SqlGrammar |
min(Property property) |
SqlGrammar |
min(Property property,
String alias) |
SqlGrammar |
ne(Property property,
Object value)
not equal( !
|
SqlGrammar |
neAst(Property property,
Object value)
ast(Assert)参数value值
not equal( !
|
SqlGrammar |
notIn(Property property,
Collection value) |
SqlGrammar |
notIn(Property property,
Object[] values) |
SqlGrammar |
or(SqlGrammar grammar)
如果grammar里面只有一个条件语句,不需要用此方法,
即使用了也效果和 and(xxx = ?)
|
SqlGrammar |
resultOrdered(boolean resultOrdered) |
SqlGrammar |
resultSets(String resultSets) |
SqlGrammar |
rowCount() |
SqlGrammar |
rowCount(String alias) |
void |
setCondition(StringBuilder condition) |
void |
setGroup(StringBuilder group) |
void |
setHaving(StringBuilder having) |
void |
setJoins(List<Join> joins) |
void |
setOrder(StringBuilder order) |
void |
setProjection(StringBuilder projection) |
void |
setUpdateSql(StringBuilder updateSql) |
SqlGrammar |
sum(Property property) |
SqlGrammar |
sum(Property property,
String alias) |
SqlGrammar |
update(Property property,
Object value) |
SqlGrammar |
updateAst(Property property,
Object value)
ast(Assert)参数value值
|
SqlGrammar |
updateByRawVal(Property property,
Object value)
value不经过任何处理直接传给生气了语句
用来设置null值,updateByRawVal("curDlvAddr", "null")
updateByRawVal(R.Shop.orderNum, "#{orderNum} + 1")
|
SqlGrammar |
updateNeed(Property property,
Object value) |
public static final short LIKE_A
public static final short LIKE_L
public static final short LIKE_R
public static SqlGrammar instance(Class<?> entity)
public static SqlGrammar instance(Class<?> entity, String alias)
public SqlGrammar join(Join join)
join - public SqlGrammar join(Property property, String tableAlias)
property - tableAlias - public SqlGrammar join(Property property, String tableAlias, JoinType joinType)
property - tableAlias - public SqlGrammar clone()
public SqlGrammar update(Property property, Object value)
property - value - 为null时则不添加该sql语句public SqlGrammar updateAst(Property property, Object value)
property - value - 当value == null 抛异常public SqlGrammar updateNeed(Property property, Object value)
property - value - 可以为null,为null时set property=nullpublic SqlGrammar updateByRawVal(Property property, Object value)
property - value - public SqlGrammar columnAll(Class<?> tableClass)
public SqlGrammar column(Property property)
property - public SqlGrammar column(Property property, Property alias)
property - public SqlGrammar column(Property property, String alias)
property - alias - 列的别名public SqlGrammar max(Property property)
public SqlGrammar max(Property property, String alias)
public SqlGrammar min(Property property)
public SqlGrammar min(Property property, String alias)
public SqlGrammar distinct(Property property)
public SqlGrammar distinct(Property property, String alias)
public SqlGrammar count(Property property)
public SqlGrammar count(Property property, String alias)
public SqlGrammar sum(Property property)
public SqlGrammar sum(Property property, String alias)
public SqlGrammar countDistinct(Property property)
public SqlGrammar countDistinct(Property property, String alias)
public SqlGrammar avg(Property property)
public SqlGrammar avg(Property property, String alias)
public SqlGrammar rowCount()
public SqlGrammar rowCount(String alias)
public SqlGrammar eqAst(Property property, Object value)
property - value - public SqlGrammar eq(Property property, Object value)
property - value - public SqlGrammar neAst(Property property, Object value)
property - value - public SqlGrammar ne(Property property, Object value)
property - value - public SqlGrammar gt(Property property, Object value)
property - value - public SqlGrammar ge(Property property, Object value)
property - value - public SqlGrammar lt(Property property, Object value)
property - value - public SqlGrammar le(Property property, Object value)
property - value - public SqlGrammar between(Property property, Object lo, Object hi)
public SqlGrammar in(Property property, Object[] values)
property - values - public SqlGrammar notIn(Property property, Object[] values)
public SqlGrammar in(Property property, Collection value)
public SqlGrammar notIn(Property property, Collection value)
public SqlGrammar like(Property property, String value)
property - value - public SqlGrammar like(Property property, String value, short type)
property - value - type - public SqlGrammar and(SqlGrammar grammar)
public SqlGrammar or(SqlGrammar grammar)
public SqlGrammar isNull(Property property)
public SqlGrammar isNull(Property property, boolean condition)
property - condition - public SqlGrammar isNotNull(Property property)
public SqlGrammar isNotNull(Property property, boolean condition)
property - condition - public SqlGrammar group(Property property)
public SqlGrammar having(SqlGrammar grammar)
public SqlGrammar desc(Property property)
public SqlGrammar asc(Property property)
public SqlGrammar limitByIndex(Integer limitSize)
limitSize - public SqlGrammar limitByIndex(Integer limitStart, Integer limitSize)
limitStart - 默认值0limitSize - public SqlGrammar limit(Integer pageNo, Integer pageSize)
pageNo - 默认为1pageSize - public SqlGrammar limit(Integer pageNo, Integer pageSize, Integer partIndex, Integer partSize)
pageNo - 默认1pageSize - partIndex - 默认1partSize - public SqlGrammar lockMode(LockMode lockMode)
public String buildSql(SqlCommandType type)
protected String convert2SqlName(Property property)
property - protected String convert2SqlName(Class<?> tableClass, String propertyName)
property - public Class<?> getEntity()
public StringBuilder getUpdateSql()
public void setUpdateSql(StringBuilder updateSql)
public StringBuilder getProjection()
public void setProjection(StringBuilder projection)
public StringBuilder getCondition()
public void setCondition(StringBuilder condition)
public StringBuilder getGroup()
public void setGroup(StringBuilder group)
public StringBuilder getHaving()
public void setHaving(StringBuilder having)
public StringBuilder getOrder()
public void setOrder(StringBuilder order)
public boolean isCountSql()
public void countSql(boolean isCountSql)
public Integer getPageNo()
public Integer getPageSize()
public Integer getLimitStart()
public Integer getLimitSize()
public Integer getPartIndex()
public Integer getPartSize()
public LockMode getLockMode()
public String getDatabaseId()
public SqlGrammar databaseId(String databaseId)
public String getKeyProperty()
public SqlGrammar keyProperty(String keyProperty)
public String getKeyColumn()
public SqlGrammar keyColumn(String keyColumn)
public String getResultSets()
public SqlGrammar resultSets(String resultSets)
public Integer getFetchSize()
public SqlGrammar fetchSize(Integer fetchSize)
public String getLang()
public SqlGrammar lang(String lang)
public boolean isResultOrdered()
public SqlGrammar resultOrdered(boolean resultOrdered)
Copyright © 2016. All rights reserved.