|
@@ -7,10 +7,15 @@ import com.huiju.estateagents.base.BaseController;
|
7
|
7
|
import com.huiju.estateagents.base.ResponseBean;
|
8
|
8
|
import com.huiju.estateagents.entity.TaSalesBatch;
|
9
|
9
|
import com.huiju.estateagents.service.ITaSalesBatchService;
|
|
10
|
+import io.swagger.models.auth.In;
|
10
|
11
|
import org.slf4j.Logger;
|
11
|
12
|
import org.slf4j.LoggerFactory;
|
12
|
13
|
import org.springframework.beans.factory.annotation.Autowired;
|
13
|
14
|
import org.springframework.web.bind.annotation.*;
|
|
15
|
+import sun.misc.Request;
|
|
16
|
+
|
|
17
|
+import javax.servlet.http.HttpServletRequest;
|
|
18
|
+import java.time.LocalDateTime;
|
14
|
19
|
|
15
|
20
|
/**
|
16
|
21
|
* <p>
|
|
@@ -21,7 +26,7 @@ import org.springframework.web.bind.annotation.*;
|
21
|
26
|
* @since 2020-02-10
|
22
|
27
|
*/
|
23
|
28
|
@RestController
|
24
|
|
-@RequestMapping("/")
|
|
29
|
+@RequestMapping("/api")
|
25
|
30
|
public class TaSalesBatchController extends BaseController {
|
26
|
31
|
|
27
|
32
|
private final Logger logger = LoggerFactory.getLogger(TaSalesBatchController.class);
|
|
@@ -36,17 +41,18 @@ public class TaSalesBatchController extends BaseController {
|
36
|
41
|
* @param pageSize
|
37
|
42
|
* @return
|
38
|
43
|
*/
|
39
|
|
- @RequestMapping(value="/taSalesBatch",method= RequestMethod.GET)
|
|
44
|
+ @RequestMapping(value="/admin/taSalesBatch",method= RequestMethod.GET)
|
40
|
45
|
public ResponseBean taSalesBatchList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
|
41
|
|
- @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize){
|
|
46
|
+ @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
|
|
47
|
+ @RequestParam(value ="salesBatchName", required = false) String salesBatchName,
|
|
48
|
+ @RequestParam(value ="buildingId", required = false) String buildingId,
|
|
49
|
+ @RequestParam(value = "status", required = false) Integer status, HttpServletRequest request){
|
42
|
50
|
ResponseBean responseBean = new ResponseBean();
|
43
|
51
|
try {
|
44
|
52
|
//使用分页插件
|
45
|
53
|
IPage<TaSalesBatch> pg = new Page<>(pageNum, pageSize);
|
46
|
|
- QueryWrapper<TaSalesBatch> queryWrapper = new QueryWrapper<>();
|
47
|
|
- queryWrapper.orderByDesc("create_date");
|
48
|
54
|
|
49
|
|
- IPage<TaSalesBatch> result = iTaSalesBatchService.page(pg, queryWrapper);
|
|
55
|
+ IPage<TaSalesBatch> result = iTaSalesBatchService.selectByCondition(pg, salesBatchName, buildingId, status, getOrgId(request));
|
50
|
56
|
responseBean.addSuccess(result);
|
51
|
57
|
}catch (Exception e){
|
52
|
58
|
e.printStackTrace();
|
|
@@ -61,10 +67,13 @@ public class TaSalesBatchController extends BaseController {
|
61
|
67
|
* @param taSalesBatch 实体对象
|
62
|
68
|
* @return
|
63
|
69
|
*/
|
64
|
|
- @RequestMapping(value="/taSalesBatch",method= RequestMethod.POST)
|
65
|
|
- public ResponseBean taSalesBatchAdd(@RequestBody TaSalesBatch taSalesBatch){
|
|
70
|
+ @RequestMapping(value="/admin/taSalesBatch",method= RequestMethod.POST)
|
|
71
|
+ public ResponseBean taSalesBatchAdd(@RequestBody TaSalesBatch taSalesBatch, HttpServletRequest request){
|
66
|
72
|
ResponseBean responseBean = new ResponseBean();
|
67
|
73
|
try {
|
|
74
|
+ taSalesBatch.setOrgId(getOrgId(request));
|
|
75
|
+ taSalesBatch.setCreateDate(LocalDateTime.now());
|
|
76
|
+ taSalesBatch.setUpdateTime(LocalDateTime.now());
|
68
|
77
|
if (iTaSalesBatchService.save(taSalesBatch)){
|
69
|
78
|
responseBean.addSuccess(taSalesBatch);
|
70
|
79
|
}else {
|
|
@@ -83,7 +92,7 @@ public class TaSalesBatchController extends BaseController {
|
83
|
92
|
* @param id 实体ID
|
84
|
93
|
*/
|
85
|
94
|
@ResponseBody
|
86
|
|
- @RequestMapping(value="/taSalesBatch/{id}", method= RequestMethod.DELETE)
|
|
95
|
+ @RequestMapping(value="/admin/taSalesBatch/{id}", method= RequestMethod.DELETE)
|
87
|
96
|
public ResponseBean taSalesBatchDelete(@PathVariable Integer id){
|
88
|
97
|
ResponseBean responseBean = new ResponseBean();
|
89
|
98
|
try {
|
|
@@ -106,11 +115,12 @@ public class TaSalesBatchController extends BaseController {
|
106
|
115
|
* @param taSalesBatch 实体对象
|
107
|
116
|
* @return
|
108
|
117
|
*/
|
109
|
|
- @RequestMapping(value="/taSalesBatch/{id}",method= RequestMethod.PUT)
|
|
118
|
+ @RequestMapping(value="/admin/taSalesBatch/{id}",method= RequestMethod.PUT)
|
110
|
119
|
public ResponseBean taSalesBatchUpdate(@PathVariable Integer id,
|
111
|
120
|
@RequestBody TaSalesBatch taSalesBatch){
|
112
|
121
|
ResponseBean responseBean = new ResponseBean();
|
113
|
122
|
try {
|
|
123
|
+ taSalesBatch.setSalesBatchId(id);
|
114
|
124
|
if (iTaSalesBatchService.updateById(taSalesBatch)){
|
115
|
125
|
responseBean.addSuccess(taSalesBatch);
|
116
|
126
|
}else {
|
|
@@ -128,7 +138,7 @@ public class TaSalesBatchController extends BaseController {
|
128
|
138
|
* 根据id查询对象
|
129
|
139
|
* @param id 实体ID
|
130
|
140
|
*/
|
131
|
|
- @RequestMapping(value="/taSalesBatch/{id}",method= RequestMethod.GET)
|
|
141
|
+ @RequestMapping(value="/admin/taSalesBatch/{id}",method= RequestMethod.GET)
|
132
|
142
|
public ResponseBean taSalesBatchGet(@PathVariable Integer id){
|
133
|
143
|
ResponseBean responseBean = new ResponseBean();
|
134
|
144
|
try {
|