List of usage examples for org.apache.ibatis.session RowBounds RowBounds
public RowBounds(int offset, int limit)
From source file:com.mycollab.db.persistence.service.DefaultService.java
License:Open Source License
@Override public List findAbsoluteListByCriteria(S searchCriteria, Integer firstIndex, Integer numberOfItems) { return getSearchMapper().findPageableListByCriteria(searchCriteria, new RowBounds(firstIndex, numberOfItems)); }
From source file:com.mycollab.module.project.service.ibatis.ProjectActivityStreamServiceImpl.java
License:Open Source License
@Override public List<ProjectActivityStream> getProjectActivityStreams( BasicSearchRequest<ActivityStreamSearchCriteria> searchRequest) { return projectMapperExt.getProjectActivityStreams(searchRequest.getSearchCriteria(), new RowBounds((searchRequest.getCurrentPage() - 1) * searchRequest.getNumberOfItems(), searchRequest.getNumberOfItems())); }
From source file:com.mycollab.module.project.service.ibatis.ProjectTaskServiceImpl.java
License:Open Source License
@SuppressWarnings("unchecked") @Override/* w w w . j a va2 s .c o m*/ public List<SimpleTask> findSubTasks(Integer parentTaskId, Integer sAccountId, SearchCriteria.OrderField orderField) { TaskSearchCriteria searchCriteria = new TaskSearchCriteria(); searchCriteria.setSaccountid(new NumberSearchField(sAccountId)); searchCriteria.setParentTaskId(new NumberSearchField(parentTaskId)); searchCriteria.setOrderFields(Collections.singletonList(orderField)); return taskMapperExt.findPagableListByCriteria(searchCriteria, new RowBounds(0, Integer.MAX_VALUE)); }
From source file:com.mycollab.module.project.service.impl.AbstractProjectTicketServiceImpl.java
License:Open Source License
@Override public List findTicketsByCriteria(@CacheKey BasicSearchRequest<ProjectTicketSearchCriteria> searchRequest) { return projectTicketMapper.findTicketsByCriteria(searchRequest.getSearchCriteria(), new RowBounds((searchRequest.getCurrentPage() - 1) * searchRequest.getNumberOfItems(), searchRequest.getNumberOfItems())); }
From source file:com.mycollab.module.project.service.impl.ProjectTaskServiceImpl.java
License:Open Source License
@Override public List<SimpleTask> findSubTasks(Integer parentTaskId, Integer sAccountId, SearchCriteria.OrderField orderField) { TaskSearchCriteria searchCriteria = new TaskSearchCriteria(); searchCriteria.setSaccountid(new NumberSearchField(sAccountId)); searchCriteria.setParentTaskId(new NumberSearchField(parentTaskId)); searchCriteria.setOrderFields(Collections.singletonList(orderField)); return taskMapperExt.findPageableListByCriteria(searchCriteria, new RowBounds(0, Integer.MAX_VALUE)); }
From source file:com.mycollab.module.user.service.mybatis.UserServiceDBImpl.java
License:Open Source License
@Override public SimpleUser findUserInAccount(String username, Integer accountId) { UserSearchCriteria criteria = new UserSearchCriteria(); criteria.setUsername(StringSearchField.and(username)); criteria.setSaccountid(new NumberSearchField(accountId)); List<SimpleUser> users = userMapperExt.findPageableListByCriteria(criteria, new RowBounds(0, 1)); if (CollectionUtils.isEmpty(users)) { return null; } else {//from w w w . j a v a 2 s. c o m return users.get(0); } }
From source file:com.qq.tars.service.config.ConfigService.java
License:Open Source License
@Transactional(rollbackFor = Exception.class) public void addDefaultNodeConfigFile(String application, String serverName, boolean enableSet, String setName, String setArea, String setGroup, String filename) { List<ServerConf> servers = serverMapper.getServerConf(application, serverName, enableSet, setName, setArea, setGroup, new RowBounds(0, 0)); servers.forEach(server -> {//from w ww .j a v a2 s. c om ConfigFile newone = new ConfigFile(); newone.setServerName(String.format("%s.%s", application, serverName)); if (enableSet) { newone.setSetName(setName); newone.setSetArea(setArea); newone.setSetGroup(setGroup); } newone.setFilename(filename); newone.setConfig(""); newone.setHost(server.getNodeName()); newone.setLevel(3); newone.setPosttime(DateTime.now()); configMapper.insertConfigFile(newone); ConfigFileHistory history = new ConfigFileHistory(); history.setConfigId(newone.getId()); history.setReason("?"); history.setContent(newone.getConfig()); history.setPosttime(newone.getPosttime()); configMapper.insertConfigFileHistory(history); }); }
From source file:com.qq.tars.service.config.ConfigService.java
License:Open Source License
public List<ConfigFile> getNodeConfigFile(String application, String serverName, String setName, String setArea, String setGroup, long configId) { boolean enableSet = StringUtils.isNoneBlank(setName, setArea, setGroup); List<ServerConf> servers = serverMapper.getServerConf(application, serverName, enableSet, setName, setArea, setGroup, new RowBounds(0, 0)); ConfigFile configFile = loadConfigFile(configId); Map<String, ConfigFile> map = configMapper .getNodeConfigFile(application, serverName, setName, setArea, setGroup).stream() .filter(config -> config.getFilename().equals(configFile.getFilename())) .collect(Collectors.toMap(config -> String.format("%s.%s.%s.%s_%s", config.getServerName(), config.getSetName(), config.getSetArea(), config.getSetGroup(), config.getHost()), config -> config)); List<ConfigFile> exists = new ArrayList<>(map.values()); servers.stream().filter(server -> { String key = String.format("%s.%s.%s.%s.%s_%s", application, serverName, enableSet ? setName : StringUtils.EMPTY, enableSet ? setArea : StringUtils.EMPTY, enableSet ? setGroup : StringUtils.EMPTY, server.getNodeName()); return !map.containsKey(key); }).forEach(server -> {//from w ww .j a v a2 s. c om ConfigFile newone = new ConfigFile(); newone.setServerName(String.format("%s.%s", application, serverName)); newone.setSetName(setName); newone.setSetArea(setArea); newone.setSetGroup(setGroup); newone.setHost(server.getNodeName()); newone.setFilename(configFile.getFilename()); newone.setConfig(""); newone.setLevel(3); newone.setPosttime(DateTime.now()); configMapper.insertConfigFile(newone); log.info("insert default node config file, id={}, server_name={}, host={}, filename={}", newone.getId(), newone.getServerName(), newone.getHost(), newone.getFilename()); ConfigFileHistory history = new ConfigFileHistory(); history.setConfigId(newone.getId()); history.setReason("?"); history.setContent(newone.getConfig()); history.setPosttime(newone.getPosttime()); configMapper.insertConfigFileHistory(history); exists.add(newone); }); return exists; }
From source file:com.qq.tars.service.config.ConfigService.java
License:Open Source License
public List<ConfigFileHistory> getConfigFileHistory(long configId, int curPage, int pageSize) { return configMapper.getConfigFileHistory(configId, new RowBounds(curPage, pageSize)); }
From source file:com.qq.tars.service.NotifyService.java
License:Open Source License
public List<ServerNotify> getServerNotifyList(String treeNodeId, int curPage, int pageSize) { List<ServerConf> serverConfs = serverService.getServerConf(treeNodeId, 0, 0); // serverid/*from www . ja va 2 s .com*/ Set<String> serverids = new HashSet<>(); serverConfs.forEach(serverConf -> serverids.add(String.format("%s.%s_%s", serverConf.getApplication(), serverConf.getServerName(), serverConf.getNodeName()))); return notifyMapper.getServerNotify(serverids, new RowBounds(curPage, pageSize)); }