Search in sources :

Example 1 with QueryOddSecondLevelServiceDetailResponse

use of beans.response.QueryOddSecondLevelServiceDetailResponse in project MSEC by Tencent.

the class QueryOddSecondLevelServiceDetail method exec.

public QueryOddSecondLevelServiceDetailResponse exec(OddSecondLevelService request) {
    QueryOddSecondLevelServiceDetailResponse resp = new QueryOddSecondLevelServiceDetailResponse();
    String result = checkIdentity();
    if (!result.equals("success")) {
        resp.setStatus(99);
        resp.setMessage(result);
        return resp;
    }
    DBUtil util = new DBUtil();
    if (util.getConnection() == null) {
        resp.setStatus(100);
        resp.setMessage("db connect failed!");
        return resp;
    }
    String sql;
    List<Object> params;
    List<OddSecondLevelServiceIPInfo> ipList;
    try {
        //查出ip列表
        sql = "select ip,port,status,second_level_service_name,first_level_service_name,comm_proto from " + "t_second_level_service_ipinfo where second_level_service_name=? and first_level_service_name=?";
        params = new ArrayList<Object>();
        params.add(request.getSecond_level_service_name());
        params.add(request.getFirst_level_service_name());
        ipList = util.findMoreRefResult(sql, params, OddSecondLevelServiceIPInfo.class);
        resp.setIpList((ArrayList<OddSecondLevelServiceIPInfo>) ipList);
        resp.setMessage("success");
        resp.setStatus(0);
        return resp;
    } catch (Exception e) {
        resp.setStatus(100);
        resp.setMessage("db query exception!");
        e.printStackTrace();
        return resp;
    } finally {
        util.releaseConn();
    }
}
Also used : DBUtil(ngse.org.DBUtil) QueryOddSecondLevelServiceDetailResponse(beans.response.QueryOddSecondLevelServiceDetailResponse)

Aggregations

QueryOddSecondLevelServiceDetailResponse (beans.response.QueryOddSecondLevelServiceDetailResponse)1 DBUtil (ngse.org.DBUtil)1