Quellcode durchsuchen

轮播图开屏广告

魏超 vor 5 Jahren
Ursprung
Commit
1fafdcab63

+ 55
- 5
src/main/java/com/huiju/estateagents/controller/ExtendContentController.java Datei anzeigen

6
 import com.huiju.estateagents.base.BaseController;
6
 import com.huiju.estateagents.base.BaseController;
7
 import com.huiju.estateagents.base.ResponseBean;
7
 import com.huiju.estateagents.base.ResponseBean;
8
 import com.huiju.estateagents.entity.ExtendContent;
8
 import com.huiju.estateagents.entity.ExtendContent;
9
+import com.huiju.estateagents.entity.TaBuilding;
9
 import com.huiju.estateagents.entity.TaBuildingDynamic;
10
 import com.huiju.estateagents.entity.TaBuildingDynamic;
11
+import com.huiju.estateagents.entity.TdCity;
10
 import com.huiju.estateagents.service.IExtendContentService;
12
 import com.huiju.estateagents.service.IExtendContentService;
11
 import com.huiju.estateagents.service.ITaBuildingDynamicService;
13
 import com.huiju.estateagents.service.ITaBuildingDynamicService;
12
 import com.huiju.estateagents.service.ITaBuildingService;
14
 import com.huiju.estateagents.service.ITaBuildingService;
15
+import com.huiju.estateagents.service.ITdCityService;
13
 import io.swagger.annotations.Api;
16
 import io.swagger.annotations.Api;
14
 import io.swagger.annotations.ApiImplicitParam;
17
 import io.swagger.annotations.ApiImplicitParam;
15
 import io.swagger.annotations.ApiImplicitParams;
18
 import io.swagger.annotations.ApiImplicitParams;
53
     @Autowired
56
     @Autowired
54
     private ITaBuildingService iTaBuildingService;
57
     private ITaBuildingService iTaBuildingService;
55
 
58
 
59
+    @Autowired
60
+    private ITdCityService iTdCityService;
61
+
56
     /**
62
     /**
57
      * 分页查询列表
63
      * 分页查询列表
58
      * @param pageNum
64
      * @param pageNum
72
     @RequestMapping(value="/admin/extendContent",method= RequestMethod.GET)
78
     @RequestMapping(value="/admin/extendContent",method= RequestMethod.GET)
73
     public ResponseBean extendContentList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
79
     public ResponseBean extendContentList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
74
                                           @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
80
                                           @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
81
+                                          @RequestParam(value = "cityId", required = false) Integer cityId,
75
                                           @RequestParam(value = "buildingId", required = false) String buildingId,
82
                                           @RequestParam(value = "buildingId", required = false) String buildingId,
76
                                           @RequestParam(value = "contentType", required = false) String contentType,
83
                                           @RequestParam(value = "contentType", required = false) String contentType,
77
                                           @RequestParam(value = "showPosition", required = false) String showPosition,
84
                                           @RequestParam(value = "showPosition", required = false) String showPosition,
78
                                           @RequestParam(value = "status", required = false) Integer status,
85
                                           @RequestParam(value = "status", required = false) Integer status,
79
                                           @RequestParam(value = "showType", required = false) String showType,HttpServletRequest request){
86
                                           @RequestParam(value = "showType", required = false) String showType,HttpServletRequest request){
80
-        ResponseBean responseBean = new ResponseBean();
87
+            ResponseBean responseBean = new ResponseBean();
81
             IPage<ExtendContent> pg = new Page<>(pageNum, pageSize);
88
             IPage<ExtendContent> pg = new Page<>(pageNum, pageSize);
82
             QueryWrapper<ExtendContent> queryWrapper = new QueryWrapper<>();
89
             QueryWrapper<ExtendContent> queryWrapper = new QueryWrapper<>();
90
+            queryWrapper.eq(cityId != null, "city_id", cityId);
83
             queryWrapper.eq(StringUtils.isNotBlank(buildingId), "building_id", buildingId);
91
             queryWrapper.eq(StringUtils.isNotBlank(buildingId), "building_id", buildingId);
84
             queryWrapper.eq(StringUtils.isNotBlank(showType), "show_type", showType);
92
             queryWrapper.eq(StringUtils.isNotBlank(showType), "show_type", showType);
85
             queryWrapper.eq(StringUtils.isNotBlank(contentType), "content_type", contentType);
93
             queryWrapper.eq(StringUtils.isNotBlank(contentType), "content_type", contentType);
86
             queryWrapper.eq(StringUtils.isNotBlank(showPosition), "show_position", showPosition);
94
             queryWrapper.eq(StringUtils.isNotBlank(showPosition), "show_position", showPosition);
87
-            queryWrapper.eq(null!=status, "status", status);
95
+            queryWrapper.ne("status",9);
96
+            queryWrapper.eq(status != null, "status", status);
88
             queryWrapper.eq( "org_id", getOrgId(request));
97
             queryWrapper.eq( "org_id", getOrgId(request));
89
             queryWrapper.orderByDesc("create_date");
98
             queryWrapper.orderByDesc("create_date");
90
             IPage<ExtendContent> result = iExtendContentService.page(pg, queryWrapper);
99
             IPage<ExtendContent> result = iExtendContentService.page(pg, queryWrapper);
100
+
101
+            result.getRecords().forEach(e -> {
102
+                QueryWrapper<TdCity> tdCityQueryWrapper = new QueryWrapper<>();
103
+                tdCityQueryWrapper.eq("id", e.getCityId());
104
+                TdCity tdCity = iTdCityService.getOne(tdCityQueryWrapper);
105
+                QueryWrapper<TaBuilding> taBuildingQueryWrapper = new QueryWrapper<>();
106
+                taBuildingQueryWrapper.eq("building_id", e.getBuildingId());
107
+                TaBuilding taBuilding = iTaBuildingService.getOne(taBuildingQueryWrapper);
108
+                e.setCityName(tdCity.getName());
109
+                if (taBuilding != null){
110
+                    e.setBuildingName(taBuilding.getBuildingName());
111
+                }
112
+            });
113
+            result.setRecords(result.getRecords());
91
             responseBean.addSuccess(result);
114
             responseBean.addSuccess(result);
92
             return responseBean;
115
             return responseBean;
93
     }
116
     }
130
     })
153
     })
131
     @RequestMapping(value="/admin/extendContent",method= RequestMethod.POST)
154
     @RequestMapping(value="/admin/extendContent",method= RequestMethod.POST)
132
     public ResponseBean extendContentAdd(@RequestBody ExtendContent extendContent, HttpServletRequest request){
155
     public ResponseBean extendContentAdd(@RequestBody ExtendContent extendContent, HttpServletRequest request){
133
-        Integer cityId = iTaBuildingService.getCityById(extendContent.getBuildingId());
134
-        extendContent.setCityId(cityId);
156
+        if (extendContent.getCityId() == null){
157
+            Integer cityId = iTaBuildingService.getCityById(extendContent.getBuildingId());
158
+            extendContent.setCityId(cityId);
159
+        }
135
         extendContent.setCreateDate(LocalDateTime.now());
160
         extendContent.setCreateDate(LocalDateTime.now());
136
         extendContent.setOrgId(getOrgId(request));
161
         extendContent.setOrgId(getOrgId(request));
137
         ResponseBean  responseBean= iExtendContentService.extendContentAdd(extendContent);
162
         ResponseBean  responseBean= iExtendContentService.extendContentAdd(extendContent);
173
      */
198
      */
174
     @ApiOperation(value = "后台轮播图保存", notes = "后台轮播图保存")
199
     @ApiOperation(value = "后台轮播图保存", notes = "后台轮播图保存")
175
     @ApiImplicitParams({
200
     @ApiImplicitParams({
176
-            @ApiImplicitParam(dataType = "Integer", name = "id", paramType = "payh",value = "轮播图id"),
201
+            @ApiImplicitParam(dataType = "Integer", name = "id", paramType = "path",value = "轮播图id"),
177
             @ApiImplicitParam(dataType = "ExtendContent", name = "extendContent", paramType = "body",value = "轮播图内容")
202
             @ApiImplicitParam(dataType = "ExtendContent", name = "extendContent", paramType = "body",value = "轮播图内容")
178
     })
203
     })
179
     @RequestMapping(value="/admin/extendContent/{id}",method= RequestMethod.PUT)
204
     @RequestMapping(value="/admin/extendContent/{id}",method= RequestMethod.PUT)
198
         return responseBean;
223
         return responseBean;
199
     }
224
     }
200
 
225
 
226
+    /**
227
+     * 删除对象,逻辑删除,修改状态为9
228
+     * @param id  实体ID
229
+     * @return
230
+     */
231
+    @ApiOperation(value = "后台轮播图删除", notes = "后台轮播图删除")
232
+    @ApiImplicitParams({
233
+            @ApiImplicitParam(dataType = "Integer", name = "id", paramType = "path",value = "轮播图id")
234
+    })
235
+    @RequestMapping(value="/admin/extendContentDelete/{id}",method= RequestMethod.PUT)
236
+    public ResponseBean extendContentUpdate(@PathVariable Integer id, HttpServletRequest request){
237
+        ResponseBean responseBean = new ResponseBean();
238
+        ExtendContent extendContent = new ExtendContent();
239
+        extendContent.setContentId(id);
240
+        extendContent.setStatus(9);
241
+        try {
242
+            iExtendContentService.updateById(extendContent);
243
+        }catch (Exception e){
244
+            e.printStackTrace();
245
+            logger.error("extendContentDelete -=- {}",e.toString());
246
+            responseBean.addError(e.getMessage());
247
+        }
248
+        return responseBean;
249
+    }
250
+
201
     /**
251
     /**
202
      * 根据id查询对象
252
      * 根据id查询对象
203
      * @param id  实体ID
253
      * @param id  实体ID

+ 6
- 0
src/main/java/com/huiju/estateagents/entity/ExtendContent.java Datei anzeigen

55
     @TableField(exist = false)
55
     @TableField(exist = false)
56
     private String targetName;
56
     private String targetName;
57
 
57
 
58
+    @TableField(exist = false)
59
+    private String cityName;
60
+
61
+    @TableField(exist = false)
62
+    private String buildingName;
63
+
58
     /**
64
     /**
59
      * 图片
65
      * 图片
60
      */
66
      */

+ 3
- 0
src/main/java/com/huiju/estateagents/service/impl/ExtendContentServiceImpl.java Datei anzeigen

29
     @Override
29
     @Override
30
     public ResponseBean extendContentAdd(ExtendContent extendContent) {
30
     public ResponseBean extendContentAdd(ExtendContent extendContent) {
31
         ResponseBean responseBean= new ResponseBean<>();
31
         ResponseBean responseBean= new ResponseBean<>();
32
+        if (extendContent.getStatus() == null){
33
+            extendContent.setStatus(0);
34
+        }
32
         extendContentMapper.insert(extendContent);
35
         extendContentMapper.insert(extendContent);
33
         responseBean.addSuccess("成功");
36
         responseBean.addSuccess("成功");
34
         return  responseBean;
37
         return  responseBean;