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.query.LambdaQueryWrapperX;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.module.qms.resource.record.controller.admin.recordassign.vo.RecordAssignPageReqVO;
import com.zt.plat.module.qms.resource.record.dal.dataobject.recordassign.RecordAssignDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 文件记录分发号,记录文件分发与线下对应的分发号对应，且标记到目标人物 Mapper
 *
 * @author YBP
 */
@Mapper
public interface RecordAssignMapper extends BaseMapperX<RecordAssignDO> {

    default PageResult<RecordAssignDO> selectPage(RecordAssignPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<RecordAssignDO>()
                .eqIfPresent(RecordAssignDO::getMainId, reqVO.getMainId())
                .eqIfPresent(RecordAssignDO::getCurrentFlag, reqVO.getCurrentFlag())
                .eqIfPresent(RecordAssignDO::getTargetType, reqVO.getTargetType())
                .likeIfPresent(RecordAssignDO::getTargetName, reqVO.getTargetName())
                .eqIfPresent(RecordAssignDO::getTargetId, reqVO.getTargetId())
                .eqIfPresent(RecordAssignDO::getAssignCode, reqVO.getAssignCode())
                .eqIfPresent(RecordAssignDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
                .eqIfPresent(RecordAssignDO::getSortNo, reqVO.getSortNo())
                .eqIfPresent(RecordAssignDO::getPermanently, reqVO.getPermanently())
                .eqIfPresent(RecordAssignDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(RecordAssignDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(RecordAssignDO::getId));
    }

}