Package | Description |
---|---|
com.jfinal.core | |
com.jfinal.plugin.activerecord | |
com.jfinal.plugin.activerecord.builder | |
com.jfinal.plugin.activerecord.dialect |
Modifier and Type | Method and Description |
---|---|
Controller |
Controller.keepModel(Class<? extends Model> modelClass) |
Controller |
Controller.keepModel(Class<? extends Model> modelClass,
String modelName) |
Modifier and Type | Class and Description |
---|---|
class |
Model<M extends Model>
Model.
|
Modifier and Type | Method and Description |
---|---|
protected Class<? extends Model> |
Model._getUsefulClass() |
Class<? extends Model<?>> |
Table.getModelClass() |
static Class<? extends Model> |
DbKit.getUsefulClass(Class<? extends Model> modelClass) |
Modifier and Type | Method and Description |
---|---|
static Map<String,Object> |
CPI.getAttrs(Model model)
Return the attributes map of the model
|
static Set<String> |
CPI.getModifyFlag(Model model) |
static SqlPara |
Db.getSqlPara(String key,
Model model) |
SqlPara |
Model.getSqlPara(String key,
Model model)
可以在模板中利用 Model 自身的属性参与动态生成 sql,例如:
select * from user where nickName = #(nickName)
new Account().setNickName("James").getSqlPara(...)
注意:由于 dao 对象上的 attrs 不允许读写,不要调用其 getSqlPara(String) 方法
public SqlPara getSqlPara(String key) {
return getSqlPara(key, this.attrs);
}
|
SqlPara |
DbPro.getSqlPara(String key,
Model model) |
M |
Model.put(Model model)
Put other model to the model without check attribute name.
|
Record |
Record.setColumns(Model<?> model)
Set columns value with Model object.
|
Modifier and Type | Method and Description |
---|---|
ActiveRecordPlugin |
ActiveRecordPlugin.addMapping(String tableName,
Class<? extends Model<?>> modelClass) |
ActiveRecordPlugin |
ActiveRecordPlugin.addMapping(String tableName,
String primaryKey,
Class<? extends Model<?>> modelClass) |
static int[] |
Db.batchSave(List<? extends Model> modelList,
int batchSize) |
int[] |
DbPro.batchSave(List<? extends Model> modelList,
int batchSize)
Batch save models using the "insert into ..." sql generated by the first model in modelList.
|
static int[] |
Db.batchUpdate(List<? extends Model> modelList,
int batchSize) |
int[] |
DbPro.batchUpdate(List<? extends Model> modelList,
int batchSize)
Batch update models using the attrs names of the first model in modelList.
|
<T> List<T> |
ModelBuilder.build(ResultSet rs,
Class<? extends Model> modelClass) |
static Config |
DbKit.getConfig(Class<? extends Model> modelClass) |
Table |
TableMapping.getTable(Class<? extends Model> modelClass) |
static Class<? extends Model> |
DbKit.getUsefulClass(Class<? extends Model> modelClass) |
Constructor and Description |
---|
Table(String name,
Class<? extends Model<?>> modelClass) |
Table(String name,
String primaryKey,
Class<? extends Model<?>> modelClass) |
Modifier and Type | Method and Description |
---|---|
<T> List<T> |
KeepByteAndShortModelBuilder.build(ResultSet rs,
Class<? extends Model> modelClass) |
<T> List<T> |
TimestampProcessedModelBuilder.build(ResultSet rs,
Class<? extends Model> modelClass) |
Modifier and Type | Method and Description |
---|---|
Page<? extends Model> |
AnsiSqlDialect.takeOverModelPaginate(Connection conn,
Class<? extends Model> modelClass,
int pageNumber,
int pageSize,
Boolean isGroupBySql,
String totalRowSql,
StringBuilder findSql,
Object... paras) |
Modifier and Type | Method and Description |
---|---|
void |
Dialect.getModelGeneratedKey(Model<?> model,
PreparedStatement pst,
Table table)
用于获取 Model.save() 以后自动生成的主键值,可通过覆盖此方法实现更精细的控制
目前只有 PostgreSqlDialect,覆盖过此方法
|
void |
PostgreSqlDialect.getModelGeneratedKey(Model<?> model,
PreparedStatement pst,
Table table)
解决 PostgreSql 获取自增主键时 rs.getObject(1) 总是返回第一个字段的值,而非返回了 id 值
issue: https://www.oschina.net/question/2312705_2243354
相对于 Dialect 中的默认实现,仅将 rs.getXxx(1) 改成了 rs.getXxx(pKey)
|
protected void |
Dialect.processGeneratedBigIntegerKey(Model<?> model,
String pKey,
Object v)
mysql 数据库的 bigint unsigned 对应的 java 类型为 BigInteger
但是 rs.getObject(1) 返回值为 Long 型,造成 model.save() 以后
model.getId() 时的类型转换异常
|
Modifier and Type | Method and Description |
---|---|
<T> List<T> |
AnsiSqlDialect.buildModel(ResultSet rs,
Class<? extends Model> modelClass,
int pageSize) |
<T> List<T> |
Dialect.buildModelList(ResultSet rs,
Class<? extends Model> modelClass) |
Page |
Dialect.takeOverModelPaginate(Connection conn,
Class<? extends Model> modelClass,
int pageNumber,
int pageSize,
Boolean isGroupBySql,
String totalRowSql,
StringBuilder findSql,
Object... paras) |
Page<? extends Model> |
AnsiSqlDialect.takeOverModelPaginate(Connection conn,
Class<? extends Model> modelClass,
int pageNumber,
int pageSize,
Boolean isGroupBySql,
String totalRowSql,
StringBuilder findSql,
Object... paras) |
Copyright © 2018. All rights reserved.