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

import com.rrtx.services.db.entity.PowerLowInfo;
import com.rrtx.services.db.mapper.PowerLowInfoMapper;
import com.rrtx.services.db.service.IPowerLowInfoService;
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: PowerLowInfoServiceImpl<br>
 * Description: IPowerLowInfoService实现 <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 PowerLowInfoServiceImpl extends ServiceImpl<PowerLowInfoMapper, PowerLowInfo> implements IPowerLowInfoService {

    @Autowired
    private PowerLowInfoMapper powerLowInfoMapper;

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

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

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void createPowerLowInfo(PowerLowInfo powerLowInfo) {
        this.save(powerLowInfo);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void updatePowerLowInfo(PowerLowInfo powerLowInfo) {
        this.saveOrUpdate(powerLowInfo);
    }

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