package com.huyi.service.base.service.impl;

import com.huyi.service.base.entity.SysUserCompanyRel;
import com.huyi.service.base.mapper.SysUserCompanyRelMapper;
import com.huyi.service.base.service.ISysUserCompanyRelService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.beans.factory.annotation.Autowired;
import com.keao.tianhu.starter.mybatis.plus.entity.QueryRequest;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;



import java.util.List;

/**
 * ClassName: SysUserCompanyRelServiceImpl<br>
 * Description: ISysUserCompanyRelService实现 <br>
 * Company: keao
 *
 * @author songqg
 * @version v1.0.0    2021-08-21  songqg    由Generator自动创建
 */
@Service
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class SysUserCompanyRelServiceImpl extends ServiceImpl<SysUserCompanyRelMapper, SysUserCompanyRel> implements ISysUserCompanyRelService {

    @Autowired
    private SysUserCompanyRelMapper sysUserCompanyRelMapper;

    @Override
    public IPage<SysUserCompanyRel> findSysUserCompanyRels(QueryRequest request, LambdaQueryWrapper<SysUserCompanyRel> wrapper) {
        Page<SysUserCompanyRel> page = new Page<>(request.getPageNum(), request.getPageSize());
        return this.page(page, wrapper);
    }

    @Override
    public List<SysUserCompanyRel> findSysUserCompanyRels(LambdaQueryWrapper<SysUserCompanyRel> wrapper) {
		return this.list(wrapper);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void createSysUserCompanyRel(SysUserCompanyRel sysUserCompanyRel) {
        this.save(sysUserCompanyRel);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void updateSysUserCompanyRel(SysUserCompanyRel sysUserCompanyRel) {
        this.saveOrUpdate(sysUserCompanyRel);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void deleteSysUserCompanyRel(LambdaQueryWrapper<SysUserCompanyRel> wrapper) {
	    this.remove(wrapper);
	}
}
