package com.face.global.service;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.face.global.vo.GlobalUser;
import com.face.global.vo.Operate;
import org.apache.ibatis.annotations.Param;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.function.Function;

public interface IGlobalBaseService<T, ID extends Serializable> extends IService<T> {

    int insert(T entity);

    int deleteById(ID id);

    int deleteById(T entity);

    int deleteByMap(Map columnMap);


    int delete(Wrapper<T> queryWrapper);


    int updateByIdForInt(T entity);


    int updateForInt(T entity, Wrapper<T> updateWrapper);


    int updateForInt(Wrapper<T> updateWrapper);


    T selectById(ID id);


    T selectOne(Wrapper<T> queryWrapper);


    T selectOne(Wrapper<T> queryWrapper, boolean throwEx);


    boolean exists(Wrapper<T> queryWrapper);


    List<T> selectByMap(Map columnMap);


    Long selectCount(Wrapper<T> queryWrapper);

    List<T> selectList(Wrapper<T> queryWrapper);

    List<T> selectBatchIds(Collection<ID> idList);

    int deleteBatchIds(Collection<ID> idList);

    String generatorStringId();

    long generatorLongId();

    /**
     * 根据entity条件复制
     * @return
     */
    int insertH(ID id, Function<ID, Map<String, Object>> content,  @Param("operate") Operate operate);

    Operate getUpdateOperate(boolean generateSeq);

    Operate getInsertOperate(boolean generateSeq);

    Operate getDeleteOperate(boolean generateSeq);

    boolean updateSomeColumnById(List dataEntity);

    GlobalUser getOperateUser();
}
