简化Record,去除tableName和pkName属性

This commit is contained in:
zhuangqian 2016-09-08 13:32:58 +08:00
parent 26863ae53b
commit d1b3e3ba94
2 changed files with 6 additions and 42 deletions

View File

@ -337,8 +337,8 @@ public class Db {
* @param rd rd
* @return
*/
public int save(Record rd){
return save(rd.getTableName(), rd.getPkName(), rd);
public int save(String tableName, Record rd){
return save(tableName, "ID", rd);
}
/**
@ -348,8 +348,8 @@ public class Db {
* @param rd msps
* @return
*/
public int update(Record rd){
return update(rd.getTableName(), rd.getPkName(), rd);
public int update(String tableName, Record rd){
return update(tableName, "ID", rd);
}
/**

View File

@ -21,55 +21,19 @@ import com.smallchill.core.toolbox.kit.BeanKit;
*/
@SuppressWarnings("serial")
public class Record extends HashMap<String, Object> {
private String tableName;
private String pkName;
public String getTableName() {
return tableName;
}
public Record setTableName(String tableName) {
this.tableName = tableName;
return this;
}
public String getPkName() {
return pkName;
}
public Record setPkName(String pkName) {
this.pkName = pkName;
return this;
}
/**
* 创建Maps
* @return Maps
* 创建Record
* @return Record
*/
public static Record create() {
return new Record();
}
/**
* 创建Maps
* @param tableName 表名
* @param pkName 主键名
* @return Maps
*/
public static Record create(String tableName, String pkName) {
return new Record(tableName, pkName);
}
private Record(){
}
private Record(String tableName, String pkName){
this.tableName = tableName;
this.pkName = pkName;
}
/**
* 创建HashMap
*