package cn.iocoder.yudao.module.system.dal.mysql.tenantagencypackage;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.system.dal.dataobject.tenant.TenantPackageDO;
import cn.iocoder.yudao.module.system.dal.dataobject.tenantagencypackage.TenantAgencyPackageDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.system.controller.admin.tenantagencypackage.vo.*;

/**
 * 代理租户套餐 Mapper
 *
 * @author 总后台
 */
@Mapper
public interface TenantAgencyPackageMapper extends BaseMapperX<TenantAgencyPackageDO> {

    default PageResult<TenantAgencyPackageDO> selectPage(TenantAgencyPackagePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<TenantAgencyPackageDO>()
                .likeIfPresent(TenantAgencyPackageDO::getName, reqVO.getName())
                .eqIfPresent(TenantAgencyPackageDO::getStatus, reqVO.getStatus())
                .eqIfPresent(TenantAgencyPackageDO::getRemark, reqVO.getRemark())
                .eqIfPresent(TenantAgencyPackageDO::getMenuIds, reqVO.getMenuIds())
                .betweenIfPresent(TenantAgencyPackageDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(TenantAgencyPackageDO::getDays, reqVO.getDays())
                .eqIfPresent(TenantAgencyPackageDO::getPrice, reqVO.getPrice())
                .eqIfPresent(TenantAgencyPackageDO::getHostslClient, reqVO.getHostslClient())
                .eqIfPresent(TenantAgencyPackageDO::getBrotherClient, reqVO.getBrotherClient())
                .eqIfPresent(TenantAgencyPackageDO::getAiClient, reqVO.getAiClient())
                .eqIfPresent(TenantAgencyPackageDO::getPackageType, reqVO.getPackageType())
                .orderByDesc(TenantAgencyPackageDO::getId));
    }

    default List<TenantAgencyPackageDO> selectListByStatus(Integer status) {
        return selectList(TenantAgencyPackageDO::getStatus, status);
    }

    TenantAgencyPackageDO selectWithXml(Long packageId);
}