use of beans.response.DelReleasePlanResponse in project MSEC by Tencent.
the class DelReleasePlan method exec.
public DelReleasePlanResponse exec(ReleasePlan request) {
Logger logger = Logger.getLogger(this.getClass().getName());
DelReleasePlanResponse response = new DelReleasePlanResponse();
response.setMessage("unkown error.");
response.setStatus(100);
String result = checkIdentity();
if (!result.equals("success")) {
response.setStatus(99);
response.setMessage(result);
return response;
}
if (request.getPlan_id() == null || request.getPlan_id().equals("")) {
response.setMessage("Plan ID should NOT be empty.");
response.setStatus(100);
return response;
}
DBUtil util = new DBUtil();
if (util.getConnection() == null) {
response.setMessage("DB connect failed.");
response.setStatus(100);
return response;
}
String sql;
List<Object> params = new ArrayList<Object>();
sql = "delete from t_release_plan where plan_id=?";
logger.info(sql);
params.add(request.getPlan_id());
try {
int delNum = util.updateByPreparedStatement(sql, params);
if (delNum == 1) {
response.setDelNumber(delNum);
response.setMessage("success");
response.setStatus(0);
return response;
} else {
response.setDelNumber(delNum);
response.setMessage("delete record number is " + delNum);
response.setStatus(100);
return response;
}
} catch (SQLException e) {
response.setMessage("del record failed:" + e.toString());
response.setStatus(100);
e.printStackTrace();
return response;
} finally {
util.releaseConn();
}
}
Aggregations