package com.yhy.module.core.dal.mysql.workbench;

import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.yhy.module.core.dal.dataobject.workbench.AuditModeDO;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;

/**
 * 审核模式 Mapper
 *
 * @author yhy
 */
@Mapper
public interface AuditModeMapper extends BaseMapperX<AuditModeDO> {

    /**
     * 根据项目ID查询审核模式列表
     */
    default List<AuditModeDO> selectListByProjectId(Long projectId) {
        return selectList(new LambdaQueryWrapperX<AuditModeDO>()
                .eq(AuditModeDO::getProjectId, projectId)
                .orderByDesc(AuditModeDO::getCreateTime));
    }

    /**
     * 根据项目ID和状态查询
     */
    default List<AuditModeDO> selectListByProjectIdAndStatus(Long projectId, String status) {
        return selectList(new LambdaQueryWrapperX<AuditModeDO>()
                .eq(AuditModeDO::getProjectId, projectId)
                .eqIfPresent(AuditModeDO::getStatus, status)
                .orderByDesc(AuditModeDO::getCreateTime));
    }
}
