package org.jeecg.modules.workOrder.mapper;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.workOrder.entity.WorkOrder;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
 * @Description: 任务工单
 * @Author: jeecg-boot
 * @Date:   2025-02-10
 * @Version: V1.0
 */
public interface WorkOrderMapper extends BaseMapper<WorkOrder> {

    @Select("SELECT \n" +
            "    (SELECT COUNT(id) FROM bu_regular_material WHERE regular = wo.regular_id) +\n" +
            "    (SELECT COUNT(id) FROM bu_regular_tools WHERE regular = wo.regular_id) AS nuum\n" +
            "FROM bu_work_order wo\n" +
            "WHERE wo.id = #{workOrderId};")
    Integer selectByWorkOrderId(@Param("workOrderId") String workOrderId);

}
