Commit 2514d928a64d316b03453fce3160e17e5e7bd38b
1 parent
a479f295
添加课后作ye,API
Showing
1 changed file
with
33 additions
and
8 deletions
src/com/fh/controller/sunvote/homework/HomeworkController.java
@@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.RequestMapping; | @@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.RequestMapping; | ||
19 | import org.springframework.web.bind.annotation.ResponseBody; | 19 | import org.springframework.web.bind.annotation.ResponseBody; |
20 | import org.springframework.web.servlet.ModelAndView; | 20 | import org.springframework.web.servlet.ModelAndView; |
21 | 21 | ||
22 | +import com.fh.controller.api.ResponseGson; | ||
22 | import com.fh.controller.base.BaseController; | 23 | import com.fh.controller.base.BaseController; |
23 | import com.fh.entity.Page; | 24 | import com.fh.entity.Page; |
24 | import com.fh.service.sunvote.homework.HomeworkManager; | 25 | import com.fh.service.sunvote.homework.HomeworkManager; |
@@ -51,9 +52,6 @@ public class HomeworkController extends BaseController { | @@ -51,9 +52,6 @@ public class HomeworkController extends BaseController { | ||
51 | @RequestMapping(value = "/save") | 52 | @RequestMapping(value = "/save") |
52 | public ModelAndView save() throws Exception { | 53 | public ModelAndView save() throws Exception { |
53 | logBefore(logger, Jurisdiction.getUsername() + "新增Homework"); | 54 | logBefore(logger, Jurisdiction.getUsername() + "新增Homework"); |
54 | - if (!Jurisdiction.buttonJurisdiction(menuUrl, "add")) { | ||
55 | - return null; | ||
56 | - } // 校验权限 | ||
57 | ModelAndView mv = this.getModelAndView(); | 55 | ModelAndView mv = this.getModelAndView(); |
58 | PageData pd = new PageData(); | 56 | PageData pd = new PageData(); |
59 | pd = this.getPageData(); | 57 | pd = this.getPageData(); |
@@ -89,9 +87,6 @@ public class HomeworkController extends BaseController { | @@ -89,9 +87,6 @@ public class HomeworkController extends BaseController { | ||
89 | @RequestMapping(value = "/edit") | 87 | @RequestMapping(value = "/edit") |
90 | public ModelAndView edit() throws Exception { | 88 | public ModelAndView edit() throws Exception { |
91 | logBefore(logger, Jurisdiction.getUsername() + "修改Homework"); | 89 | logBefore(logger, Jurisdiction.getUsername() + "修改Homework"); |
92 | - if (!Jurisdiction.buttonJurisdiction(menuUrl, "edit")) { | ||
93 | - return null; | ||
94 | - } // 校验权限 | ||
95 | ModelAndView mv = this.getModelAndView(); | 90 | ModelAndView mv = this.getModelAndView(); |
96 | PageData pd = new PageData(); | 91 | PageData pd = new PageData(); |
97 | pd = this.getPageData(); | 92 | pd = this.getPageData(); |
@@ -110,8 +105,6 @@ public class HomeworkController extends BaseController { | @@ -110,8 +105,6 @@ public class HomeworkController extends BaseController { | ||
110 | @RequestMapping(value = "/list") | 105 | @RequestMapping(value = "/list") |
111 | public ModelAndView list(Page page) throws Exception { | 106 | public ModelAndView list(Page page) throws Exception { |
112 | logBefore(logger, Jurisdiction.getUsername() + "列表Homework"); | 107 | logBefore(logger, Jurisdiction.getUsername() + "列表Homework"); |
113 | - // if(!Jurisdiction.buttonJurisdiction(menuUrl, "cha")){return null;} | ||
114 | - // //校验权限(无权查看时页面会有提示,如果不注释掉这句代码就无法进入列表页面,所以根据情况是否加入本句代码) | ||
115 | ModelAndView mv = this.getModelAndView(); | 108 | ModelAndView mv = this.getModelAndView(); |
116 | PageData pd = new PageData(); | 109 | PageData pd = new PageData(); |
117 | pd = this.getPageData(); | 110 | pd = this.getPageData(); |
@@ -268,4 +261,36 @@ public class HomeworkController extends BaseController { | @@ -268,4 +261,36 @@ public class HomeworkController extends BaseController { | ||
268 | Gson gson = new Gson(); | 261 | Gson gson = new Gson(); |
269 | return gson.toJson(pd); | 262 | return gson.toJson(pd); |
270 | } | 263 | } |
264 | + | ||
265 | + /** | ||
266 | + * 列表 | ||
267 | + * | ||
268 | + * @param page | ||
269 | + * @throws Exception | ||
270 | + */ | ||
271 | + @RequestMapping(value = "/listdata", produces = "application/json;charset=UTF-8") | ||
272 | + @ResponseBody | ||
273 | + public String listdata(Page page) throws Exception { | ||
274 | + PageData pd = new PageData(); | ||
275 | + pd = this.getPageData(); | ||
276 | + String keywords = pd.getString("keywords"); // 关键词检索条件 | ||
277 | + if (null != keywords && !"".equals(keywords)) { | ||
278 | + pd.put("keywords", keywords.trim()); | ||
279 | + } | ||
280 | + page.setPd(pd); | ||
281 | + List<PageData> varList = homeworkService.list(page); // 列出Homework列表 | ||
282 | + Gson gson = new Gson(); | ||
283 | + return gson.toJson(varList); | ||
284 | + } | ||
285 | + | ||
286 | + @RequestMapping(value = "/savedata") | ||
287 | + public String savedata() throws Exception { | ||
288 | + PageData pd = new PageData(); | ||
289 | + pd = this.getPageData(); | ||
290 | + pd.put("HOMEWORK_ID", this.get32UUID()); // 主键 | ||
291 | + homeworkService.save(pd); | ||
292 | + ResponseGson<String> responseGson = new ResponseGson<String>(); | ||
293 | + responseGson.setData(pd.getString("HOMEWORK_ID")); | ||
294 | + return responseGson.toJson(); | ||
295 | + } | ||
271 | } | 296 | } |