All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.haoxuer.discover.user.data.dao.impl.UserRoleDaoImpl Maven / Gradle / Ivy

There is a newer version: 3.3.18-20230117
Show newest version
package com.haoxuer.discover.user.data.dao.impl;

import com.haoxuer.discover.data.page.Filter;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.haoxuer.discover.data.core.CriteriaDaoImpl;
import com.haoxuer.discover.user.data.dao.UserRoleDao;
import com.haoxuer.discover.user.data.entity.UserRole;

/**
 * Created by imake on 2020年07月27日11:36:00.
 */
@Repository

public class UserRoleDaoImpl extends CriteriaDaoImpl implements UserRoleDao {

    @Override
    public UserRole findById(Long id) {
        if (id == null) {
            return null;
        }
        return get(id);
    }

    @Override
    public UserRole save(UserRole bean) {

        getSession().save(bean);


        return bean;
    }

    @Override
    public UserRole deleteById(Long id) {
        UserRole entity = super.get(id);
        if (entity != null) {
            getSession().delete(entity);
        }
        return entity;
    }

    @Override
    public UserRole findByName(String name) {
        return one(Filter.eq("name", name));
    }

    @Override
    protected Class getEntityClass() {
        return UserRole.class;
    }

    @Autowired
    public void setSuperSessionFactory(SessionFactory sessionFactory) {
        super.setSessionFactory(sessionFactory);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy