forked from vector4wang/spring-boot-quick
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWebController.java
More file actions
33 lines (29 loc) · 900 Bytes
/
WebController.java
File metadata and controls
33 lines (29 loc) · 900 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package com.quick.controller;
import com.quick.entity.City;
import com.quick.mapper.CityMapper;
import net.sf.json.JSON;
import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* Created with IDEA
* User: vector
* Data: 2017/4/18
* Time: 10:14
* Description:
*/
@Controller
@RequestMapping("/web")
public class WebController {
@Autowired
private CityMapper cityMapper;
@RequestMapping("/hello")
public ResponseEntity<?> hello(){
City city = cityMapper.selectByPrimaryKey(12);
System.out.println(JSONObject.fromObject(city).toString());
return new ResponseEntity<Object>("hello", HttpStatus.OK);
}
}