package com.storlead.framework.mybatis.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.storlead.framework.mybatis.entity.SysBaseField;
import com.storlead.framework.mybatis.query.QueryBaseEntity;

import java.io.Serializable;
import java.util.List;

public interface MyBaseService <T> extends IService<T> {

    <R extends SysBaseField, E extends QueryBaseEntity> List<R> listWithScopeVo(IPage page, E e);

    List<T> listWith(IPage page, LambdaQueryWrapper<T> wrapper);

    <R extends SysBaseField, E extends QueryBaseEntity> List<R> listWithScopeVo(IPage page, LambdaQueryWrapper<T> wrapper,E e);

    <R extends SysBaseField, E extends QueryBaseEntity> List<R> pageWithScopelist(IPage page, LambdaQueryWrapper<T> wrapper);

    <R extends SysBaseField, E extends QueryBaseEntity> List<R> pageWithScopelist(IPage page, LambdaQueryWrapper<T> wrapper, String mergeSql);

    <R extends SysBaseField> List<R> listWithScopeVo(LambdaQueryWrapper<T> wrapper);

    List<T> listWithScope(LambdaQueryWrapper<T> wrapper);
    List<T> listWithScope(LambdaQueryWrapper<T> wrapper,String mergeSql);

    <R extends SysBaseField> IPage<R> listWithScopeVo(IPage page, LambdaQueryWrapper<T> wrapper);

    IPage<T> pageWithScope(IPage page, LambdaQueryWrapper<T> wrapper);

    IPage<T> pageWithScope(IPage page, LambdaQueryWrapper<T> wrapper,String mergeSql);

    <E extends QueryBaseEntity> IPage<T> pageWithScope(IPage page, LambdaQueryWrapper<T> wrapper,E e,String mergeSql);

    <E extends QueryBaseEntity> List<T> listWithScope(LambdaQueryWrapper<T> wrapper,E e,String mergeSql);

    Integer selectCount(LambdaQueryWrapper<T> wrapper,String mergeSql);

    <E extends QueryBaseEntity> Integer selectCount(LambdaQueryWrapper<T> wrapper,E e,String mergeSql);

    Boolean lgDelete(Long id);

    Boolean lgCustomerDelete(Long customerId);

    Boolean lgCustomerListDelete(List<Long> customerIdList);

    Boolean lgDelete(List<Long> ids);

    List<T> listByIds(List<Long> ids);

    Boolean changeCustomerId(Long fromId, Long customerId);

    T getNextById(Serializable currentId, LambdaQueryWrapper<T> queryWrapper);

    T getPreviousById(Serializable currentId, LambdaQueryWrapper<T> queryWrapper);

//    T getOldEntityById(Class<T> clazz, Long id);

    Class<T> getEntityClass();

    boolean changeResourceTypeId(String resourceType, Long fromId, Long id);

    boolean deleteByResourceId(String resourceType, Long resourceTypeId);

    boolean deleteByResourceIds(String resourceType, List<Long> resourceTypeIds);

    List<T> listByResourceId(String resourceType, Long resourceTypeId);

    List<T> listByResourceIds(String resourceType, List<Long> resourceTypeIds);
}
