package com.njcn.rdms.module.system.dal.mysql.permission;

import com.njcn.rdms.framework.mybatis.core.mapper.BaseMapperX;
import com.njcn.rdms.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.njcn.rdms.module.system.dal.dataobject.permission.UserVisibilityConfigDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 用户数据可见性配置 Mapper
 */
@Mapper
public interface UserVisibilityConfigMapper extends BaseMapperX<UserVisibilityConfigDO> {

    /**
     * 按 user_id 查单条配置（唯一索引保证一人一条）。
     */
    default UserVisibilityConfigDO selectByUserId(Long userId) {
        return selectOne(new LambdaQueryWrapperX<UserVisibilityConfigDO>()
                .eq(UserVisibilityConfigDO::getUserId, userId));
    }

}
