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";
}
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";
}
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;
}
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;
}
Aggregations