12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- package com.edu.web;
- import com.edu.base.Page;
- import com.edu.service.user.UserService;
- import com.edu.base.ResponseEntity;
- import com.edu.user.pojo.User;
- import org.springframework.stereotype.Controller;
- import org.springframework.web.bind.annotation.PathVariable;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestMethod;
- import org.springframework.web.bind.annotation.ResponseBody;
- import javax.annotation.Resource;
- import java.util.List;
- /**
- * Created by KangJellen on 2017/4/24.
- */
- @Controller
- @RequestMapping("/user")
- public class UserAction {
- @Resource
- private UserService userServiceImpl;
- @RequestMapping(value = "/getUserName/{id}", method = RequestMethod.GET, produces = "application/json")
- @ResponseBody
- public ResponseEntity getUserName(@PathVariable Long id) {
- ResponseEntity ret = userServiceImpl.getNameById(id);
- return ret;
- }
- @RequestMapping(value = "/getUserList", method = RequestMethod.GET, produces = "application/json")
- @ResponseBody
- public ResponseEntity<List<User>> getUserList(User user) {
- if(user == null) {
- user = new User();
- }
- Page page = user.getPage();
- if(null == page){
- page = new Page();
- user.setPage(page);
- }
- ResponseEntity<List<User>> ret = userServiceImpl.getUserList(user);
- return ret;
- }
- }
|