|
@@ -6,9 +6,12 @@ import javax.servlet.http.HttpServletRequest;
|
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
|
|
+import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
|
|
|
import com.alibaba.druid.util.StringUtils;
|
|
import com.alibaba.druid.util.StringUtils;
|
|
|
|
|
+import com.goafanti.common.bo.Result;
|
|
|
|
|
+import com.goafanti.common.constant.ErrorConstants;
|
|
|
import com.goafanti.common.controller.BaseController;
|
|
import com.goafanti.common.controller.BaseController;
|
|
|
import com.goafanti.news.enums.NewsType;
|
|
import com.goafanti.news.enums.NewsType;
|
|
|
import com.goafanti.news.service.NewsService;
|
|
import com.goafanti.news.service.NewsService;
|
|
@@ -48,4 +51,33 @@ public class NewsController extends BaseController {
|
|
|
//modelview.addObject(attributeValue)
|
|
//modelview.addObject(attributeValue)
|
|
|
return modelview;
|
|
return modelview;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 新闻列表
|
|
|
|
|
+ */
|
|
|
|
|
+ @RequestMapping(value = "/portal/news/list", method = RequestMethod.GET)
|
|
|
|
|
+ @ResponseBody
|
|
|
|
|
+ public Result portalNewsList(Integer type, String pageSize, String pageNo, String noCache){
|
|
|
|
|
+ Result res = new Result();
|
|
|
|
|
+ if (StringUtils.equals(noCache, "clear")) {
|
|
|
|
|
+ newsService.cleanList();
|
|
|
|
|
+ }
|
|
|
|
|
+ res.setData(newsService.findPortalList(pageSize, pageNo, type));
|
|
|
|
|
+ return res;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 新闻详情
|
|
|
|
|
+ */
|
|
|
|
|
+ @RequestMapping(value = "/portal/news/detail", method = RequestMethod.GET)
|
|
|
|
|
+ @ResponseBody
|
|
|
|
|
+ public Result portalNewsDetail(Long id){
|
|
|
|
|
+ Result res = new Result();
|
|
|
|
|
+ if (null == id) {
|
|
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "新闻ID"));
|
|
|
|
|
+ return res;
|
|
|
|
|
+ }
|
|
|
|
|
+ res.setData(newsService.findNewsDetail(id));
|
|
|
|
|
+ return res;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|