package com.zt.plat.module.qms.common.data.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.common.data.controller.vo.DataOpinionPageReqVO;
import com.zt.plat.module.qms.common.data.dal.dataobject.DataOpinionDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 审批意见 Mapper
 *
 * @author 后台管理
 */
@Mapper
public interface DataOpinionMapper extends BaseMapperX<DataOpinionDO> {

    default PageResult<DataOpinionDO> selectPage(DataOpinionPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DataOpinionDO>()
                .eqIfPresent(DataOpinionDO::getBusinessId, reqVO.getBusinessId())
                .eqIfPresent(DataOpinionDO::getFlowInstanceId, reqVO.getFlowInstanceId())
                .eqIfPresent(DataOpinionDO::getNodeKey, reqVO.getNodeKey())
                .likeIfPresent(DataOpinionDO::getNodeName, reqVO.getNodeName())
                .eqIfPresent(DataOpinionDO::getCustomKey, reqVO.getCustomKey())
                .eqIfPresent(DataOpinionDO::getOpinionUserId, reqVO.getOpinionUserId())
                .likeIfPresent(DataOpinionDO::getOpinionUserName, reqVO.getOpinionUserName())
                .eqIfPresent(DataOpinionDO::getOpinionDepartmentId, reqVO.getOpinionDepartmentId())
                .likeIfPresent(DataOpinionDO::getOpinionDepartmentName, reqVO.getOpinionDepartmentName())
                .betweenIfPresent(DataOpinionDO::getOpinionTime, reqVO.getOpinionTime())
                .eqIfPresent(DataOpinionDO::getOpinionContent, reqVO.getOpinionContent())
                .eqIfPresent(DataOpinionDO::getOpinionSignatureId, reqVO.getOpinionSignatureId())
                .eqIfPresent(DataOpinionDO::getCancelFlag, reqVO.getCancelFlag())
                .eqIfPresent(DataOpinionDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
                .eqIfPresent(DataOpinionDO::getSortNo, reqVO.getSortNo())
                .eqIfPresent(DataOpinionDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(DataOpinionDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(DataOpinionDO::getId));
    }

}