⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xscontractmaindao.java

📁 关于网上汽车销售系统的详细编程项目实战实例
💻 JAVA
字号:
package com.company.hib.dao.impl;

import java.util.Date;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts.action.ActionForm;
import org.hibernate.LockMode;
import org.springframework.context.ApplicationContext;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.company.hib.dao.DAOAdapter;
import com.company.hib.dao.IFindDapter;
import com.company.struts.form.XsContractMain;

/**
 * Data access object (DAO) for domain model class XsContractMain.
 * 
 * @see com.company.struts.form.XsContractMain
 * @author MyEclipse Persistence Tools
 */

public class XsContractMainDAO extends DAOAdapter implements IFindDapter{
	private static final Log log = LogFactory.getLog(XsContractMainDAO.class);

	// property constants
	public static final String CONTRACT_CODE = "contractCode";

	public static final String QUOTATION_MAIN_ID = "quotationMainId";

	public static final String QUOTATION_CODE = "quotationCode";

	public static final String KJ_YEAR = "kjYear";

	public static final String PERIOD = "period";

	public static final String CONTRACT_TYPE_CODE = "contractTypeCode";

	public static final String CUS_CODE = "cusCode";

	public static final String CONSIGN_ADDRESS = "consignAddress";

	public static final String SELLER_SIGNER = "sellerSigner";

	public static final String BUYER_SIGNER = "buyerSigner";

	public static final String SIGN_ADDRESS = "signAddress";

	public static final String DEPT_CODE = "deptCode";

	public static final String PERSON_CODE = "personCode";

	public static final String PAY_CODE = "payCode";

	public static final String ERNEST = "ernest";

	public static final String FOREIGN_CURR_CODE = "foreignCurrCode";

	public static final String EXCH_RATE = "exchRate";

	public static final String SELL_TYPE_CODE = "sellTypeCode";

	public static final String CONTRACT_ITEM_CODE = "contractItemCode";

	public static final String MAKER = "maker";

	public static final String CHECKER = "checker";

	public static final String CLOSER = "closer";

	public static final String CONVER_FLAG = "converFlag";

	public static final String REMARK = "remark";

	protected void initDao() {
		// do nothing
	}

	public List findByOrderBill() {
			
			try {	
				String sql="select a.contractDate,a.contractCode,a.cusCode,a.deptCode,a.personCode,a.sellTypeCode,a.contractTypeCode,b.wareCode,b.quantity,b.capitalTax,b.capitalWholeMoney,c.consignQuantity,c.quantity,a.sellTypeCode,a.contractCode,a.checker,a.contractTypeCode from Xs_ContractMain as a,XS_ContractSub as b,Xs_OrderBillSub as c where a.contractMainID=b.contractMainID and b.wareCode=c.wareCode";
				return getHibernateTemplate().find(sql);
			} catch (RuntimeException re) {
				log.error("find by property name failed", re);
				throw re;
			}
		}

	public ActionForm findById(java.lang.Integer id) {
		log.debug("getting XsContractMain instance with id: " + id);
		try {
			XsContractMain instance = (XsContractMain) getHibernateTemplate()
					.get("com.company.struts.form.XsContractMain", id);
			return instance;
		} catch (RuntimeException re) {
			log.error("get failed", re);
			throw re;
		}
	}

	public List findByExample(ActionForm instance) {
		log.debug("finding XsContractMain 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 XsContractMain instance with property: "
				+ propertyName + ", value: " + value);
		try {
			String queryString = "from XsContractMain 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 findByContractCode(Object contractCode) {
		return findByProperty(CONTRACT_CODE, contractCode);
	}

	public List findByQuotationMainId(Object quotationMainId) {
		return findByProperty(QUOTATION_MAIN_ID, quotationMainId);
	}

	public List findByQuotationCode(Object quotationCode) {
		return findByProperty(QUOTATION_CODE, quotationCode);
	}

	public List findByKjYear(Object kjYear) {
		return findByProperty(KJ_YEAR, kjYear);
	}

	public List findByPeriod(Object period) {
		return findByProperty(PERIOD, period);
	}

	public List findByContractTypeCode(Object contractTypeCode) {
		return findByProperty(CONTRACT_TYPE_CODE, contractTypeCode);
	}

	public List findByCusCode(Object cusCode) {
		return findByProperty(CUS_CODE, cusCode);
	}

	public List findByConsignAddress(Object consignAddress) {
		return findByProperty(CONSIGN_ADDRESS, consignAddress);
	}

	public List findBySellerSigner(Object sellerSigner) {
		return findByProperty(SELLER_SIGNER, sellerSigner);
	}

	public List findByBuyerSigner(Object buyerSigner) {
		return findByProperty(BUYER_SIGNER, buyerSigner);
	}

	public List findBySignAddress(Object signAddress) {
		return findByProperty(SIGN_ADDRESS, signAddress);
	}

	public List findByDeptCode(Object deptCode) {
		return findByProperty(DEPT_CODE, deptCode);
	}

	public List findByPersonCode(Object personCode) {
		return findByProperty(PERSON_CODE, personCode);
	}

	public List findByPayCode(Object payCode) {
		return findByProperty(PAY_CODE, payCode);
	}

	public List findByErnest(Object ernest) {
		return findByProperty(ERNEST, ernest);
	}

	public List findByForeignCurrCode(Object foreignCurrCode) {
		return findByProperty(FOREIGN_CURR_CODE, foreignCurrCode);
	}

	public List findByExchRate(Object exchRate) {
		return findByProperty(EXCH_RATE, exchRate);
	}

	public List findBySellTypeCode(Object sellTypeCode) {
		return findByProperty(SELL_TYPE_CODE, sellTypeCode);
	}

	public List findByContractItemCode(Object contractItemCode) {
		return findByProperty(CONTRACT_ITEM_CODE, contractItemCode);
	}

	public List findByMaker(Object maker) {
		return findByProperty(MAKER, maker);
	}

	public List findByChecker(Object checker) {
		return findByProperty(CHECKER, checker);
	}

	public List findByCloser(Object closer) {
		return findByProperty(CLOSER, closer);
	}

	public List findByConverFlag(Object converFlag) {
		return findByProperty(CONVER_FLAG, converFlag);
	}

	public List findByRemark(Object remark) {
		return findByProperty(REMARK, remark);
	}

	public List findAll() {
		log.debug("finding all XsContractMain instances");
		try {
			String queryString = "from XsContractMain";
			return getHibernateTemplate().find(queryString);
		} catch (RuntimeException re) {
			log.error("find all failed", re);
			throw re;
		}
	}

	public void attachDirty(XsContractMain instance) {
		log.debug("attaching dirty XsContractMain instance");
		try {
			getHibernateTemplate().saveOrUpdate(instance);
			log.debug("attach successful");
		} catch (RuntimeException re) {
			log.error("attach failed", re);
			throw re;
		}
	}

	public void attachClean(XsContractMain instance) {
		log.debug("attaching clean XsContractMain instance");
		try {
			getHibernateTemplate().lock(instance, LockMode.NONE);
			log.debug("attach successful");
		} catch (RuntimeException re) {
			log.error("attach failed", re);
			throw re;
		}
	}

	public static XsContractMainDAO getFromApplicationContext(
			ApplicationContext ctx) {
		return (XsContractMainDAO) ctx.getBean("XsContractMainDAO");
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -