package com.zksy.info.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.info.domain.EContactManagement;
import com.zksy.info.service.EContactManagementService;
import com.zksy.info.mapper.EContactManagementMapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author Administrator
* @description 针对表【e_contact_management(联系人管理表)】的数据库操作Service实现
* @createDate 2025-06-27 10:06:49
*/
@Service
public class EContactManagementServiceImpl extends ServiceImpl<EContactManagementMapper, EContactManagement>
    implements EContactManagementService{

    @Override
    public Page<EContactManagement> findByPage(long pageNum, long pageSize, String contactName, String contactDepartment, String contactMobile) {
        Page<EContactManagement> page = new Page<>(pageNum,pageSize);
        LambdaQueryWrapper<EContactManagement> queryWrapper = new LambdaQueryWrapper();
        queryWrapper.like(contactName != null,EContactManagement::getContactName,contactName);
        queryWrapper.like(contactDepartment != null,EContactManagement::getContactDepartment,contactDepartment);
        queryWrapper.like(contactMobile != null,EContactManagement::getContactMobile,contactMobile);
        queryWrapper.orderByDesc(EContactManagement::getUpdateTime);
        Page<EContactManagement> page1 = this.page(page, queryWrapper);
        return page1;
    }

    @Override
    public List<EContactManagement> getEContactManagementList(String contactName, String contactDepartment, String contactMobile) {
        LambdaQueryWrapper<EContactManagement> queryWrapper = new LambdaQueryWrapper();
        queryWrapper.like(contactName != null,EContactManagement::getContactName,contactName);
        queryWrapper.like(contactDepartment != null,EContactManagement::getContactDepartment,contactDepartment);
        queryWrapper.like(contactMobile != null,EContactManagement::getContactMobile,contactMobile);
        queryWrapper.orderByDesc(EContactManagement::getUpdateTime);
        List<EContactManagement> list = this.list(queryWrapper);
        return list;
    }
}




