package com.yeshi.buwan.dao.vip;
|
|
import com.yeshi.buwan.dao.base.BaseDao;
|
import com.yeshi.buwan.domain.vip.OrderType;
|
import com.yeshi.buwan.domain.vip.OrderRecord;
|
import org.springframework.stereotype.Repository;
|
|
import java.util.List;
|
|
@Repository
|
public class OrderRecordDao extends BaseDao<OrderRecord> {
|
|
|
private String getHql(DaoQuery daoQuery) {
|
|
String hql = "from OrderRecord r where 1=1";
|
|
if (daoQuery.state != null) {
|
hql += " and r.state=" + daoQuery.state;
|
}
|
|
if (daoQuery.uid != null) {
|
hql += " and r.uid=" + daoQuery.uid;
|
}
|
|
if (daoQuery.orderType != null) {
|
hql += " and r.orderType=" + daoQuery.orderType;
|
}
|
|
hql += " order by r.createTime desc";
|
return hql;
|
}
|
|
|
public List<OrderRecord> list(DaoQuery daoQuery) {
|
return super.list(getHql(daoQuery), daoQuery.start, daoQuery.count, null);
|
}
|
|
|
public long count(DaoQuery daoQuery) {
|
return super.getCount(getHql(daoQuery), null);
|
}
|
|
public static class DaoQuery {
|
public Integer state;
|
public OrderType orderType;
|
public String uid;
|
public int start;
|
public int count;
|
}
|
|
}
|