package cn.iocoder.yudao.module.inspection.mapper;

import cn.iocoder.yudao.module.inspection.entity.DlInspectionProject;
import cn.iocoder.yudao.module.inspection.entity.InspectionWorkNode;
import cn.iocoder.yudao.module.inspection.query.InspectionListQuery;
import cn.iocoder.yudao.module.inspection.vo.StaffProjectCountVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

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

/**
 * <p>
 * 检测流程表 Mapper 接口
 * </p>
 *
 * @author dianliang
 * @since 2024-10-31
 */
@Mapper
public interface InspectionWorkNodeMapper extends BaseMapper<InspectionWorkNode> {

    /**
     * 根据检测id获取检测流程
     * @param inspectionId
     * @return
     */
    List<InspectionWorkNode> getWeorkNodesById(Integer inspectionId);

    IPage<Map> getRoyaltyList(@Param("page")IPage page,@Param("inspectionWorkNode") InspectionWorkNode inspectionWorkNode);
    Map getRoyaltySum(@Param("inspectionWorkNode") InspectionWorkNode inspectionWorkNode);

    void cancelAnOrder(InspectionWorkNode workNode);

    /**
     * 批量修改检测状态
     * @param workNodes
     */
    void recheck(@Param("list") List<InspectionWorkNode> workNodes, @Param("status") String status);

    List<StaffProjectCountVO> getStaffCount(DlInspectionProject dlInspectionProject);

    List<StaffProjectCountVO> getStaffCountByUserId(DlInspectionProject dlInspectionProject);

    /**
     * 根据检测id获取异常节点
     * @param idList
     * @return
     */
    List<Map<String, Object>> selectExceptionNodesByInspectionIds(@Param("ids") List<Long> idList);

    IPage<Map<String, Object>> selectStaffProjectByUserId(@Param("page")Page<Map<String, Object>> page, @Param("query") InspectionListQuery query);

    /**
     * @description: 查询员工项目统计根据车型
     * @author: 许
     * @date: 2025/8/5 13:13
     * @param: [dlInspectionProject]
     * @return: java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
     **/
    List<Map<String, Object>> queryStaffCountGroupByGoods(DlInspectionProject dlInspectionProject);

    /**
     * @description: 查询员工项目统计
     * @author: 许
     * @date: 2025/8/5 14:07
     * @param: [dlInspectionProject]
     * @return: java.util.Map<java.lang.String,java.lang.Object>
     **/
    Map<String, Object> queryStaffInspectionCount(DlInspectionProject dlInspectionProject);
}
