package com.rrtx.services.db.service.impl;

import com.rrtx.services.db.entity.PowerOverInfo;
import com.rrtx.services.db.mapper.PowerOverInfoMapper;
import com.rrtx.services.db.service.IPowerOverInfoService;
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.rrtx.fap.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: PowerOverInfoServiceImpl<br>
 * Description: IPowerOverInfoService实现 <br>
 * Company: rrtx
 *
 * @author zhangzz
 * @version v1.0.0    2021-02-02  zhangzz    由Generator自动创建
 */
@Service
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class PowerOverInfoServiceImpl extends ServiceImpl<PowerOverInfoMapper, PowerOverInfo> implements IPowerOverInfoService {

    @Autowired
    private PowerOverInfoMapper powerOverInfoMapper;

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

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

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void createPowerOverInfo(PowerOverInfo powerOverInfo) {
        this.save(powerOverInfo);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void updatePowerOverInfo(PowerOverInfo powerOverInfo) {
        this.saveOrUpdate(powerOverInfo);
    }

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