package com.yuchen.saas.park.service.service.building.impl;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yuchen.saas.park.api.dto.building.PmgBatBuildingManagerQueryDto;
import com.yuchen.saas.park.api.entity.building.PmgBatBuildingManager;
import com.yuchen.saas.park.service.mapper.building.PmgBatBuildingManagerMapper;
import com.yuchen.saas.park.service.service.building.IPmgBatBuildingManagerService;
import org.nest.springwrap.core.mp.base.BaseServiceImpl;
import org.nest.springwrap.core.tool.utils.Func;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 客户经理表 服务实现类
 * </p>
 *
 * @author yuanzhelin
 * @since 2024-10-17
 */
@Service
public class PmgBatBuildingManagerServiceImpl extends BaseServiceImpl<PmgBatBuildingManagerMapper, PmgBatBuildingManager> implements IPmgBatBuildingManagerService {

    @Override
    public Page<PmgBatBuildingManager> pages(PmgBatBuildingManagerQueryDto dto) {
        Page<PmgBatBuildingManager> page = new Page<>(dto.getCurrent(), dto.getSize());
        LambdaQueryWrapper<PmgBatBuildingManager> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(Func.isNotEmpty(dto.getProjectId()),PmgBatBuildingManager::getProjectId, dto.getProjectId());
        wrapper.like(Func.isNotEmpty(dto.getClientManager()),PmgBatBuildingManager::getClientManager, dto.getClientManager());
        wrapper.eq(Func.isNotEmpty(dto.getPhone()),PmgBatBuildingManager::getPhone, dto.getPhone());
        return this.page(page,wrapper);
    }
}
