魏熙美 преди 5 години
родител
ревизия
c7d11ecb7e

+ 3
- 3
src/main/java/com/huiju/estateagents/common/CommConstant.java Целия файл

@@ -118,17 +118,17 @@ public class CommConstant {
118 118
     //=================  首屏广告 / 轮播图 start =======================
119 119
 
120 120
     /**
121
-     * 首页轮播图类型_活动
121
+     * 首页 轮播图/广告 类型 ====  活动
122 122
      */
123 123
     public static final String CAROUSEL_ACTIVITY = "activity";
124 124
 
125 125
     /**
126
-     * 首页 轮播图/广告 类型_项目
126
+     * 首页 轮播图/广告 类型 ==== 项目
127 127
      */
128 128
     public static final String CAROUSEL_PROJECT = "project";
129 129
 
130 130
     /**
131
-     * 首页轮播图类型_资讯
131
+     * 首页轮播图/广告 类型 ==== 资讯
132 132
      */
133 133
     public static final String CAROUSEL_NEWS = "news";
134 134
 

+ 23
- 3
src/main/java/com/huiju/estateagents/controller/ExtendContentController.java Целия файл

@@ -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());

+ 4
- 0
src/main/java/com/huiju/estateagents/entity/ExtendContent.java Целия файл

@@ -1,5 +1,6 @@
1 1
 package com.huiju.estateagents.entity;
2 2
 
3
+import com.baomidou.mybatisplus.annotation.TableField;
3 4
 import com.baomidou.mybatisplus.annotation.TableName;
4 5
 import com.baomidou.mybatisplus.annotation.IdType;
5 6
 import com.baomidou.mybatisplus.annotation.TableId;
@@ -51,6 +52,9 @@ public class ExtendContent implements Serializable {
51 52
      */
52 53
     private String targetId;
53 54
 
55
+    @TableField(exist = false)
56
+    private String targetName;
57
+
54 58
     /**
55 59
      * 图片
56 60
      */