package cn.com.countrygarden.bi.main.service.twerp.hm.impl;

import cn.com.countrygarden.bi.main.core.AbstractService;
import cn.com.countrygarden.bi.main.dao.twerp.hm.TbSysUserRoleMapper;
import cn.com.countrygarden.bi.main.model.twerp.hm.TbSysUserRole;
import cn.com.countrygarden.bi.main.service.twerp.hm.TbSysUserRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class TbSysUserRoleServiceImpl extends AbstractService<TbSysUserRole> implements TbSysUserRoleService {

    @Autowired
    private TbSysUserRoleMapper tbSysUserRoleMapper;

    public TbSysUserRole findByUserCode(String userCode) {
        List<TbSysUserRole> roles = tbSysUserRoleMapper.findByUserCode(userCode);
        if(roles.size()>0){
            return roles.get(0);
        }
        return null;
    }
    public TbSysUserRole findUserOrganCodeByUserCode(String userCode) {
        return tbSysUserRoleMapper.findUserOrganCodeByUserCode(userCode);
    }

}
