package com.jy.system.dao;

import cn.hutool.core.util.ObjectUtil;
import com.jy.framework.model.base.BaseDao;
import com.jy.framework.model.base.BaseIdPo;
import com.jy.system.mapper.SysPermissionMapper;
import com.jy.system.model.entity.SysPermission;
import org.springframework.stereotype.Service;

@Service
public class SysPermissionDao extends BaseDao<SysPermissionMapper, SysPermission> {

    /**
     * 权限编码是否存在
     */
    public boolean codeExists(Long id, String code) {
        return lambdaQuery().eq(ObjectUtil.isNotNull(id), BaseIdPo::getId, id).eq(SysPermission::getCode, code).exists();
    }

}
