package com.xhkjedu.sapi.mapper.cloud;

import com.xhkjedu.base.TkMapper;
import com.xhkjedu.sapi.model.cloud.TCloudSync;
import org.apache.ibatis.annotations.Param;

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

public interface CloudSyncMapper extends TkMapper<TCloudSync> {
    //列表
    List<Map> findAll(@Param("sync") TCloudSync sync);

    //添加
    void save(@Param("sync") TCloudSync sync);

    //获取最后一条同步任务
    TCloudSync getLastSync();

    //更新同步状态
    void updateState(@Param("csid") Integer csid, @Param("syncstate") int syncstate
            , @Param("timestamp") int timestamp);

    //同步科目
    void syncSubject(@Param("list") List<Map> list, @Param("timestamp") int timestamp);

    //同步版本
    void syncVersion(@Param("list") List<Map> list, @Param("timestamp") int timestamp);

    //同步教材
    void syncSubjectBook(@Param("list") List<Map> list, @Param("timestamp") int timestamp);

    //同步题型
    void syncSubjectQuestionType(@Param("list") List<Map> list, @Param("timestamp") int timestamp);

    //同步章节
    void syncDirector(@Param("list") List<Map> list, @Param("timestamp") int timestamp);

    //同步知识点
    void syncPoint(@Param("list") List<Map> list, @Param("timestamp") int timestamp);

    //同步试题
    void syncQuestion(@Param("m") Map list, @Param("timestamp") int timestamp);

    //同步试题章节
    void syncQuestionDirector(@Param("list") List<Map> list, @Param("timestamp") int timestamp);

    //同步试题知识点
    void syncQuestionPoint(@Param("list") List<Map> list, @Param("timestamp") int timestamp);

    //同步资源
    void syncResource(@Param("m") Map list, @Param("timestamp") int timestamp);

    //同步资源章节
    void syncResourceDirector(@Param("list") List<Map> list, @Param("timestamp") int timestamp);

    //平台基础信息
    TCloudSync getCloudInfo();

    //外键是否存在
    Integer getFkExisted(@Param("fkname") String fkname, @Param("dbname") String dbname);

    //删除章节外键
    void delDirectorFk();

    //添加章节外键
    void addDirectorFk();

    //删除知识点外键
    void delPointFk();

    //添加知识点外键
    void addPointFk();

    //获取同步类型
    List<Map> listModule();
}
