Search in sources :

Example 1 with ProductSpecExample

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

the class ProductSpecServiceImpl method getProductSpecs.

/**
 * 获取指定产品的所有规格
 *
 * @param productId
 *            产品id
 * @param isValidityTrue
 *            是否有效,可选
 * @return
 * @throws Exception
 */
public List<ProductSpec> getProductSpecs(Long productId, Boolean isValidityTrue) throws Exception {
    List<ProductSpec> productSpecList = new ArrayList<ProductSpec>();
    ProductSpecExample example = new ProductSpecExample();
    ProductSpecExample.Criteria criteria = example.or();
    criteria.andProductIdEqualTo(productId);
    if (null != isValidityTrue) {
        criteria.andIsValidityEqualTo(isValidityTrue);
    }
    example.setOrderByClause("create_time asc");
    productSpecList = sqlSession.selectList("com.itrus.portal.db.ProductSpecMapper.selectByExample", example);
    return productSpecList;
}
Also used : ProductSpecExample(com.itrus.portal.db.ProductSpecExample) ArrayList(java.util.ArrayList) ProductSpec(com.itrus.portal.db.ProductSpec)

Example 2 with ProductSpecExample

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

the class ProductSpecServiceImpl method getEditBillProductSpec.

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

Example 3 with ProductSpecExample

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

the class ProductSpecServiceImpl method getProductSpec.

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

Aggregations

ProductSpec (com.itrus.portal.db.ProductSpec)3 ProductSpecExample (com.itrus.portal.db.ProductSpecExample)3 ArrayList (java.util.ArrayList)3 EditBill (com.itrus.portal.db.EditBill)2 HashMap (java.util.HashMap)2 Bill (com.itrus.portal.db.Bill)1