import java.util.List;
import com.java1234.model.BigType;
import com.java1234.model.PageBean;
public interface BigTypeDao {
public List selectBigType();
public List selectBigTypeById(int id,PageBean pageBean);
public int bigTypeCount(int id);
public BigType selectBigTypeById(int id);
public int bigTypeCount();
public List selectBigType(PageBean pageBean);
public void saveBigType(BigType bt);
public void deleteBigType(int id);
}
import java.util.List;
import javax.annotation.Resource;
import org.hibernate.Query;
import org.hibernate.Session;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.stereotype.Component;
import com.java1234.dao.BigTypeDao;
import com.java1234.model.BigType;
import com.java1234.model.Link;
import com.java1234.model.PageBean;
@Component
public class BigTypeDaoImpl implements BigTypeDao {
private HibernateTemplate ht;
public HibernateTemplate getHibernateTemplate() {
return ht;
}
@Resource
public void setHibernateTemplate(HibernateTemplate hibernateTemplate) {
this.ht = hibernateTemplate;
}
public List selectBigType() {
return this.ht.find("from BigType");
}
@SuppressWarnings("unchecked")
public List selectBigTypeById(int id,PageBean pageBean) {
Session session = this.ht.getSessionFactory().getCurrentSession();
List bigTypeList = null;
Query q = session.createQuery("from Goods g where g.bigType.id ='"+id+"'");
q.setFirstResult(pageBean.getStart());
q.setMaxResults(pageBean.getRows());
bigTypeList = q.list();
return bigTypeList;
}
public int bigTypeCount(int id) {
return this.ht.find("from Goods g where g.bigType.id='"+id+"'").size();
}
public BigType selectBigTypeById(int id) {
Session session = this.ht.getSessionFactory().getCurrentSession();
List bigTypeList = null;
bigTypeList = se