📄 forumlabelimpl.java
字号:
/*
* Created on 2007-5-21
* Last modified on 2007-5-21
* Powered by YeQiangWei.com
*/
package com.yeqiangwei.club.dao.hibernate.impl;
import java.util.List;
import com.yeqiangwei.club.dao.ForumLabelDAO;
import com.yeqiangwei.club.dao.hibernate.support.HibernateFacade;
import com.yeqiangwei.club.dao.model.ForumLabel;
import com.yeqiangwei.club.param.ForumParameter;
public class ForumLabelImpl implements ForumLabelDAO{
private static final String DELETE_LABELID = "delete from ForumLabel where labelId=?";
private static final String DELETE_LABELIDS = "delete from ForumLabel where labelId in (:ids)";
private static final String FIND_LABELID = "from ForumLabel where labelId=?";
private static final String UPDATE_FORUMID = "update ForumLabel set forumId=? where forumId=?";
public ForumLabel create(ForumLabel item) {
HibernateFacade<ForumLabel> facade = new HibernateFacade<ForumLabel>();
item = facade.save(item);
return item;
}
public ForumLabel update(ForumLabel item) {
HibernateFacade<ForumLabel> facade = new HibernateFacade<ForumLabel>();
item = facade.update(item);
return item;
}
public int update(int forumId, int toForumId){
HibernateFacade<ForumLabel> facade = new HibernateFacade<ForumLabel>();
facade.createQuery(UPDATE_FORUMID);
facade.setInt(0, toForumId);
facade.setInt(1, forumId);
int c = facade.executeUpdate();
return c;
}
public int delete(ForumLabel item) {
HibernateFacade<ForumLabel> facade = new HibernateFacade<ForumLabel>();
facade.createQuery(DELETE_LABELID);
facade.setInt(0,item.getLabelId());
int c = facade.executeUpdate();
return c;
}
public int delete(List ids) {
HibernateFacade<ForumLabel> facade = new HibernateFacade<ForumLabel>();
facade.createQuery(DELETE_LABELIDS);
facade.setParameterList("ids", ids);
int c = facade.executeUpdate();
return c;
}
public ForumLabel findById(int id) {
HibernateFacade<ForumLabel> facade = new HibernateFacade<ForumLabel>();
facade.createQuery(FIND_LABELID);
facade.setInt(0,id);
facade.setCacheable(true);
ForumLabel item = facade.uniqueResult();
return item;
}
public List<ForumLabel> findByParameter(ForumParameter param) {
StringBuffer hql = new StringBuffer();
hql.append("from ForumLabel where labelId>0");
if(param.getForumId()!=null){
hql.append(" and forumId=");
hql.append(param.getForumId().intValue());
}
hql.append(" order by orderList desc");
HibernateFacade<ForumLabel> facade = new HibernateFacade<ForumLabel>();
facade.createQuery(hql);
List<ForumLabel> list = facade.executeQuery();
return list;
}
public long countByParameter(ForumParameter param) {
return 0;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -