package com.common.base.module.data.module;

import com.common.base.common.WebPageInfo;
import com.common.base.module.tableconfig.entity.OsSysTable;
import com.github.pagehelper.PageInfo;

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

public interface BaseMapper {

    int save(DataMap dataMap);

    int save(String tableName,String pkName , Map<String, Object> data);

    int updateByPk(DataMap dataMap);

    int updateByPk(String tableName, String pkName, Object pkValue, Map<String, Object> data);

    int updateByPk(OsSysTable osSysTable, Object pkValue, Map<String, Object> data);

    int updateInPk(DataMap dataMap);

    <E> int updateInPk(String tableName, String pkName, List<E> ids, Map<String, Object> data);

    <E> int updateInPk(OsSysTable osSysTable, List<E> ids, Map<String, Object> data);

    int updateByCondition(DataMap dataMap, Condition condition);

    int updateByCondition(String tableName,Map<String,Object> data, Condition condition);

    int deleteByPk(DataMap dataMap);

    int deleteByPk(String tableName, String pkName,Object pkValue);

    int deleteByPk(OsSysTable osSysTable,Object pkValue);

    <E> int deleteInPk(String tableName, String pkName,List<E> ids);

    int deleteInPk(DataMap dataMap);

    <E> int deleteInPk(OsSysTable osSysTable,List<E> ids);

    int deleteByCondition(DataMap dataMap, Condition condition);

    int deleteByCondition(String tableName, Condition condition);

    List<Map<String, Object>> selectAll(String tableName);

    List<Map<String,Object>> selectByEqual(DataMap dataMap, Map<String,Object> map);

    List<Map<String,Object>> selectByEqual(String tableName, Map<String,Object> map);

    PageInfo<Map<String,Object>> selectByEqual(DataMap dataMap, Map<String,Object> map, WebPageInfo webPageInfo);

    PageInfo<Map<String,Object>> selectByEqual(String tableName, Map<String,Object> map, WebPageInfo webPageInfo);

    Map<String,Object> selectOneByEqual(DataMap dataMap,Map<String,Object> map);

    Map<String, Object> selectByPk(DataMap dataMap);

    Map<String, Object> selectByPk(OsSysTable osSysTable,Object pkValue);

    Map<String, Object> selectByPk(String tableName,String pkName,Object pkValue);

    List<Map<String, Object>> selectByCondition(Condition condition);

    List<Map<String, Object>> selectByCondition(DataMap dataMap, Condition condition);

    List<Map<String, Object>> selectByCondition(String tableName, Condition condition);

    List<Map<String, Object>> selectByCondition(String tableName,List<String> fieldList, Condition condition);

    List<Map<String, Object>> selectByCondition(String tableName,String fieldList, Condition condition);

    PageInfo<Map<String, Object>> selectByCondition(Condition condition, WebPageInfo webPageInfo);

    PageInfo<Map<String, Object>> selectByCondition(DataMap dataMap, Condition condition, WebPageInfo webPageInfo);

    PageInfo<Map<String, Object>> selectByCondition(String tableName, Condition condition, WebPageInfo webPageInfo);

    PageInfo<Map<String, Object>> selectByCondition(String tableName,List<String> fieldList, Condition condition, WebPageInfo webPageInfo);

    PageInfo<Map<String, Object>> selectByCondition(String tableName,String fieldList, Condition condition, WebPageInfo webPageInfo);

    Map<String, Object> selectOneByCondition(DataMap dataMap, Condition condition);

    Map<String, Object> selectOneByCondition(String tableName, Condition condition);

    Map<String, Object> selectOneByCondition(String tableName,List<String> fieldList, Condition condition);

    Map<String, Object> selectOneByCondition(String tableName,String fieldList, Condition condition);

    Map<String, Object> selectOneByCondition(Condition condition);

    List<Map<String, Object>> selectJoinByCondition(String tableName, JoinCondition joinCondition, Condition condition);

    List<Map<String, Object>> selectJoinByCondition(String tableName, List<JoinCondition> joinCondition, Condition condition);

    List<Map<String, Object>> selectLeftJoinByCondition(String tableName, JoinCondition joinCondition, Condition condition);

    List<Map<String, Object>> selectLeftJoinByCondition(String tableName, List<JoinCondition> joinCondition, Condition condition);

    List<Map<String, Object>> selectRightJoinByCondition(String tableName, JoinCondition joinCondition, Condition condition);

    List<Map<String, Object>> selectRightJoinByCondition(String tableName, List<JoinCondition> joinCondition, Condition condition);

    List<Map<String, Object>> selectionByCondition(SelectCondition selectCondition, Condition condition);

    List<Map<String, Object>> selectSql(String sql);

    PageInfo<Map<String, Object>> selectSqlByPage(String sql, WebPageInfo webPageInfo);

    Map<String, Object> selectOneSql(String sql);

}
