Search in sources :

Example 1 with ProductExample

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

the class BillServiceImpl 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 2 with ProductExample

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

the class BillServiceImpl method getProductMapByEnterpriseId.

/**
 * 根据企业id查询订单表中对应的产品Manp
 *
 * @param enterprise
 * @return
 */
public Map<Long, Product> getProductMapByEnterpriseId(Long enterprise) {
    Map<Long, Product> productMap = new HashMap<Long, Product>();
    List<Long> productIds = sqlSession.selectList("com.itrus.portal.db.BillMapper.selectProductsByEnterprise", enterprise);
    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 3 with ProductExample

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

the class BillServiceImpl method getProductMapByBills.

/**
 * 根据订单list获取对应产品Map
 *
 * @param bills
 * @return
 */
public Map<Long, Product> getProductMapByBills(List<Bill> bills) {
    Map<Long, Product> productMap = new HashMap<Long, Product>();
    List<Long> productIds = new ArrayList<Long>();
    for (Bill 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) Bill(com.itrus.portal.db.Bill) Product(com.itrus.portal.db.Product) ProductExample(com.itrus.portal.db.ProductExample)

Example 4 with ProductExample

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

the class ProductServiceImpl method getKeyUnlockProductIds.

/**
 * 获取所有的解锁产品的ID
 * @return
 */
public List<Long> getKeyUnlockProductIds() {
    List<Long> list = new ArrayList<>();
    List<Product> products = new ArrayList<>();
    ProductExample example = new ProductExample();
    ProductExample.Criteria criteria = example.or();
    criteria.andKeyUnlockTypeIsNotNull();
    products = sqlSession.selectList("com.itrus.portal.db.ProductMapper.selectByExample", example);
    if (null == products || products.isEmpty()) {
        return null;
    }
    for (Product product : products) {
        list.add(product.getId());
    }
    return list;
}
Also used : ArrayList(java.util.ArrayList) Product(com.itrus.portal.db.Product) ProductExample(com.itrus.portal.db.ProductExample)

Example 5 with ProductExample

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

the class MakeSealServerServiceImpl method getProduct.

/**
 * 根据签章服务id,查找关联的产品
 *
 * @param makeSealServerId
 * @return
 */
private List<Product> getProduct(Long makeSealServerId) {
    ProductExample example = new ProductExample();
    ProductExample.Criteria criteria = example.or();
    criteria.andMakeSealServerEqualTo(makeSealServerId);
    return sqlSession.selectList("com.itrus.portal.db.ProductMapper.selectByExample", example);
}
Also used : 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