package com.zt.plat.module.base.dal.mysql.tmpltp;

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.base.controller.admin.templtp.vo.DepartmentInstanceRelativityPageReqVO;
import com.zt.plat.module.base.dal.dataobject.tmpltp.DepartmentInstanceRelativityDO;
import org.apache.ibatis.annotations.Mapper;


/**
 * 部门与实例关联 Mapper
 *
 * @author 后台管理
 */
@Mapper
public interface DepartmentInstanceRelativityMapper extends BaseMapperX<DepartmentInstanceRelativityDO> {

    default PageResult<DepartmentInstanceRelativityDO> selectPage(DepartmentInstanceRelativityPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DepartmentInstanceRelativityDO>()
                .eqIfPresent(DepartmentInstanceRelativityDO::getCompanyDepartmentId, reqVO.getCompanyDepartmentId())
                .eqIfPresent(DepartmentInstanceRelativityDO::getTemplateInstanceId, reqVO.getTemplateInstanceId())
                .betweenIfPresent(DepartmentInstanceRelativityDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(DepartmentInstanceRelativityDO::getId));
    }

}
