package com.njcn.rdms.module.project.dal.mysql.workreport.monthly;

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.workreport.monthly.MonthlyReportSignOffDO;
import org.apache.ibatis.annotations.Mapper;

@Mapper
public interface MonthlyReportSignOffMapper extends BaseMapperX<MonthlyReportSignOffDO> {

    default MonthlyReportSignOffDO selectByMonthlyReportId(Long monthlyReportId) {
        return selectOne(new LambdaQueryWrapperX<MonthlyReportSignOffDO>()
                .eq(MonthlyReportSignOffDO::getMonthlyReportId, monthlyReportId));
    }

    default int updateByMonthlyReportIdAndStatus(MonthlyReportSignOffDO update, Long monthlyReportId,
            String fromStatus) {
        return update(update, new LambdaQueryWrapperX<MonthlyReportSignOffDO>()
                .eq(MonthlyReportSignOffDO::getMonthlyReportId, monthlyReportId)
                .eq(MonthlyReportSignOffDO::getStatusCode, fromStatus));
    }
}
