提交 | 用户 | 时间
|
062075
|
1 |
package com.mandi.fendan.controller; |
A |
2 |
|
|
3 |
import com.mandi.common.Jacksonmethod; |
|
4 |
import com.mandi.common.SessionMethod; |
|
5 |
import com.mandi.dao.common.ObjectResult; |
|
6 |
import com.mandi.dao.common.PageRequest; |
|
7 |
import com.mandi.dao.common.PageResult; |
|
8 |
import com.mandi.fendan.mapper.BusinessVehiclePersonMapper; |
|
9 |
import com.mandi.fendan.persist.BusinessVehiclePerson; |
|
10 |
import com.sun.org.apache.xpath.internal.operations.Bool; |
|
11 |
import org.apache.commons.lang3.time.DateFormatUtils; |
|
12 |
import org.springframework.stereotype.Controller; |
|
13 |
import org.springframework.stereotype.Service; |
|
14 |
import org.springframework.web.bind.annotation.RequestMapping; |
|
15 |
|
|
16 |
import javax.annotation.Resource; |
|
17 |
import javax.servlet.http.HttpServletRequest; |
|
18 |
import javax.servlet.http.HttpServletResponse; |
|
19 |
import java.util.Date; |
|
20 |
import java.util.HashMap; |
|
21 |
import java.util.List; |
|
22 |
import java.util.Map; |
|
23 |
|
|
24 |
@Controller |
|
25 |
@RequestMapping("/businessVehiclePerson") |
|
26 |
public class BusinessVehiclePersonController { |
|
27 |
@Resource |
|
28 |
BusinessVehiclePersonMapper businessVehiclePersonMapper; |
|
29 |
@RequestMapping("/listAll.htm") |
|
30 |
void listAll(int page, int pageSize, HttpServletResponse re){ |
|
31 |
Map map = new HashMap(); |
|
32 |
map.put("pageSize",50); |
|
33 |
List<BusinessVehiclePerson> list = businessVehiclePersonMapper.selectPage(map); |
|
34 |
PageResult<BusinessVehiclePerson> prr= new PageResult<>(); |
|
35 |
prr.setList(list); |
|
36 |
String str= Jacksonmethod.tojson(prr, false); |
|
37 |
SessionMethod.writeresp(re, str); |
|
38 |
} |
|
39 |
|
|
40 |
@RequestMapping("/list.htm") |
|
41 |
void list(String businessNo, String vehicleId, HttpServletRequest r, HttpServletResponse re){ |
|
42 |
List<BusinessVehiclePerson> list = businessVehiclePersonMapper.selectList(businessNo,vehicleId); |
|
43 |
PageResult<BusinessVehiclePerson> prr= new PageResult<>(); |
|
44 |
prr.setList(list); |
|
45 |
String str= Jacksonmethod.tojson(prr, false); |
|
46 |
SessionMethod.writeresp(re, str); |
|
47 |
} |
|
48 |
@RequestMapping("/get.htm") |
|
49 |
void getById(Long id, HttpServletResponse re){ |
|
50 |
BusinessVehiclePerson businessVehiclePerson = businessVehiclePersonMapper.selectById(id); |
|
51 |
ObjectResult<BusinessVehiclePerson> prr= new ObjectResult<>(); |
|
52 |
prr.setItem(businessVehiclePerson); |
|
53 |
String str= Jacksonmethod.tojson(prr, false); |
|
54 |
SessionMethod.writeresp(re, str); |
|
55 |
} |
|
56 |
@RequestMapping("/update.htm") |
|
57 |
void update(BusinessVehiclePerson businessVehiclePerson,HttpServletResponse re){ |
|
58 |
ObjectResult<Boolean> objectResult = new ObjectResult<>(); |
|
59 |
try { |
|
60 |
BusinessVehiclePerson old = businessVehiclePersonMapper.selectById(businessVehiclePerson.getId()); |
|
61 |
businessVehiclePerson.setCreateTime(old.getCreateTime()); |
|
62 |
businessVehiclePerson.setUpdateTime(DateFormatUtils.format(new Date(),"yyyy-MM-dd HH:mm:ss")); |
|
63 |
businessVehiclePersonMapper.update(businessVehiclePerson); |
|
64 |
objectResult.setCode(0); |
|
65 |
} catch (Exception e) { |
|
66 |
objectResult.setCode(1); |
|
67 |
objectResult.setErrmsg("系统繁忙,请稍后再试!"); |
|
68 |
} |
|
69 |
String str= Jacksonmethod.tojson(objectResult, false); |
|
70 |
SessionMethod.writeresp(re, str); |
|
71 |
} |
|
72 |
@RequestMapping("/add.htm") |
|
73 |
void add(BusinessVehiclePerson businessVehiclePerson,HttpServletResponse re){ |
|
74 |
ObjectResult<Boolean> objectResult = new ObjectResult<>(); |
|
75 |
try { |
|
76 |
businessVehiclePerson.setCreateTime(DateFormatUtils.format(new Date(),"yyyy-MM-dd HH:mm:ss")); |
|
77 |
businessVehiclePersonMapper.insert(businessVehiclePerson); |
|
78 |
objectResult.setCode(0); |
|
79 |
} catch (Exception e) { |
|
80 |
objectResult.setCode(1); |
|
81 |
objectResult.setErrmsg("系统繁忙,请稍后再试!"); |
|
82 |
} |
|
83 |
String str= Jacksonmethod.tojson(objectResult, false); |
|
84 |
SessionMethod.writeresp(re, str); |
|
85 |
} |
|
86 |
@RequestMapping("/del.htm") |
|
87 |
void del(Long id,HttpServletResponse re){ |
|
88 |
ObjectResult<Boolean> objectResult = new ObjectResult<>(); |
|
89 |
try { |
|
90 |
businessVehiclePersonMapper.delete(id); |
|
91 |
objectResult.setCode(0); |
|
92 |
} catch (Exception e) { |
|
93 |
objectResult.setCode(1); |
|
94 |
objectResult.setErrmsg("系统繁忙,请稍后再试!"); |
|
95 |
} |
|
96 |
String str= Jacksonmethod.tojson(objectResult, false); |
|
97 |
SessionMethod.writeresp(re, str); |
|
98 |
} |
|
99 |
} |