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