📄 detailfinancedao.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.DetailFinance;
import com.woyi.page.PageInfo;
import com.woyi.page.Pagination;
/**
* Data access object (DAO) for domain model class DetailFinance.
*
* @see .DetailFinance
* @author MyEclipse Persistence Tools
*/
public class DetailFinanceDAO extends HibernateDaoSupport {
private static final Log log = LogFactory.getLog(DetailFinanceDAO.class);
// property constants
public static final String CORPORATE = "corporate";
public static final String REASON = "reason";
public static final String FEE_TYPE = "feeType";
public static final String CHG_TYPE = "chgType";
public static final String EXAMTYPE = "examtype";
public static final String SVCNUM = "svcnum";
public static final String SHOULD_CHG = "shouldChg";
public static final String ALREADY_CHG = "alreadyChg";
public static final String NO_CHG = "noChg";
public static final String OPTRID = "optrid";
public static final String REMARK = "remark";
public Pagination pagination;
public DetailFinance detailFinance;
protected void initDao() {
// do nothing
}
public boolean save(DetailFinance transientInstance) {
log.debug("saving DetailFinance instance");
boolean isflag=false;
try {
getHibernateTemplate().save(transientInstance);
log.debug("save successful");
isflag=true;
return isflag;
} catch (RuntimeException re) {
log.error("save failed", re);
return isflag;
}
}
public boolean delete(DetailFinance persistentInstance) {
log.debug("deleting DetailFinance 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 List finddById(java.lang.Integer id) {
try {
String queryString = "from DetailFinance as model where model.sqlertid='"
+ id + "'";
return getHibernateTemplate().find(queryString);
} catch (RuntimeException re) {
log.error("find by property name failed", re);
throw re;
}
}
public DetailFinance findById(java.lang.Integer id) {
log.debug("getting DetailFinance instance with id: " + id);
System.out.println("------3");
try {
DetailFinance instance = (DetailFinance) getHibernateTemplate()
.get("DetailFinance", id);
System.out.println("------3.1");
return instance;
} catch (RuntimeException re) {
System.out.println("------1.2");
log.error("get failed", re);
throw re;
}
}
public List findByExample(DetailFinance instance) {
log.debug("finding DetailFinance 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 DetailFinance instance with property: "
+ propertyName + ", value: " + value);
try {
String queryString = "from DetailFinance 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 findByCorporate(Object corporate) {
return findByProperty(CORPORATE, corporate);
}
public List findByReason(Object reason) {
return findByProperty(REASON, reason);
}
public List findByFeeType(Object feeType) {
return findByProperty(FEE_TYPE, feeType);
}
public List findByChgType(Object chgType) {
return findByProperty(CHG_TYPE, chgType);
}
public List findByExamtype(Object examtype) {
return findByProperty(EXAMTYPE, examtype);
}
public List findBySvcnum(Object svcnum) {
return findByProperty(SVCNUM, svcnum);
}
public List findByShouldChg(Object shouldChg) {
return findByProperty(SHOULD_CHG, shouldChg);
}
public List findByAlreadyChg(Object alreadyChg) {
return findByProperty(ALREADY_CHG, alreadyChg);
}
public List findByNoChg(Object noChg) {
return findByProperty(NO_CHG, noChg);
}
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 DetailFinance instances");
try {
String queryString = "from DetailFinance";
return getHibernateTemplate().find(queryString);
} catch (RuntimeException re) {
log.error("find all failed", re);
throw re;
}
}
public DetailFinance merge(DetailFinance detachedInstance) {
log.debug("merging DetailFinance instance");
try {
DetailFinance result = (DetailFinance) getHibernateTemplate()
.merge(detachedInstance);
log.debug("merge successful");
return result;
} catch (RuntimeException re) {
log.error("merge failed", re);
throw re;
}
}
public boolean attachDirty(DetailFinance instance) {
log.debug("attaching dirty DetailFinance 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(DetailFinance instance) {
log.debug("attaching clean DetailFinance instance");
try {
getHibernateTemplate().lock(instance, LockMode.NONE);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public static DetailFinanceDAO getFromApplicationContext(
ApplicationContext ctx) {
return (DetailFinanceDAO) ctx.getBean("DetailFinanceDAO");
}
public Pagination getPagination() {
return pagination;
}
public void setPagination(Pagination pagination) {
this.pagination = pagination;
}
/**
* 获取组群信息
* @param value
* @return
*/
public PageInfo fechRevInfo(String corporate,String feetype,String ChgTYPE ,String startdate,String enddate,int pageNo){
log.debug("finding corporate instance with property: " + corporate
);
try {
String queryString = "from DetailFinance as b where b.feeType='"+feetype+"' and b.chgType='"+ChgTYPE+"' and b.corporate like '%"
+ corporate + "%' and b.optdate<=date('"+enddate+"') and b.optdate>date('"+startdate+"')";
String count = "select count(*) from DetailFinance as b where b.feeType='"+feetype+"' and b.chgType='"+ChgTYPE+"' and b.corporate like '%"
+ corporate + "%' and b.optdate<=date('"+enddate+"') and b.optdate>date('"+startdate+"')";
PageInfo pageInfo = pagination.page(pageNo, 10, queryString, count);
return pageInfo;
} catch (RuntimeException re) {
log.error("find by property name failed", re);
throw re;
}
}
public DetailFinance getDetailFinance() {
return detailFinance;
}
public void setDetailFinance(DetailFinance detailFinance) {
this.detailFinance = detailFinance;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -