Search in sources :

Example 6 with ExtraProductExample

use of com.itrus.portal.db.ExtraProductExample 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)

Example 7 with ExtraProductExample

use of com.itrus.portal.db.ExtraProductExample in project portal by ixinportal.

the class ExtraProductReleaseController method show.

// 显示详情页面
@RequestMapping(value = "/show/{id}", produces = "text/html")
public String show(@PathVariable("id") Long id, Model uiModel) throws Exception {
    Project project = projectService.selectByPrimaryKey(id);
    List<ExtraProductRelease> extraProductReleases = extraProductReleaseService.getByprojectId(id);
    // 所有的增值产品信息,以id为主键.以便页面显示信息
    Map<Long, ExtraProduct> extraProductMap = new HashMap<Long, ExtraProduct>();
    extraProductMap = extraProductService.selectMapByExample(null);
    // 项目信息
    uiModel.addAttribute("project", project);
    // 产品与项目之间的关系
    uiModel.addAttribute("extraProductReleases", extraProductReleases);
    // 所有的产品
    uiModel.addAttribute("extraProductMap", extraProductMap);
    // 显示新建的增值产品,还未与项目产生关联
    ExtraProductExample epe = new ExtraProductExample();
    ExtraProductExample.Criteria epec = epe.createCriteria();
    List<Long> havedProductIds = new ArrayList<>();
    for (ExtraProductRelease epr : extraProductReleases) {
        havedProductIds.add(epr.getExtraProduct());
    }
    if (havedProductIds != null && havedProductIds.size() > 0) {
        epec.andIdNotIn(havedProductIds);
    }
    epe.setOrderByClause("id asc");
    // 没有与该项目产生关联关系的增值产品
    List<ExtraProduct> remainingProducts = extraProductService.selectByExample(epe);
    uiModel.addAttribute("remainingProducts", remainingProducts);
    return "extraproductrelease/show";
}
Also used : Project(com.itrus.portal.db.Project) ExtraProduct(com.itrus.portal.db.ExtraProduct) ExtraProductRelease(com.itrus.portal.db.ExtraProductRelease) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ExtraProductExample(com.itrus.portal.db.ExtraProductExample) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 8 with ExtraProductExample

use of com.itrus.portal.db.ExtraProductExample in project portal by ixinportal.

the class ExtraBillServiceImpl method getProductMapByEnterpriseId.

/**
 * 根据企业id查询订单表中对应的产品Manp
 *
 * @param enterprise
 * @return
 */
public Map<Long, ExtraProduct> getProductMapByEnterpriseId(Long enterprise) {
    Map<Long, ExtraProduct> productMap = new HashMap<Long, ExtraProduct>();
    List<Long> productIds = sqlSession.selectList("com.itrus.portal.db.ExtraBillMapper.selectProductsByEnterprise", enterprise);
    if (null != productIds && !productIds.isEmpty()) {
        ExtraProductExample example = new ExtraProductExample();
        ExtraProductExample.Criteria criteria = example.or();
        criteria.andIdIn(productIds);
        productMap = sqlSession.selectMap("com.itrus.portal.db.ExtraProductMapper.selectByExample", example, "id");
    }
    return productMap;
}
Also used : ExtraProduct(com.itrus.portal.db.ExtraProduct) HashMap(java.util.HashMap) ExtraProductExample(com.itrus.portal.db.ExtraProductExample)

Example 9 with ExtraProductExample

use of com.itrus.portal.db.ExtraProductExample in project portal by ixinportal.

the class ExtraProductServiceImpl method getProductOpenType.

/**
 * 返回指定产品开通类型的产品id集合
 * @param productOpenType
 * @return
 * @throws Exception
 */
public List<Long> getProductOpenType(Long productOpenType) throws Exception {
    List<Long> list = new ArrayList<>();
    ExtraProductExample example = new ExtraProductExample();
    ExtraProductExample.Criteria criteria = example.or();
    criteria.andProductOpenTypeEqualTo(productOpenType);
    List<ExtraProduct> products = selectByExample(example);
    if (null != products && !products.isEmpty()) {
        for (ExtraProduct extraProduct : products) {
            list.add(extraProduct.getId());
        }
    }
    return list;
}
Also used : ExtraProduct(com.itrus.portal.db.ExtraProduct) ArrayList(java.util.ArrayList) ExtraProductExample(com.itrus.portal.db.ExtraProductExample)

Aggregations

ExtraProductExample (com.itrus.portal.db.ExtraProductExample)9 ExtraProduct (com.itrus.portal.db.ExtraProduct)8 ArrayList (java.util.ArrayList)6 HashMap (java.util.HashMap)5 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)4 ExtraProductRelease (com.itrus.portal.db.ExtraProductRelease)2 Project (com.itrus.portal.db.Project)2 Enterprise (com.itrus.portal.db.Enterprise)1 ServiceProvider (com.itrus.portal.db.ServiceProvider)1 ServiceProviderExample (com.itrus.portal.db.ServiceProviderExample)1 UserInfo (com.itrus.portal.db.UserInfo)1 UserinfoEnterprise (com.itrus.portal.db.UserinfoEnterprise)1 UserInfoServiceException (com.itrus.portal.exception.UserInfoServiceException)1 IOException (java.io.IOException)1 Map (java.util.Map)1 HttpSession (javax.servlet.http.HttpSession)1