提交 | 用户 | 时间
|
58d006
|
1 |
package com.mandi.fendan.controller; |
A |
2 |
|
|
3 |
import java.util.HashMap; |
|
4 |
import java.util.Map; |
|
5 |
|
|
6 |
import javax.annotation.Resource; |
|
7 |
import javax.servlet.http.HttpServletRequest; |
|
8 |
import javax.servlet.http.HttpServletResponse; |
|
9 |
|
|
10 |
|
|
11 |
import org.apache.log4j.Logger; |
|
12 |
import org.springframework.stereotype.Controller; |
|
13 |
import org.springframework.web.bind.annotation.RequestMapping; |
|
14 |
import org.springframework.web.bind.annotation.RequestMethod; |
|
15 |
import org.springframework.web.bind.annotation.ResponseBody; |
|
16 |
|
|
17 |
import com.mandi.common.Jacksonmethod; |
|
18 |
import com.mandi.common.RequestParam; |
|
19 |
import com.mandi.common.SessionMethod; |
|
20 |
import com.mandi.dao.common.ObjectResult; |
|
21 |
import com.mandi.dao.common.PageRequest; |
|
22 |
import com.mandi.dao.common.PageResult; |
|
23 |
import com.mandi.fendan.persist.Fd_Erpconfig; |
|
24 |
import com.mandi.fendan.service.Ifd_erpconfigService; |
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
@Controller("fd_erpconfig_con") |
|
29 |
@RequestMapping(value="/erpconfig",method={RequestMethod.GET,RequestMethod.POST}) |
|
30 |
public class Fd_ErpconfigController { |
|
31 |
private Logger log=Logger.getLogger(Fd_ErpconfigController.class); |
|
32 |
@Resource |
|
33 |
private Ifd_erpconfigService ies; |
|
34 |
|
|
35 |
@RequestMapping(value = "/saveItem.htm", method = {RequestMethod.GET,RequestMethod.POST }) |
|
36 |
@ResponseBody |
|
37 |
public String saveItem(HttpServletRequest r,HttpServletResponse re){ |
|
38 |
Fd_Erpconfig fvc = RequestParam.getobj(r, new Fd_Erpconfig()); |
|
39 |
ObjectResult<Fd_Erpconfig> orr=new ObjectResult<Fd_Erpconfig>(); |
|
40 |
try { |
|
41 |
orr = ies.saveFd_Erpconfig(fvc); |
|
42 |
} catch (Exception e) { |
|
43 |
orr.setCode(1); |
|
44 |
orr.setErrmsg(e.getMessage()); |
|
45 |
} |
|
46 |
|
|
47 |
SessionMethod.writeresp(re, Jacksonmethod.tojson(orr, false)); |
|
48 |
return null; |
|
49 |
} |
|
50 |
|
|
51 |
|
|
52 |
@RequestMapping(value = "/getList.htm", method = {RequestMethod.GET,RequestMethod.POST }) |
|
53 |
@ResponseBody |
|
54 |
public String getList(HttpServletRequest r,HttpServletResponse re){ |
|
55 |
String uri=RequestParam.getSqlString(r, "searchword");//车牌号 |
|
56 |
int page=RequestParam.getInt(r, "page"); |
|
57 |
int pagesize=RequestParam.getInt(r, "pagesize"); |
|
58 |
int pages=RequestParam.getInt(r, "pages"); |
|
59 |
PageRequest pr=new PageRequest(page, pagesize, null); |
|
60 |
if(pages>0) |
|
61 |
pr.setNeedPages(true); |
|
62 |
else |
|
63 |
pr.setNeedPages(false); |
|
64 |
Map<String, Object> map = new HashMap<String,Object>(); |
|
65 |
map.put("uri", uri); |
|
66 |
PageResult<Fd_Erpconfig> prr = null; |
|
67 |
try { |
|
68 |
prr = ies.getList(map, pr); |
|
69 |
} catch (Exception e) { |
|
70 |
// TODO Auto-generated catch block |
|
71 |
e.printStackTrace(); |
|
72 |
} |
|
73 |
String str=Jacksonmethod.tojson(prr, false); |
|
74 |
SessionMethod.writeresp(re, str); |
|
75 |
return null; |
|
76 |
} |
|
77 |
@RequestMapping(value = "/getItem.htm", method = {RequestMethod.GET,RequestMethod.POST }) |
|
78 |
@ResponseBody |
|
79 |
public String getItem(HttpServletRequest r,HttpServletResponse re){ |
|
80 |
String id=RequestParam.getSqlString(r, "id"); |
|
81 |
|
|
82 |
|
|
83 |
ObjectResult<Fd_Erpconfig> orr=new ObjectResult<Fd_Erpconfig>(); |
|
84 |
try { |
|
85 |
orr = ies.getFd_Erpconfig(id); |
|
86 |
} catch (Exception e) { |
|
87 |
orr.setCode(1); |
|
88 |
orr.setErrmsg(e.getMessage()); |
|
89 |
} |
|
90 |
|
|
91 |
SessionMethod.writeresp(re, Jacksonmethod.tojson(orr, false)); |
|
92 |
return null; |
|
93 |
} |
|
94 |
@RequestMapping(value = "/delItem.htm", method = {RequestMethod.GET,RequestMethod.POST }) |
|
95 |
@ResponseBody |
|
96 |
public String delItem(HttpServletRequest r,HttpServletResponse re){ |
|
97 |
String id=RequestParam.getSqlString(r, "id"); |
|
98 |
|
|
99 |
ObjectResult<Boolean> orr=new ObjectResult<Boolean>(); |
|
100 |
try { |
|
101 |
orr = ies.delFd_Erpconfig(id); |
|
102 |
} catch (Exception e) { |
|
103 |
orr.setCode(1); |
|
104 |
orr.setErrmsg(e.getMessage()); |
|
105 |
} |
|
106 |
|
|
107 |
SessionMethod.writeresp(re, Jacksonmethod.tojson(orr, false)); |
|
108 |
return null; |
|
109 |
} |
|
110 |
|
|
111 |
|
|
112 |
|
|
113 |
} |