use of beans.dbaccess.SecondLevelServiceConfigTag in project MSEC by Tencent.
the class DelSecondLevelServiceConfigTag method deleteAll.
public static String deleteAll(String flsn, String slsn) {
DBUtil util = new DBUtil();
if (util.getConnection() == null) {
return "DB connect failed.";
}
try {
String sql = "select tag_name from t_config_tag where first_level_service_name=? and second_level_service_name=?";
List<Object> params = new ArrayList<Object>();
params.add(flsn);
params.add(slsn);
ArrayList<SecondLevelServiceConfigTag> result = util.findMoreRefResult(sql, params, SecondLevelServiceConfigTag.class);
for (int i = 0; i < result.size(); i++) {
String tag_name = result.get(i).getTag_name();
sql = "delete from t_config_tag where tag_name=? and first_level_service_name=? and second_level_service_name=?";
params = new ArrayList<Object>();
params.add(tag_name);
params.add(flsn);
params.add(slsn);
//删除数据库记录
int delNum = util.updateByPreparedStatement(sql, params);
String filename = SecondLevelServiceConfigTag.getConfigFileName(flsn, slsn, tag_name);
RemoveFile(filename);
}
return "success";
} catch (Exception e) {
e.printStackTrace();
return e.getMessage();
} finally {
util.releaseConn();
}
}
Aggregations