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

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.base.vo.CompanyRelativityPageReqVO;
import com.zt.plat.module.base.dal.dataobject.base.CompanyRelaDeptDO;
import com.zt.plat.module.base.dal.dataobject.base.CompanyRelativityDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 公司关系 Mapper
 *
 * @author 后台管理
 */
@Mapper
public interface CompanyRelativityMapper extends BaseMapperX<CompanyRelativityDO> {

    default PageResult<CompanyRelativityDO> selectPage(CompanyRelativityPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CompanyRelativityDO>()
                .likeIfPresent(CompanyRelativityDO::getErpNumber, reqVO.getErpNumber())
                .likeIfPresent(CompanyRelativityDO::getNumber, reqVO.getNumber())
                .betweenIfPresent(CompanyRelativityDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(CompanyRelativityDO::getId));
    }

    List<CompanyRelaDeptDO> getPageByReq(CompanyRelativityPageReqVO pageReqVO);

    void removeByIds(@Param("ids") List<Long> ids);
}