浏览代码

轮播图,开屏

dingxin 5 年前
父节点
当前提交
27b156b205

+ 24
- 1
src/main/java/com/huiju/estateagents/common/CommConstant.java 查看文件

107
     /**
107
     /**
108
      * 活动的当前状态3:结束
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
     public ResponseBean extendContentList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
46
     public ResponseBean extendContentList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
47
                                           @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize){
47
                                           @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize){
48
         ResponseBean responseBean = new ResponseBean();
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
             responseBean.addSuccess(result);
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
         return responseBean;
71
         return responseBean;
63
     }
72
     }
64
 
73
 
74
+
65
     /**
75
     /**
66
      * 保存对象
76
      * 保存对象
67
      * @param extendContent 实体对象
77
      * @param extendContent 实体对象
69
      */
79
      */
70
     @RequestMapping(value="/extendContent",method= RequestMethod.POST)
80
     @RequestMapping(value="/extendContent",method= RequestMethod.POST)
71
     public ResponseBean extendContentAdd(@RequestBody ExtendContent extendContent){
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
     }
91
     }
92
 
92
 
93
     /**
93
     /**
94
-     * 添加活动
94
+     * 添加活动报名
95
      * @param taActivityDynamicEnlist
95
      * @param taActivityDynamicEnlist
96
      * @param request
96
      * @param request
97
      * @return
97
      * @return

+ 2
- 1
src/main/java/com/huiju/estateagents/mapper/ExtendContentMapper.java 查看文件

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

+ 21
- 0
src/main/java/com/huiju/estateagents/service/IExtendContentService.java 查看文件

1
 package com.huiju.estateagents.service;
1
 package com.huiju.estateagents.service;
2
 
2
 
3
 import com.baomidou.mybatisplus.extension.service.IService;
3
 import com.baomidou.mybatisplus.extension.service.IService;
4
+import com.huiju.estateagents.base.ResponseBean;
4
 import com.huiju.estateagents.entity.ExtendContent;
5
 import com.huiju.estateagents.entity.ExtendContent;
5
 
6
 
6
 /**
7
 /**
13
  */
14
  */
14
 public interface IExtendContentService extends IService<ExtendContent> {
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
 package com.huiju.estateagents.service.impl;
1
 package com.huiju.estateagents.service.impl;
2
 
2
 
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
3
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
4
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
5
+import com.huiju.estateagents.base.ResponseBean;
6
+import com.huiju.estateagents.common.CommConstant;
4
 import com.huiju.estateagents.entity.ExtendContent;
7
 import com.huiju.estateagents.entity.ExtendContent;
5
 import com.huiju.estateagents.mapper.ExtendContentMapper;
8
 import com.huiju.estateagents.mapper.ExtendContentMapper;
6
 import com.huiju.estateagents.service.IExtendContentService;
9
 import com.huiju.estateagents.service.IExtendContentService;
10
+import org.springframework.beans.factory.annotation.Autowired;
7
 import org.springframework.stereotype.Service;
11
 import org.springframework.stereotype.Service;
8
 
12
 
13
+import java.util.List;
14
+
9
 /**
15
 /**
10
  * <p>
16
  * <p>
11
  * 辅助内容表  服务实现类
17
  * 辅助内容表  服务实现类
17
 @Service
23
 @Service
18
 public class ExtendContentServiceImpl extends ServiceImpl<ExtendContentMapper, ExtendContent> implements IExtendContentService {
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
 }