美文网首页
SSM项目基础实战总结(配置文件篇)

SSM项目基础实战总结(配置文件篇)

作者: XHHP | 来源:发表于2019-08-07 21:13 被阅读0次

    在学完ssm之后,觉得自己需要一个项目来练练手,巩固一些学到的知识,不然也容易忘记。就选择了大二开学参加软件设计大赛的项目(基于校园形式的报修系统)进行一些重构,用ssm框架重新搭建一下后台的代码。我现在只重构了我的部分,还需要我的队友重构完他的部分,就会将项目放上github。
    主要应用技术:mybatis、spring、springmvc、mysql、ajax,maven
    这个是最初软件设计大赛时的项目简介(当初是主要用servlet搭建的)


    在这里插入图片描述

    一、项目的搭建目录

    <span><img src="https://img-blog.csdnimg.cn/20190531103119371.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MTc5OTAxOQ==,size_16,color_FFFFFF,t_70" height="500px"></span>
    <font color="red">总结:采用了传统的按层分包的模式:Controller、Service、Repository、tools(工具类)、common(通用类)、filter(过滤器类)</font>

    二、pom.xml文件

    <?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">
      <modelVersion>4.0.0</modelVersion>
    
      <groupId>com.gduf</groupId>
      <artifactId>GuaranteeSystem</artifactId>
      <version>1.0-SNAPSHOT</version>
      <packaging>war</packaging>
    
      <name>GuaranteeSystem Maven Webapp</name>
      <!-- FIXME change it to the project's website -->
      <url>http://www.example.com</url>
    
      <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.7</maven.compiler.source>
        <maven.compiler.target>1.7</maven.compiler.target>
      </properties>
    
      <dependencies>
        <!--junit测试-->
        <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>4.11</version>
          <scope>test</scope>
        </dependency>
    
        <!--SpringMvc、Spring-->
        <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-webmvc</artifactId>
          <version>5.1.5.RELEASE</version>
        </dependency>
    
        <!--Spring JDBC-->
        <!-- https://mvnrepository.com/artifact/org.springframework/spring-jdbc -->
        <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-jdbc</artifactId>
          <version>5.1.5.RELEASE</version>
        </dependency>
    
        <!--Spring面向切面编程-->
        <!-- https://mvnrepository.com/artifact/org.springframework/spring-aspects -->
        <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-aspects</artifactId>
          <version>5.1.5.RELEASE</version>
        </dependency>
    
        <!--mybatis-->
        <!-- https://mvnrepository.com/artifact/org.mybatis/mybatis -->
        <dependency>
          <groupId>org.mybatis</groupId>
          <artifactId>mybatis</artifactId>
          <version>3.4.6</version>
        </dependency>
    
    
        <!--mybatis整合spring的适配包-->
        <!-- https://mvnrepository.com/artifact/org.mybatis/mybatis-spring -->
        <dependency>
          <groupId>org.mybatis</groupId>
          <artifactId>mybatis-spring</artifactId>
          <version>1.3.2</version>
        </dependency>
    
        <!--数据库连接池、驱动-->
        <!-- https://mvnrepository.com/artifact/c3p0/c3p0 -->
        <dependency>
          <groupId>com.mchange</groupId>
          <artifactId>c3p0</artifactId>
          <version>0.9.5.2</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
        <dependency>
          <groupId>mysql</groupId>
          <artifactId>mysql-connector-java</artifactId>
          <version>LATEST</version>
        </dependency>
    
        <!--json数据转换器需要的依赖-->
        <!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
        <dependency>
          <groupId>com.fasterxml.jackson.core</groupId>
          <artifactId>jackson-core</artifactId>
          <version>2.9.8</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
        <dependency>
          <groupId>com.fasterxml.jackson.core</groupId>
          <artifactId>jackson-databind</artifactId>
          <version>2.9.8</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations -->
        <dependency>
          <groupId>com.fasterxml.jackson.core</groupId>
          <artifactId>jackson-annotations</artifactId>
          <version>RELEASE</version>
        </dependency>
    
    
        <!--短信验证码需要的jsonObject-->
        <dependency>
          <groupId>com.alibaba</groupId>
          <artifactId>fastjson</artifactId>
          <version>1.2.4</version>
        </dependency>
    
        <!--json的token-->
        <!-- https://mvnrepository.com/artifact/com.googlecode.jsontoken/jsontoken -->
        <dependency>
          <groupId>com.googlecode.jsontoken</groupId>
          <artifactId>jsontoken</artifactId>
          <version>1.1</version>
        </dependency>
    
        <!--引入JWT依赖,由于是基于Java,所以需要的是java-jwt-->
        <dependency>
          <groupId>io.jsonwebtoken</groupId>
          <artifactId>jjwt</artifactId>
          <version>0.9.1</version>
        </dependency>
        <dependency>
          <groupId>com.auth0</groupId>
          <artifactId>java-jwt</artifactId>
          <version>3.4.0</version>
        </dependency>
    
          <!--Base64算法-->
          <!-- https://mvnrepository.com/artifact/net.iharder/base64 -->
          <dependency>
              <groupId>net.iharder</groupId>
              <artifactId>base64</artifactId>
              <version>2.3.8</version>
          </dependency>
    
          <!--joda Time-->
          <dependency>
            <groupId>joda-time</groupId>
            <artifactId>joda-time</artifactId>
            <version>2.9.7</version>
          </dependency>
    
          <!--WebListener注解-->
        <dependency>
          <groupId>org.apache.tomcat</groupId>
          <artifactId>tomcat-servlet-api</artifactId>
          <version>7.0.62</version>
        </dependency>
    
         <!--分页插件 PageHelper-->
        <dependency>
          <groupId>com.github.pagehelper</groupId>
          <artifactId>pagehelper</artifactId>
          <version>LATEST</version>
        </dependency>
    
        <!--上传文件-->
        <!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
        <dependency>
          <groupId>commons-io</groupId>
          <artifactId>commons-io</artifactId>
          <version>2.4</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/commons-fileupload/commons-fileupload -->
        <dependency>
          <groupId>commons-fileupload</groupId>
          <artifactId>commons-fileupload</artifactId>
          <version>1.3.1</version>
        </dependency>
    
      </dependencies>
    
      <build>
        <finalName>GuaranteeSystem</finalName>
        <pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
          <plugins>
            <plugin>
              <artifactId>maven-clean-plugin</artifactId>
              <version>3.1.0</version>
            </plugin>
            <!-- see http://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_war_packaging -->
            <plugin>
              <artifactId>maven-resources-plugin</artifactId>
              <version>3.0.2</version>
            </plugin>
            <plugin>
              <artifactId>maven-compiler-plugin</artifactId>
              <version>3.8.0</version>
            </plugin>
            <plugin>
              <artifactId>maven-surefire-plugin</artifactId>
              <version>2.22.1</version>
            </plugin>
            <plugin>
              <artifactId>maven-war-plugin</artifactId>
              <version>3.2.2</version>
            </plugin>
            <plugin>
              <artifactId>maven-install-plugin</artifactId>
              <version>2.5.2</version>
            </plugin>
            <plugin>
              <artifactId>maven-deploy-plugin</artifactId>
              <version>2.8.2</version>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </project>
    
    

    <font color="red">总结:需要添加的依赖主要有以下几个:

    1. junit测试
    2. SpringMvc、Spring
    3. SpringJDBC
    4. Spring面向切面变成Aspect
    5. mybatis
    6. mybatis整合spring的适配包
    7. 数据库连接池、驱动
    8. json转换器
    9. 分页插件-PageHelper

    三、web.xml文件

    <!DOCTYPE web-app PUBLIC
            "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
            "http://java.sun.com/dtd/web-app_2_3.dtd" >
    
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
             xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
             id="WebApp_ID" version="2.5">
        <display-name>Archetype Created Web Application</display-name>
    
        <!--Spring配置-->
        <context-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>classpath:applicationContext.xml</param-value>
        </context-param>
        
        <!--配置ContextLoaderListener用以初始化SpringIoc容器-->
        <listener>
            <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
        </listener>
        
        <!--SpringMvc核心配置-->
        <servlet>
            <servlet-name>spring-mvc</servlet-name>
            <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
            <load-on-startup>1</load-on-startup>
        </servlet>
        <servlet-mapping>
            <servlet-name>spring-mvc</servlet-name>
            <url-pattern>/</url-pattern>
        </servlet-mapping>
        
        <!--字符编码过滤器,一定要放在过滤器之前-->
        <filter>
            <filter-name>CharacterEncodingFilter</filter-name>
            <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
            <init-param>
                <param-name>encoding</param-name>
                <param-value>utf-8</param-value>
            </init-param>
            <init-param>
                <param-name>forceRequestEncoding</param-name>
                <param-value>true</param-value>
            </init-param>
            <init-param>
                <param-name>foreResponseEncoding</param-name>
                <param-value>true</param-value>
            </init-param>
        </filter>
        <filter-mapping>
            <filter-name>CharacterEncodingFilter</filter-name>
            <url-pattern>/*</url-pattern>
        </filter-mapping>
    
        <!--使用Restful风格的Url,将页面普通的get请求或者post请求转换成delete或push请求-->
        <filter>
            <filter-name>hiddenHttpMethodFilter</filter-name>
            <filter-class>org.springframework.web.filter.HiddenHttpMethodFilter</filter-class>
        </filter>
        <filter-mapping>
            <filter-name>hiddenHttpMethodFilter</filter-name>
            <url-pattern>/*</url-pattern>
        </filter-mapping>
    </web-app>
    
    

    <font color="red">总结:web.xml配置文件主要有以下几个配置项:

    1. Spring配置
    2. ContextLoaderListener配置(用以初始化SpringIoc容器)
    3. SpringMvc核心配置
    4. 字符编码过滤器
    5. Restful风格配置(如有需要)

    四、SpringMvc配置文件(spring-mvc-servlet.xml)

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
           xmlns:context="http://www.springframework.org/schema/context"
           xmlns:tx="http://www.springframework.org/schema/cache"
           xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd">
        <!--使用注解驱动-->
        <mvc:annotation-driven></mvc:annotation-driven>
        <!--定义扫描装载的包-->
        <context:component-scan base-package="com.ssm.code"></context:component-scan>
        <!--视图解析器-->
        <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
            <property name="prefix" value="/html/"></property>
            <property name="suffix" value=".html"></property>
        </bean>
    
        <!--静态资源过滤-->
        <mvc:resources mapping="/html/**" location="/html/"></mvc:resources>
        <mvc:resources mapping="/js/**" location="/js/"></mvc:resources>
        <mvc:resources mapping="/css/**" location="/css/"></mvc:resources>
        <mvc:resources mapping="/imgs/**" location="/imgs/"></mvc:resources>
        <mvc:resources mapping="/iconfont/**" location="/iconfont/"></mvc:resources>
        <mvc:resources mapping="/iconfont2/**" location="/iconfont2/"></mvc:resources>
        <mvc:resources mapping="/scripts/**" location="/scripts/"></mvc:resources>
    </beans>
    

    <font color="red">总结:SpringMvc配置文件主要有以下几个配置项:

    1. 使用注解驱动
    2. 扫描要装载的包
    3. 视图解析器
    4. 静态资源的过滤

    五、Spring配置文件(applicationContext.xml)

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
           xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
    
        <!--注解扫描-->
        <context:annotation-config></context:annotation-config>
        <!--包扫描-->
        <context:component-scan base-package="com.ssm.code">
            <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"></context:exclude-filter>
        </context:component-scan>
    
        <!--数据源配置-->
        <bean class="com.mchange.v2.c3p0.ComboPooledDataSource" id="dataSource" destroy-method="close">
            <property name="user" value="root"></property>
            <property name="password" value="XHHP0913"></property>
            <property name="driverClass" value="com.mysql.jdbc.Driver"></property>
            <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/guaranteesystem?serverTimezone=UTC"></property>
        </bean>
    
        <!--整合mybatis-->
        <bean class="org.mybatis.spring.SqlSessionFactoryBean" id="sqlSessionFactory">
            <property name="dataSource" ref="dataSource"></property>
            <!--指定mybatis全局配置文件-->
            <property name="configLocation" value="classpath:/mybatis-config.xml"></property>
        </bean>
    
        <!--采用自动扫描方式,将mybatis的接口扫描到容器中-->
        <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
            <property name="basePackage" value="com.ssm.code.dao"></property>
            <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"></property>
            <property name="annotationClass" value="org.springframework.stereotype.Repository"></property>
        </bean>
    
        <!--事物管理器配置数据源事物-->
        <bean class="org.springframework.jdbc.datasource.DataSourceTransactionManager" id="dataSourceTransactionManager">
            <property name="dataSource" ref="dataSource"></property>
        </bean>
        <!--使用注解定义事物-->
        <tx:annotation-driven transaction-manager="dataSourceTransactionManager"></tx:annotation-driven>
    
        <!--配置数据库事务-->
        <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
            <property name="dataSource" ref="dataSource"></property>
        </bean>
    
        <!--配置json消息转换器-->
        <bean id="jsonConverter" class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
            <property name="supportedMediaTypes">
                <list>
                    <value>application/json;charset=utf-8</value>
                </list>
            </property>
        </bean>
        <bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter">
            <property name="messageConverters">
                <list>
                    <ref bean="jsonConverter"></ref>
                </list>
            </property>
        </bean>
    
    
    </beans>
    

    <font color="red">总结:Spring配置文件主要有以下几个配置项:

    1. 注解扫描
    2. 包扫描
    3. 数据源配置
    4. 整合mybatis
    5. 采用自动扫描方式,将mybatis的接口扫描到容器中
    6. 事务管理器配置数据源事物
    7. 使用注解定义事物
    8. 配置json消息转换器

    六、Mybatis总配置文件(mybatis-config.xml)

    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE configuration
            PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
            "http://mybatis.org/dtd/mybatis-3-config.dtd">
    <configuration>
        <!--配置分页插件-->
        <plugins>
            <plugin interceptor="com.github.pagehelper.PageInterceptor">
                <property name="helperDialect" value="mysql"></property>
            </plugin>
        </plugins>
        
        <mappers>
            <!--注册功能-->
            <mapper resource="/mapper/RegisterMapper.xml"></mapper>
            <!--学生登录功能-->
            <mapper resource="/mapper/StudentLoginMapper.xml"></mapper>
            <!--服务信息获取-->
            <mapper resource="/mapper/NoticeInformMapper.xml"></mapper>
            <!--数据分析-->
            <mapper resource="/mapper/AnalyzeDataMapper.xml"></mapper>
            <!--商品购买-->
            <mapper resource="/mapper/CommidityMapper.xml"></mapper>
            <!--个人信息功能-->
            <mapper resource="/mapper/PersonInformMapper.xml"></mapper>
            <!--工人端登录-->
            <mapper resource="/mapper/WorkerLoginMapper.xml"></mapper>
            <!--管理端登录-->
            <mapper resource="/mapper/ManagerLoginMapper.xml"></mapper>
            <!--报修评价-->
            <mapper resource="/mapper/ScoreMapper.xml"></mapper>
        </mappers>
    </configuration>
    
    

    七、数据库文件(建表语句)

    /*
    Navicat MySQL Data Transfer
    
    Source Server         : InformationSystem
    Source Server Version : 80012
    Source Host           : localhost:3306
    Source Database       : guaranteesystem
    
    Target Server Type    : MYSQL
    Target Server Version : 80012
    File Encoding         : 65001
    
    Date: 2019-05-31 11:09:31
    */
    
    SET FOREIGN_KEY_CHECKS=0;
    
    -- ----------------------------
    -- Table structure for admin
    -- ----------------------------
    DROP TABLE IF EXISTS `admin`;
    CREATE TABLE `admin` (
      `a_id` varchar(11) NOT NULL,
      `a_phone` varchar(11) DEFAULT NULL,
      `a_password` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
      `a_major` int(11) DEFAULT NULL,
      PRIMARY KEY (`a_id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    
    -- ----------------------------
    -- Table structure for admin_chat
    -- ----------------------------
    DROP TABLE IF EXISTS `admin_chat`;
    CREATE TABLE `admin_chat` (
      `username` varchar(255) DEFAULT NULL,
      `roomid` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
      PRIMARY KEY (`roomid`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    
    -- ----------------------------
    -- Table structure for area
    -- ----------------------------
    DROP TABLE IF EXISTS `area`;
    CREATE TABLE `area` (
      `id` int(11) NOT NULL,
      `name` varchar(10) NOT NULL,
      `code` int(11) DEFAULT NULL,
      PRIMARY KEY (`id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    
    -- ----------------------------
    -- Table structure for build
    -- ----------------------------
    DROP TABLE IF EXISTS `build`;
    CREATE TABLE `build` (
      `id` int(11) NOT NULL,
      `building` varchar(20) DEFAULT NULL,
      `code` int(11) DEFAULT NULL,
      PRIMARY KEY (`id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    
    -- ----------------------------
    -- Table structure for commidity
    -- ----------------------------
    DROP TABLE IF EXISTS `commidity`;
    CREATE TABLE `commidity` (
      `commidity_id` varchar(20) DEFAULT NULL,
      `name` varchar(100) DEFAULT NULL,
      `description` varchar(255) DEFAULT NULL,
      `price` double(10,2) DEFAULT NULL
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    
    -- ----------------------------
    -- Table structure for evaluateform
    -- ----------------------------
    DROP TABLE IF EXISTS `evaluateform`;
    CREATE TABLE `evaluateform` (
      `e_ordernumber` int(11) NOT NULL AUTO_INCREMENT,
      `s_id` varchar(11) DEFAULT NULL,
      `r_ordernumber` int(11) DEFAULT NULL,
      `e_level` int(11) DEFAULT NULL,
      `e_mess` varchar(255) DEFAULT NULL,
      PRIMARY KEY (`e_ordernumber`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    
    -- ----------------------------
    -- Table structure for noticeinform
    -- ----------------------------
    DROP TABLE IF EXISTS `noticeinform`;
    CREATE TABLE `noticeinform` (
      `UpLoader` varchar(255) NOT NULL,
      `FilePath` varchar(255) NOT NULL,
      `FileName` varchar(255) NOT NULL,
      `DownLoadNum` int(11) NOT NULL,
      `UpLoadDate` varchar(255) NOT NULL,
      PRIMARY KEY (`FilePath`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    
    -- ----------------------------
    -- Table structure for repairform
    -- ----------------------------
    DROP TABLE IF EXISTS `repairform`;
    CREATE TABLE `repairform` (
      `r_ordernumber` int(11) NOT NULL AUTO_INCREMENT,
      `r_sertype` int(11) NOT NULL,
      `r_seradd` varchar(50) DEFAULT NULL,
      `r_serinform` varchar(70) DEFAULT NULL,
      `r_sertime` varchar(30) DEFAULT NULL,
      `r_detailtime` varchar(30) DEFAULT NULL,
      `r_judgestate` int(11) DEFAULT NULL,
      `r_filepath` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
      `s_id` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
      `s_phone` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
      `a_id` varchar(11) DEFAULT NULL,
      `r_userconfirm` int(11) DEFAULT '0',
      `r_submittime` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '维修人员确定维修单完成',
      PRIMARY KEY (`r_ordernumber`)
    ) ENGINE=InnoDB AUTO_INCREMENT=218 DEFAULT CHARSET=utf8;
    
    -- ----------------------------
    -- Table structure for score
    -- ----------------------------
    DROP TABLE IF EXISTS `score`;
    CREATE TABLE `score` (
      `r_ordernumber` int(11) NOT NULL,
      `satisfied` varchar(20) DEFAULT NULL,
      `suggest` varchar(255) DEFAULT NULL,
      `score` int(11) DEFAULT NULL,
      `flag` int(5) DEFAULT '0',
      `repairman` varchar(50) DEFAULT NULL,
      `username` varchar(20) DEFAULT NULL,
      `time` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    
    -- ----------------------------
    -- Table structure for student
    -- ----------------------------
    DROP TABLE IF EXISTS `student`;
    CREATE TABLE `student` (
      `stu_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
      `phone` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
      `password` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
      `area` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
      `build` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
      `room` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
      `sex` int(255) DEFAULT NULL,
      `timestamp` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
      PRIMARY KEY (`stu_id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    
    -- ----------------------------
    -- Table structure for studentpurchase
    -- ----------------------------
    DROP TABLE IF EXISTS `studentpurchase`;
    CREATE TABLE `studentpurchase` (
      `stu_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
      `commidity_id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
      `quantity` int(11) DEFAULT NULL,
      `commidity_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
      `price` double(10,2) DEFAULT NULL
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    
    -- ----------------------------
    -- Table structure for student_chat
    -- ----------------------------
    DROP TABLE IF EXISTS `student_chat`;
    CREATE TABLE `student_chat` (
      `username` varchar(255) DEFAULT NULL,
      `roomid` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
      `num` int(11) NOT NULL AUTO_INCREMENT,
      PRIMARY KEY (`num`)
    ) ENGINE=InnoDB AUTO_INCREMENT=266 DEFAULT CHARSET=utf8;
    
    -- ----------------------------
    -- Table structure for worker
    -- ----------------------------
    DROP TABLE IF EXISTS `worker`;
    CREATE TABLE `worker` (
      `worker_id` varchar(20) NOT NULL,
      `worker_password` varchar(50) NOT NULL,
      `ser_type` varchar(10) DEFAULT NULL
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    
    

    相关文章

      网友评论

          本文标题:SSM项目基础实战总结(配置文件篇)

          本文链接:https://www.haomeiwen.com/subject/tblbdctx.html