瀏覽代碼

提交分支代码

魏超 6 年之前
父節點
當前提交
bfc249873b

+ 9
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/BannerController.java 查看文件

34
 
34
 
35
     @ApiOperation(value = "首页运营banner接口", notes = "获取首页运营banner")
35
     @ApiOperation(value = "首页运营banner接口", notes = "获取首页运营banner")
36
     @RequestMapping(value = "/banner/{bannerId}", method = RequestMethod.GET)
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
     public ResponseBean selectToBannerImg(@PathVariable("bannerId")Integer bannerId){
38
     public ResponseBean selectToBannerImg(@PathVariable("bannerId")Integer bannerId){
39
         ResponseBean responseBean = new ResponseBean();
39
         ResponseBean responseBean = new ResponseBean();
40
         ToBanner toBannerList = bannerService.viewBannerImg(bannerId);
40
         ToBanner toBannerList = bannerService.viewBannerImg(bannerId);
42
         return responseBean;
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
 
11
 
12
     ToBanner selectByCommunityId(@Param("bannerId") Integer bannerId, @Param("nowTime") String nowTime);
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
 package com.community.huiju.dao;
1
 package com.community.huiju.dao;
2
 
2
 
3
 import com.community.huiju.model.TpCarouselSetting;
3
 import com.community.huiju.model.TpCarouselSetting;
4
+import org.apache.ibatis.annotations.Mapper;
4
 
5
 
6
+@Mapper
5
 public interface TpCarouselSettingMapper {
7
 public interface TpCarouselSettingMapper {
6
     int deleteByPrimaryKey(Integer id);
8
     int deleteByPrimaryKey(Integer id);
7
 
9
 
14
     int updateByPrimaryKeySelective(TpCarouselSetting record);
16
     int updateByPrimaryKeySelective(TpCarouselSetting record);
15
 
17
 
16
     int updateByPrimaryKey(TpCarouselSetting record);
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
 public interface BannerServiceI {
12
 public interface BannerServiceI {
13
 
13
 
14
     ToBanner viewBannerImg(Integer bannerId);
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
 package com.community.huiju.service.impl;
1
 package com.community.huiju.service.impl;
2
 
2
 
3
+import com.community.commom.constant.Constant;
3
 import com.community.commom.utils.DateUtils;
4
 import com.community.commom.utils.DateUtils;
4
 import com.community.huiju.dao.ToBannerMapper;
5
 import com.community.huiju.dao.ToBannerMapper;
6
+import com.community.huiju.dao.TpCarouselSettingMapper;
5
 import com.community.huiju.model.ToBanner;
7
 import com.community.huiju.model.ToBanner;
6
 import com.community.huiju.service.BannerServiceI;
8
 import com.community.huiju.service.BannerServiceI;
7
 import org.springframework.beans.factory.annotation.Autowired;
9
 import org.springframework.beans.factory.annotation.Autowired;
20
     @Autowired
22
     @Autowired
21
     private ToBannerMapper toBannerMapper;
23
     private ToBannerMapper toBannerMapper;
22
 
24
 
25
+    @Autowired
26
+    private TpCarouselSettingMapper tpCarouselSettingMapper;
27
+
23
     @Override
28
     @Override
24
     public ToBanner viewBannerImg(Integer bannerId) {
29
     public ToBanner viewBannerImg(Integer bannerId) {
25
         String nowTime = DateUtils.getDate("yyyy-MM-dd");
30
         String nowTime = DateUtils.getDate("yyyy-MM-dd");
26
         return toBannerMapper.selectByCommunityId(bannerId, nowTime);
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
   <select id="selectByCommunityId" resultMap="BaseResultMap">
24
   <select id="selectByCommunityId" resultMap="BaseResultMap">
25
     select
25
     select
26
     <include refid="Base_Column_List"></include>
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
   </select>
43
   </select>
29
 </mapper>
44
 </mapper>

+ 6
- 0
CODE/smart-community/app-api/src/main/resources/mapper/TpCarouselSettingMapper.xml 查看文件

16
     from tp_carousel_setting
16
     from tp_carousel_setting
17
     where id = #{id,jdbcType=INTEGER}
17
     where id = #{id,jdbcType=INTEGER}
18
   </select>
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
   <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
25
   <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
20
     delete from tp_carousel_setting
26
     delete from tp_carousel_setting
21
     where id = #{id,jdbcType=INTEGER}
27
     where id = #{id,jdbcType=INTEGER}