sys字典表dao.java

来自「医院信息系统(Hospital Information System」· Java 代码 · 共 242 行

JAVA
242
字号
package hospital.Model;

import java.util.List;
import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.LockMode;
import org.hibernate.Query;
import org.hibernate.criterion.Example;

/**
 * Data access object (DAO) for domain model class Sys字典表.
 * @see hospital.Model.Sys字典表
 * @author MyEclipse - Hibernate Tools
 */
public class Sys字典表DAO extends BaseHibernateDAO {

    private static final Log log = LogFactory.getLog(Sys字典表DAO.class);

	//property constants
	public static final String CAPTION = "caption";
	public static final String FIELD_NAME = "fieldName";
	public static final String TABLE_NAME = "tableName";
	public static final String SEQUENCE_NO = "sequenceNo";
	public static final String FIELD_TYPE = "fieldType";
	public static final String MAX_LENGTH = "maxLength";
	public static final String DISP_LENGTH = "dispLength";
	public static final String CODE_TYPE = "codeType";
	public static final String CODE_SHOW = "codeShow";
	public static final String CODE_CASCADE = "codeCascade";
	public static final String NOT_NULL_FLAG = "notNullFlag";
	public static final String IS_KEY = "isKey";
	public static final String INPUT_ENABLE = "inputEnable";
	public static final String VISIBLE = "visible";
	public static final String DEFAULT_TYPE = "defaultType";
	public static final String SCALE_LENGTH = "scaleLength";
	public static final String CHOOSE_ENABLE = "chooseEnable";
	public static final String EDIT_ENABLE = "editEnable";
	public static final String SORT_ENABLE = "sortEnable";
	public static final String CHECK_NUMBER = "checkNumber";
	public static final String CHECK_DATE = "checkDate";
	public static final String CHECK_CONDITION1 = "checkCondition1";
	public static final String CHECK_CONDITION2 = "checkCondition2";
	public static final String CHECK_CONDITION3 = "checkCondition3";

    
    public void save(Sys字典表 transientInstance) {
        log.debug("saving Sys字典表 instance");
        try {
            getSession().save(transientInstance);
            log.debug("save successful");
        } catch (RuntimeException re) {
            log.error("save failed", re);
            throw re;
        }
    }
    
	public void delete(Sys字典表 persistentInstance) {
        log.debug("deleting Sys字典表 instance");
        try {
            getSession().delete(persistentInstance);
            log.debug("delete successful");
        } catch (RuntimeException re) {
            log.error("delete failed", re);
            throw re;
        }
    }
    
    public Sys字典表 findById( java.lang.String id) {
        log.debug("getting Sys字典表 instance with id: " + id);
        try {
            Sys字典表 instance = (Sys字典表) getSession()
                    .get("hospital.Model.Sys字典表", id);
            return instance;
        } catch (RuntimeException re) {
            log.error("get failed", re);
            throw re;
        }
    }
    
    
    public List findByExample(Sys字典表 instance) {
        log.debug("finding Sys字典表 instance by example");
        try {
            List results = getSession()
                    .createCriteria("hospital.Model.Sys字典表")
                    .add(Example.create(instance))
            .list();
            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 Sys字典表 instance with property: " + propertyName
            + ", value: " + value);
      try {
         String queryString = "from Sys字典表 as model where model." 
         						+ propertyName + "= ?";
         Query queryObject = getSession().createQuery(queryString);
		 queryObject.setParameter(0, value);
		 return queryObject.list();
      } catch (RuntimeException re) {
         log.error("find by property name failed", re);
         throw re;
      }
	}

	public List findByCaption(Object caption) {
		return findByProperty(CAPTION, caption);
	}
	
	public List findByFieldName(Object fieldName) {
		return findByProperty(FIELD_NAME, fieldName);
	}
	
	public List findByTableName(Object tableName) {
		return findByProperty(TABLE_NAME, tableName);
	}
	
	public List findBySequenceNo(Object sequenceNo) {
		return findByProperty(SEQUENCE_NO, sequenceNo);
	}
	
	public List findByFieldType(Object fieldType) {
		return findByProperty(FIELD_TYPE, fieldType);
	}
	
	public List findByMaxLength(Object maxLength) {
		return findByProperty(MAX_LENGTH, maxLength);
	}
	
	public List findByDispLength(Object dispLength) {
		return findByProperty(DISP_LENGTH, dispLength);
	}
	
	public List findByCodeType(Object codeType) {
		return findByProperty(CODE_TYPE, codeType);
	}
	
	public List findByCodeShow(Object codeShow) {
		return findByProperty(CODE_SHOW, codeShow);
	}
	
	public List findByCodeCascade(Object codeCascade) {
		return findByProperty(CODE_CASCADE, codeCascade);
	}
	
	public List findByNotNullFlag(Object notNullFlag) {
		return findByProperty(NOT_NULL_FLAG, notNullFlag);
	}
	
	public List findByIsKey(Object isKey) {
		return findByProperty(IS_KEY, isKey);
	}
	
	public List findByInputEnable(Object inputEnable) {
		return findByProperty(INPUT_ENABLE, inputEnable);
	}
	
	public List findByVisible(Object visible) {
		return findByProperty(VISIBLE, visible);
	}
	
	public List findByDefaultType(Object defaultType) {
		return findByProperty(DEFAULT_TYPE, defaultType);
	}
	
	public List findByScaleLength(Object scaleLength) {
		return findByProperty(SCALE_LENGTH, scaleLength);
	}
	
	public List findByChooseEnable(Object chooseEnable) {
		return findByProperty(CHOOSE_ENABLE, chooseEnable);
	}
	
	public List findByEditEnable(Object editEnable) {
		return findByProperty(EDIT_ENABLE, editEnable);
	}
	
	public List findBySortEnable(Object sortEnable) {
		return findByProperty(SORT_ENABLE, sortEnable);
	}
	
	public List findByCheckNumber(Object checkNumber) {
		return findByProperty(CHECK_NUMBER, checkNumber);
	}
	
	public List findByCheckDate(Object checkDate) {
		return findByProperty(CHECK_DATE, checkDate);
	}
	
	public List findByCheckCondition1(Object checkCondition1) {
		return findByProperty(CHECK_CONDITION1, checkCondition1);
	}
	
	public List findByCheckCondition2(Object checkCondition2) {
		return findByProperty(CHECK_CONDITION2, checkCondition2);
	}
	
	public List findByCheckCondition3(Object checkCondition3) {
		return findByProperty(CHECK_CONDITION3, checkCondition3);
	}
	
    public Sys字典表 merge(Sys字典表 detachedInstance) {
        log.debug("merging Sys字典表 instance");
        try {
            Sys字典表 result = (Sys字典表) getSession()
                    .merge(detachedInstance);
            log.debug("merge successful");
            return result;
        } catch (RuntimeException re) {
            log.error("merge failed", re);
            throw re;
        }
    }

    public void attachDirty(Sys字典表 instance) {
        log.debug("attaching dirty Sys字典表 instance");
        try {
            getSession().saveOrUpdate(instance);
            log.debug("attach successful");
        } catch (RuntimeException re) {
            log.error("attach failed", re);
            throw re;
        }
    }
    
    public void attachClean(Sys字典表 instance) {
        log.debug("attaching clean Sys字典表 instance");
        try {
            getSession().lock(instance, LockMode.NONE);
            log.debug("attach successful");
        } catch (RuntimeException re) {
            log.error("attach failed", re);
            throw re;
        }
    }
}

⌨️ 快捷键说明

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