package com.zsc.edu.gateway.modules.system.service.impl;

//import com.zsc.edu.gateway.modules.system.dto.RoleAuthCreateDto;
//import com.zsc.edu.gateway.modules.system.dto.RoleAuthorityDto;
import com.zsc.edu.gateway.modules.system.entity.Authority;
import com.zsc.edu.gateway.modules.system.entity.RoleAuthority;
//import com.zsc.edu.gateway.modules.system.mapper.RoleAuthorityMapper;
import com.zsc.edu.gateway.modules.system.repo.AuthorityRepository;
import com.zsc.edu.gateway.modules.system.repo.RoleAuthoritiesRepository;
import com.zsc.edu.gateway.modules.system.repo.RoleRepository;
import com.zsc.edu.gateway.modules.system.service.RoleAuthService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;


/**
 * @author zhuang
 */
@AllArgsConstructor
@Service
public class RoleAuthServiceImpl extends ServiceImpl<RoleAuthoritiesRepository, RoleAuthority> implements RoleAuthService {
//    private RoleAuthorityMapper mapper;
    private AuthorityRepository repo;
    private RoleRepository roleRepository;

    @Override
    public boolean removeByRoleId(Long roleId) {
        return remove(new LambdaQueryWrapper<RoleAuthority>().eq(RoleAuthority::getRoleId, roleId));
    }

//    @Override
//    public boolean addRoleAuthority(RoleAuthCreateDto dto){
//        Long authId=repo.getAuthorityIdByName(dto.getAuthName());
//        Long roleId=roleRepository.getRoleIdByName(dto.getRoleName());
//        RoleAuthorityDto dto1=new RoleAuthorityDto();
//        dto1.setAuthorityId(authId);
//        dto1.setRoleId(roleId);
//        RoleAuthority roleAuthority = mapper.toEntity(dto1);
//        return save(roleAuthority);
//    }
}