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

import com.rrtx.services.db.entity.SuspectedPowerFailure;
import com.rrtx.services.db.mapper.SuspectedPowerFailureMapper;
import com.rrtx.services.db.service.ISuspectedPowerFailureService;
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: SuspectedPowerFailureServiceImpl<br>
 * Description: ISuspectedPowerFailureService实现 <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 SuspectedPowerFailureServiceImpl extends ServiceImpl<SuspectedPowerFailureMapper, SuspectedPowerFailure> implements ISuspectedPowerFailureService {

    @Autowired
    private SuspectedPowerFailureMapper suspectedPowerFailureMapper;

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

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

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void createSuspectedPowerFailure(SuspectedPowerFailure suspectedPowerFailure) {
        this.save(suspectedPowerFailure);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void updateSuspectedPowerFailure(SuspectedPowerFailure suspectedPowerFailure) {
        this.saveOrUpdate(suspectedPowerFailure);
    }

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