소스 검색

提交分支代码

魏超 6 년 전
부모
커밋
bfc249873b

+ 9
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/BannerController.java 파일 보기

@@ -34,7 +34,7 @@ public class BannerController {
34 34
 
35 35
     @ApiOperation(value = "首页运营banner接口", notes = "获取首页运营banner")
36 36
     @RequestMapping(value = "/banner/{bannerId}", method = RequestMethod.GET)
37
-    @ApiImplicitParams({ @ApiImplicitParam(paramType = "query", dataType = "Long", name = "bannerId", value = "运营banner图Id") })
37
+    @ApiImplicitParams({ @ApiImplicitParam(paramType = "path", dataType = "integer", name = "bannerId", value = "运营banner图Id") })
38 38
     public ResponseBean selectToBannerImg(@PathVariable("bannerId")Integer bannerId){
39 39
         ResponseBean responseBean = new ResponseBean();
40 40
         ToBanner toBannerList = bannerService.viewBannerImg(bannerId);
@@ -42,4 +42,12 @@ public class BannerController {
42 42
         return responseBean;
43 43
     }
44 44
 
45
+    @ApiOperation(value = "首页运营所有banner接口", notes = "获取首页所有运营banner")
46
+    @RequestMapping(value = "/banners", method = RequestMethod.GET)
47
+    public ResponseBean selectAllToBannerImg(){
48
+        ResponseBean responseBean = new ResponseBean();
49
+        List<ToBanner> toBannerList = bannerService.viewAllBannerImg();
50
+        responseBean.addSuccess(toBannerList);
51
+        return responseBean;
52
+    }
45 53
 }

+ 1
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/ToBannerMapper.java 파일 보기

@@ -11,4 +11,5 @@ public interface ToBannerMapper {
11 11
 
12 12
     ToBanner selectByCommunityId(@Param("bannerId") Integer bannerId, @Param("nowTime") String nowTime);
13 13
 
14
+    List<ToBanner> selectAllByNum(@Param("nowTime") String nowTime, @Param("num")Integer num);
14 15
 }

+ 4
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpCarouselSettingMapper.java 파일 보기

@@ -1,7 +1,9 @@
1 1
 package com.community.huiju.dao;
2 2
 
3 3
 import com.community.huiju.model.TpCarouselSetting;
4
+import org.apache.ibatis.annotations.Mapper;
4 5
 
6
+@Mapper
5 7
 public interface TpCarouselSettingMapper {
6 8
     int deleteByPrimaryKey(Integer id);
7 9
 
@@ -14,4 +16,6 @@ public interface TpCarouselSettingMapper {
14 16
     int updateByPrimaryKeySelective(TpCarouselSetting record);
15 17
 
16 18
     int updateByPrimaryKey(TpCarouselSetting record);
19
+
20
+    Integer selectCarouselNum(String carouselType);
17 21
 }

+ 1
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/BannerServiceI.java 파일 보기

@@ -12,5 +12,5 @@ import java.util.List;
12 12
 public interface BannerServiceI {
13 13
 
14 14
     ToBanner viewBannerImg(Integer bannerId);
15
-
15
+    List<ToBanner> viewAllBannerImg();
16 16
 }

+ 14
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/BannerServiceImpl.java 파일 보기

@@ -1,7 +1,9 @@
1 1
 package com.community.huiju.service.impl;
2 2
 
3
+import com.community.commom.constant.Constant;
3 4
 import com.community.commom.utils.DateUtils;
4 5
 import com.community.huiju.dao.ToBannerMapper;
6
+import com.community.huiju.dao.TpCarouselSettingMapper;
5 7
 import com.community.huiju.model.ToBanner;
6 8
 import com.community.huiju.service.BannerServiceI;
7 9
 import org.springframework.beans.factory.annotation.Autowired;
@@ -20,9 +22,21 @@ public class BannerServiceImpl implements BannerServiceI {
20 22
     @Autowired
21 23
     private ToBannerMapper toBannerMapper;
22 24
 
25
+    @Autowired
26
+    private TpCarouselSettingMapper tpCarouselSettingMapper;
27
+
23 28
     @Override
24 29
     public ToBanner viewBannerImg(Integer bannerId) {
25 30
         String nowTime = DateUtils.getDate("yyyy-MM-dd");
26 31
         return toBannerMapper.selectByCommunityId(bannerId, nowTime);
27 32
     }
33
+
34
+    @Override
35
+    public List<ToBanner> viewAllBannerImg() {
36
+        //查询轮播图数量
37
+        Integer bannerNum = tpCarouselSettingMapper.selectCarouselNum(Constant.ANNOUNCEMENT);
38
+
39
+        String nowTime = DateUtils.getDate("yyyy-MM-dd");
40
+        return toBannerMapper.selectAllByNum(nowTime, bannerNum);
41
+    }
28 42
 }

+ 16
- 1
CODE/smart-community/app-api/src/main/resources/mapper/ToBannerMapper.xml 파일 보기

@@ -24,6 +24,21 @@
24 24
   <select id="selectByCommunityId" resultMap="BaseResultMap">
25 25
     select
26 26
     <include refid="Base_Column_List"></include>
27
-    from to_banner t where id = #{bannerId} and t.eff_time &lt; #{nowTime} and t.exp_time &gt; #{nowTime} order by t.sort, t.eff_time
27
+    from to_banner t where id = #{bannerId}
28
+    and t.eff_time &lt; #{nowTime}
29
+    and t.exp_time &gt; #{nowTime}
30
+    order by t.sort, t.eff_time
31
+  </select>
32
+
33
+  <select id="selectAllByNum" resultMap="BaseResultMap">
34
+    select
35
+    <include refid="Base_Column_List"></include>
36
+    from to_banner t where t.eff_time &lt; #{nowTime}
37
+    and t.exp_time &gt; #{nowTime}
38
+    order by t.sort, t.eff_time
39
+    <if test="num != null">
40
+      limit #{num}
41
+    </if>
42
+
28 43
   </select>
29 44
 </mapper>

+ 6
- 0
CODE/smart-community/app-api/src/main/resources/mapper/TpCarouselSettingMapper.xml 파일 보기

@@ -16,6 +16,12 @@
16 16
     from tp_carousel_setting
17 17
     where id = #{id,jdbcType=INTEGER}
18 18
   </select>
19
+  <select id="selectCarouselNum" resultType="java.lang.Integer" parameterType="java.lang.String" >
20
+    select
21
+    carousel_num
22
+    from tp_carousel_setting
23
+    where carousel_type = #{carouselType}
24
+  </select>
19 25
   <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
20 26
     delete from tp_carousel_setting
21 27
     where id = #{id,jdbcType=INTEGER}