package com.storlead.user.service.impl;

import com.storlead.framework.mybatis.service.impl.MyBaseServiceImpl;
import com.storlead.user.mapper.DeptRoleMapper;
import com.storlead.user.pojo.entity.DeptRoleEntity;
import com.storlead.user.service.DeptRoleService;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;

/**
 * <p>
 * 部门角色权限 服务实现类
 * </p>
 *
 * @author chenkq
 * @since 2024-04-02
 */
@Service
public class DeptRoleServiceImpl extends MyBaseServiceImpl<DeptRoleMapper, DeptRoleEntity> implements DeptRoleService {

    @Override
    public void updateDeptRole(Long roleId, Set<Long> deptIds) {
        if (Objects.nonNull(roleId) && !CollectionUtils.isEmpty(deptIds)) {
//            this.removeByMap(Map.of("role_id", roleId));
//            Set<DeptRoleEntity> collect = deptIds.stream().map(deptId -> new DeptRoleEntity(roleId, deptId)).collect(Collectors.toSet());
//            this.saveBatch(collect);
        }
    }
}
