package com.dayou.service.impl;

import com.dayou.entity.Visit;
import com.dayou.mapper.VisitMapper;
import com.dayou.service.IVisitService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dayou.vo.VisitVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import java.util.List;


/**
 * <p>
 * 拜访记录表 服务实现类
 * </p>
 *
 * @author wucl
 * @since 2023-01-10
 */
@Service
public class VisitServiceImpl extends ServiceImpl<VisitMapper, Visit> implements IVisitService {

    @Autowired
    private VisitMapper visitMapper;

    @Override
    @SuppressWarnings("unchecked")
    public Page<VisitVO> selectPage(Page page, VisitVO visit,String keyword){
        Page<VisitVO> result = visitMapper.page(page,visit,keyword);
        return result;
    }


    @Override
    public VisitVO detail(Long id){
        return visitMapper.detail(id);
    }

    @Override
    public Boolean add(Visit visit){
        return  this.save(visit);
    }

    @Override
    public Boolean update(Visit visit){
        return  this.updateById(visit);
    }

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

    @Override
    public List<VisitVO> getList(VisitVO visit, String keyword) {
        return visitMapper.getList(visit,keyword);
    }
}
