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> getUserList(User user) { if(user == null) { user = new User(); } Page page = user.getPage(); if(null == page){ page = new Page(); user.setPage(page); } ResponseEntity> ret = userServiceImpl.getUserList(user); return ret; } }