
package com.lideeyunji.core.framework.service;

import cn.hutool.json.JSONObject;
import com.lideeyunji.tool.framework.yunji.model.ResultDataModel;
import com.lideeyunji.tool.framework.yunji.model.ExecuteEnhanceModel;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import net.sf.jsqlparser.JSQLParserException;

import java.util.List;
import java.util.Map;

/**
 * 框架业务相关
 */
public interface IFrameService {



    /**
     * 校验表是否存在
     * @param tableName
     * @return true=存在  false = 不存在
     */
    boolean checkTable(String tableName);

    //校验数据库是否存在表
    boolean checkDbTable(String tableName);

    /**
     * 同步数据到数据库
     * @param dbFormId
     * @param syncModel
     */
    void syncDb(Long dbFormId,String syncModel) throws JSQLParserException;

    /**
     * 删除表
     * @param tableName
     */
    boolean dropTable(String tableName);


    /*------------------表相关----------------------*/

    //获取表数据 -不分页
    ResultDataModel getDataList(Long dbFormId,Map<String, Object> params);

    ResultDataModel getDataList(Long dbFormId, Page page, Map<String, Object> params);

    //获取统计数据
    ResultDataModel getDataSummaryList(Long dbFormId, Map<String, Object> params);

    //获取表详情
    ResultDataModel getDataDetail(Long dbFormId,Long id,Map<String, Object> params);

    //保存数据
    ExecuteEnhanceModel saveData(Long dbformId, Map<String,Object> params);
    //保存数据-批量新增
    List<String> saveBatchData(Long dbformId, List<JSONObject> dataMapList);

    //编辑数据
    ExecuteEnhanceModel editData(Long dbformId, Long id, Map<String,Object> params);

    //编辑数据-批量
    void editBatchData(Long dbformId,List<JSONObject> jsonObjectList);

    //删除数据
    ExecuteEnhanceModel delData(Long dbFormId, Map<String,Object> params);

    /*------------------Excel相关----------------------*/
    //获取导出数据
    ResultDataModel getExportDataList(Long dbFormId, Map<String, Object> params);
    //导入校验
    ExecuteEnhanceModel importEnhanceData(Long dbformId, Map<String,Object> params);
    //导入结束
    ExecuteEnhanceModel importEnhanceDataEnd(Long dbformId, Map<String,Object> params);
    /*------------------报表相关----------------------*/

    //获取数据表数据 -分页
    ResultDataModel getReportDataList(String reportCode, Page page, Map<String, Object> params);
}
