package com.lz.modules.equipment.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lz.common.utils.ISelect;
import com.lz.common.utils.PageUtils;
import com.lz.modules.equipment.dao.EquipmentTypeMapper;
import com.lz.modules.equipment.entity.EquipmentType;
import com.lz.modules.equipment.entity.EquipmentTypeReq;
import com.lz.modules.equipment.service.IEquipmentTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* <p>
*  服务类
* </p>
*
* @author quyixiao
* @since 2020-07-24
*/

@Service
public class EquipmentTypeServiceImpl extends ServiceImpl<EquipmentTypeMapper, EquipmentType> implements IEquipmentTypeService {


    @Autowired
	private EquipmentTypeMapper equipmentTypeMapper;



	@Override
	public EquipmentType selectEquipmentTypeById(Long id){
		return equipmentTypeMapper.selectEquipmentTypeById(id);
	}



	@Override
	public Long insertEquipmentType(EquipmentType equipmentType){
		return equipmentTypeMapper.insertEquipmentType(equipmentType);
	}



	@Override
	public int updateEquipmentTypeById(EquipmentType equipmentType){
		return equipmentTypeMapper.updateEquipmentTypeById(equipmentType);
	}



	@Override
	public int updateCoverEquipmentTypeById(EquipmentType equipmentType){
		return equipmentTypeMapper.updateCoverEquipmentTypeById(equipmentType);
	}



	@Override
	public int deleteEquipmentTypeById(Long id){
		return equipmentTypeMapper.deleteEquipmentTypeById(id);
	}


	@Override
	public List<EquipmentType> listEquipmentTypes() {
		return equipmentTypeMapper.listEquipmentTypes();
	}

	@Override
	public EquipmentType selectByType(String type) {

		return equipmentTypeMapper.selectEquipmentTypeByType(type);
	}


	@Override
    public List<EquipmentType> selectEquipmentTypeByType(String type) {
        return equipmentTypeMapper.selectByType(type);
    }

    @Override
    public List<EquipmentType> selectAll() {
        return equipmentTypeMapper.selectAll();
    }

    @Override
    public PageUtils selectByCondition(EquipmentTypeReq req) {
		PageUtils pageUtils = PageUtils.startPage(req.getPage(), req.getRows()).doSelect(
				page -> equipmentTypeMapper.selectByCondition(page, req)
		);
		return pageUtils;
		/*return PageUtils.startPage(req.getPage(),req.getRows()).doSelect(new ISelect() {
			@Override
			public List doSelect(Page page) {
				return equipmentTypeMapper.selectByCondition(page,req);
			}
		});*/
    }
}
