use of com.itrus.portal.db.ServiceProviderExample in project portal by ixinportal.
the class ServiceProviderController method list.
// 遍历页面
@RequestMapping(produces = "text/html")
public String list(@RequestParam(value = "queryDate1", required = false) Date queryDate1, @RequestParam(value = "queryDate2", required = false) Date queryDate2, @RequestParam(value = "name", required = false) String name, @RequestParam(value = "contactsName", required = false) String contactsName, @RequestParam(value = "contactsMphone", required = false) String contactsMphone, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, Model uiModel) throws Exception {
if (queryDate1 == null && queryDate2 == null) {
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DATE, 1);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
calendar.add(Calendar.MILLISECOND, -1);
queryDate2 = calendar.getTime();
calendar.add(Calendar.MILLISECOND, 1);
calendar.add(Calendar.MONTH, -1);
queryDate1 = calendar.getTime();
}
if (page == null || page < 1)
page = 1;
if (size == null || size < 1)
size = 10;
Integer offset = size * (page - 1);
ServiceProviderExample example = new ServiceProviderExample();
ServiceProviderExample.Criteria criteria = example.createCriteria();
criteria.andCreateTimeBetween(queryDate1, queryDate2);
Integer count = ServiceProviderService.countByExample(example);
example.setLimit(size);
example.setOffset(offset);
if (StringUtils.isNotBlank(name)) {
criteria.andNameLike(name);
}
if (StringUtils.isNotBlank(contactsName)) {
criteria.andContactsNameLike(contactsName);
}
if (StringUtils.isNotBlank(contactsMphone)) {
criteria.andContactsMphoneLike(contactsMphone);
}
List<ServiceProvider> serviceProviders = ServiceProviderService.selectByExample(example);
uiModel.addAttribute("serviceProviders", serviceProviders);
uiModel.addAttribute("queryDate1", queryDate1);
uiModel.addAttribute("queryDate2", queryDate2);
uiModel.addAttribute("name", name);
uiModel.addAttribute("contactsName", contactsName);
uiModel.addAttribute("contactsMphone", contactsMphone);
uiModel.addAttribute("page", page);
uiModel.addAttribute("size", size);
uiModel.addAttribute("count", count);
return "serviceprovider/list";
}
use of com.itrus.portal.db.ServiceProviderExample 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