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

import com.huyi.service.base.entity.SysCompany;
import com.huyi.service.base.mapper.SysCompanyMapper;
import com.huyi.service.base.service.ISysCompanyService;
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: SysCompanyServiceImpl<br>
 * Description: ISysCompanyService实现 <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 SysCompanyServiceImpl extends ServiceImpl<SysCompanyMapper, SysCompany> implements ISysCompanyService {

    @Autowired
    private SysCompanyMapper sysCompanyMapper;

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

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

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void createSysCompany(SysCompany sysCompany) {
        this.save(sysCompany);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void updateSysCompany(SysCompany sysCompany) {
        this.saveOrUpdate(sysCompany);
    }

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