package com.njcn.rdms.module.project.dal.mysql.performance;

import com.njcn.rdms.framework.mybatis.core.mapper.BaseMapperX;
import com.njcn.rdms.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.njcn.rdms.module.project.dal.dataobject.performance.PerformanceSheetSignOffDO;
import org.apache.ibatis.annotations.Mapper;

@Mapper
public interface PerformanceSheetSignOffMapper extends BaseMapperX<PerformanceSheetSignOffDO> {

    default PerformanceSheetSignOffDO selectByPerformanceSheetId(Long performanceSheetId) {
        return selectOne(new LambdaQueryWrapperX<PerformanceSheetSignOffDO>()
                .eq(PerformanceSheetSignOffDO::getPerformanceSheetId, performanceSheetId));
    }

    default int updateByPerformanceSheetIdAndStatus(PerformanceSheetSignOffDO update, Long performanceSheetId,
            String fromStatus) {
        return update(update, new LambdaQueryWrapperX<PerformanceSheetSignOffDO>()
                .eq(PerformanceSheetSignOffDO::getPerformanceSheetId, performanceSheetId)
                .eq(PerformanceSheetSignOffDO::getStatusCode, fromStatus));
    }
}
