|
@@ -6,7 +6,11 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
6
|
6
|
import com.huiju.estateagents.base.BaseController;
|
7
|
7
|
import com.huiju.estateagents.base.ResponseBean;
|
8
|
8
|
import com.huiju.estateagents.entity.ExtendContent;
|
|
9
|
+import com.huiju.estateagents.entity.TaBuildingDynamic;
|
9
|
10
|
import com.huiju.estateagents.service.IExtendContentService;
|
|
11
|
+import com.huiju.estateagents.service.ITaBuildingDynamicService;
|
|
12
|
+import com.huiju.estateagents.service.ITaBuildingService;
|
|
13
|
+import org.apache.commons.lang3.StringUtils;
|
10
|
14
|
import org.slf4j.Logger;
|
11
|
15
|
import org.slf4j.LoggerFactory;
|
12
|
16
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -18,6 +22,8 @@ import org.springframework.web.bind.annotation.RequestParam;
|
18
|
22
|
import org.springframework.web.bind.annotation.ResponseBody;
|
19
|
23
|
import org.springframework.web.bind.annotation.RestController;
|
20
|
24
|
|
|
25
|
+import java.time.LocalDateTime;
|
|
26
|
+
|
21
|
27
|
/**
|
22
|
28
|
* <p>
|
23
|
29
|
* 辅助内容表 前端控制器
|
|
@@ -35,6 +41,9 @@ public class ExtendContentController extends BaseController {
|
35
|
41
|
@Autowired
|
36
|
42
|
public IExtendContentService iExtendContentService;
|
37
|
43
|
|
|
44
|
+ @Autowired
|
|
45
|
+ private ITaBuildingDynamicService iTaBuildingDynamicService;
|
|
46
|
+
|
38
|
47
|
|
39
|
48
|
/**
|
40
|
49
|
* 分页查询列表
|
|
@@ -44,10 +53,16 @@ public class ExtendContentController extends BaseController {
|
44
|
53
|
*/
|
45
|
54
|
@RequestMapping(value="/admin/extendContent",method= RequestMethod.GET)
|
46
|
55
|
public ResponseBean extendContentList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
|
47
|
|
- @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize){
|
|
56
|
+ @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
|
|
57
|
+ @RequestParam(value = "buildingId", required = false) String buildingId,
|
|
58
|
+ @RequestParam(value = "showType", required = false) String showType){
|
48
|
59
|
ResponseBean responseBean = new ResponseBean();
|
49
|
60
|
IPage<ExtendContent> pg = new Page<>(pageNum, pageSize);
|
50
|
|
- IPage<ExtendContent> result = iExtendContentService.page(pg);
|
|
61
|
+ QueryWrapper<ExtendContent> queryWrapper = new QueryWrapper<>();
|
|
62
|
+ queryWrapper.eq(StringUtils.isNotBlank(buildingId), "building_id", buildingId);
|
|
63
|
+ queryWrapper.eq(StringUtils.isNotBlank(showType), "show_type", showType);
|
|
64
|
+ queryWrapper.orderByDesc("create_date");
|
|
65
|
+ IPage<ExtendContent> result = iExtendContentService.page(pg, queryWrapper);
|
51
|
66
|
responseBean.addSuccess(result);
|
52
|
67
|
return responseBean;
|
53
|
68
|
}
|
|
@@ -74,6 +89,7 @@ public class ExtendContentController extends BaseController {
|
74
|
89
|
*/
|
75
|
90
|
@RequestMapping(value="/admin/extendContent",method= RequestMethod.POST)
|
76
|
91
|
public ResponseBean extendContentAdd(@RequestBody ExtendContent extendContent){
|
|
92
|
+ extendContent.setCreateDate(LocalDateTime.now());
|
77
|
93
|
ResponseBean responseBean= iExtendContentService.extendContentAdd(extendContent);
|
78
|
94
|
responseBean.addSuccess(extendContent);
|
79
|
95
|
return responseBean;
|
|
@@ -111,6 +127,7 @@ public class ExtendContentController extends BaseController {
|
111
|
127
|
public ResponseBean extendContentUpdate(@PathVariable Integer id,
|
112
|
128
|
@RequestBody ExtendContent extendContent){
|
113
|
129
|
ResponseBean responseBean = new ResponseBean();
|
|
130
|
+ extendContent.setContentId(id);
|
114
|
131
|
try {
|
115
|
132
|
if (iExtendContentService.updateById(extendContent)){
|
116
|
133
|
responseBean.addSuccess(extendContent);
|
|
@@ -133,7 +150,10 @@ public class ExtendContentController extends BaseController {
|
133
|
150
|
public ResponseBean extendContentGet(@PathVariable Integer id){
|
134
|
151
|
ResponseBean responseBean = new ResponseBean();
|
135
|
152
|
try {
|
136
|
|
- responseBean.addSuccess(iExtendContentService.getById(id));
|
|
153
|
+ ExtendContent extendContent = iExtendContentService.getById(id);
|
|
154
|
+ TaBuildingDynamic taBuildingDynamic = iTaBuildingDynamicService.getById(extendContent.getTargetId());
|
|
155
|
+ extendContent.setTargetName(taBuildingDynamic.getTitle());
|
|
156
|
+ responseBean.addSuccess(extendContent);
|
137
|
157
|
}catch (Exception e){
|
138
|
158
|
e.printStackTrace();
|
139
|
159
|
logger.error("extendContentDelete -=- {}",e.toString());
|