package com.mosty.common.core.business.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mosty.common.core.business.entity.SysRoleDept;
import com.mosty.common.core.business.service.SysRoleDeptService;
import com.mosty.common.core.business.mapper.SysRoleDeptMapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author li
* @description 针对表【sys_role_dept(角色和部门关联表)】的数据库操作Service实现
* @createDate 2022-02-12 16:53:15
*/
@Service
public class SysRoleDeptServiceImpl extends ServiceImpl<SysRoleDeptMapper, SysRoleDept>
    implements SysRoleDeptService {

    @Override
    public List<SysRoleDept> listByDeptId(Long deptId) {
        List<SysRoleDept> list = this.list(new LambdaQueryWrapper<SysRoleDept>()
                .eq(SysRoleDept::getDeptId, deptId));
        return list;
    }

    @Override
    public SysRoleDept getByDeptIdAndRoleId(Long deptId, Long roleId) {
        SysRoleDept one = this.getOne(new LambdaQueryWrapper<SysRoleDept>()
                .eq(SysRoleDept::getDeptId, deptId).eq(SysRoleDept::getRoleId, roleId));
        return one;
    }
}




