package com.cf.imes.module.manage.dal.mysql.process;


import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.cf.imes.module.manage.controller.admin.process.vo.*;
import com.cf.imes.module.manage.controller.admin.query.vo.productionStatus.OrderModuleVO;
import com.cf.imes.module.manage.dal.dataobject.process.OrderProcessStepItemNDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.math.BigDecimal;
import java.util.List;

/**
 * 生产单工序明细表 order_process_step_item_{N} Mapper
 *
 * @author 晨丰科技
 */
@Mapper
public interface ProcessStepItemMapper extends BaseMapperX<OrderProcessStepItemNDO> {


    List<OrderModuleVO> selectPlateName(Long processStepId);


    void updateStatus(@Param("id") Long id, @Param("nickname") String nickname, @Param("salary")BigDecimal salary);


    ProcessStepStatus selectStatusById(@Param("id") Long id,@Param("name") String name, @Param("organId") Long organId);


    void updateStemStatus(@Param("processStepId")  Long processStepId,@Param("name") String name, @Param("nickname") String nickname);



    default List<OrderProcessStepItemNDO> selectStemById(Long stepId,Boolean status,Long organId) {
        return selectList(new LambdaQueryWrapperX<OrderProcessStepItemNDO>()
                .eq(OrderProcessStepItemNDO::getOrganId,organId)
                .eqIfPresent(OrderProcessStepItemNDO::getStatus,status)
                .eqIfPresent(OrderProcessStepItemNDO::getProcessStepId,stepId));

    }



    List<OrderBodyRespVo> selectBodyIds(@Param("processStepId") Long processStepId,@Param("name") String name, @Param("organId") Long organId);

    BigDecimal selectAreaByProcessStepId(@Param("processStepId") Long processStepId);
}
