package cn.iocoder.yudao.module.configure.dal.mysql.tracelink;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.configure.dal.dataobject.tracelink.TraceLinkDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.configure.controller.admin.tracelink.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 溯源模板-环节 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface TraceLinkMapper extends BaseMapperX<TraceLinkDO> {

    default PageResult<TraceLinkDO> selectPage(TraceLinkPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<TraceLinkDO>()
                .eqIfPresent(TraceLinkDO::getTraceTemplateId, reqVO.getTraceTemplateId())
                .likeIfPresent(TraceLinkDO::getTraceTemplateName, reqVO.getTraceTemplateName())
                .eqIfPresent(TraceLinkDO::getLinkId, reqVO.getLinkId())
                .likeIfPresent(TraceLinkDO::getLinkName, reqVO.getLinkName())
                .eqIfPresent(TraceLinkDO::getBelongBusinessId, reqVO.getBelongBusinessId())
                .likeIfPresent(TraceLinkDO::getBelongBusinessName, reqVO.getBelongBusinessName())
                .betweenIfPresent(TraceLinkDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(TraceLinkDO::getId));
    }

    List<TraceLinkRespVO> getTraceLinkList(@Param("traceLink") TraceLinkReqVO traceLink);

}
