hjg
2024-02-05 301115d5e96b56cd093eee3fcff2d60a15184162
提交 | 用户 | 时间
58d006 1 package com.mandi.fendan.controller;
A 2
3
4
5 import javax.annotation.Resource;
6 import javax.servlet.http.HttpServletRequest;
7 import javax.servlet.http.HttpServletResponse;
8
9 import org.apache.log4j.Logger;
10 import org.springframework.stereotype.Controller;
11 import org.springframework.web.bind.annotation.RequestMapping;
12 import org.springframework.web.bind.annotation.RequestMethod;
13 import org.springframework.web.bind.annotation.ResponseBody;
14
15 import com.mandi.common.Jacksonmethod;
16 import com.mandi.common.RequestParam;
17 import com.mandi.common.SessionMethod;
18 import com.mandi.dao.common.ObjectResult;
19 import com.mandi.dao.common.PageRequest;
20 import com.mandi.dao.common.PageResult;
21 import com.mandi.fendan.persist.Fd_Systemconfig;
22 import com.mandi.fendan.service.Ifd_systemconfigService;
23
24
25
26 @Controller("fd_systemconfig_con")
27 @RequestMapping(value="/systemconfig",method={RequestMethod.POST})
28 public class Fd_SystemconfigController {
29     private Logger log=Logger.getLogger(Fd_SystemconfigController.class);
30     @Resource
31     private Ifd_systemconfigService isfs;
32     
33     @RequestMapping(value = "/getList.htm", method = {RequestMethod.POST })
34     @ResponseBody
35     public String getList(HttpServletRequest r,HttpServletResponse re){
36         int page=RequestParam.getInt(r, "page");
37         int pagesize=RequestParam.getInt(r, "pagesize");
38         int pages=RequestParam.getInt(r, "pages");
39         String name=RequestParam.getSqlString(r, "name");
40
41         PageRequest pr=new PageRequest(page,pagesize,null);
42         if(pages>0)
43             pr.setNeedPages(true);
44         else
45             pr.setNeedPages(false);
46         
47
48         PageResult<Fd_Systemconfig> prr = isfs.getlist(name,  pr);
49         SessionMethod.writeresp(re, Jacksonmethod.tojson(prr, false));
50         return null;
51     }
52
53     
54     @RequestMapping(value = "/saveItem.htm", method = {RequestMethod.POST })
55     @ResponseBody
56     public String saveItem(HttpServletRequest r,HttpServletResponse re){
57         Fd_Systemconfig fsf = RequestParam.getobj(r, new Fd_Systemconfig());
58         ObjectResult<Fd_Systemconfig> orr=new ObjectResult<Fd_Systemconfig>();
59         try {
60             orr = isfs.saveFd_Systemconfig(fsf);
61         } catch (Exception e) {
62             orr.setCode(1);
63             orr.setErrmsg(e.getMessage());
64         }
65
66         SessionMethod.writeresp(re, Jacksonmethod.tojson(orr, false));
67         return null;
68     }
69     @RequestMapping(value = "/getItem.htm", method = {RequestMethod.POST })
70     @ResponseBody
71     public String getItem(HttpServletRequest r,HttpServletResponse re){
72         String id=RequestParam.getSqlString(r, "id");
73
74         
75         ObjectResult<Fd_Systemconfig> orr=new ObjectResult<Fd_Systemconfig>();
76         try {
77             orr = isfs.getFd_Systemconfig(id);
78         } catch (Exception e) {
79             orr.setCode(1);
80             orr.setErrmsg(e.getMessage());
81         }
82
83         SessionMethod.writeresp(re, Jacksonmethod.tojson(orr, false));
84         return null;
85     }
86
87     
88 }