List of usage examples for org.apache.ibatis.session SqlSession selectList
<E> List<E> selectList(String statement, Object parameter);
From source file:com.onnurimotors.wm.service.WmService.java
public Object getEmployeePage(HttpServletRequest request, Model model) { SqlSession session = sqlSession(); EMPLOYEE employee = new EMPLOYEE(); if (request != null) { String name = request.getParameter("name"); String employee_id = request.getParameter("employee_id"); String flimit = request.getParameter("flimit"); String nlimit = request.getParameter("nlimit"); employee.setNAME(""); employee.setEMPLOYEE_ID(-1);/*w w w . ja va 2s . co m*/ employee.setFROM_LIMIT(0); employee.setNUM_LIMIT(10); if (name != null && !name.equals("")) { employee.setNAME(name); } if (employee_id != null && !employee_id.equals("")) { employee.setEMPLOYEE_ID(Integer.parseInt(employee_id)); } if (flimit != null && !flimit.equals("")) { employee.setFROM_LIMIT(Integer.parseInt(flimit)); } if (nlimit != null && !nlimit.equals("")) { employee.setNUM_LIMIT(Integer.parseInt(nlimit)); } } ArrayList<EMPLOYEE> employees = (ArrayList<EMPLOYEE>) session .selectList("watchman.mybatis.selectEmployeePage", employee); if (model != null) { model.addAttribute("vehicles", employees); } session.close(); return employees; }
From source file:com.onnurimotors.wm.service.WmService.java
private int getEmployeeCount(HttpServletRequest request) { SqlSession session = sqlSession(); EMPLOYEE employee = new EMPLOYEE(); String name = request.getParameter("name"); String employee_id = request.getParameter("employee_id"); employee.setNAME(""); employee.setEMPLOYEE_ID(-1);// w w w .j a v a 2 s. com if (name != null && !name.equals("")) { employee.setNAME(name); } if (employee_id != null && !employee_id.equals("")) { employee.setEMPLOYEE_ID(Integer.parseInt(employee_id)); } ArrayList<EMPLOYEE> employees = (ArrayList<EMPLOYEE>) session .selectList("watchman.mybatis.selectAllEmployee", employee); session.close(); return employees.size(); }
From source file:com.onnurimotors.wm.service.WmService.java
public Object getAllHistory(HttpServletRequest request, Model model, String date_visit) { SqlSession session = sqlSession(); PARAMETER_HISTORY parameter_history = new PARAMETER_HISTORY(); parameter_history.setHISTORY_ID(-1); if (request != null) { String parameter = request.getParameter("HISTORY_ID"); if (parameter != null && !parameter.equals("")) { parameter_history.setHISTORY_ID(Integer.parseInt(parameter)); }/* w ww. j ava 2 s.c o m*/ } parameter_history.setDATE_VISIT(""); if (date_visit != null && !date_visit.equals("")) { parameter_history.setDATE_VISIT(date_visit); } ArrayList<HISTORY> historys = (ArrayList<HISTORY>) session.selectList("watchman.mybatis.selectAllHistory", parameter_history); session.close(); if (model != null) { model.addAttribute("historys", historys); } return historys; }
From source file:com.onnurimotors.wm.service.WmService.java
public Object getAllHistoryByVehicle(HttpServletRequest request, Model model, int vehicle_id) { getVehicle(request, model, vehicle_id); SqlSession session = sqlSession(); PARAMETER_VEHICLE parameter_vehicle = new PARAMETER_VEHICLE(); parameter_vehicle.setVEHICLE_ID(vehicle_id); if (request != null) { String parameter = request.getParameter("vehicle_id"); if (parameter != null && !parameter.equals("")) { parameter_vehicle.setVEHICLE_ID(Integer.parseInt(parameter)); }//from www . ja v a2 s .com } ArrayList<HISTORY> historys = (ArrayList<HISTORY>) session .selectList("watchman.mybatis.selectAllDateVisitByVehicle", parameter_vehicle); session.close(); if (model != null) { model.addAttribute("historys", historys); } return historys; }
From source file:com.onnurimotors.wm.service.WmService.java
public Object getManagementByHistory(HttpServletRequest request, Map<String, Object> model, int vehicle_id, String date_visit) {//from w w w .j a va2s.c o m SqlSession session = sqlSession(); PARAMETER_HISTORY parameter_history = new PARAMETER_HISTORY(); parameter_history.setDATE_VISIT(date_visit); parameter_history.setVEHICLE_ID(vehicle_id); parameter_history.setHISTORY_ID(-1); parameter_history.setPAGE(0); parameter_history.setSIZE_PAGE(1); PARAMETER_MANAGEMENT parameter_management = new PARAMETER_MANAGEMENT(); parameter_management.setVEHICLE_ID(vehicle_id); parameter_management.setDATE_VISIT(date_visit); ArrayList<MANAGEMENT> managements = (ArrayList<MANAGEMENT>) session .selectList("watchman.mybatis.selectAllManagementByDateVisitVehicle", parameter_management); HISTORY history = (HISTORY) session.selectOne("watchman.mybatis.selectHistory", parameter_history); parameter_history.setHISTORY_ID(history.getHISTORY_ID()); HISTORY prev_history = (HISTORY) session.selectOne("watchman.mybatis.selectPrevHistory", parameter_history); HISTORY next_history = (HISTORY) session.selectOne("watchman.mybatis.selectNextHistory", parameter_history); if (model != null) { model.put("history", history); model.put("prev_history", prev_history); model.put("next_history", next_history); model.put("managements", managements); } session.close(); return managements; }
From source file:com.onnurimotors.wm.service.WmService.java
private void deleteHistoryByVehicle(int vehicle_id) { SqlSession session = sqlSession(); PARAMETER_VEHICLE parameter_vehicle = new PARAMETER_VEHICLE(); parameter_vehicle.setVEHICLE_ID(vehicle_id); ArrayList<HISTORY> historys = (ArrayList<HISTORY>) session .selectList("watchman.mybatis.selectAllHistoryByVehicle", parameter_vehicle); session.close();//from w w w . ja va 2 s .c o m for (int i = 0; i < historys.size(); i++) { deleteHistory(null, null, historys.get(i).getHISTORY_ID()); } }
From source file:com.sec.ose.airs.persistence.SPDXMapperImpl.java
License:Open Source License
@Override public List<SPDXFileDTO> getFileList(int packageId) { SqlSession session = factory.openSession(true); List<SPDXFileDTO> result; try {//from w w w. j a v a 2s . c om result = session.selectList("getFileList", packageId); } finally { session.close(); } return result; }
From source file:com.sec.ose.airs.persistence.SPDXMapperImpl.java
License:Open Source License
@Override public List<SPDXOtherLicenseDTO> getOtherLicenseList(int packageId) { SqlSession session = factory.openSession(true); List<SPDXOtherLicenseDTO> result; try {/*from www . ja v a 2s.c o m*/ result = session.selectList("getOtherLicenseList", packageId); } finally { session.close(); } return result; }
From source file:com.sec.ose.airs.persistence.SPDXMapperImpl.java
License:Open Source License
@Override public List<SPDXFileDTO> getSameFileWithChecksum(List<Integer> packageIdList, String checksum) { SqlSession session = factory.openSession(true); List<SPDXFileDTO> fileList = null; HashMap<String, Object> map = new HashMap<String, Object>(); map.put("packageIdList", packageIdList); map.put("checksum", checksum); try {//from w ww.ja v a2 s .c om fileList = session.selectList("getSameFileWithChecksum", map); } finally { session.close(); } return fileList; }
From source file:com.skt.adcas.lte.action.DownLinkByNMSAction.java
public String selectDailyCellTraffic() { this.log.debug("selectDailyCellTraffic Start"); SqlSession session = null; try {//from w w w. j a v a 2 s.c om parseParam(); /* if( isNull(this.BTS_NM_CMS).equals("") ) { throw new Exception("DU? "); } */ this.log.debug("###################### "); session = SqlSessionManager.getSqlSession().openSession(); //this.param.put("BTS_NM_CMS",BTS_NM_CMS); this.log.debug("###################### ?? "); this.rows = session.selectList("DownLinkByNMS.selectDailyCellTraffic" + VIEWTYPE, param); this.log.debug("###################### "); //session.commit(); this.log.debug("###################### "); this.msg = "?"; this.status = "SUCCESS"; } catch (Exception e) { this.msg = e.getMessage(); this.status = "ERROR"; this.error = true; if (session != null) { session.rollback(); } e.printStackTrace(); } finally { if (session != null) { session.close(); } } this.log.debug("selectDailyCellTraffic End"); return SUCCESS; }