package com.hs.api.service.Impl;

import com.hs.api.mapper.SysUserRoleRsMapper;
import com.hs.api.model.SysRole;
import com.hs.api.model.SysUserRoleRs;
import com.hs.api.service.SysUserRoleRsService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class SysUserRoleServiceImpl implements SysUserRoleRsService {

    @Resource
    private SysUserRoleRsMapper sysUserRoleRsMapper;


    @Override
    public List<SysRole> getRoleListByUser(Long userId) throws Exception {
        return sysUserRoleRsMapper.selectRoleByUser(userId);
    }

    @Override
    public int add(SysUserRoleRs sysUserRoleRs) {
        return sysUserRoleRsMapper.insert(sysUserRoleRs);
    }

    @Override
    public List<SysUserRoleRs> findAll() {
        return sysUserRoleRsMapper.selectAll();
    }

    @Override
    public SysUserRoleRs find(Long id) {
        return sysUserRoleRsMapper.selectByPrimaryKey(id);
    }

    @Override
    public int delete(Long id) {
        return sysUserRoleRsMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int logicDelete(Long id) {
        return 0;
    }

    @Override
    public int update(SysUserRoleRs sysUserRoleRs) {
        return sysUserRoleRsMapper.updateByPrimaryKey(sysUserRoleRs);
    }
}
