📄 admininfodaoimpl.java
字号:
package com.chinahr.dao.impl;
import java.util.List;
import com.chinahr.dao.AdminInfoDao;
import com.chinahr.pojo.SysAdminInfo;
public class AdminInfoDaoImpl extends com.chinahr.util.BaseHibernateDao implements AdminInfoDao {
public boolean addAdminInfo(SysAdminInfo admin) {
// TODO Auto-generated method stub
try {
getHibernateTemplate().save(admin);
return true;
} catch (RuntimeException re) {
return false;
}
}
public boolean deleteAdminInfo(int adminId) {
// TODO Auto-generated method stub
try{
Object obj=this.getHibernateTemplate().load("com.chinahr.pojo.SysAdminInfo", adminId);
this.getHibernateTemplate().delete(obj);
return true;
}catch(RuntimeException re){}
return false;
}
public boolean deleteAdminInfo(SysAdminInfo admin) {
// TODO Auto-generated method stub
try {
getHibernateTemplate().delete(admin);
return true;
} catch (RuntimeException re) {
return false;
}
}
public SysAdminInfo getAdminInfoByAdminId(int adminId) {
// TODO Auto-generated method stub
try {
SysAdminInfo instance = (SysAdminInfo) getHibernateTemplate().get(
"com.chinahr.pojo.SysAdminInfo", new Integer( adminId));
return instance;
} catch (RuntimeException re) {
return null;
}
}
public List<SysAdminInfo> getAllAdminInfo() {
// TODO Auto-generated method stub
try {
String queryString = "from SysAdminInfo";
return getHibernateTemplate().find(queryString);
} catch (RuntimeException re) {
return null;
}
}
public int islogin(String userid,String pwd,SysAdminInfo adm){
String hql="from SysAdminInfo as ad where ad.adminName='"+userid+"'";
List<SysAdminInfo> list=this.getHibernateTemplate().find(hql);
int i=0;
if(list.size()==0){
i=0;
}else{
SysAdminInfo admin=list.get(0);
if(admin.getAdminPass().trim().equals(pwd)){
adm.setAdminId(admin.getAdminId());
i=2;
}else{
i=1;
}
}
return i;
}
public boolean updateAdminInfo(SysAdminInfo admin) {
// TODO Auto-generated method stub
try{
this.getHibernateTemplate().saveOrUpdate(admin);
return true;
}catch(RuntimeException re){
return false;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -