标签:over ack public red dao层 cep exception statement argument
/**
*
* 删除数据
*/
@Override
public void deleteObject(List<Map<String, Object>> params, String tableName) {
StringBuilder sql = new StringBuilder(
"DELETE FROM order_info WHERE 1=1 ");
Connection connection = null;
PreparedStatement preparedStatement = null;
try {
connection = DBConnection.getConnection();
if (params != null && params.size() > 0) {
for (int i = 0; i < params.size(); i++) {
Map<String, Object> map = params.get(i);
sql.append(" AND " + map.get("name") + " "
+ map.get("rela") + " " + map.get("value") + " ");
}
}
connection = DBConnection.getConnection();
preparedStatement = connection.prepareStatement(sql.toString());
preparedStatement.executeLargeUpdate();
} catch (SQLException e) {
e.printStackTrace();
System.out.println("删除失败!");
} catch (IllegalArgumentException e) {
e.printStackTrace();
} finally {
DBConnection.close(connection, preparedStatement, null);
}
}
标签:over ack public red dao层 cep exception statement argument
原文地址:https://www.cnblogs.com/caoleiCoding/p/9061931.html