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.RoleServiceDao;
import io.hmit.modules.serviceOrder.dto.RoleServiceDTO;
import io.hmit.modules.serviceOrder.entity.RoleServiceEntity;
import io.hmit.modules.serviceOrder.service.RoleServiceService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * 角色菜单关系
 *
 * @author zsh 408538940@qq.com
 * @since 1.0.0 2021-01-26
 */
@Service
public class RoleServiceServiceImpl extends CrudServiceImpl<RoleServiceDao, RoleServiceEntity, RoleServiceDTO> implements RoleServiceService {

    @Override
    public QueryWrapper<RoleServiceEntity> getWrapper(Map<String, Object> params){
        String id = (String)params.get("id");
        String roleId = params.get("roleId") != null ?params.get("roleId").toString():"";

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

        return wrapper;
    }


}
