package cn.iocoder.yudao.module.mes.dal.mysql.task;

import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.mes.dal.dataobject.task.TaskDetailSumResult;
import cn.iocoder.yudao.module.mes.dal.dataobject.task.ViewTaskProductSummary;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 生产任务单明细 Mapper
 *
 * @author 内蒙必硕
 */
@Mapper
public interface ViewTaskProductSummaryMapper extends BaseMapperX<ViewTaskProductSummary> {

    default List<ViewTaskProductSummary> selectListByTaskId(Long taskId) {
        return selectList(ViewTaskProductSummary::getTaskId, taskId);
    }

    default int deleteByTaskId(Long taskId) {
        return delete(ViewTaskProductSummary::getTaskId, taskId);
    }

    default PageResult<ViewTaskProductSummary> selectPage(PageParam reqVO, Long taskId) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ViewTaskProductSummary>()
                .eq(ViewTaskProductSummary::getTaskId, taskId)
                .orderByDesc(ViewTaskProductSummary::getTaskId));
    }

    public List<TaskDetailSumResult> selectSumListByTaskId(Long taskId);
}