albertshaw 8 vuotta sitten
vanhempi
commit
0ea9866b14

+ 39 - 0
src/main/java/com/goafanti/app/controller/AppApiController.java

@@ -0,0 +1,39 @@
+package com.goafanti.app.controller;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.annotation.Resource;
+
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.goafanti.activity.service.ActivityService;
+import com.goafanti.banners.enums.BannersType;
+import com.goafanti.banners.service.BannersService;
+import com.goafanti.common.bo.Result;
+import com.goafanti.common.controller.BaseApiController;
+import com.goafanti.news.enums.NewsType;
+import com.goafanti.news.service.NewsService;
+
+@RestController
+@RequestMapping(path = "/api/portal/app", method = RequestMethod.GET)
+public class AppApiController extends BaseApiController {
+	@Resource
+	BannersService			bannersService;
+	@Resource
+	private ActivityService	activityService;
+	@Resource
+	NewsService				newsService;
+
+	@RequestMapping(value = "/index", method = RequestMethod.GET)
+	public Result index() {
+		Map<String, Object> result = new HashMap<>();
+		result.put("banners", bannersService.findPortalBanners(BannersType.APP.getKey()));
+		result.put("activities", activityService.findPortalList(0, 3, null));
+		result.put("policies", newsService.findNewsList(0, NewsType.GJZC.getCode(), 3));
+		result.put("news", newsService.findNewsList(0, NewsType.JTDT.getCode(), 5));
+		return res().data(result);
+	}
+}

+ 3 - 1
src/main/java/com/goafanti/common/dao/BannersMapper.java

@@ -3,6 +3,8 @@ package com.goafanti.common.dao;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.ibatis.annotations.Param;
+
 import com.goafanti.common.model.Banners;
 
 public interface BannersMapper {
@@ -20,5 +22,5 @@ public interface BannersMapper {
 
 	List<Banners> findList(Map<String, Object> params);
 
-	int findListCount(String sign);
+	int findListCount(@Param(value = "sign") String sign);
 }

+ 1 - 1
src/main/java/com/goafanti/common/mapper/BannersMapperExt.xml

@@ -13,7 +13,7 @@
 		limit #{pageNo,jdbcType=INTEGER}, #{pageSize,jdbcType=INTEGER}
 		</if>
 	</select>
-	<select id="findListCount" parameterType="String" resultType="java.lang.Integer">
+	<select id="findListCount" parameterType="java.lang.String" resultType="java.lang.Integer">
 		select count(1)
 		from banners where 1=1 
 		<if test="sign != null">

+ 1 - 0
src/main/resources/shiro_base_auth.ini

@@ -18,6 +18,7 @@
 /favicon.ico=anon
 /static/**=anon
 /portal/**=anon
+/api/portal/**=anon
 /api/admin/**=admin,permission
 /api/user/partner/**=anon
 /api/user/**=login