Package com.jeecms.cms.dao.main.impl

Source Code of com.jeecms.cms.dao.main.impl.CmsGroupDaoImpl

package com.jeecms.cms.dao.main.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.jeecms.cms.dao.main.CmsGroupDao;
import com.jeecms.cms.entity.main.CmsGroup;
import com.jeecms.common.hibernate3.HibernateBaseDao;

@Repository
public class CmsGroupDaoImpl extends HibernateBaseDao<CmsGroup, Integer>
    implements CmsGroupDao {
  @SuppressWarnings("unchecked")
  public List<CmsGroup> getList() {
    String hql = "from CmsGroup bean order by bean.priority asc,bean.id asc";
    return find(hql);
  }

  public CmsGroup getRegDef() {
    String hql = "from CmsGroup bean where bean.regDef=true";
    return (CmsGroup) findUnique(hql);
  }

  public CmsGroup findById(Integer id) {
    CmsGroup entity = get(id);
    return entity;
  }

  public CmsGroup save(CmsGroup bean) {
    getSession().save(bean);
    return bean;
  }

  public CmsGroup deleteById(Integer id) {
    CmsGroup entity = super.get(id);
    if (entity != null) {
      getSession().delete(entity);
    }
    return entity;
  }

  @Override
  protected Class<CmsGroup> getEntityClass() {
    return CmsGroup.class;
  }
}
TOP

Related Classes of com.jeecms.cms.dao.main.impl.CmsGroupDaoImpl

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.