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

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.project.ProjectRequirementStatusLogDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 项目需求状态变更日志 Mapper
 */
@Mapper
public interface ProjectRequirementStatusLogMapper extends BaseMapperX<ProjectRequirementStatusLogDO> {

    /**
     * 根据需求 ID 查询状态变更日志列表
     */
    default List<ProjectRequirementStatusLogDO> selectListByRequirementId(Long requirementId) {
        return selectList(new LambdaQueryWrapperX<ProjectRequirementStatusLogDO>()
                .eq(ProjectRequirementStatusLogDO::getRequirementId, requirementId)
                .orderByDesc(ProjectRequirementStatusLogDO::getCreateTime));
    }

}
