package com.hotent.base.dao;

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

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;

public interface CommonDao{
	@Update("${sql}")
	int update(Map<String,Object> map);
	
	List<Map<String,Object>> query(Map<String,Object> map);
	
	IPage<Map<String,Object>> queryByPage(IPage<?> page,@Param("sql") String sql);
	
	IPage<Map<String,Object>> queryByQueryFilter(IPage<?> page, @Param("sql") String sql, @Param(Constants.WRAPPER) Wrapper<Map<String,Object>> wrapper);

	IPage<Map<String,Object>> queryByCustomSql(IPage<?> page,@Param("sql") String sql,@Param(Constants.WRAPPER) Wrapper<Map<String,Object>> wrapper);
	
	int batchInsert(@Param("tableName") String tableName,@Param("insertFields")  String insertFields,@Param("valueList") List<Map<String,Object>> valueList  );

	int batchInsert4Oracle(@Param("tableName") String tableName,@Param("insertFields")  String insertFields,@Param("valueList") List<Map<String,Object>> valueList  );

	int batchUpdate(@Param("tableName") String tableName, @Param("pkField") String pkField,
			@Param("valueList") List<Map<String, Object>> valueList,
			@Param("ignoreDataVersion") Boolean ignoreDataVersion);

	int batchDelete(@Param("tableName") String tableName,@Param("pkField")  String pkField,@Param("pkValues") List<String> pkValues);
	
    int updateByCustom(@Param("tableName") String tableName,@Param("pkField")  String pkField, @Param("mapParam") Map<String, ?> map);

	List<Map<String,Object>> queryByCustomSql(@Param("sql") String sql,@Param(Constants.WRAPPER) Wrapper<Map<String,Object>> wrapper);
}
