package com.ssj.service.sys.parentrole.service.impl;

import com.ssj.bean.sys.parentrole.domain.SSJParentRole;
import com.ssj.dao.sys.parentrole.dao.SSJParentRoleDao;
import com.ssj.framework.core.common.service.BaseServiceImpl;
import com.ssj.service.sys.parentrole.service.SSJParentRoleService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class SSJParentRoleServiceImpl  extends BaseServiceImpl<SSJParentRole, String> implements SSJParentRoleService {

	private Logger    logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private SSJParentRoleDao dao;

	@Override
	public PagingAndSortingRepository<SSJParentRole, String> getDao() {
		return dao;
	}

	@Override
	public SSJParentRole findByVipIdAndRoleUserId(String vipId, String roleUserId) {
		return dao.findByVipIdAndRoleUserId(vipId, roleUserId);
	}

	@Override
	public int countByVipIdAndRoleName(String vipId, String roleName) {
		return dao.countByVipIdAndRoleName(vipId, roleName);
	}

	@Override
	public void deleteByVipIdAndRoleUserId(String vipId, String roleUserId) {
		dao.deleteByVipIdAndRoleUserId(vipId,roleUserId);
	}

	@Override
	public void deleteByVipId(String vipId) {
		dao.deleteByVipId(vipId);
	}

	@Override
	public void deleteByRoleUserId(String roleId) {
		dao.deleteByRoleUserId(roleId);
	}

	@Override
	public List<SSJParentRole> findByRoleUserId(String userId) {
		return dao.findByRoleUserId(userId);
	}
}
