package cn.com.tenlion.configtable.dao.configtableoperation;

import cn.com.tenlion.configtable.pojo.bos.configtable.ConfigTableBO;
import cn.com.tenlion.configtable.pojo.dtos.configtable.ConfigTableDTO;
import cn.com.tenlion.configtable.pojo.dtos.configtableoperation.ConfigTableOperationDTO;
import cn.com.tenlion.configtable.pojo.pos.configtable.ConfigTablePO;
import ink.wgink.exceptions.RemoveException;
import ink.wgink.exceptions.SaveException;
import ink.wgink.exceptions.SearchException;
import ink.wgink.exceptions.UpdateException;
import org.springframework.stereotype.Repository;

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

/**
 * @ClassName: IConfigTableDao
 * @Description: 
 * @Author: CodeFactory
 * @Date: 2021-06-24 10:59:30
 * @Version: 3.0
 **/
@Repository
public interface IConfigTableOperationDao {

    /**
     * 统计
     *
     * @param params
     * @return
     * @throws SearchException
     */
    Integer count(Map<String, Object> params) throws SearchException;

    /**
     * 判断表是否存在
     *
     * @param tableName
     * @return
     * @throws SearchException
     */
    Integer getTableExist(String tableName) throws SearchException;

    /**
     * 创建真实表单
     * @param params
     * @throws SaveException
     */
    void saveTable(Map<String, Object> params) throws SaveException;

    /**
     * 查询动态表单的基础信息
     *
     * @param configTableCode 数据库表名
     * @throws SaveException
     */
    List<ConfigTableOperationDTO> getTableFieldConfig(String configTableCode) throws SearchException;

    /**
     * 动态表数据查询
     * @param query
     * @return
     * @throws SearchException
     */
    List<Map<String, Object>> getTableFieldData(Map<String, Object> query) throws SearchException;

    /**
     * 动态表数据修改
     * @param update
     * @throws UpdateException
     */
    void updateTableFieldData(Map<String, Object> update) throws UpdateException;

    /**
     * 动态表数据新增
     * @param update
     * @throws SaveException
     */
    void saveTableFieldData(Map<String, Object> update) throws SaveException;

    /**
     * 动态表数据删除
     * @param delete
     * @throws SaveException
     */
    void deleteTableFieldData(Map<String, Object> delete) throws RemoveException;

    /**
     * 动态表单列表查询
     * @param params
     * @return
     * @throws SearchException
     */
    List<Map<String, Object>> list(Map<String, Object> params) throws SearchException;

    /**
     * 真实删除数据库表
     * @param configTableCode
     * @throws RemoveException
     */
    void deleteTable(String configTableCode) throws RemoveException;
}