1. 程式人生 > >16、首頁動態展示(內容服務系統)

16、首頁動態展示(內容服務系統)

首頁動態展示(內容服務系統)

內容資訊要從資料庫中獲得

動態展示分析

  • 內容需要進行分類
  • 分類下有子分類,需要動態管理
  • 分類下有內容列表
  • 單點的內容資訊
    • 有圖片
    • 有連結
    • 有標題
    • 有價格
    • 包含大文字型別,可以作為公告

在這裡插入圖片描述

需要一個內容分類表和一個內容表。內容分類和內容表是一對多的關係。
內容分類表,需要儲存樹形結構的資料。
內容分類表:tb_content_category
內容表:tb_content

需要有後臺來維護內容資訊—— CMS 系統。

在這裡插入圖片描述

在這裡插入圖片描述

在這裡插入圖片描述

內容服務系統建立

工程搭建

需要建立一個內容服務系統。可以參考 e3-manager 建立。

e3-content:聚合工程打包方式pom
    |--e3-content-interface  jar
    |--e3-content-Service  war

e3-content

pom檔案

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent> <artifactId>e3-parent</artifactId> <groupId>cn.ynx.e3mall</groupId> <version>1.0-SNAPSHOT</version> <relativePath
>
../e3-parent/pom.xml</relativePath> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>e3-content</artifactId> <packaging>pom</packaging> <dependencies> <dependency> <groupId>cn.ynx.e3mall</groupId> <artifactId>e3-common</artifactId> <version>1.0-SNAPSHOT</version> </dependency> </dependencies> <!-- 配置tomcat外掛 --> <build> <plugins> <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <configuration> <port>8083</port> <path>/</path> </configuration> </plugin> </plugins> </build> </project>

e3-content-interface

pom檔案

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>e3-content</artifactId>
        <groupId>cn.ynx.e3mall</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>e3-content-interface</artifactId>

    <packaging>jar</packaging>

    <dependencies>
        <dependency>
            <groupId>cn.ynx.e3mall</groupId>
            <artifactId>e3-manager-pojo</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>
    </dependencies>

</project>

e3-content-service

pom檔案

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>e3-content</artifactId>
        <groupId>cn.ynx.e3mall</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>e3-content-service</artifactId>

    <packaging>war</packaging>

    <dependencies>
        <dependency>
            <groupId>cn.ynx.e3mall</groupId>
            <artifactId>e3-manager-dao</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>cn.ynx.e3mall</groupId>
            <artifactId>e3-content-interface</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>
        <!-- spring的依賴 -->
        <!-- Spring -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aspects</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jms</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context-support</artifactId>
        </dependency>
        <!-- dubbo相關 -->
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>dubbo</artifactId>
            <!-- 排除依賴 -->
            <exclusions>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.jboss.netty</groupId>
                    <artifactId>netty</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.zookeeper</groupId>
            <artifactId>zookeeper</artifactId>
        </dependency>
        <dependency>
            <groupId>com.github.sgroschupf</groupId>
            <artifactId>zkclient</artifactId>
        </dependency>
    </dependencies>

</project>

框架整合

參考 e3-manager
複製 e3-manager-service 的配置檔案

在這裡插入圖片描述

修改 applicationContext-service.xml

在這裡插入圖片描述

修改 applicationContext-trans.xml

在這裡插入圖片描述

修改 web.xml

在這裡插入圖片描述