package com.microservices.dms.achievementLibrary.mapper;

import java.util.*;

import com.microservices.common.datasource.annotation.Master;
import com.microservices.common.datasource.annotation.Slave;
import com.microservices.dms.achievementLibrary.domain.*;
import com.microservices.dms.behaviorImage.domain.AchievementBehaviorSumVo;
import com.microservices.dms.resourceLibrary.domain.CompetitionResourceLibrary;
import com.microservices.dms.resourceLibrary.domain.TaskResourceLibrary;
import com.microservices.dms.resourceLibrary.domain.vo.KeyValVo;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * 成果Mapper接口
 *
 * @author microservices
 * @date 2025-04-02
 */
@Mapper
@Slave
public interface AchievementsMapper {
    /**
     * 查询成果
     *
     * @param id 成果主键
     * @return 成果
     */
    public Achievements selectAchievementsById(Long id);

    /**
     * 查询成果列表
     *
     * @param achievements 成果
     * @return 成果集合
     */
    public List<Achievements> selectAchievementsList(Achievements achievements);

    /**
     * 新增成果
     *
     * @param achievements 成果
     * @return 结果
     */
    public int insertAchievements(Achievements achievements);

    /**
     * 修改成果
     *
     * @param achievements 成果
     * @return 结果
     */
    public int updateAchievements(Achievements achievements);

    /**
     * 删除成果
     *
     * @param id 成果主键
     * @return 结果
     */
    public int deleteAchievementsById(Long id);

    /**
     * 批量删除成果
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteAchievementsByIds(Long[] ids);

    @MapKey("k")
    @Master
    List<Map<String, String>> getFileInfoByIdents(@Param("idents") Set<String> idents);

    List<Achievements> getChoiceImport();

    List<KeyValueVo> getTjBySources();

    List<KeyValueVo> getTjByAreas();

    List<Achievements> selectAchievementsByParam(AchQueryVo achQueryVo);

    Long getAchievementClickSum(@Param("id")  Long id);

    List<KeyValVo<String, Long>> getaWatcher(@Param("s") Date s, @Param("e") Date e, @Param("t") String achievements);

    List<KeyValVo<String, Long>> getFavorite(@Param("s") Date s, @Param("e") Date e, @Param("t") String achievements);

    List<KeyValVo<String, Long>> getAchievement(@Param("s") Date s, @Param("e") Date e, @Param("t") String source);

    List<HotAchVo> getHotAchievement();

    Map<String, Long> indexProjectStatistic();

    Map<String, Object> indexTaskStatistic();

    Map<String, Long> indexCompetitionStatistic();

    Long indexSchoolEnterpriseStatistic(@Param("s") String s, @Param("t") String tags);

    List<KeyValueVo> getAreasByName(@Param("areaName")  String areaName);

    AchievementBehaviorSumVo getActDataStatisticById(@Param("id") Long id);

    List<KeyValVo<String, Long>> get7AddClickById(@Param("s") Date s, @Param("e") Date e, @Param("t") String achievements, @Param("id") String id);

    AchievementBehaviorSumVo getWatchFavoriteStatusById(@Param("id") Long id, @Param("userId")Long userId);

    Long countAchievementBySource(@Param("s") Date s, @Param("e") Date e, @Param("t") String achievements);

    List<Map<String, Object>> getAchievementDataYearly();

    List<Map<String, Object>> getAchievementType();

    List<KeyValueVo> getAchievementActData(@Param("s") Date s, @Param("e") Date e);

    List<Map<String, Object>> getAchievementDomain();

    List<Map<String, Object>> getAchievementAddYearly();

    List<Map<String, Object>> getAchievementHotRank();

    List<Long> getAllId();

    List<AreaStatisticVo> getAreaStatistic(@Param("areaKey") String areaKey);

    List<AchRelatedVo> getRelatedAch(@Param("id")Long id, @Param("sourceId") List<Long> sourceId, @Param("paramYear")String paramYear);

    List<String> getDistinctYear(@Param("id")Long id, @Param("sourceId")List<Long> sourceId);

    List<Long> selectAchievementsByName(@Param("achName") String achName);

    String getField1NameByParam(@Param("source")String source,  @Param("id") Long id);

    List<KeyValueVo> getProjectAreasByName(@Param("areaName")  String areaName);

    List<String> getExpertAreasByName(@Param("areaName") String areaName);

    List<Long> getAllSourceId(@Param("id")Long id, @Param("sourceId")Long sourceId);

    List<Long> getAllSourceIdCompetition(@Param("id")Long id, @Param("sourceId")Long sourceId);

    List<Long> getAllSourceIdTask(@Param("id")Long id, @Param("sourceId")Long sourceId);

    List<TaskResourceLibrary> getRelatedAchTaskOfExpert(@Param("id")Long id);

    List<CompetitionResourceLibrary> getRelatedAchCompetitionOfExpert(@Param("id")Long id);

    List<KeyValVo<String,Long>> getAchievementAddYearlyData(@Param("s") Date s, @Param("e") Date e);

    List<KeyValueVo> getAchievementActDataW(@Param("s") Date s, @Param("e") Date e);

    List<KeyValueVo> getAchievementActDataC(@Param("s") Date s, @Param("e") Date e);

    List<KeyValueVo> getAchievementActDataD(@Param("s") Date s, @Param("e") Date e);
    List<KeyValueVo> getAchievementActDataF(@Param("s") Date s, @Param("e") Date e);

    List<Map<String, Object>> getDockingUserInfo(@Param("id") Long id);
}
