package cn.com.ctop.kuaishou.modules.clean.mapper;

import cn.com.ctop.kuaishou.modules.clean.entity.KuaiShouAccountCleanLogInfo;
import cn.com.ctop.kuaishou.modules.clean.entity.KuaiShouAccountCleanTemplateInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

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

/**
 * @Description: 快手-账户清理
 * @Author: zzy
 * @Date: 2021-07-20
 * @Version: V1.0
 */
@Mapper
public interface KuaishouAccountCleanTemplateMapper {
    //创建模板
     void saveAccountCleanTemplate(KuaiShouAccountCleanTemplateInfo kuaiShouAccountCleanTemplateInfo);
    //根据id 创建人查询模板列表
    List<KuaiShouAccountCleanTemplateInfo> getTemplateList(@Param("templateName")String templateName, @Param("createUser")String createUser, @Param("createIds")List<String> userIds);
    //根据id查询数据
    KuaiShouAccountCleanTemplateInfo getInfoById(@Param("templateId")String templateId);
    //查询账户关联模板个数
    int getAccountAssociatedSize(@Param("accountId")String accountId);
    //推送模板保存关联关系
    void savePushTemplateAssociated(@Param("templateId")String templateId,@Param("accountId")String accountId,@Param("createTime")String createTime);
    //修改模板
    void updateTemplate(KuaiShouAccountCleanTemplateInfo kuaiShouAccountCleanTemplateInfo);
    //根据模板id修改模板状态
    void updateTemplateStatus(@Param("templateId")String templateId,@Param("status")String status);
    //根据id和accountId 删除关联表信息
    void removeBinding(@Param("templateId")String templateId,@Param("accountId")String accountId);
    //查询清理日志记录
    List<KuaiShouAccountCleanLogInfo> getCleanUpLog(@Param("templateId") String templateId, @Param("userId") String userId);

    //根据账户id 运营名称 查询个人模板信息
    List<KuaiShouAccountCleanTemplateInfo> getMyselfTemplateList(@Param("accountId")String accountId, @Param("userName")String userName, @Param("createId")String createId);

    //查询所有启用的模板
    List<KuaiShouAccountCleanTemplateInfo> getTemplateListBystatus();
    //根据规则模板查询相应组信息
    String getGroupMessage(@Param("template") KuaiShouAccountCleanTemplateInfo kuaiShouAccountCleanTemplateInfo, @Param("optimizationObjective") String optimizationObjective, @Param("startDate") String startDate, @Param("unitId") String unitId);
    List<Map> getGroupByAccount(@Param("accountId") String accountId);

    //保存操作日志
    void saveCleamLog(KuaiShouAccountCleanLogInfo kuaiShouAccountCleanLogInfo);

    Map<String,String> getUserNameByAccountId(@Param("accountId")String accountId);

    String getUserRealName(@Param("userId") String userId);
    /**
     * 根据模板名称查询
     */
    int getTemplateName(@Param("templateName") String templateName);

    /**
     * 根据模板名称查询
     */
    String getProjectId(@Param("accountId") String accountId);
}
