package com.kym.service.admin.impl;

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


/**
 * <p>
 * 投资者-物业信息表 服务实现类
 * </p>
 *
 * @author skyline
 * @since 2023-12-27
 */
@Service
@DS("db-admin")
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);
    }
}
