Commit ba92643a22c409248d5c2710c68e3c7be84359fa
1 parent
e51c719d28
Exists in
master
提交代码
Showing 4 changed files with 58 additions and 13 deletions
mainData/src/main/java/com/lymsh/yimiao/main/data/util/ArticleContext.java
View file @
ba92643
... | ... | @@ -10,6 +10,16 @@ |
10 | 10 | private Integer id; |
11 | 11 | private String title; |
12 | 12 | private String content; |
13 | + | |
14 | + public String getIntroduction() { | |
15 | + return Introduction; | |
16 | + } | |
17 | + | |
18 | + public void setIntroduction(String introduction) { | |
19 | + Introduction = introduction; | |
20 | + } | |
21 | + | |
22 | + private String Introduction; | |
13 | 23 | private ImageContext image; |
14 | 24 | |
15 | 25 | public String getErrorcode() { |
webApi/src/main/java/com/lyms/yimiao/web/controller/v1/ArgumentsController.java
View file @
ba92643
1 | +package com.lyms.yimiao.web.controller.v1; | |
2 | + | |
3 | +import com.lymsh.mommybaby.basecommon.base.BaseController; | |
4 | +import org.springframework.stereotype.Controller; | |
5 | +import org.springframework.web.bind.annotation.RequestMapping; | |
6 | +import org.springframework.web.servlet.ModelAndView; | |
7 | + | |
8 | +import javax.servlet.http.HttpServletResponse; | |
9 | + | |
10 | +/** | |
11 | + * Created by Administrator on 2016/5/14 0014. | |
12 | + */ | |
13 | + | |
14 | +@Controller | |
15 | +@RequestMapping("/v1") | |
16 | +public class ArgumentsController extends BaseController{ | |
17 | + | |
18 | + //获取文章 | |
19 | + @RequestMapping(value = "/getArguments") | |
20 | + public ModelAndView getArguments(HttpServletResponse response){ | |
21 | + ModelAndView mv = new ModelAndView("error"); | |
22 | + mv.setViewName("arguments"); | |
23 | + return mv; | |
24 | + } | |
25 | + | |
26 | +} |
webApi/src/main/java/com/lyms/yimiao/web/controller/v1/ArticleController.java
View file @
ba92643
... | ... | @@ -9,6 +9,7 @@ |
9 | 9 | import org.springframework.web.bind.annotation.RequestMapping; |
10 | 10 | import org.springframework.web.bind.annotation.RequestMethod; |
11 | 11 | import org.springframework.web.bind.annotation.RequestParam; |
12 | +import org.springframework.web.servlet.ModelAndView; | |
12 | 13 | |
13 | 14 | import javax.servlet.http.HttpServletResponse; |
14 | 15 | |
15 | 16 | |
16 | 17 | |
17 | 18 | |
18 | 19 | |
... | ... | @@ -45,20 +46,23 @@ |
45 | 46 | } |
46 | 47 | |
47 | 48 | //获取文章 |
48 | - @RequestMapping(value = "/articles") | |
49 | - public void getArticles(HttpServletResponse response, | |
49 | + @RequestMapping(value = "/getArticles") | |
50 | + public ModelAndView getArticles(HttpServletResponse response, | |
50 | 51 | @RequestParam("id")Integer id){ |
52 | + ModelAndView mv = new ModelAndView("error"); | |
51 | 53 | |
52 | - ArticleContext articleContext = ArticleUtil.getArticles(id); | |
53 | - if (articleContext!=null){ | |
54 | - | |
55 | - | |
56 | - | |
57 | - | |
54 | + if (id == null) { | |
55 | + mv.addObject("msg", "vaccineNames id is null"); | |
58 | 56 | } |
59 | 57 | |
60 | - | |
58 | + ArticleContext articleContext = ArticleUtil.getArticles(id); | |
59 | + if (articleContext==null){ | |
60 | + mv.setViewName("empty"); | |
61 | + mv.addObject("msg", "无疫苗详情信息"); | |
62 | + } | |
63 | + mv.setViewName("article"); | |
64 | + mv.addObject("articleContext", articleContext); | |
65 | + return mv; | |
61 | 66 | } |
62 | - | |
63 | 67 | } |
webApi/src/main/webapp/WEB-INF/html/article.vm
View file @
ba92643
... | ... | @@ -3,7 +3,7 @@ |
3 | 3 | <html xmlns="http://www.w3.org/1999/xhtml" class="mommyboby"> |
4 | 4 | <head> |
5 | 5 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> |
6 | - <title>服务协议</title> | |
6 | + <title>文章详情</title> | |
7 | 7 | |
8 | 8 | <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> |
9 | 9 | <meta content="IE=edge" http-equiv="X-UA-Compatible"> |
... | ... | @@ -41,8 +41,13 @@ |
41 | 41 | <body> |
42 | 42 | |
43 | 43 | <div class="container"> |
44 | - <h1>疫苗知识汇总</h1> | |
45 | - <p><img src="http://7xnggy.com1.z0.glb.clouddn.com/168饮食避免食用鱼类.jpg" width="299" height="200" border="0" hspace="0" vspace="0" title="" style="width: 299px; height: 200px;"/></p><p>在药物治疗结核期间,请您避免食用无鳞鱼类及淡水鱼。因为抗组结核药物中的异烟肼是一种单胺氧化酶抑制剂,会影响体内组织胺的代谢。而鱼类组织胺的含量很高。在异烟肼治疗期间,如果食用鱼类,会因为缺少有效的单胺氧化酶抑制剂将鱼肉中的组织胺氧化,可能会造成体内组织胺大量蓄积。这就会引起头痛、头晕、恶心、荨麻疹样皮疹、呕吐、腹痛、腹泻、呼吸困难、血压升高等症状。更甚者,会出现高血压危象和脑出血等严重威胁生命安全的情况。</p><p>因此建议您在抗结核药物治疗期间,为了您和宝贝的安全最好不要食用无鳞鱼类和淡水鱼。常见的无鳞鱼类有金枪鱼、鱿鱼、沙丁鱼等。如果您实在想吃鱼的话可以选用有鳞的海鱼,但请您注意,选择的海鱼是一定得是新鲜的(最好是活鱼)。因为不新鲜的海鱼中同样含有大量的组织胺。即使是能吃的鱼类,也不要吃太多,每周一次就可以了。</p><p> </p><p><br/></p> | |
44 | + | |
45 | + <h1>$!articleContext.title</h1> | |
46 | + <p> | |
47 | + <img src=$!articleContext.image.real width="299" height="200" border="0" hspace="0" vspace="0" title="" style="width: 299px; height: 200px;"/> | |
48 | + </p> | |
49 | + <p>$!articleContext.Introduction</p> | |
50 | + <p> </p><p><br/></p> | |
46 | 51 | </div> |
47 | 52 | |
48 | 53 | </body> |