package com.jhcf.category.dao.impl;
import java.util.ArrayList;
import org.springframework.stereotype.Repository;
import com.jhcf.category.bean.Category;
import com.jhcf.category.dao.ICategoryDao;
import com.jhcf.common.DBHelp;
@Repository
public class CategoryDao extends DBHelp implements ICategoryDao {
/**
* 添加分类
*/
public boolean addCategory(Category category) {
this.getHibernateTemplate().save(category);
return category.getId()>0?true:false;
}
/**
* 查询所有分类
*/
public ArrayList<Category> findAllCategory() {
String hql="select c from Category as c";
ArrayList<Category> listCategory= (ArrayList<Category>) this.getHibernateTemplate().find(hql);
if(listCategory.size()>0){
return listCategory;
}else{
return null;
}
}
/**
* 通过id查询分类
*/
public Category findCategoryById(int id) {
return (Category) this.getHibernateTemplate().get(Category.class, id);
}
/**
* 更新分类
*/
public void updateCategory(Category category) {
this.getHibernateTemplate().update(category);
}
}
最近下载更多
178174qasw LV10
2021年8月19日
1528280504 LV3
2021年3月4日
qingyan163 LV4
2020年8月7日
1729990558 LV3
2020年5月13日
ommmly LV5
2020年4月18日
沉醉不知归wd LV6
2020年3月31日
biminghua LV6
2020年3月12日
不停的奔跑 LV20
2020年2月8日
Lcovde LV19
2019年12月12日
p13994295637 LV7
2019年12月12日

最近浏览