package com.yunzhupaas.base.service.impl;

import com.yunzhupaas.base.service.SuperServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yunzhupaas.base.entity.ModuleDataAuthorizeLinkEntity;
import com.yunzhupaas.base.mapper.ModuleDataAuthorizeLinkDataMapper;
import com.yunzhupaas.base.service.ModuleDataAuthorizeLinkDataService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 数据权限方案
 *
 * @author 云筑产品开发平台组
 * @version V3.1.0
 * @copyright 深圳市乐程软件有限公司
 * @date 2023/09/27
 */
@Service
public class ModuleDataAuthorizeLinkDataServiceImpl extends SuperServiceImpl<ModuleDataAuthorizeLinkDataMapper, ModuleDataAuthorizeLinkEntity> implements ModuleDataAuthorizeLinkDataService {


	@Override
	public ModuleDataAuthorizeLinkEntity getLinkDataEntityByMenuId(String menuId,Integer type) {
		QueryWrapper<ModuleDataAuthorizeLinkEntity> linkEntityQueryWrapper = new QueryWrapper<>();
		linkEntityQueryWrapper.lambda().eq(ModuleDataAuthorizeLinkEntity::getModuleId,menuId).eq(ModuleDataAuthorizeLinkEntity::getDataType,type);
		List<ModuleDataAuthorizeLinkEntity> list = this.list(linkEntityQueryWrapper);
		if (list.size()>0){
			return list.get(0);
		}
		return new ModuleDataAuthorizeLinkEntity();
	}
}

