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

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.huyi.service.base.entity.SysCompanyRel;
import com.huyi.service.base.mapper.SysCompanyRelMapper;
import com.huyi.service.base.service.ISysCompanyRelService;
import com.keao.tianhu.starter.mybatis.plus.entity.QueryRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

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

    @Autowired
    private SysCompanyRelMapper sysCompanyRelMapper;

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

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

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void createSysCompanyRel(SysCompanyRel sysCompanyRel) {
        this.save(sysCompanyRel);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void updateSysCompanyRel(SysCompanyRel sysCompanyRel) {
        this.saveOrUpdate(sysCompanyRel);
    }

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