package org.dromara.demo.controller; import org.dromara.demo.domain.Student; import org.dromara.demo.service.IStudentRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.graphql.data.method.annotation.Argument; import org.springframework.graphql.data.method.annotation.QueryMapping; import org.springframework.stereotype.Controller; @Controller public class TestJPAController { @Autowired private IStudentRepository studentRepository; @QueryMapping public void addStudent(@Argument Student student){ studentRepository.save(student); } @QueryMapping public Student getStudent(@Argument Long id){ return studentRepository.findById(id).orElse(null); } }