Search in sources :

Example 1 with QueryFirstLevelServiceResponse

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

the class QueryFirstLevelService method exec.

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

Aggregations

FirstLevelService (beans.dbaccess.FirstLevelService)1 QueryFirstLevelServiceResponse (beans.response.QueryFirstLevelServiceResponse)1 ArrayList (java.util.ArrayList)1 DBUtil (msec.org.DBUtil)1