소스 검색

轮播图,开屏

dingxin 5 년 전
부모
커밋
27b156b205

+ 24
- 1
src/main/java/com/huiju/estateagents/common/CommConstant.java 파일 보기

@@ -107,8 +107,31 @@ public class CommConstant {
107 107
     /**
108 108
      * 活动的当前状态3:结束
109 109
      */
110
-    public static final Integer ACTIVITY_CONDITION_ONE_THREE= 3;
110
+    public static final Integer ACTIVITY_CONDITION_ONE_THREE = 3;
111 111
 
112
+    /**
113
+     * 首页轮播图类型_活动
114
+     */
115
+    public static final String CAROUSEL_ACTIVITY = "activity";
112 116
 
117
+    /**
118
+     * 首页轮播图类型_项目
119
+     */
120
+    public static final String CAROUSEL_PROJECT = "project";
121
+
122
+    /**
123
+     * 首页轮播图类型_资讯
124
+     */
125
+    public static final String CAROUSEL_INFORMATION = "information";
126
+
127
+    /**
128
+     * 开屏
129
+     */
130
+    public static final String OPEN_SCREEN = "screen";
131
+
132
+    /**
133
+     * 首页轮播图
134
+     */
135
+    public static final String CAROUSEL = "banner";
113 136
 
114 137
 }

+ 25
- 25
src/main/java/com/huiju/estateagents/controller/ExtendContentController.java 파일 보기

@@ -46,22 +46,32 @@ public class ExtendContentController extends BaseController {
46 46
     public ResponseBean extendContentList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
47 47
                                           @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize){
48 48
         ResponseBean responseBean = new ResponseBean();
49
-        try {
50
-            //使用分页插件
51
-		    IPage<ExtendContent> pg = new Page<>(pageNum, pageSize);
52
-            QueryWrapper<ExtendContent> queryWrapper = new QueryWrapper<>();
53
-            queryWrapper.orderByDesc("create_date");
54
-
55
-            IPage<ExtendContent> result = iExtendContentService.page(pg, queryWrapper);
49
+            IPage<ExtendContent> pg = new Page<>(pageNum, pageSize);
50
+            IPage<ExtendContent> result = iExtendContentService.page(pg);
56 51
             responseBean.addSuccess(result);
57
-        }catch (Exception e){
58
-            e.printStackTrace();
59
-            logger.error("extendContentList -=- {}",e.toString());
60
-            responseBean.addError(e.getMessage());
61
-        }
52
+            return responseBean;
53
+    }
54
+
55
+    /**
56
+     * 根据状态查当前的轮播图
57
+     * @return
58
+     */
59
+    @RequestMapping(value="/wx/selectExtendContent",method= RequestMethod.GET)
60
+    public ResponseBean extendContentList(@RequestBody ExtendContent extendContent ){
61
+        ResponseBean responseBean= iExtendContentService.selectExtendContentList(extendContent);
62
+        return responseBean;
63
+    }
64
+
65
+    /**
66
+     * 根据状态查当前的开屏
67
+     */
68
+    @RequestMapping(value="/wx/selectExtendContentShowType",method= RequestMethod.GET)
69
+    public ResponseBean extendContentListShowType(@RequestBody ExtendContent extendContent ){
70
+        ResponseBean responseBean= iExtendContentService.selectExtendContentListShowType(extendContent);
62 71
         return responseBean;
63 72
     }
64 73
 
74
+
65 75
     /**
66 76
      * 保存对象
67 77
      * @param extendContent 实体对象
@@ -69,19 +79,9 @@ public class ExtendContentController extends BaseController {
69 79
      */
70 80
     @RequestMapping(value="/extendContent",method= RequestMethod.POST)
71 81
     public ResponseBean extendContentAdd(@RequestBody ExtendContent extendContent){
72
-        ResponseBean responseBean = new ResponseBean();
73
-        try {
74
-            if (iExtendContentService.save(extendContent)){
75
-                responseBean.addSuccess(extendContent);
76
-            }else {
77
-                responseBean.addError("fail");
78
-            }
79
-        }catch (Exception e){
80
-            e.printStackTrace();
81
-            logger.error("extendContentAdd -=- {}",e.toString());
82
-            responseBean.addError(e.getMessage());
83
-        }
84
-        return responseBean;
82
+        ResponseBean  responseBean= iExtendContentService.extendContentAdd(extendContent);
83
+          responseBean.addSuccess(extendContent);
84
+          return responseBean;
85 85
     }
86 86
 
87 87
     /**

+ 1
- 1
src/main/java/com/huiju/estateagents/controller/TaBuildingDynamicController.java 파일 보기

@@ -91,7 +91,7 @@ public class TaBuildingDynamicController extends BaseController {
91 91
     }
92 92
 
93 93
     /**
94
-     * 添加活动
94
+     * 添加活动报名
95 95
      * @param taActivityDynamicEnlist
96 96
      * @param request
97 97
      * @return

+ 2
- 1
src/main/java/com/huiju/estateagents/mapper/ExtendContentMapper.java 파일 보기

@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 4
 import com.huiju.estateagents.entity.ExtendContent;
5 5
 import org.apache.ibatis.annotations.Mapper;
6 6
 
7
+import java.util.List;
8
+
7 9
 /**
8 10
  * <p>
9 11
  * 辅助内容表  Mapper 接口
@@ -14,5 +16,4 @@ import org.apache.ibatis.annotations.Mapper;
14 16
  */
15 17
 @Mapper
16 18
 public interface ExtendContentMapper extends BaseMapper<ExtendContent> {
17
-
18 19
 }

+ 21
- 0
src/main/java/com/huiju/estateagents/service/IExtendContentService.java 파일 보기

@@ -1,6 +1,7 @@
1 1
 package com.huiju.estateagents.service;
2 2
 
3 3
 import com.baomidou.mybatisplus.extension.service.IService;
4
+import com.huiju.estateagents.base.ResponseBean;
4 5
 import com.huiju.estateagents.entity.ExtendContent;
5 6
 
6 7
 /**
@@ -13,4 +14,24 @@ import com.huiju.estateagents.entity.ExtendContent;
13 14
  */
14 15
 public interface IExtendContentService extends IService<ExtendContent> {
15 16
 
17
+    /**
18
+     * 添加当前
19
+     * @param extendContent
20
+     * @return
21
+     */
22
+    ResponseBean extendContentAdd(ExtendContent extendContent);
23
+
24
+    /**
25
+     * 根据状态查当前的轮播图
26
+     * @param extendContent
27
+     * @return
28
+     */
29
+    ResponseBean selectExtendContentList(ExtendContent extendContent);
30
+
31
+    /**
32
+     * 开屏
33
+     * @param extendContent
34
+     * @return
35
+     */
36
+    ResponseBean selectExtendContentListShowType(ExtendContent extendContent);
16 37
 }

+ 50
- 0
src/main/java/com/huiju/estateagents/service/impl/ExtendContentServiceImpl.java 파일 보기

@@ -1,11 +1,17 @@
1 1
 package com.huiju.estateagents.service.impl;
2 2
 
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
3 4
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
5
+import com.huiju.estateagents.base.ResponseBean;
6
+import com.huiju.estateagents.common.CommConstant;
4 7
 import com.huiju.estateagents.entity.ExtendContent;
5 8
 import com.huiju.estateagents.mapper.ExtendContentMapper;
6 9
 import com.huiju.estateagents.service.IExtendContentService;
10
+import org.springframework.beans.factory.annotation.Autowired;
7 11
 import org.springframework.stereotype.Service;
8 12
 
13
+import java.util.List;
14
+
9 15
 /**
10 16
  * <p>
11 17
  * 辅助内容表  服务实现类
@@ -17,4 +23,48 @@ import org.springframework.stereotype.Service;
17 23
 @Service
18 24
 public class ExtendContentServiceImpl extends ServiceImpl<ExtendContentMapper, ExtendContent> implements IExtendContentService {
19 25
 
26
+    @Autowired
27
+    private ExtendContentMapper extendContentMapper;
28
+    @Override
29
+    public ResponseBean extendContentAdd(ExtendContent extendContent) {
30
+        ResponseBean responseBean= new ResponseBean<>();
31
+        if ("1".equals(extendContent.getContentType())){
32
+            extendContent.setContentType(CommConstant.CAROUSEL_ACTIVITY);
33
+        }else if("2".equals(extendContent.getContentType())){
34
+            extendContent.setContentType(CommConstant.CAROUSEL_PROJECT);
35
+        }else if ("3".equals(extendContent.getContentType())){
36
+            extendContent.setContentType(CommConstant.CAROUSEL_INFORMATION);
37
+        }
38
+        extendContentMapper.insert(extendContent);
39
+        responseBean.addSuccess("成功");
40
+        return  responseBean;
41
+    }
42
+
43
+    @Override
44
+    public ResponseBean selectExtendContentList(ExtendContent extendContent) {
45
+        ResponseBean responseBean = new ResponseBean<>();
46
+        // 查询轮播图
47
+        QueryWrapper<ExtendContent> extendContentQuery= new QueryWrapper<>();
48
+        extendContentQuery.eq("show_position",CommConstant.CAROUSEL);
49
+        extendContentQuery.eq("content_type",extendContent.getContentType());
50
+        extendContentQuery.eq("building_id",extendContent.getBuildingId());
51
+        extendContentQuery.eq("status","1");
52
+        List<ExtendContent> taExtendContent = extendContentMapper.selectList(extendContentQuery);
53
+        responseBean.addSuccess(taExtendContent);
54
+        return responseBean;
55
+    }
56
+
57
+    @Override
58
+    public ResponseBean selectExtendContentListShowType(ExtendContent extendContent) {
59
+        ResponseBean responseBean= new ResponseBean<>();
60
+        // 开屏
61
+        QueryWrapper<ExtendContent> extendContentQuery= new QueryWrapper<>();
62
+        extendContentQuery.eq("show_type",CommConstant.OPEN_SCREEN);
63
+        extendContentQuery.eq("content_type",extendContent.getContentType());
64
+        extendContentQuery.eq("building_id",extendContent.getBuildingId());
65
+        extendContentQuery.eq("status","1");
66
+        ExtendContent taExtendContent = extendContentMapper.selectOne(extendContentQuery);
67
+        responseBean.addSuccess(taExtendContent);
68
+        return responseBean;
69
+    }
20 70
 }