简化Record,去除tableName和pkName属性
This commit is contained in:
parent
26863ae53b
commit
d1b3e3ba94
|
|
@ -337,8 +337,8 @@ public class Db {
|
||||||
* @param rd rd
|
* @param rd rd
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public int save(Record rd){
|
public int save(String tableName, Record rd){
|
||||||
return save(rd.getTableName(), rd.getPkName(), rd);
|
return save(tableName, "ID", rd);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -348,8 +348,8 @@ public class Db {
|
||||||
* @param rd msps
|
* @param rd msps
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public int update(Record rd){
|
public int update(String tableName, Record rd){
|
||||||
return update(rd.getTableName(), rd.getPkName(), rd);
|
return update(tableName, "ID", rd);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -21,55 +21,19 @@ import com.smallchill.core.toolbox.kit.BeanKit;
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class Record extends HashMap<String, Object> {
|
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
|
* 创建Record
|
||||||
* @return Maps
|
* @return Record
|
||||||
*/
|
*/
|
||||||
public static Record create() {
|
public static Record create() {
|
||||||
return new Record();
|
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(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Record(String tableName, String pkName){
|
|
||||||
this.tableName = tableName;
|
|
||||||
this.pkName = pkName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建HashMap
|
* 创建HashMap
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user