Search in sources :

Example 1 with ExtraProductSpecExample

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

the class ExtraProductSpecServiceImpl method getProductSpec.

/**
 * 获取订单list对应的规格Map
 *
 * @param billList
 * @return
 */
public Map<Long, ExtraProductSpec> getProductSpec(List<ExtraBill> billList) {
    Map<Long, ExtraProductSpec> productSpecMap = new HashMap<Long, ExtraProductSpec>();
    List<Long> productSpecIds = new ArrayList<Long>();
    for (ExtraBill bill : billList) {
        if (null != bill.getExtraProductSpec() && 0 != bill.getExtraProductSpec()) {
            productSpecIds.add(bill.getExtraProductSpec());
        }
    }
    if (productSpecIds.isEmpty())
        return productSpecMap;
    ExtraProductSpecExample example = new ExtraProductSpecExample();
    ExtraProductSpecExample.Criteria criteria = example.or();
    criteria.andIdIn(productSpecIds);
    productSpecMap = sqlSession.selectMap("com.itrus.portal.db.ExtraProductSpecMapper.selectByExample", example, "id");
    return productSpecMap;
}
Also used : HashMap(java.util.HashMap) ExtraBill(com.itrus.portal.db.ExtraBill) ArrayList(java.util.ArrayList) ExtraProductSpec(com.itrus.portal.db.ExtraProductSpec) ExtraProductSpecExample(com.itrus.portal.db.ExtraProductSpecExample)

Example 2 with ExtraProductSpecExample

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

the class ExtraProductSpecServiceImpl method getSpecByProductId.

/**
 * 根据增值产品,获取增值产品对应的规格
 *
 * @throws Exception
 */
public List<ExtraProductSpec> getSpecByProductId(Long id) throws Exception {
    List<ExtraProductSpec> extraProductSpecs = new ArrayList<>();
    ExtraProductSpecExample example = new ExtraProductSpecExample();
    ExtraProductSpecExample.Criteria criteria = example.or();
    criteria.andExtraProductEqualTo(id);
    example.setOrderByClause("priority ASC");
    extraProductSpecs = selectByExample(example);
    return extraProductSpecs;
}
Also used : ArrayList(java.util.ArrayList) ExtraProductSpec(com.itrus.portal.db.ExtraProductSpec) ExtraProductSpecExample(com.itrus.portal.db.ExtraProductSpecExample)

Example 3 with ExtraProductSpecExample

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

the class ExtraProductSpecServiceImpl method getSpecByProductIdValid.

/**
 * 根据增值产品,获取增值产品对应的规格,获取有效的规格,排序
 *
 * @throws Exception
 */
public List<ExtraProductSpec> getSpecByProductIdValid(Long id) throws Exception {
    List<ExtraProductSpec> extraProductSpecs = new ArrayList<>();
    ExtraProductSpecExample example = new ExtraProductSpecExample();
    ExtraProductSpecExample.Criteria criteria = example.or();
    criteria.andExtraProductEqualTo(id);
    criteria.andIsValidEqualTo(true);
    example.setOrderByClause("priority ASC");
    extraProductSpecs = selectByExample(example);
    return extraProductSpecs;
}
Also used : ArrayList(java.util.ArrayList) ExtraProductSpec(com.itrus.portal.db.ExtraProductSpec) ExtraProductSpecExample(com.itrus.portal.db.ExtraProductSpecExample)

Aggregations

ExtraProductSpec (com.itrus.portal.db.ExtraProductSpec)3 ExtraProductSpecExample (com.itrus.portal.db.ExtraProductSpecExample)3 ArrayList (java.util.ArrayList)3 ExtraBill (com.itrus.portal.db.ExtraBill)1 HashMap (java.util.HashMap)1