@SuppressWarnings("unchecked") public List<SysOrderDto> queryEffectiveOrderList(SysOrderDto dto) { Map<String, Object> paraMap = new HashMap<String, Object>(); try { paraMap.put("fromOrderDate", dto.getFromOrderDate()); paraMap.put("toOrderDate", dto.getToOrderDate()); paraMap.put("fromPayDate", dto.getFromPayDate()); paraMap.put("toPayDate", dto.getToPayDate()); paraMap.put("status", dto.getStatus()); paraMap.put("payDate", dto.getPayDate()); paraMap.put("serviceCode", dto.getServiceCode()); paraMap.put("inOrderName", dto.getInOrderName()); paraMap.put("inOrderName", dto.getInOrderName()); paraMap.put("inOrderName", dto.getInOrderName()); paraMap.put("inOrderName", dto.getInOrderName()); paraMap.put("serviceName", dto.getServiceName()); paraMap.put("itemCode", dto.getItemCode()); paraMap.put("inOrder", dto.getInOrder()); paraMap.put("endDate", dto.getEndDate()); paraMap.put("service1Remains", dto.getService1Remains()); paraMap.put("service2Remains", dto.getService2Remains()); paraMap.put("service3Remains", dto.getService3Remains()); } catch (Exception e) { logger.error(e); } return sqlMapClientTemplate.queryForList("queryEffectiveOrderList", paraMap); }
@Test public void activeJobs_shouldRemoveCacheActiveJobOnUpdateJobStatus() { final ActiveJob first = new ActiveJob(1L, "pipeline", 1, "label", "stage", "first"); final ActiveJob second = new ActiveJob(2L, "another", 2, "label", "stage", "job1"); List<ActiveJob> expectedJobs = Arrays.asList(first, second); when(mockTemplate.queryForList("getActiveJobIds")).thenReturn(Arrays.asList(1L, 2L)); when(mockTemplate.queryForObject("getActiveJobById", arguments("id", 1L).asMap())) .thenReturn(first); when(mockTemplate.queryForObject("getActiveJobById", arguments("id", 2L).asMap())) .thenReturn(second); jobInstanceDao.setSqlMapClientTemplate(mockTemplate); jobInstanceDao.activeJobs(); // cache it first jobInstanceDao.updateStateAndResult(instance(1L)); // should remove from cache List<ActiveJob> activeJobs = jobInstanceDao.activeJobs(); assertThat(expectedJobs, is(activeJobs)); verify(mockTemplate, times(2)).queryForList("getActiveJobIds"); verify(mockTemplate, times(2)).queryForObject("getActiveJobById", arguments("id", 1L).asMap()); verify(mockTemplate, times(1)).queryForObject("getActiveJobById", arguments("id", 2L).asMap()); }
@Test public void updateStatus_shouldRemoveCachedJobPlan() { when(mockTemplate.queryForList(eq("scheduledPlanIds"))).thenReturn(Arrays.asList(1L)); final DefaultJobPlan firstJob = jobPlan(1); List<JobPlan> expectedPlans = new ArrayList<JobPlan>() { { add(firstJob); } }; when(mockTemplate.queryForObject("scheduledPlan", arguments("id", 1L).asMap())) .thenReturn(firstJob); jobInstanceDao.setSqlMapClientTemplate(mockTemplate); jobInstanceDao.orderedScheduledBuilds(); // populate the cache JobInstance instance = instance(1); jobInstanceDao.updateStateAndResult(instance); List<JobPlan> plans = jobInstanceDao.orderedScheduledBuilds(); assertThat(plans, is(expectedPlans)); verify(mockTemplate, times(2)) .queryForObject( "scheduledPlan", arguments("id", 1L).asMap()); // because the cache is cleared verify(mockTemplate, times(2)).queryForList(eq("scheduledPlanIds")); }
@Test public void orderedScheduledBuilds_shouldCacheJobPlan() { when(mockTemplate.queryForList(eq("scheduledPlanIds"))).thenReturn(Arrays.asList(1L, 2L)); final DefaultJobPlan firstJob = jobPlan(1); final DefaultJobPlan secondJob = jobPlan(2); List<JobPlan> expectedPlans = new ArrayList<JobPlan>() { { add(firstJob); add(secondJob); } }; when(mockTemplate.queryForObject("scheduledPlan", arguments("id", 1L).asMap())) .thenReturn(firstJob); when(mockTemplate.queryForObject("scheduledPlan", arguments("id", 2L).asMap())) .thenReturn(secondJob); jobInstanceDao.setSqlMapClientTemplate(mockTemplate); jobInstanceDao.orderedScheduledBuilds(); List<JobPlan> plans = jobInstanceDao.orderedScheduledBuilds(); assertThat(plans, is(expectedPlans)); verify(mockTemplate, times(2)).queryForObject(eq("scheduledPlan"), any()); verify(mockTemplate, times(2)).queryForList(eq("scheduledPlanIds")); }
public List<BoardVo> getList() { System.out.println("BoardDaoList"); List<BoardVo> list = (List<BoardVo>) sqlMapClientTemplate.queryForList("board.list"); /* String sql = " SELECT no, view_cnt, member_name, title, TO_CHAR (reg_date, 'YYYY-MMDD HH:MM:SS'), member_no FROM board order by my_no desc, order_no"; */ return list; }
public Checkphone getCheckphoneBean(CheckphoneModel checkphoneModel) { Checkphone backcheckphone = null; List list = (List) sqlMapClientTemplate.queryForList("Checkphone.getCheckphone", checkphoneModel); if (list != null && list.size() > 0) { backcheckphone = (Checkphone) list.get(0); } return backcheckphone; }
@Test public void activeJobs_shouldCacheCurrentlyActiveJobIds() { final ActiveJob first = new ActiveJob(1L, "pipeline", 1, "label", "stage", "job1"); final ActiveJob second = new ActiveJob(2L, "another", 2, "label", "stage", "job1"); List<ActiveJob> expectedJobs = Arrays.asList(first, second); when(mockTemplate.queryForList("getActiveJobIds")).thenReturn(Arrays.asList(1L, 2L)); when(mockTemplate.queryForObject("getActiveJobById", arguments("id", 1L).asMap())) .thenReturn(first); when(mockTemplate.queryForObject("getActiveJobById", arguments("id", 2L).asMap())) .thenReturn(second); jobInstanceDao.setSqlMapClientTemplate(mockTemplate); jobInstanceDao.activeJobs(); // populate the cache List<ActiveJob> activeJobs = jobInstanceDao.activeJobs(); assertThat(expectedJobs, is(activeJobs)); verify(mockTemplate, times(1)).queryForList("getActiveJobIds"); verify(mockTemplate, times(1)).queryForObject("getActiveJobById", arguments("id", 1L).asMap()); verify(mockTemplate, times(1)).queryForObject("getActiveJobById", arguments("id", 2L).asMap()); }
public List<SysOrderDto> queryOrderByOrderIdList(SysOrderDto dto) { return sqlMapClientTemplate.queryForList("queryOrderByOrderIdList", dto); }
public List<Comments> getCommentsByP_id(int p_id) { return ibatisTemplate.queryForList("getCommentsByP_id", p_id); }
@SuppressWarnings("unchecked") public List<CertAccessHistoryDto> queryCertAccessHistoryListByCertIdAndCompanyId( CertAccessHistoryDto certAccessHistoryDto) { return sqlMapClientTemplate.queryForList( "queryCertAccessHistoryListByCertIdAndCompanyId", certAccessHistoryDto); }
@SuppressWarnings("unchecked") public List<CertAccessHistoryDto> queryCertAccessHistoryByCertId(Long certId) { return sqlMapClientTemplate.queryForList("queryCertAccessHistoryByCertId", certId); }
public List<UserVo> getUser() { return sqlMapClientTemplate.queryForList("admin.selectUser"); }