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.AHouseInfoDetail;
import com.zksy.property.mapper.AHouseInfoDetailMapper;
import com.zksy.property.service.AHouseInfoDetailService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author Administrator
* @description 针对表【a_house_info_detail(房屋详细信息表)】的数据库操作Service实现
* @createDate 2025-07-14 11:59:44
*/
@Service
public class AHouseInfoDetailServiceImpl extends ServiceImpl<AHouseInfoDetailMapper, AHouseInfoDetail>
    implements AHouseInfoDetailService{
    @Override
    public AHouseInfoDetail getBySimplifiedHouseId(String simplifiedHouseId) {
        LambdaQueryWrapper<AHouseInfoDetail> aHouseInfoDetailLambdaQueryWrapper = new LambdaQueryWrapper<>();
        aHouseInfoDetailLambdaQueryWrapper.eq(AHouseInfoDetail::getSimplifiedHouseId,simplifiedHouseId);
        return this.getOne(aHouseInfoDetailLambdaQueryWrapper);
    }

    @Override
    public Page<AHouseInfoDetail> findByPage(long pageNum, long pageSize, String area, String introduce, String houseType) {
        Page<AHouseInfoDetail> page = new Page<>(pageNum,pageSize);
        LambdaQueryWrapper<AHouseInfoDetail> queryWrapper = new LambdaQueryWrapper();
        queryWrapper.like(area != null,AHouseInfoDetail::getArea,area);
        queryWrapper.like(introduce != null,AHouseInfoDetail::getIntroduce,introduce);
        queryWrapper.like(houseType != null,AHouseInfoDetail::getHouseType,houseType);
        Page<AHouseInfoDetail> page1 = this.page(page, queryWrapper);
        return page1;
    }

    @Override
    public List<AHouseInfoDetail> getAHouseInfoDetailList(String area, String introduce, String houseType) {
        LambdaQueryWrapper<AHouseInfoDetail> queryWrapper = new LambdaQueryWrapper();
        queryWrapper.like(area != null,AHouseInfoDetail::getArea,area);
        queryWrapper.like(introduce != null,AHouseInfoDetail::getIntroduce,introduce);
        queryWrapper.like(houseType != null,AHouseInfoDetail::getHouseType,houseType);
        List<AHouseInfoDetail> list = this.list(queryWrapper);
        return list;
    }
}




