Search in sources :

Example 1 with OddFirstLevelService

use of beans.dbaccess.OddFirstLevelService in project MSEC by Tencent.

the class QueryOddFirstLevelService method exec.

public QueryOddFirstLevelServiceResponse exec(OddSecondLevelService request) {
    QueryOddFirstLevelServiceResponse resp = new QueryOddFirstLevelServiceResponse();
    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;
    }
    List<OddFirstLevelService> serviceList;
    String sql = "select first_level_service_name from t_first_level_service where type='odd' ";
    List<Object> params = new ArrayList<Object>();
    if (request.getSecond_level_service_name() != null && request.getSecond_level_service_name().length() > 0) {
        sql += " where first_level_service_name=? ";
        params.add(request.getSecond_level_service_name());
    }
    try {
        serviceList = util.findMoreRefResult(sql, params, OddFirstLevelService.class);
    } catch (Exception e) {
        resp.setStatus(100);
        resp.setMessage("db query exception!");
        e.printStackTrace();
        return resp;
    } finally {
        util.releaseConn();
    }
    resp.setService_list((ArrayList<OddFirstLevelService>) serviceList);
    resp.setMessage("success");
    resp.setStatus(0);
    return resp;
}
Also used : DBUtil(ngse.org.DBUtil) OddFirstLevelService(beans.dbaccess.OddFirstLevelService) ArrayList(java.util.ArrayList) QueryOddFirstLevelServiceResponse(beans.response.QueryOddFirstLevelServiceResponse)

Aggregations

OddFirstLevelService (beans.dbaccess.OddFirstLevelService)1 QueryOddFirstLevelServiceResponse (beans.response.QueryOddFirstLevelServiceResponse)1 ArrayList (java.util.ArrayList)1 DBUtil (ngse.org.DBUtil)1