package io.hmit.modules.serviceOrder.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.hmit.common.service.impl.CrudServiceImpl;
import io.hmit.modules.serviceOrder.dao.RoleDao;
import io.hmit.modules.serviceOrder.dto.RoleDTO;
import io.hmit.modules.serviceOrder.entity.RoleEntity;
import io.hmit.modules.serviceOrder.service.RoleService;
import io.hmit.modules.serviceOrder.service.RoleServiceService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 角色管理
 *
 * @author zsh 408538940@qq.com
 * @since 1.0.0 2021-01-26
 */
@Service
public class RoleServiceImpl extends CrudServiceImpl<RoleDao, RoleEntity, RoleDTO> implements RoleService {

    @Autowired
    private RoleServiceService roleServiceService;
    @Override
    public QueryWrapper<RoleEntity> getWrapper(Map<String, Object> params){
        String id = (String)params.get("id");

        QueryWrapper<RoleEntity> wrapper = new QueryWrapper<>();
        wrapper.eq(StringUtils.isNotBlank(id), "id", id);

        return wrapper;
    }


    @Override
    public void saveOrUpdateRoleService(Long roleId, List<Long> serviceIdList) {
        roleServiceService.saveOrUpdateRoleService(roleId, serviceIdList);
    }
}
