Search in sources :

Example 16 with ProductExample

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

the class PersonalBillServiceImpl method getProductMapByUserInfoId.

/**
 * 根据用户id查询订单表中对应的产品Map
 *
 * @param userInfo
 * @return
 */
public Map<Long, Product> getProductMapByUserInfoId(Long userInfo) {
    Map<Long, Product> productMap = new HashMap<Long, Product>();
    List<Long> productIds = sqlSession.selectList("com.itrus.portal.db.BillMapper.selectProductsByUserInfo", userInfo);
    if (null != productIds && !productIds.isEmpty()) {
        ProductExample example = new ProductExample();
        ProductExample.Criteria criteria = example.or();
        criteria.andIdIn(productIds);
        productMap = sqlSession.selectMap("com.itrus.portal.db.ProductMapper.selectByExample", example, "id");
    }
    return productMap;
}
Also used : HashMap(java.util.HashMap) Product(com.itrus.portal.db.Product) ProductExample(com.itrus.portal.db.ProductExample)

Example 17 with ProductExample

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

the class PersonalBillServiceImpl method getProductMapByBills.

/**
 * 根据订单list获取对应产品Map
 *
 * @param bills
 * @return
 */
public Map<Long, Product> getProductMapByBills(List<PersonalBill> bills) {
    Map<Long, Product> productMap = new HashMap<Long, Product>();
    List<Long> productIds = new ArrayList<Long>();
    for (PersonalBill bill : bills) {
        productIds.add(bill.getProduct());
    }
    if (!productIds.isEmpty()) {
        ProductExample example = new ProductExample();
        ProductExample.Criteria criteria = example.or();
        criteria.andIdIn(productIds);
        productMap = sqlSession.selectMap("com.itrus.portal.db.ProductMapper.selectByExample", example, "id");
    }
    return productMap;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Product(com.itrus.portal.db.Product) ProductExample(com.itrus.portal.db.ProductExample)

Aggregations

ProductExample (com.itrus.portal.db.ProductExample)17 Product (com.itrus.portal.db.Product)15 ArrayList (java.util.ArrayList)6 HashMap (java.util.HashMap)5 EnterpriseQq (com.itrus.portal.db.EnterpriseQq)2 EnterpriseQqExample (com.itrus.portal.db.EnterpriseQqExample)2 IOException (java.io.IOException)2 JsonGenerationException (org.codehaus.jackson.JsonGenerationException)2 JsonMappingException (org.codehaus.jackson.map.JsonMappingException)2 Bill (com.itrus.portal.db.Bill)1 Project (com.itrus.portal.db.Project)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1