package com.zksy.property.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zksy.property.domain.ATenantInfo;
import com.zksy.property.mapper.ATenantInfoMapper;
import com.zksy.property.service.ATenantInfoService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author Administrator
* @description 针对表【a_tenant_info(租户信息表)】的数据库操作Service实现
* @createDate 2025-07-14 11:59:44
*/
@Service
public class ATenantInfoServiceImpl extends ServiceImpl<ATenantInfoMapper, ATenantInfo>
    implements ATenantInfoService{

    @Override
    public Page<ATenantInfo> findByPage(long pageNum, long pageSize, String tenantName, String tenantIdCard, String tenantInDate) {
        Page<ATenantInfo> page = new Page<>(pageNum,pageSize);
        LambdaQueryWrapper<ATenantInfo> queryWrapper = new LambdaQueryWrapper();
        queryWrapper.like(tenantName != null,ATenantInfo::getTenantName,tenantName);
        queryWrapper.like(tenantIdCard != null,ATenantInfo::getTenantIdCard,tenantIdCard);
        queryWrapper.like(tenantInDate != null,ATenantInfo::getTenantInDate,tenantInDate);
        Page<ATenantInfo> page1 = this.page(page, queryWrapper);
        return page1;
    }

    @Override
    public List<ATenantInfo> getATenantInfoList(String tenantName, String tenantIdCard, String tenantInDate) {
        LambdaQueryWrapper<ATenantInfo> queryWrapper = new LambdaQueryWrapper();
        queryWrapper.like(tenantName != null,ATenantInfo::getTenantName,tenantName);
        queryWrapper.like(tenantIdCard != null,ATenantInfo::getTenantIdCard,tenantIdCard);
        queryWrapper.like(tenantInDate != null,ATenantInfo::getTenantInDate,tenantInDate);
        List<ATenantInfo> list = this.list(queryWrapper);
        return list;
    }

    @Override
    public ATenantInfo getBySimplifiedHouseId(String simplifiedHouseId) {
        LambdaQueryWrapper<ATenantInfo> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(ATenantInfo::getSimplifiedHouseId,simplifiedHouseId);
        return this.getOne(queryWrapper);
    }
}




