📄 smsinfodao.java
字号:
package com.woyi.dao;
// default package
import java.util.Date;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.LockMode;
import org.springframework.context.ApplicationContext;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import com.woyi.dto.SmsInfo;
import com.woyi.page.PageInfo;
import com.woyi.page.Pagination;
/**
* Data access object (DAO) for domain model class SmsInfo.
*
* @see .SmsInfo
* @author MyEclipse Persistence Tools
*/
public class SmsInfoDAO extends HibernateDaoSupport {
private static final Log log = LogFactory.getLog(SmsInfoDAO.class);
// property constants
public static final String SMSTYPE = "smstype";
public static final String SMSDESC = "smsdesc";
public static final String VALIDFLAG = "validflag";
public static final String OPTRID = "optrid";
public static final String REMARK = "remark";
public Pagination pagination;
protected void initDao() {
// do nothing
}
public void save(SmsInfo transientInstance) {
log.debug("saving SmsInfo instance");
try {
getHibernateTemplate().save(transientInstance);
log.debug("save successful");
} catch (RuntimeException re) {
log.error("save failed", re);
throw re;
}
}
public boolean delete(SmsInfo persistentInstance) {
log.debug("deleting SmsInfo instance");
boolean isflag=false;
try {
getHibernateTemplate().delete(persistentInstance);
log.debug("delete successful");
isflag=true;
return isflag;
} catch (RuntimeException re) {
log.error("delete failed", re);
return isflag;
}
}
public SmsInfo findById(java.lang.Integer id) {
log.debug("getting SmsInfo instance with id: " + id);
try {
SmsInfo instance = (SmsInfo) getHibernateTemplate().get("SmsInfo",
id);
return instance;
} catch (RuntimeException re) {
log.error("get failed", re);
throw re;
}
}
public List findByExample(SmsInfo instance) {
log.debug("finding SmsInfo instance by example");
try {
List results = getHibernateTemplate().findByExample(instance);
log.debug("find by example successful, result size: "
+ results.size());
return results;
} catch (RuntimeException re) {
log.error("find by example failed", re);
throw re;
}
}
public List findByProperty(String propertyName, Object value) {
log.debug("finding SmsInfo instance with property: " + propertyName
+ ", value: " + value);
try {
String queryString = "from SmsInfo as model where model."
+ propertyName + "= ?";
return getHibernateTemplate().find(queryString, value);
} catch (RuntimeException re) {
log.error("find by property name failed", re);
throw re;
}
}
public List findBySmstype(Object smstype) {
return findByProperty(SMSTYPE, smstype);
}
public List findBySmsdesc(Object smsdesc) {
return findByProperty(SMSDESC, smsdesc);
}
public List findByValidflag(Object validflag) {
return findByProperty(VALIDFLAG, validflag);
}
public List findByOptrid(Object optrid) {
return findByProperty(OPTRID, optrid);
}
public List findByRemark(Object remark) {
return findByProperty(REMARK, remark);
}
public List findAll() {
log.debug("finding all SmsInfo instances");
try {
String queryString = "from SmsInfo";
return getHibernateTemplate().find(queryString);
} catch (RuntimeException re) {
log.error("find all failed", re);
throw re;
}
}
public SmsInfo merge(SmsInfo detachedInstance) {
log.debug("merging SmsInfo instance");
try {
SmsInfo result = (SmsInfo) getHibernateTemplate().merge(
detachedInstance);
log.debug("merge successful");
return result;
} catch (RuntimeException re) {
log.error("merge failed", re);
throw re;
}
}
public boolean attachDirty(SmsInfo instance) {
log.debug("attaching dirty SmsInfo instance");
boolean isflag=false;
try {
getHibernateTemplate().saveOrUpdate(instance);
log.debug("attach successful");
isflag=true;
return isflag;
} catch (RuntimeException re) {
log.error("attach failed", re);
return isflag;
}
}
public void attachClean(SmsInfo instance) {
log.debug("attaching clean SmsInfo instance");
try {
getHibernateTemplate().lock(instance, LockMode.NONE);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public static SmsInfoDAO getFromApplicationContext(ApplicationContext ctx) {
return (SmsInfoDAO) ctx.getBean("SmsInfoDAO");
}
public Pagination getPagination() {
return pagination;
}
public void setPagination(Pagination pagination) {
this.pagination = pagination;
}
/**
* 获取短信模板信息
* @param value
* @return
*/
public PageInfo fetchSMS(String smsname,int pageNo) {
log.debug("finding Optrinfo instance with property: " + smsname
);
try {
String queryString = "from SmsInfo as b where b.smstype like '%"
+ smsname + "%' order by b.smstype";
String count = "select count(*) from SmsInfo as b where b.smstype like '%"
+ smsname + "%' order by b.smstype";
PageInfo pageInfo = pagination.page(pageNo, 10, queryString, count);
return pageInfo;
} catch (RuntimeException re) {
log.error("find by property name failed", re);
throw re;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -