|
|
@ -210,6 +210,12 @@ public class DataBaseHelper { |
|
|
|
return rowNum; |
|
|
|
return rowNum; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 新增数据 |
|
|
|
|
|
|
|
* @param obj |
|
|
|
|
|
|
|
* @param abstractDbBuiler |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
public static boolean insertEntity(Object obj, AbstractDbBuiler abstractDbBuiler) { |
|
|
|
public static boolean insertEntity(Object obj, AbstractDbBuiler abstractDbBuiler) { |
|
|
|
Map<String, Object> fieldMap = BeanUtil.getFieldValue(obj); |
|
|
|
Map<String, Object> fieldMap = BeanUtil.getFieldValue(obj); |
|
|
|
String sql = abstractDbBuiler.insertSql(obj, fieldMap); |
|
|
|
String sql = abstractDbBuiler.insertSql(obj, fieldMap); |
|
|
@ -217,6 +223,13 @@ public class DataBaseHelper { |
|
|
|
return executeUpdate(sql, params) == 1; |
|
|
|
return executeUpdate(sql, params) == 1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 更新数据 |
|
|
|
|
|
|
|
* @param obj |
|
|
|
|
|
|
|
* @param abstractDbBuiler |
|
|
|
|
|
|
|
* @param id |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
public static boolean updateEntity(Object obj, AbstractDbBuiler abstractDbBuiler, Long id) { |
|
|
|
public static boolean updateEntity(Object obj, AbstractDbBuiler abstractDbBuiler, Long id) { |
|
|
|
Map<String, Object> fieldMap = BeanUtil.getFieldValue(obj); |
|
|
|
Map<String, Object> fieldMap = BeanUtil.getFieldValue(obj); |
|
|
|
String sql = abstractDbBuiler.insertSql(obj, fieldMap); |
|
|
|
String sql = abstractDbBuiler.insertSql(obj, fieldMap); |
|
|
@ -227,6 +240,13 @@ public class DataBaseHelper { |
|
|
|
return executeUpdate(sql, params) == 1; |
|
|
|
return executeUpdate(sql, params) == 1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 删除数据 |
|
|
|
|
|
|
|
* @param obj |
|
|
|
|
|
|
|
* @param abstractDbBuiler |
|
|
|
|
|
|
|
* @param id |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
public static boolean deleteEntity(Object obj, AbstractDbBuiler abstractDbBuiler, Long id) { |
|
|
|
public static boolean deleteEntity(Object obj, AbstractDbBuiler abstractDbBuiler, Long id) { |
|
|
|
Map<String, Object> fieldMap = BeanUtil.getFieldValue(obj); |
|
|
|
Map<String, Object> fieldMap = BeanUtil.getFieldValue(obj); |
|
|
|
String sql = abstractDbBuiler.deleteSql(obj, fieldMap); |
|
|
|
String sql = abstractDbBuiler.deleteSql(obj, fieldMap); |
|
|
|