package cn.iocoder.yudao.module.system.dal.mysql.comment;

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.system.controller.app.comment.dto.CommentDTO;
import cn.iocoder.yudao.module.system.dal.dataobject.comment.WorkLogCommentDO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.system.controller.app.comment.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 工作日志评论 Mapper
 *
 * @author 艾楷
 */
@Mapper
public interface WorkLogCommentMapper extends BaseMapperX<WorkLogCommentDO> {

    default PageResult<WorkLogCommentDO> selectPage(WorkLogCommentPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<WorkLogCommentDO>()
                .eqIfPresent(WorkLogCommentDO::getWorkLogId, reqVO.getWorkLogId())
                .eqIfPresent(WorkLogCommentDO::getCommentId, reqVO.getCommentId())
                .eqIfPresent(WorkLogCommentDO::getUserId, reqVO.getUserId())
                .eqIfPresent(WorkLogCommentDO::getCommentUserId, reqVO.getCommentUserId())
                .eqIfPresent(WorkLogCommentDO::getComment, reqVO.getComment())
                .eqIfPresent(WorkLogCommentDO::getType, reqVO.getType())
                .eqIfPresent(WorkLogCommentDO::getBuildingCode, reqVO.getBuildingCode())
                .betweenIfPresent(WorkLogCommentDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(WorkLogCommentDO::getId));
    }

    /**
     *
     * @param page
     * @param dto
     * @return
     */
    IPage<CommentPageListVO> queryCommentPageList(@Param("page") Page<CommentPageListVO> page, @Param("dto") CommentDTO dto);
}