| Package | Description |
|---|---|
| com.litongjava.db.activerecord | |
| com.litongjava.db.activerecord.builder | |
| com.litongjava.db.activerecord.dialect |
| Modifier and Type | Class and Description |
|---|---|
class |
DaoTemplate<M extends Model>
DaoTemplate
|
class |
Model<M extends Model>
Model.
|
| Modifier and Type | Field and Description |
|---|---|
protected Model<M> |
DaoTemplate.dao |
| 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) |
static Class<? extends Model> |
CPI.getUsefulClass(Model model) |
| Modifier and Type | Method and Description |
|---|---|
M |
Model._setOrPut(Model model) |
static Map<String,Object> |
CPI.getAttrs(Model model)
Return the attributes map of the model
|
static Config |
CPI.getConfig(Model model) |
static String |
CPI.getConfigName(Model model) |
static Set<String> |
CPI.getModifyFlag(Model model) |
com.litongjava.db.SqlPara |
Model.getSqlPara(String key,
Model model) |
com.litongjava.db.SqlPara |
DbPro.getSqlPara(String key,
Model model) |
static com.litongjava.db.SqlPara |
Db.getSqlPara(String key,
Model model) |
com.litongjava.db.SqlPara |
Model.getSqlParaByString(String content,
Model model) |
static Table |
CPI.getTable(Model model) |
static Class<? extends Model> |
CPI.getUsefulClass(Model model) |
M |
Model.put(Model model)
Put other model to the model without check attribute name.
|
Row |
Row.setColumns(Model<?> model)
Set columns value with Model object.
|
DaoTemplate<M> |
Model.template(String key,
Model model) |
DaoTemplate<M> |
Model.templateByString(String content,
Model model) |
| Modifier and Type | Method and Description |
|---|---|
ReplicaActiveRecordPlugin |
ReplicaActiveRecordPlugin.addMapping(String tableName,
Class<? extends Model<?>> modelClass) |
ActiveRecordPlugin |
ActiveRecordPlugin.addMapping(String tableName,
Class<? extends Model<?>> modelClass) |
ReplicaActiveRecordPlugin |
ReplicaActiveRecordPlugin.addMapping(String tableName,
String primaryKey,
Class<? extends Model<?>> modelClass) |
ActiveRecordPlugin |
ActiveRecordPlugin.addMapping(String tableName,
String primaryKey,
Class<? extends Model<?>> modelClass) |
static void |
CPI.addModelToConfigMapping(Class<? extends Model> modelClass,
Config config) |
static List<Integer> |
DbKit.batchListSave(List<? extends Model> modelList) |
static List<Integer> |
DbKit.batchListSave(List<? extends Model> modelList,
int batchSize,
String db)
原有框架方法更新只会取modelList第一个元素的字段状态,批量插入的SQL全部相同,只是参数值不同
本方法会根据modelList中所有元素,生成不同的SQL和参数,分批分别执行 自动过滤所有null值属性
|
static List<Integer> |
DbKit.batchListSave(List<? extends Model> modelList,
String db) |
static List<Integer> |
DbKit.batchListUpdate(List<? extends Model> modelList) |
static List<Integer> |
DbKit.batchListUpdate(List<? extends Model> modelList,
int batchSize,
String db)
原有框架方法更新只会取modelList第一个元素的字段状态,批量更新的SQL全部相同,只是参数值不同
本方法会根据modelList中所有元素,生成不同的SQL和参数,分批分别执行 自动过滤所有null值属性
|
static List<Integer> |
DbKit.batchListUpdate(List<? extends Model> modelList,
String db) |
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.batchSave(List<? extends Model> modelList,
int batchSize) |
int[] |
BatchSaveFetchGeneratedKey.batchSave(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.
|
static int[] |
Db.batchUpdate(List<? extends Model> modelList,
int batchSize) |
<T> List<T> |
ModelBuilder.build(ResultSet rs,
Class<? extends Model> modelClass) |
<T> List<T> |
ModelBuilder.build(ResultSet rs,
Class<? extends Model> modelClass,
java.util.function.Function<T,Boolean> func) |
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 |
|---|
DaoTemplate(boolean byString,
Model dao,
String content,
Map<?,?> data) |
DaoTemplate(boolean byString,
Model dao,
String content,
Object... paras) |
DaoTemplate(Model dao,
String key,
Map<?,?> data) |
DaoTemplate(Model dao,
String key,
Object... paras) |
| 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> |
TimestampProcessedModelBuilder.build(ResultSet rs,
Class<? extends Model> modelClass) |
<T> List<T> |
KeepByteAndShortModelBuilder.build(ResultSet rs,
Class<? extends Model> modelClass) |
<T> List<T> |
TimestampProcessedModelBuilder.build(ResultSet rs,
Class<? extends Model> modelClass,
java.util.function.Function<T,Boolean> func) |
<T> List<T> |
KeepByteAndShortModelBuilder.build(ResultSet rs,
Class<? extends Model> modelClass,
java.util.function.Function<T,Boolean> func) |
| Modifier and Type | Method and Description |
|---|---|
com.litongjava.model.page.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 |
PostgreSqlDialect.getModelGeneratedKey(Model<?> model,
PreparedStatement pst,
Table table)
解决 PostgreSql 获取自增主键时 rs.getObject(1) 总是返回第一个字段的值,而非返回了 id 值 issue:
https://www.oschina.net/question/2312705_2243354
|
void |
Dialect.getModelGeneratedKey(Model<?> model,
PreparedStatement pst,
Table table)
用于获取 Model.save() 以后自动生成的主键值,可通过覆盖此方法实现更精细的控制
目前只有 PostgreSqlDialect,覆盖过此方法
|
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) |
<T> void |
Dialect.eachModel(ResultSet rs,
Class<? extends Model> modelClass,
java.util.function.Function<T,Boolean> func) |
com.litongjava.model.page.Page |
Dialect.takeOverModelPaginate(Connection conn,
Class<? extends Model> modelClass,
int pageNumber,
int pageSize,
Boolean isGroupBySql,
String totalRowSql,
StringBuilder findSql,
Object... paras) |
com.litongjava.model.page.Page<? extends Model> |
AnsiSqlDialect.takeOverModelPaginate(Connection conn,
Class<? extends Model> modelClass,
int pageNumber,
int pageSize,
Boolean isGroupBySql,
String totalRowSql,
StringBuilder findSql,
Object... paras) |
Copyright © 2025. All rights reserved.