Springboot 整合 Mybatis 的完整 Web 案例

This commit is contained in:
JeffLi1993
2017-02-07 18:05:37 +08:00
committed by liqiangqiang
parent 8474f311fb
commit 52a7cde071
12 changed files with 325 additions and 37 deletions

View File

@@ -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);
}
}