package com.hzg.user;

import com.hzg.tools.Writer;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
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 javax.servlet.http.HttpServletResponse;

/**
 * Created by Administrator on 2017/3/16.
 */
@Controller
@RequestMapping("/user")
public class UserController {

    Logger logger = Logger.getLogger(UserController.class);

    @Autowired
    private UserDao userDao;

    @RequestMapping(value="/queryUser",method= RequestMethod.GET)
    public void queryUser(HttpServletResponse response, User user){
        logger.info("queryUser start, parameter:" + user.toString());

        User dbUser = userDao.queryUser(user);
        logger.info("queryUser end, result:" + dbUser.toString());

        Writer.writeObjectToJson(response, dbUser);
    }

    @RequestMapping(value="/updateUser",method= RequestMethod.GET)
    public void updateUser(HttpServletResponse response, User user){
        logger.info("updateUser start, parameter:" + user.toString());

        int result = userDao.updateUser(user);
        Writer.writeStringToJson(response, "{\"result\":\"" + result + "\"}");

        logger.info("updateUser end, result:" + result);
    }
}

@@ -186,24 +186,84 @@
 Controller;%0A
+import org.springframework.web.bind.annotation.RequestBody;%0A
 import org.s
@@ -379,103 +379,8 @@
 od;%0A
-import org.springframework.web.bind.annotation.ResponseBody;%0A%0Aimport javax.annotation.Resource;
 %0Aimp
@@ -422,16 +422,39 @@
 esponse;
+%0Aimport java.util.List;
 %0A%0A/**%0A *
@@ -704,32 +704,33 @@
 =%22/queryUser
+s
 %22,method
 = RequestMet
@@ -709,34 +709,36 @@
 eryUsers%22,method
+ 
 = 
+%7B
 RequestMethod.GE
@@ -730,32 +730,52 @@
 equestMethod.GET
+,RequestMethod.POST%7D
 )%0A    public voi
@@ -781,24 +781,25 @@
 id queryUser
+s
 (HttpServlet
@@ -808,32 +808,45 @@
 sponse response,
+ @RequestBody
  User user)%7B%0A   
@@ -868,24 +868,25 @@
 o(%22queryUser
+s
  start, para
@@ -926,19 +926,24 @@
     
-User dbU
+List%3CUser%3E u
 ser
+s
  = u
@@ -954,24 +954,25 @@
 ao.queryUser
+s
 (user);%0A    
@@ -993,24 +993,25 @@
 o(%22queryUser
+s
  end, result
@@ -1014,28 +1014,28 @@
 sult
-:%22 + dbUser.toString
+ size:%22 + users.size
 ());
@@ -1083,14 +1083,13 @@
 se, 
-dbU
+u
 ser
+s
 );%0A 

add receive feign request