package com.kym.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.kym.common.utils.CommUtil;
import com.kym.entity.InvestorInfo;
import com.kym.entity.queryParams.CommonQueryParam;
import com.kym.entity.common.PageBean;
import com.kym.mapper.InvestorInfoMapper;
import com.kym.service.InvestorInfoService;
import org.springframework.stereotype.Service;


/**
 * <p>
 * 投资者-物业信息表 服务实现类
 * </p>
 *
 * @author skyline
 * @since 2023-12-27
 */
@Service
public class InvestorInfoServiceImpl extends ServiceImpl<InvestorInfoMapper, InvestorInfo> implements InvestorInfoService {

    @Override
    public PageBean<InvestorInfo> list(CommonQueryParam params) {
        PageHelper.startPage(params.getPageNum(), params.getPageSize());
        var list = lambdaQuery()
                .like(CommUtil.isNotEmptyAndNull(params.getMobilePhone()), InvestorInfo::getTelephone, params.getMobilePhone())
                .like(CommUtil.isNotEmptyAndNull(params.getUsername()), InvestorInfo::getAdminUserName, params.getUsername())
                .orderByDesc(InvestorInfo::getUpdateTime)
                .list();
        return new PageBean<>(list);
    }
}
