package com.zt.plat.module.qms.resource.record.dal.mapper;

import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.module.qms.resource.record.controller.admin.recordapply.vo.RecordApplyPageReqVO;
import com.zt.plat.module.qms.resource.record.dal.dataobject.recordapply.RecordApplyDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 文件记录通用申请 Mapper
 *
 * @author 后台管理
 */
@Mapper
public interface RecordApplyMapper extends BaseMapperX<RecordApplyDO> {

    default PageResult<RecordApplyDO> selectPage(RecordApplyPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<RecordApplyDO>()
                .eqIfPresent(RecordApplyDO::getTitle, reqVO.getTitle())
                .eqIfPresent(RecordApplyDO::getBusinessType, reqVO.getBusinessType())
                .eqIfPresent(RecordApplyDO::getApplyUserId, reqVO.getApplyUserId())
                .likeIfPresent(RecordApplyDO::getApplyUserName, reqVO.getApplyUserName())
                .eqIfPresent(RecordApplyDO::getApplyDepartmentName, reqVO.getApplyDepartmentName())
                .eqIfPresent(RecordApplyDO::getApplyDepartmentId, reqVO.getApplyDepartmentId())
                .eqIfPresent(RecordApplyDO::getReviewRange, reqVO.getReviewRange())
                .likeIfPresent(RecordApplyDO::getTargetDepartmentIds, reqVO.getTargetDepartmentIds())
                .eqIfPresent(RecordApplyDO::getTargetUserIds, reqVO.getTargetUserIds())
                .eqIfPresent(RecordApplyDO::getApplyContent, reqVO.getApplyContent())
                .eqIfPresent(RecordApplyDO::getChangeBefore, reqVO.getChangeBefore())
                .eqIfPresent(RecordApplyDO::getChangeAfter, reqVO.getChangeAfter())
                .eqIfPresent(RecordApplyDO::getPermanently, reqVO.getPermanently())
                .betweenIfPresent(RecordApplyDO::getApplyStartDate, reqVO.getApplyStartDate())
                .betweenIfPresent(RecordApplyDO::getApplyEndDate, reqVO.getApplyEndDate())
                .eqIfPresent(RecordApplyDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
                .eqIfPresent(RecordApplyDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(RecordApplyDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(RecordApplyDO::getId));
    }

//    List<RecordApplyDO> selectApplyByStatus(String businessType, java.util.List<Long> documentIds, java.util.List<String> businessStatuses);

    // 分页查询--文件分发
//    IPage<RecordApplyJoinPageVO> recordDistributePage(Page<RecordApplyPageReqVO> page,RecordApplyPageReqVO respVO);

// 分页查询--文件更改
//    IPage<RecordApplyJoinPageVO> recordUpdatePage(Page<RecordApplyPageReqVO> page, RecordApplyPageReqVO respVO);

    // 分页查询--文件作废
//    IPage<RecordApplyJoinPageVO> recordInvalidPage(Page<RecordApplyPageReqVO> page, RecordApplyPageReqVO respVO);
}