package cn.iocoder.yudao.module.system.dal.mysql.biz;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.system.controller.admin.biz.vo.CommunicationRecordPageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.biz.FamilyCommunicationRecordDO;
import org.apache.ibatis.annotations.Mapper;


/**
 * 家属沟通记录 Mapper
 *
 * @author 系统管理员
 */
@Mapper
public interface FamilyCommunicationRecordMapper extends BaseMapperX<FamilyCommunicationRecordDO> {

    default PageResult<FamilyCommunicationRecordDO> selectPage(CommunicationRecordPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<FamilyCommunicationRecordDO>()
                .eqIfPresent(FamilyCommunicationRecordDO::getElderId, reqVO.getElderId())
                .betweenIfPresent(FamilyCommunicationRecordDO::getCommunicationTime, reqVO.getCommunicationTime())
                .eqIfPresent(FamilyCommunicationRecordDO::getCommunicationMethod, reqVO.getCommunicationMethod())
                .eqIfPresent(FamilyCommunicationRecordDO::getServicePerson, reqVO.getServicePerson())
                .likeIfPresent(FamilyCommunicationRecordDO::getFamilyName, reqVO.getFamilyName())
                .likeIfPresent(FamilyCommunicationRecordDO::getElderName, reqVO.getElderName())
                .eqIfPresent(FamilyCommunicationRecordDO::getRelationshipWithElder, reqVO.getRelationshipWithElder())
                .eqIfPresent(FamilyCommunicationRecordDO::getCommunicationContent, reqVO.getCommunicationContent())
                .eqIfPresent(FamilyCommunicationRecordDO::getSolutionEffect, reqVO.getSolutionEffect())
                .eqIfPresent(FamilyCommunicationRecordDO::getTenantId,reqVO.getTenantId())
                .orderByDesc(FamilyCommunicationRecordDO::getCreateTime));
    }

}