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

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

    @Autowired
    private PowerFailureInformationCaptureMapper powerFailureInformationCaptureMapper;

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

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

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void createPowerFailureInformationCapture(PowerFailureInformationCapture powerFailureInformationCapture) {
        this.save(powerFailureInformationCapture);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void updatePowerFailureInformationCapture(PowerFailureInformationCapture powerFailureInformationCapture) {
        this.saveOrUpdate(powerFailureInformationCapture);
    }

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