package com.dayou.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.dayou.entity.CustomerLinkman;
import com.dayou.mapper.CustomerLinkmanMapper;
import com.dayou.service.ICustomerLinkmanService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dayou.utils.LoginContext;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.dayou.utils.ExcelUtil;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
import java.util.ArrayList;
import org.springframework.transaction.annotation.Transactional;
import com.dayou.enums.BatchTaskTypeEnum;

/**
 * <p>
 * 企业客户联系人 服务实现类
 * </p>
 *
 * @author wucl
 * @since 2023-12-01
 */
@DS("mbs")
@Service
public class CustomerLinkmanServiceImpl extends ServiceImpl<CustomerLinkmanMapper, CustomerLinkman> implements ICustomerLinkmanService {


    @Override
    @SuppressWarnings("unchecked")
    public Page<CustomerLinkman> selectPage(Page page,CustomerLinkman customerLinkman){
        return this.page(page, new QueryWrapper<CustomerLinkman>(customerLinkman));
    }


    @Override
    public CustomerLinkman detail(Long id){
        return this.getById(id);
    }

    @Override
    public Boolean add(CustomerLinkman customerLinkman){
        customerLinkman.setClientManagerId(LoginContext.getCurrentUserId());
        return  this.save(customerLinkman);
    }

    @Override
    public Boolean update(CustomerLinkman customerLinkman){
        return  this.updateById(customerLinkman);
    }

    @Override
    public Boolean delete(Long id){
        //逻辑删除
        return this.removeById(id);
    }
}
