门户网站介绍商城首页搭建内容系统创建cms实现课堂04.淘淘-day04v2_第1页
门户网站介绍商城首页搭建内容系统创建cms实现课堂04.淘淘-day04v2_第2页
门户网站介绍商城首页搭建内容系统创建cms实现课堂04.淘淘-day04v2_第3页
门户网站介绍商城首页搭建内容系统创建cms实现课堂04.淘淘-day04v2_第4页
门户网站介绍商城首页搭建内容系统创建cms实现课堂04.淘淘-day04v2_第5页
免费预览已结束,剩余31页可下载查看

付费下载

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、1. 课程计划1、门户系统的搭建2、显示商城首页3、内容管理系统的实现a)b)内容分类管理内容管理4、首页的轮播图展示实现2. 门户系统的搭建2.1.门户系统从广义上来说,它将各种应用系统、数据资源和互联网资源集成到一个信息管理之上,并以的用户界面提供给用户,并建立企业对客户、企业对员工和企业对企业的信息通道,使企业能够在企业和外部的各种信息。门户就是的,通俗的说在这里就是首页。比如:jd 首页,taotao 首页,首页。门户属于前台系统 :面向广大的互联网网民。系统:面向,入住的商家,使用。2.2. 系统架构搭建 taotao-portal-web 工程创建 Maven 工程参考 taota

2、o-manager-web2.3.2. 修改pom.xml 文件4.0.0com.taotaotaotao-parent0.0.1-SNAPSHOTcom.taotaotaotao-portal-web0.0.1-SNAPSHOTwar.springframeworkspring-context.springframeworkspring-beans.springframeworkspring-webmvc.springframeworkspring-jdbc.springframeworkspring-aspects.springframeworkspring-jms.springframe

3、workspring-context-supportjstljstljavax.servletservlet-apiprovidedjavax.servletjsp-apiprovided2.3.3. 配置 web.xmlweb-app xmlns:xsi=xmlns=h/xml/ns/javaeecom.alibabadubbo.springframeworkspring.jtynetty.apache.zookeeperzookeepercom.sgroschupfzkcnt.apache.tomcat.maventomcat7-maven-plugin8082/SEO:搜索引擎优化,为了

4、提高的流量,提高在各搜索引擎中的搜索,需要进行优化,那么可以为站伪静态化,以提高。2.3.4. 加入配置文件springmvc.xmlxsi:schemaLocation=h/xml/ns/javaee h/xml/ns/javaee/web-app_2_5.xsdver=2.5taotao-portal-webindex.jspCharacterEncodingFilter.springframework.web.filter.CharacterEncodingFilterencodingutf-8CharacterEncodingFilter/*taotao-portal-web.spri

5、ngframework.web.servlet.DispatcherServletcontextConfigLocationclasspath:spring/springmvc.xml1taotao-portal-web*.htmlperties(添加 log4j 不是必须的),log4j 参考:E:courses淘淘商城01.教案01.参考资料下的 perties搭建后的效果图:3. 商城首页展示首页的原型:添加静态页面及资源。页面位置如下:3.1. 功能分析请求的 url:/index参数:没有返回值:String 逻辑视图3.2. 功能实现一般:jd,时直接这里能否直接:(相当于,后面部

6、署的时候将会换成)是否定的,要想实现此功能,修改:web.xml。添加红色部分如下:效果如下:4. 内容管理系统介绍4.1. 首页大位开发实现分析可以根据首页大位的数据结构设计一张表,进行增删改查管理其他部分的展示内容同样可以设计表,进行增删改查存在:位等等),单独建立表,进行 CRUD 操作,如果每一个前端展示内容(大会有以下问题:位、小首页页面信息大量堆积,发布显的异常繁琐沉重;内容繁杂,管理效率低下;3.许多工作都需要其他技术配合完成;4.工作量大,扩展性差;使用内容管理系统解决以上问题。4.2. 内容管理系统内容管理系统(content management system,CMS)是一

7、种位于 WEB 前端(Web 服务器)和后端办公系统或流程(内容创作、编辑)之间的系统。内容的创作、编辑人使用内容管理系统来提交、修改、发布内容。这里指的“内容”可能包括员、发布文件、表格、数据库中的数据甚至等一切你想要发布到ernet的信息。就是管理前台的页面和页面中的内容可以动态展示。4.3. 动态展示分析对首页展示功能进行分析,抽取,发现应当有以下的字段属性:有有有标题有价格提示包含大文本类型,可以作为公告把首页的每个展示功能(大位,淘淘快报等),看作是一个分类每个展示功能里面展示的多条信息,看作是分类下的内容例如:首页大,对应的是大的内容分类,而大位展示的多张,就是大分类下前台需要获取

8、大的,只需要根据大的 id 查询对应的内容即可需要一个内容分类表和一个内容表。内容分类和内容表是一对多的关系。内容分类表,需要树形结构的数据。(大分类下有小分类)内容分类表:tb_content_category内容表:tb_content分类表结构:内容表结构:来内容信息 CMS 系统。需要有需要创建一个内容服务系统5. 内容服务系统创建可以参考 taotao-manager 创建。taotao-content:聚合工程打包方式 pom|-taotao-content-erfacejar|-taotao-content-Servicewar/直接依赖 POJO 过来/直接依赖过来5.1. t

9、aotao-content5.1.1. Pom 文件4.0.0com.taotaotaotao-parent0.0.1-SNAPSHOTcom.taotaotaotao-content0.0.1-SNAPSHOTpomcom.taotaomon0.0.1-SNAPSHOT5.2. taotao-content-erface5.2.1. Pom 文件project xmlns= xmlns:xsi=.apache.tomcat.maventomcat7-maven-plugin8083/5.3. taotao-content-service5.3.1. Pom 文件4.0.0com.taotao

10、taotao-content0.0.1-SNAPSHOTtaotao-content-erfacecom.taotaotaotao-managojo0.0.1-SNAPSHOTxmlns:xsi=xsi:schemaLocation=4.0.0com.taotaotaotao-content0.0.1-SNAPSHOTtaotao-content-servicewarcom.taotaotaotao-manager-0.0.1-SNAPSHOTcom.taotaotaotao-content-erface0.0.1-SNAPSHOT.springframeworkspring-context.

11、springframeworkspring-beans.springframeworkspring-webmvc.springframeworkspring-jdbc.springframeworkspring-aspects5.4. 框架整合参考 taotao-manager.springframeworkspring-jms.springframeworkspring-context-supportcom.alibabadubbo.springframeworkspring.jtynetty.apache.zookeeperzookeepercom.sgroschupfzkcnt6. Cm

12、s 系统实现内容分类管理展示内容分类a)原型图b)功能分析请求的 url:/content/category/list请求的参数:id,当前节点的 id。第一次请求是没有参数,需要给默认值“0”响应数据:List(ResponseBody)Json 数据。id:1,text:节点名称,se:open(closed),id:2,text:节点名称 2,se:open(closed),id:3,text:节点名称 3,se:open(closed)业务逻辑:1、取查询参数 id,parentId2、根据 parentId 查询 tb_content_category,查询子节点列表。 3、得到 L

13、ist4、把列表转换成 Listc)使用逆向工程层d) Service参数:long parentId返回值:ListServicepublic class ContentCategoryServiceImpl implements ContentCategoryService Autowiredprivate TbContentCategoryMapper contentCategoryMapper;Overridepublic List getContentCategoryList(long parentId) / 1、取查询参数id,parentId/ 2、根据parentId 查询tb

14、_content_category,查询子节点列表。 TbContentCategoryExle exle = new TbContentCategoryExle();/设置查询条件Criteria criteria = exle.createCriteria(); criteria.andParentIdEqualTo(parentId);/执行查询/ 3、得到ListList list = contentCategoryMapper.selectByExle(exle);/ 4、把列表转换成Listub List resultList = new ArrayList(); for (TbC

15、ontentCategory tbContentCategory : list) EasyUITreeNode node = new EasyUITreeNode(); node.setId(tbContentCategory.getId(); node.setText(tbContentCategory.getName();node.setSe(tbContentCategory.getIsParent()?closed:open);/添加到列表 resultList.add(node);return resultList;e)发布服务f)表现层g)服务Taotao-manager-web依

16、赖 taotao-content-erface 模块h) ControllerControllerRequestMap(/content/category)public class ContentCategoryController 6.1.2. 新增节点功能分析请求的 url:/content/category/create请求的参数: Long parentId String name 响应的结果:json 数据,TaotaoResult,其中包含一个对象,对象有 id 属性,新生产的内容分类 id数据结点之后需要判断,如果在原结点是叶子节点的时候添加,更新其父节点(is_parent属性

17、设置为 1)业务逻辑:1、接收两个参数:parentId、name 2、向 tb_content_category 表中数据。a)创建一个 TbContentCategory 对象Autowiredprivate ContentCategoryService contentCategoryService;RequestMap(/list) ResponseBodypublic List getContentCist( RequestParam(value=id, defaultValue=0) Long parentId) List list = contentCategoryService.

18、getContentCategoryList(parentId);return list;b)c)补全 TbContentCategory 对象的属性向 tb_content_category 表中数据3、判断父节点的 isparent 是否为 true,不是 true 需要改为 true。 4、需要主键返回。5、返回 TaotaoResult,其中包装 TbContentCategory 对象层可以使用逆向工程。需要添加主键返回:注意:修改完代码后,需要向本地仓库安装 taotao-manager-注意去掉分号 包Service 层参数:parentId、name返回值:返回 TaotaoR

19、esult,其中包装 TbContentCategory 对象Overridepublic TaotaoResult addContentCategory(long parentId, String name) / 1、接收两个参数:parentId、name/ 2、向tb_content_category 表中数据。/ a)创建一个TbContentCategory 对象TbContentCategory tbContentCategory = new TbContentCategory();/ b)补全TbContentCategory 对象的属性 tbContentCategory.se

20、tIsParent(false); tbContentCategory.setName(name); tbContentCategory.setParentId(parentId);/排列序号,表示同级类目的展现次序,如数值相等则按名称次序排列。取值范围:大于零的整数 tbContentCategory.setSortOrder(1);/状态。可选值:1(正常),2(删除) tbContentCategory.setSus(1);tbContentCategory.setCreated(new Date();发布服务。表现层请求的 url:/content/category/create请求的

21、参数: Long parentId String name 响应的结果:json 数据,TaotaoResult6.1.3. 内容分类重命名、删除RequestMap(/create) ResponseBodypublic TaotaoResult createCategory(Long parentId, String name) TaotaoResult result = contentCategoryService.addContentCategory(parentId, name);return result;tbContentCategory.setUpdated(new Date(

22、);/ c)向tb_content_category 表中数据contentCategoryMapper.insert(tbContentCategory);/ 3、判断父节点的isparent 是否为 true,不是true 需要改为true。TbContentCategory parentNode = contentCategoryMapper.selectByPrimaryKey(parentId);if (!parentNode.getIsParent() parentNode.setIsParent(true);/更新父节点contentCategoryMapper.updateBy

23、PrimaryKey(parentNode);/ 4、需要主键返回。/ 5、返回TaotaoResult,其中包装 TbContentCategory 对象return TaotaoResult.ok(tbContentCategory);重命名请求的 url:/content/category/update参数:id,当前节点 ,重命名后的名称。业务逻辑:根据 id 更新。返回值:返回 TaotaoResult.ok()作业。删除节点请求的 url:/content/category/delete/参数:id,当前节点的 id。响应的数据:json。TaotaoResult。业务逻辑:1、根

24、据 id 删除。2、判断父节点下是否还有子节点,如果没有需要把父节点的 isparent 改为 false 3、如果删除的是父节点,子节点要级联删除。两种解决方案:1)如果判断是父节点不允许删除。2)递归删除。(不会使用)作业。内容管理功能点分析1、内容列表查询2、新增内容3、编辑内容4、删除内容6.2.2. 内容列表查询请求的 url:/content/query/list参数:categoryId 分类id响应的数据:json 数据total:查询结果总数量,rowsid:1,title:aaa,subtit EasyUIDataGridResult描述商品数据 List查询的表:tb_c

25、ontent业务逻辑:b,.根据内容分类 id 查询内容列表。要进行分页处理。参考商品列表的查询。6.2.3. 新增内容功能分析新增内容,必须指定一个内容分类。提交表单请求的 url:/content/save参数:表单的数据。使用 pojo 接收 TbContent返回值:TaotaoResult(json 数据)业务逻辑:1、把 TbContent 对象属性补全。2、向 tb_content 表中3、返回 TaotaoResult数据。逆向工程Service参数:TbContent返回值:TaotaoResultServicepublic class ContentServiceImpl

26、implements ContentService Autowiredprivate TbContentMapper contentMapper;Overridepublic TaotaoResult addContent(TbContent content) /补全属性 content.setCreated(new Date(); content.setUpdated(new Date();/数据 contentMapper.insert(content); return TaotaoResult.ok();发布服务服务Toatao-manager-web 工程中。Controller提交表

27、单请求的 url:/content/save参数:表单的数据。使用 pojo 接收 TbContent返回值:TaotaoResult(json 数据)Controllerpublic class ContentController Autowiredprivate ContentService contentService;RequestMap(/content/save)作业6.2.4. 编辑内容:选择一个复选框 点击编辑 ,编辑的页面所在的位置:URL: /rest/item/update参数:表单数据(tbContent 来接收)返回值:taotaoResult业务逻辑:根据 id 更

28、新 tbContent可以是逆向工程。(单表)补全其他没有更新过来的属性。(created updated)服务层发布服务(前面已经发布过了)表现层引入服务(调用服务方法,返回)。6.2.5.删除内容位置:ResponseBodypublic TaotaoResult addContent(TbContent content) TaotaoResult result = contentService.addContent(content); return result;URL: /content/delete参数: ids(一个内容 id 拼成的字符串)返回值:taotaoresult业务逻辑

29、:根据 ids 的值分割字符串,得到 id 的数组根据 id 循环删除返回 taotaoresult7. 首页轮播图展示taotao-portal-web 工程中,动态展示内容信息。前端团队:负责 JS,html 等开发。后端团队:负责的开发并提供数据给前端。7.1. 功能分析只需要动态生成一个 json 数据,轮播图就可以动态展示:taotao-portal-web 工程下的 index.jsp 中:Json 数据格式:分析:portal-web需要自己自定义的 POJO 的类型数据的列表content 服务层公用的,可以被其他的系统(表现的系统)来调用 ;为了通用性:content 服务层

30、中 获取 tbcontent 的内容列表 即:listportal-web 表现层 需要拿到 tbcontent 的列表,然后进行转换成自定义的类型的数据列表即可。从 tb_content 表中取数据,根据(叶子节点)内容分类 id 查询列表(内容列表)。内容分类 id 固定,需要配置在属性文件中。List的 width、height 配置在属性文件中。Alt 属性从 sub_title 中取。Src-pic srcB-pic2 Href-url分析:srcB: http:/images/2015/03/03/9345.jpg, height: 240,alt: , width: 670,sr

31、c: http:/images/2015/03/03/9345.jpg, widthB: 550,href: /at.html?cpdad=1DLSUE, heightB: 240URL:/index参数:无。返回值:首页页面(数据是 JSON 设置 m中)业务逻辑:根据分类的 id发布服务查询 内容列表(List)表现层引入服务调用服务 ,转换成自定义的数据类型(Ad1Node) 的列表5.将数据列表设置到 M中,返回给页面。需要创建一个 pojo 转换成页面需要的 json 数据格式。放入 com.taotao.portal.pojo 中。7.2.层从 tb_content 表中取数据,根

32、据内容分类 id 查询列表。可以使用逆向工程7.3. Service 层参数:long categoryId返回值:ListOverridepublic List getContentList(long cid) public class Ad1Node private String srcB; private String height; private String alt; private String width; private String src; private String widthB; private String href; private String heightB

33、;/getter/setter7.3.1. 发布服务7.4. 表现层在 taotao-portal-web 中实现,查询首页轮播图的内容。7.4.1.服务在 taotao-protal-web 项目中引入依赖包,如图:7.4.2. Controller在首页展示之前,对数据进行处理,然后展示首页,需要在 PageController 中实现。/根据cid 查询内容列表TbContentExle exle = new TbContentExle();/设置查询条件Criteria criteria = exle.createCriteria(); criteria.andCategoryIdEqualTo(ci

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

最新文档

评论

0/150

提交评论