use of com.itrus.portal.db.ServiceProvider in project portal by ixinportal.
the class ExtraProductController method list.
// 遍历页面
@RequestMapping(produces = "text/html")
public String list(@RequestParam(value = "ServiceProvider", required = false) String ServiceProvider, @RequestParam(value = "appName", required = false) String appName, @RequestParam(value = "appType", required = false) String appType, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, Model uiModel) throws Exception {
if (page == null || page < 1)
page = 1;
if (size == null || size < 1)
size = 10;
Integer offset = size * (page - 1);
ExtraProductExample example = new ExtraProductExample();
ExtraProductExample.Criteria criteria = example.or();
// 筛选服务商下属的产品
if (StringUtils.isNotBlank(ServiceProvider)) {
ServiceProviderExample serviceProviderExample = new ServiceProviderExample();
ServiceProviderExample.Criteria criteria2 = serviceProviderExample.createCriteria();
serviceProviderExample.setOrderByClause("create_time desc");
criteria2.andNameEqualTo(ServiceProvider);
List<ServiceProvider> serviceProviders = serviceProviderService.selectByExample(serviceProviderExample);
criteria.andServiceProviderEqualTo(serviceProviders.get(0).getId());
}
if (StringUtils.isNotBlank(appName)) {
criteria.andAppNameLike(appName);
}
if (StringUtils.isNotBlank(appType)) {
criteria.andAppTypeLike(appType);
}
Integer count = extraProductService.countByExample(example);
example.setLimit(size);
example.setOffset(offset);
List<ExtraProduct> extraProducts = extraProductService.selectByExample(example);
uiModel.addAttribute("extraProducts", extraProducts);
uiModel.addAttribute("ServiceProvider", ServiceProvider);
uiModel.addAttribute("appName", appName);
uiModel.addAttribute("appType", appType);
uiModel.addAttribute("page", page);
uiModel.addAttribute("size", size);
uiModel.addAttribute("count", count);
// 服务提供商组成的map
Map<Long, ServiceProvider> serviceProviderMap = serviceProviderService.selectMapByExample(null);
uiModel.addAttribute("serviceProviderMap", serviceProviderMap);
return "extraproduct/list";
}
Aggregations