package com.ruoyi.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.system.domain.SyncVisit;
import com.ruoyi.system.mapper.SyncVisitMapper;
import com.ruoyi.system.service.ISyncVisitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 参数配置 服务层实现
 *
 * @author ruoyi
 */
@Service
@DataSource(value = DataSourceType.SLAVE)
public class SyncVisitServiceImpl extends ServiceImpl<SyncVisitMapper, SyncVisit> implements ISyncVisitService {
    @Autowired
    private SyncVisitMapper syncVisitMapper;

    public List<SyncVisit> listS() {
        List lst = syncVisitMapper.selectList(new QueryWrapper<SyncVisit>());
        return lst;
    }

    @Override
    public SyncVisit findOne(LambdaQueryWrapper<SyncVisit> eq) {
        return syncVisitMapper.selectOne(eq);
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public void Save(SyncVisit vo) {
        syncVisitMapper.insert(vo);
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public boolean saveOrUpdate(SyncVisit entity) {
        return super.saveOrUpdate(entity);
    }


    @Override
    public Integer selectCount(Wrapper<SyncVisit> queryWrapper) {
        return syncVisitMapper.selectCount(queryWrapper);
    }
}
