package com.jy.framework.mybatis.join;

import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.assist.ISqlRunner;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.SelectProvider;

import java.util.List;

@SuppressWarnings({"UnusedReturnValue"})
@Mapper
public interface JoinMapper {

    /**
     * 列表
     */
    @SelectProvider(type = SqlProvider.class, method = "getSql")
    List<JSONObject> listMap(@Param(ISqlRunner.SQL) Sql<?> sql);

    /**
     * 分页
     */
    @SelectProvider(type = SqlProvider.class, method = "getSql")
    Page<JSONObject> pageMap(@Param(ISqlRunner.SQL) Sql<?> sql, @Param(ISqlRunner.PAGE) Page<?> page);

    /**
     * 单条纪录
     */
    @SelectProvider(type = SqlProvider.class, method = "getSql")
    JSONObject oneMap(@Param(ISqlRunner.SQL) Sql<?> sql);

    /**
     * 列表
     */
    @SelectProvider(type = SqlProvider.class, method = "getSql")
    List<Object> listObj(@Param(ISqlRunner.SQL) Sql<?> sql);

    /**
     * 分页
     */
    @SelectProvider(type = SqlProvider.class, method = "getSql")
    Page<Object> pageObj(@Param(ISqlRunner.SQL) Sql<?> sql, @Param(ISqlRunner.PAGE) Page<?> page);

    /**
     * 单条纪录
     */
    @SelectProvider(type = SqlProvider.class, method = "getSql")
    Object oneObj(@Param(ISqlRunner.SQL) Sql<?> sql);

}
