package com.fdage.service.impl;

import com.fdage.dao.base.TbEquipmentMapper;
import com.fdage.dao.cust.TbEquipmentMapperCust;
import com.fdage.pojo.TbEquipment;
import com.fdage.request.RequestEquipment;
import com.fdage.respon.ResponEquipment;
import com.fdage.service.IEquipmentService;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Hb_zzZ on 2019/9/11.
 */
@Service
public class EquipmentServiceImpl implements IEquipmentService{

    @Autowired
    private TbEquipmentMapper mapper;

    @Autowired
    private TbEquipmentMapperCust mapperCust;

    @Override
    public int insert(TbEquipment equipment) {
        return mapper.insertSelective(equipment);
    }

    @Override
    public int update(TbEquipment equipment) {
        return mapper.updateByPrimaryKeySelective(equipment);
    }

    @Override
    public List<ResponEquipment> findList(RequestEquipment bo) {
        int pageNum = bo.getPageNum() == 0? 1: bo.getPageNum();
        int pageSize = bo.getPageSize() == 0? 10: bo.getPageSize();
        PageHelper.startPage(pageNum, pageSize);
        return mapperCust.findList();
    }

}
