package org.dromara.zhishu.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.dromara.common.mybatis.annotation.DataColumn;
import org.dromara.common.mybatis.annotation.DataPermission;
import org.dromara.zhishu.domain.Task;
import org.dromara.zhishu.domain.vo.ShopDetailVo;
import org.dromara.zhishu.domain.vo.ShopVo;
import org.dromara.zhishu.domain.vo.TaskVo;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;

import java.util.List;

/**
 * 任务列表Mapper接口
 *
 * @author yxy
 * @date 2025-03-21
 */
@Mapper
public interface TaskMapper extends BaseMapperPlus<Task, TaskVo> {

    @Override
    @DataPermission({
            @DataColumn(key = "userName", value = "create_by")
    })
    default <P extends IPage<TaskVo>> P selectVoPage(IPage<Task> page, Wrapper<Task> wrapper) {
        return selectVoPage(page, wrapper, this.currentVoClass());
    }

    List<Long> selectByShopId(Long userId);

    TaskVo selectByFileName(String fileName);

    List<TaskVo> selectRunningTask(@Param("pageSize") Integer pageSize,@Param("pageNum") Integer pageNum);

    int selectRunningTaskCount();

    void editTaskDataNum(@Param("shopIds")String shopIds, @Param("dataNum")Long dataNum, @Param("taskType") String taskType);

    Task getTaskBoByRelationId(String id);

    /**
     * 批量查询店铺基本信息
     */
    List<ShopVo> selectShopsByIds(@Param("ids") List<Long> ids);

    /**
     * 批量查询店铺详情信息
     */
    List<ShopDetailVo> selectShopDetailsByIds(@Param("ids") List<Long> ids);
}
