/*
 * Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
 *
 */
package net.northking.cctp.attachment.db.service;

import net.northking.cctp.attachment.db.entity.Attachment;
import net.northking.cctp.common.db.BasicService;
import net.northking.cctp.common.security.authentication.NKSecurityContext;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 附件
 *
 * <p>文件内容由代码生成器产生，请不要手动修改！ <br>
 * createdate:  2022-03-08 10:31:06  <br>
 *
 * @author: maven-cctp-plugin  <br>
 * @since: 1.0 <br>
 */
public interface AttachmentService extends BasicService<Attachment>
{

  /**
   * 判断表是否存在
   *
   * @param tenantId 租户ID
   * @return 表是否存在
   */
  boolean existTable(String tenantId);

  /**
   * 创建指定租户的表
   *
   * @param tenantId 租户ID
   */
  void createNewTable(String tenantId);


  Attachment findByPK(String tenantId, String pkId);

  /**
   * 匿名插入记录
   * @param record 附件记录
   * @return 插入数量
   */
  int insertByBus(Attachment record);

  void updateAllNewFile(Attachment update);

  /**
   * 查询需要需要删除的录制截图
   * @return
   */
  List<Attachment> queryClearRecordScreenshot(List<String> businessCodes, LocalDate date);

    void updateByObjIds(List<String> objectIds);


    List<Attachment> queryByObjId(String objId, LocalDate date);

  List<Attachment> findByPrimaryKeys(List<String> ids, String tenantId);

  /**
   * 获取默认租户表后缀
   * @return 租户表后缀
   */
  default String getDefaultTableSuffix(){
    return "_" + NKSecurityContext.getTenantId();
  }
  /**
   * 获取指定租户表后缀
   * @return 租户表后缀
   */
  default String getTableSuffix(String tenantId){
    return "_" + tenantId;
  }

    void clearSceneTaskAttachments(List<String> deleteIds);

  void associatedFiles(String objectId, List<String> fileIds);

  List<Attachment> queryByOverTime(LocalDateTime now);

  List<Attachment> queryByBusiness(LocalDate now);
}
