package com.platform.test;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.platform.entities.EncodedInfoEntity;
import com.platform.service.EncodeInfoService;

@Controller
public class TestController {
	// private static Logger logger = Logger.getLogger(TestController.class);
    @Resource(name = "encodeInfoService")
    private EncodeInfoService eis;

	public void setEis(EncodeInfoService eis) {
		this.eis = eis;
	}

	@RequestMapping("/hello")
	@ResponseBody
	public List<EncodedInfoEntity> hello(String name, HttpServletResponse res) {
		System.out.println(name);		
		return eis.getAllEncodeInfo("system_info");		
	}

	@RequestMapping("/json")
	@ResponseBody
	public List<User> getJson(HttpServletRequest res, HttpServletResponse req) {
		List<User> list = new ArrayList<User>();
		list.add(new User("lisi", 1, "男"));
		list.add(new User("zhansan", 2, "男"));
		return list;
	}

	@RequestMapping("log")
	public void testLog(HttpServletResponse res) {
		System.out.println(eis.getEncodeNameByCode("1", "system_info"));
	}
	
	@RequestMapping("/data111.json")
	public void test(String name, HttpServletResponse res){
		
		
	}
}
