community/src/com/zby/dao/UserDaoImpl.java
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
package com.zby.dao;
import java.sql.SQLException;
import java.util.List;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.springframework.orm.hibernate3.HibernateCallback;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import com.zby.bean.User;
public class UserDaoImpl extends HibernateDaoSupport implements UserDao{
public void delete(int uid) {
User u = (User)this.getHibernateTemplate().get(User.class, uid);
this.getHibernateTemplate().delete(u);
}
//管理员
public List getPager(String name) {
String hql = "from User u where u.utype<>'业主'";
return this.getHibernateTemplate().find(hql);
}
public List getPager(int current, int rowsPerPage, String name) {
String hql = "from User u where u.utype<>'业主'";
final String fhql=hql;
final int f_current=current;
final int f_rowsPerPage = rowsPerPage;
return (List)this.getHibernateTemplate().execute(new HibernateCallback(){
public Object doInHibernate(Session session)throws HibernateException, SQLException {
Query query=session.createQuery(fhql);
query.setFirstResult((f_current-1)*f_rowsPerPage);
query.setMaxResults(f_rowsPerPage);
List list = query.list();
return list;
}
});
}
//业主
public List getPagers(String name) {
String hql = "from User u where u.utype='业主'";
return this.getHibernateTemplate().find(hql);
}
public List getPagers(int current, int rowsPerPage, String name) {
String hql = "from User u where u.utype='业主'";
final String fhql=hql;
final int f_current=current;
final int f_rowsPerPage = rowsPerPage;
return (List)this.getHibernateTemplate().execute(new HibernateCallback(){
public Object doInHibernate(Session session)throws HibernateException, SQLException {
Query query=session.createQuery(fhql);
query.setFirstResult((f_current-1)*f_rowsPerPage);
query.setMaxResults(f_rowsPerPage);
List list = query.list();
return list;
}
});
后面还有 36 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
