首页>代码>spring boot使用mongodb数据库实现简单的数据插入和查询实例>/springboot-mongdb/src/main/java/com/singahnd/controller/StudentController.java
package com.singahnd.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import com.singahnd.entity.Student; import com.singahnd.service.StudentService; /** ************************************************* * @ClassName: StudentController * @Description: TODO(学生控制类) * @author mjy * @date 2018年5月24日 下午2:42:22 ************************************************ */ @RestController @RequestMapping(value = "student", method = RequestMethod.POST) public class StudentController { @Autowired private StudentService studentService; @RequestMapping(value = "inserStudent") public String inserStudent(@RequestBody Student student) { boolean inserStudentOne = studentService.inserStudentOne(student); if (inserStudentOne) { return "成功"; } else { return "失败"; } } @RequestMapping(value = "queryStudent") public Student queryStudent(@RequestBody Student student) { return studentService.queryStudentById(student.getStudentId()); } }

微信网友_7134912998903808 LV15
2024年9月13日
876318269 LV6
2023年11月3日
asd6260647 LV4
2022年6月2日
天险无涯 LV15
2021年11月5日
sunlzh888888 LV29
2021年6月24日
wcy071213 LV27
2021年5月16日
Missqq LV4
2020年4月27日
NoNameLwj LV2
2020年2月23日
壹级天灾 LV14
2019年12月12日
寒江雪2017 LV10
2019年11月26日

ma406805131 LV19
2024年12月22日
微信网友_7134912998903808 LV15
2024年9月13日
405117548 LV6
2024年6月20日
smart001
2024年1月6日
暂无贡献等级
漫步的海星 LV4
2023年9月21日
1529860026 LV24
2023年7月19日
crosa_Don LV18
2023年2月8日
yohohero LV1
2023年1月15日
rain112 LV31
2022年12月13日
Super强 LV13
2022年10月21日