package com.huatek.busi.service.impl.transformer;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.alibaba.dubbo.config.annotation.Service;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.huatek.busi.dto.TransformerMicroDto;
import com.huatek.busi.entity.TransformerMicro;
import com.huatek.busi.mapper.TransformerMicroMapper;
import com.huatek.busi.service.impl.cac.AbstractCacEtlService;
import com.huatek.busi.service.transformer.TransformerMicroService;
import com.huatek.busi.vo.TransformerMicroVo;

/**
 * 变压器/电抗器——微水：021003 ServiceImpl
 *
 * @author anker_cheng
 * @date Jun 26, 2019 1:11:48 PM
 */
@Component
@Service(interfaceClass = TransformerMicroService.class)
@Transactional(rollbackFor = Exception.class)
public class TransformerMicroServiceImpl extends AbstractCacEtlService<TransformerMicro>
        implements TransformerMicroService {

    @Autowired
    private TransformerMicroMapper transformerMicroMapper;

    @Override
    public Page<TransformerMicroVo> findTransformerMicroPage(TransformerMicroDto transformerMicroDto) {
        if (transformerMicroDto.getPage() != null && transformerMicroDto.getLimit() != null) {
            PageHelper.startPage(transformerMicroDto.getPage(), transformerMicroDto.getLimit());
        }
        Page<TransformerMicroVo> transformerMicros = transformerMicroMapper
                .selectTransformerMicroPage(transformerMicroDto);
        return transformerMicros;
    }
}