package com.example.springboot.service; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.example.springboot.entity.StorageRack; import com.example.springboot.mapper.StorageRackMapper; @Service public class StorageRackService { @Autowired private StorageRackMapper storageRackMapper; public void Save(StorageRack user) { if (user.getId() == null) { storageRackMapper.insert(user); } else { storageRackMapper.update(user); } } }