package com.nantian.cloud.dbcapp.carbon.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.nantian.cloud.dbcapp.carbon.domain.ent.InstrumentEquipment;
import com.nantian.cloud.dbcapp.carbon.mapper.InstrumentEquipmentDao;
import com.nantian.cloud.dbcapp.carbon.service.InstrumentEquipmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class InstrumentEquipmentServiceImpl extends ServiceImpl<InstrumentEquipmentDao, InstrumentEquipment> implements InstrumentEquipmentService {



    @Override
    public InstrumentEquipment findByCategoryCode(Long categoryCode,String entCode) {

        //检查数据库是否有code相同的对象
        InstrumentEquipment instrumentEquipment = baseMapper.findByCategoryCode(categoryCode,entCode);
        return instrumentEquipment;
    }

    @Override
    public List<InstrumentEquipment> selectByEntId(String entId) {
        return baseMapper.getListAll(entId);
    }

    @Override
    public int deleteByInsId(String id, String entId) {
        return baseMapper.deleteByInsId(id,entId);
    }

    @Override
    public int updateByInsId(InstrumentEquipment entity) {
        return baseMapper.updateByInsId(entity);
    }

    @Override
    public IPage<InstrumentEquipment> getList(Page page, String entCode) {
        return baseMapper.getList(page,entCode);
    }

    @Override
    public String getEntId( String entCode) {
        return baseMapper.getEntId(entCode);
    }
}
