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.CommUser;
import com.ruoyi.system.mapper.CommUserMapper;
import com.ruoyi.system.service.ICommUserService;
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 CommUserServiceImpl extends ServiceImpl<CommUserMapper, CommUser> implements ICommUserService {
    @Autowired
    private CommUserMapper commUserMapper;

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

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

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

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


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