package org.cs.mgr.order.dao.impl;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;
import org.cs.core.dao.impl.BaseDao;
import org.cs.util.Pager;
import org.cs.mgr.order.model.MgmOrderProduct;
import org.cs.mgr.order.dao.IMgmOrderProductDao;

/**
 * 
 * @ClassName: MgmOrderProductDao
 * @Description:  
 * @author: sunny_shi
 * @date: 2018-06-09 13:29:03
 */
@Repository
public class MgmOrderProductDao extends BaseDao<MgmOrderProduct> implements IMgmOrderProductDao {
	private final Logger logger = LoggerFactory.getLogger(this.getClass());
	
	@Override
	public Pager queryMgmOrderProducts(Pager page){
		String hql = "from MgmOrderProduct where isDelete = false";
		return findPageByHql(hql, page, null);
	}

	@Override
	public Pager queryMgmOrderProductsbyOrderId(Pager page, String orderId) {
		// TODO Auto-generated method stub		
		StringBuffer sql = new StringBuffer();
		sql.append("from MgmOrderProduct where isDelete = false and orderId="+orderId);
		return findPageByHql(sql.toString(), page, null);
	}

	@Override
	public Pager queryMgmOrderProductsbyOPId(Pager page, String orderId, String pruductId) {
		// TODO Auto-generated method stub
		StringBuffer sql = new StringBuffer();
		sql.append("from MgmOrderProduct where isDelete = false and orderId="+orderId+" and productId="+pruductId);
		return findPageByHql(sql.toString(), page, null);
	}
}
