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.SecUser;
import com.ruoyi.system.mapper.SecUserMapper;
import com.ruoyi.system.service.ISecUserService;
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 SecUserServiceImpl extends ServiceImpl<SecUserMapper, SecUser> implements ISecUserService {
    @Autowired
    private SecUserMapper secUserMapper;

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

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

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

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


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