mirror of
https://github.com/JeffLi1993/springboot-learning-example.git
synced 2026-03-14 22:23:54 +08:00
Springboot 整合 Mybatis 的完整 Web 案例
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package org.spring.springboot.controller;
|
||||
|
||||
import org.spring.springboot.domain.City;
|
||||
import org.spring.springboot.service.CityService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* Created by bysocket on 07/02/2017.
|
||||
*/
|
||||
@RestController
|
||||
public class CityRestController {
|
||||
|
||||
@Autowired
|
||||
private CityService cityService;
|
||||
|
||||
@RequestMapping(value = "/api/city", method = RequestMethod.GET)
|
||||
public City findOneCity(@RequestParam(value = "cityName", required = true) String cityName) {
|
||||
return cityService.findCityByName(cityName);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user