Search in sources :

Example 16 with ServiceProvider

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";
}
Also used : ExtraProduct(com.itrus.portal.db.ExtraProduct) ServiceProvider(com.itrus.portal.db.ServiceProvider) ExtraProductExample(com.itrus.portal.db.ExtraProductExample) ServiceProviderExample(com.itrus.portal.db.ServiceProviderExample) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

ServiceProvider (com.itrus.portal.db.ServiceProvider)16 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)14 ExtraProduct (com.itrus.portal.db.ExtraProduct)11 ExtraProductSpec (com.itrus.portal.db.ExtraProductSpec)9 Enterprise (com.itrus.portal.db.Enterprise)6 Ereceipt (com.itrus.portal.db.Ereceipt)6 UserInfo (com.itrus.portal.db.UserInfo)6 Agent (com.itrus.portal.db.Agent)5 BusinessLicense (com.itrus.portal.db.BusinessLicense)5 ExtraBill (com.itrus.portal.db.ExtraBill)5 IdentityCard (com.itrus.portal.db.IdentityCard)5 OnlinePay (com.itrus.portal.db.OnlinePay)5 OpenBankInfo (com.itrus.portal.db.OpenBankInfo)5 OrgCode (com.itrus.portal.db.OrgCode)5 TaxRegisterCert (com.itrus.portal.db.TaxRegisterCert)5 Einvoice (com.itrus.portal.db.Einvoice)4 ExtraBillExample (com.itrus.portal.db.ExtraBillExample)4 OnPayInfo (com.itrus.portal.db.OnPayInfo)4 Project (com.itrus.portal.db.Project)4 ServiceHall (com.itrus.portal.db.ServiceHall)4