@@ -0,0 +1,1664 @@
+package com.lance.jpa.web;%0A%0Aimport java.util.HashMap;%0Aimport java.util.List;%0Aimport java.util.Map;%0A%0Aimport org.springframework.beans.factory.annotation.Autowired;%0Aimport org.springframework.web.bind.annotation.PathVariable;%0Aimport org.springframework.web.bind.annotation.RequestMapping;%0Aimport org.springframework.web.bind.annotation.RequestMethod;%0Aimport org.springframework.web.bind.annotation.RestController;%0A%0Aimport com.alibaba.fastjson.JSON;%0Aimport com.lance.jpa.domain.Teacher;%0Aimport com.lance.jpa.service.TeacherService;%0A%0A@RestController%0Apublic class IndexController %7B%0A%09@Autowired%0A%09private TeacherService teacherService;%0A%09%0A%09@RequestMapping(value=%22list%22, method=RequestMethod.POST)%0A%09public String list()%7B%0A%09%09Map%3CString, Object%3E map = new HashMap%3C%3E();%0A%09%09List%3CTeacher%3E infos = teacherService.findAll();%0A%09%09map.put(%22rows%22, infos);%0A%09%09map.put(%22total%22, infos.size());%0A%09%09return JSON.toJSONString(map);%0A%09%7D%0A%09%0A%09/**%0A%09 * %E4%BF%9D%E5%AD%98%E5%AE%9A%E6%97%B6%E4%BB%BB%E5%8A%A1%0A%09 * @param info%0A%09 * 2016%E5%B9%B410%E6%9C%889%E6%97%A5%E4%B8%8B%E5%8D%881:36:59%0A%09 */%0A%09@RequestMapping(value=%22save%22, method=RequestMethod.POST, produces = %22application/json; charset=UTF-8%22)%0A%09public String save(Teacher info)%7B%0A%09%09teacherService.saveAndFlush(info);%0A%09%09Map%3CString, Object%3E map = new HashMap%3C%3E();%0A%09%09map.put(%22errorCode%22, 0);%0A%09%09map.put(%22errorText%22, null);%0A%09%09return JSON.toJSONString(map);%0A%09%7D%0A%09%0A%09/**%0A%09 * %E5%88%A0%E9%99%A4%E5%AE%9A%E6%97%B6%E4%BB%BB%E5%8A%A1%0A%09 * @param jobName%0A%09 * @param jobGroup%0A%09 * 2016%E5%B9%B410%E6%9C%889%E6%97%A5%E4%B8%8B%E5%8D%881:52:20%0A%09 */%0A%09@RequestMapping(value=%22delete/%7Bid%7D%22, produces = %22application/json; charset=UTF-8%22)%0A%09public String delete(@PathVariable int id)%7B%0A%09%09teacherService.delete(id);%0A%09%09Map%3CString, Object%3E map = new HashMap%3C%3E();%0A%09%09map.put(%22errorCode%22, 0);%0A%09%09map.put(%22errorText%22, null);%0A%09%09return JSON.toJSONString(map);%0A%09%7D%0A%7D%0A

add index controller