package cn.reghao.tnb.file.app.zdisk.db.mapper;

import cn.reghao.jutil.jdk.web.db.BaseMapper;
import cn.reghao.jutil.jdk.web.db.Page;
import cn.reghao.tnb.file.app.zdisk.model.po.DiskFile;
import cn.reghao.tnb.file.app.zdisk.model.query.DiskQuery;
import cn.reghao.tnb.file.app.zdisk.model.vo.DiskFileCount;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author reghao
 * @date 2025-08-28 22:47:28
 */
@Mapper
public interface DiskFileMapper extends BaseMapper<DiskFile> {
    void updateMoveDiskFile(DiskFile diskFile);
    void updateDeleteDiskFiles(List<String> fileIds);
    void updateDeleteByPathPrefix(@Param("owner") long owner, @Param("pathPrefix") String pathPrefix);

    List<DiskFileCount> findFileTypeCountByGroup(long owner);
    int countByDiskQuery(DiskQuery diskQuery);
    List<DiskFile> findDiskQueryByPage(@Param("page") Page page, @Param("diskQuery") DiskQuery diskQuery);
    List<DiskFile> findByFileIds(List<String> list);
    List<DiskFile> findByParentIds(List<String> list);
    DiskFile findRoot();

    List<String> countSha256sumGroupByDiskQuery(@Param("fileType") int fileType, @Param("userId") long userId);
    List<DiskFile> findSha256sumGroupByPage(@Param("page") Page page,
                                            @Param("fileType") int fileType,
                                            @Param("userId") long userId);
    List<DiskFile> findSha256sumGroup(List<String> sha256sumList);
}
