package com.zioinfo.mes.job.mapper;

import com.zioinfo.mes.job.MesJob;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

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

@Mapper
public interface JobMapper {
    List<MesJob> findAll(@Param("status") String status,
                         @Param("workerId") String workerId,
                         @Param("woNo") String woNo,
                         @Param("equipmentCode") String equipmentCode);
    MesJob findById(@Param("id") Long id);
    int countByNo(@Param("jobNo") String jobNo);
    int insert(MesJob job);
    int update(MesJob job);
    int assign(@Param("id") Long id, @Param("workerId") String workerId,
               @Param("equipmentCode") String equipmentCode);
    int updateStatus(@Param("id") Long id, @Param("status") String status);
    int addDone(@Param("id") Long id, @Param("qty") Double qty);
    int delete(@Param("id") Long id);

    /** 상태별 카운트(작업현황 보드). */
    List<Map<String, Object>> countByStatus();
    /** 작업자별 진행중 작업 수(부하 조회). */
    List<Map<String, Object>> workloadByWorker();
}
