SSM框架的技术综述

  • Post author:
  • Post category:其他




SSM框架的技术综述

首先SSM框架是由spring、springMVC和mybatis组成的,其次Spring引入了IOC(控制反转)和AOP(面向切面编程)的核心技术思想,其核心功能模块是负责管理业务对象;(例如对象创建、初始化和销毁),它帮助完成类的初始化和使用;开发者可以根据需求调用具体的对象。

SpringMVC实际上是Spring的一个专门用于web开发的模块,因此它的核心技术基于Spring;它的底层是servlet,框架是在servlet基础上面加入一些功能,为了让我们做web开发更加方便。SpringMVC的功能职责是负责请求的转发和视图管理,它其中有一个核心的Servlet对象DispatherServlet(中央调度器),它负责接收用户请求,然后中央调度器再将请求派发给Controller对象;最终有Controller对象处理完成给页面展示。

最后是mybatis,它是对JDBC的封装,过去我们开发是链接数据库,需要注册数据库驱动、获取数据库连接、获取创建statement对象、最后执行SQL语句,操作十分繁琐。因此,Mybatis可以帮助我们开发者将数据存入数据库中和从数据库中取数据;通过一个半自动化的对象关系映射(ORM),成功的将接口和java实体类对象映射成数据库中的记录;程序员只需通过注解或者xml的方法配置信息即可。

Spring框架主要由七部分组成,分别是 Spring Core、 Spring AOP、 Spring ORM、 Spring DAO、Spring Context、 Spring Web和 Spring Web MVC。

如下图所示:

在这里插入图片描述



SSM框架的整合



一、SSM框架环境搭建



1. pom.xml文件的配置,添加坐标依赖

      <!-- spring 核心jar -->
   <dependency>
     <groupId>org.springframework</groupId>
     <artifactId>spring-context</artifactId>
     <version>5.2.4.RELEASE</version>
   </dependency>
   <!-- spring 测试jar -->
   <dependency>
     <groupId>org.springframework</groupId>
     <artifactId>spring-test</artifactId>
     <version>5.2.4.RELEASE</version>
   </dependency>
   <!-- spring jdbc -->
   <dependency>
     <groupId>org.springframework</groupId>
     <artifactId>spring-jdbc</artifactId>
     <version>5.2.4.RELEASE</version>
   </dependency>

   <!-- spring事务 -->
   <dependency>
     <groupId>org.springframework</groupId>
     <artifactId>spring-tx</artifactId>
     <version>5.2.4.RELEASE</version>
   </dependency>

   <!-- aspectj切面编程的jar -->
   <dependency>
     <groupId>org.aspectj</groupId>
     <artifactId>aspectjweaver</artifactId>
     <version>1.9.5</version>
   </dependency>
      <!-- c3p0 数据源连接池 -->
      <dependency>
        <groupId>com.mchange</groupId>
        <artifactId>c3p0</artifactId>
        <version>0.9.5.2</version>
      </dependency>

      <!-- mybatis依赖 -->
      <dependency>
        <groupId>org.mybatis</groupId>
        <artifactId>mybatis</artifactId>
        <version>3.5.3</version>
      </dependency>

       <!-- 添加mybatis与Spring整合的核心包 -->
       <dependency>
         <groupId>org.mybatis</groupId>
         <artifactId>mybatis-spring</artifactId>
         <version>2.0.3</version>
       </dependency>

       <!-- mysql 驱动包 -->
       <dependency>
         <groupId>mysql</groupId>
         <artifactId>mysql-connector-java</artifactId>
         <version>8.0.19</version>
       </dependency>

       <!-- 日志打印相关的jar -->
       <dependency>
         <groupId>org.slf4j</groupId>
         <artifactId>slf4j-log4j12</artifactId>
         <version>1.7.2</version>
       </dependency>
     <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-api</artifactId>
       <version>1.7.2</version>
     </dependency>

     <!-- 分页插件 -->
     <dependency>
       <groupId>com.github.pagehelper</groupId>
       <artifactId>pagehelper</artifactId>
       <version>5.1.10</version>
    </dependency>

      <!-- spring web -->
      <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>5.2.4.RELEASE</version>
      </dependency>
      <!-- spring mvc -->
      <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>5.2.4.RELEASE</version>
      </dependency>
    <!-- web servlet -->
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
      <version>3.0.1</version>
      <scope>provided</scope>
    </dependency>
    <!-- 添加json 依赖jar包(注意版本问题) -->
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-core</artifactId>
      <version>2.10.0</version>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
      <version>2.10.0</version>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-annotations</artifactId>
      <version>2.10.0</version>
    </dependency>
    <!-- commons-fileupload文件上传-->
    <dependency>
      <groupId>commons-fileupload</groupId>
      <artifactId>commons-fileupload</artifactId>
      <version>1.3.2</version>
    </dependency>
   <!-- commons-io-->
    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
      <version>2.4</version>
    </dependency>

    <!--注解依赖-->
    <dependency>
      <groupId>javax.annotation</groupId>
      <artifactId>javax.annotation-api</artifactId>
      <version>1.3.2</version>
    </dependency>
<!--引入jsp分页的依赖-->
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
      <version>3.1.0</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.taglibs</groupId>
      <artifactId>taglibs-standard-impl</artifactId>
      <version>1.2.5</version>
    </dependency>
    <dependency>
      <groupId>javax.servlet.jsp.jstl</groupId>
      <artifactId>jstl-api</artifactId>
      <version>1.2</version>
    </dependency>
    </dependencies>
    <build>
      <finalName>SSM</finalName>
      <resources>
        <resource>
          <directory>src/main/resources</directory>
        </resource>
        <resource>
          <directory>src/main/java</directory>
          <includes>
            <include>**/*.xml</include>
            <include>**/*.properties</include>
            <include>**/*.tld</include>
          </includes>
          <filtering>false</filtering>
        </resource>
      </resources>

      <plugins>
        <!-- 编译环境插件 -->
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-compiler-plugin</artifactId>
         <version>2.3.2</version>
         <configuration>
           <source>11</source>
           <target>11</target>
           <encoding>UTF-8</encoding>
         </configuration>
       </plugin>
       <!-- jetty插件 -->
       <plugin>
         <groupId>org.eclipse.jetty</groupId>
         <artifactId>jetty-maven-plugin</artifactId>
      <version>9.4.27.v20200227</version>
      <configuration>
        <scanIntervalSeconds>10</scanIntervalSeconds>
        <!-- 设置端口 -->
        <httpConnector>
          <port>8080</port>
        </httpConnector>
        <!-- 设置项目路径 -->
        <webAppConfig>
          <contextPath>/ssm</contextPath>
        </webAppConfig>
      </configuration>
    </plugin>
  </plugins>
   </build>



2.web.xml配置文件

     <?xml version="1.0" encoding="UTF-8"?>
     <web-app id="WebApp_ID" version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
              http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
         <!-- 启动spring容器-->
         <context-param>
             <param-name>contextConfigLocation</param-name>
             <param-value>classpath:spring.xml</param-value>
         </context-param>
         <!-- 设置监听器 -->
         <listener>
             <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
         </listener>
         <!-- 编码过滤 utf-8 -->
         <filter>
             <description>char encoding filter</description>
             <filter-name>encodingFilter</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>
         </filter>
         <filter-mapping>
             <filter-name>encodingFilter</filter-name>
             <url-pattern>/*</url-pattern>
         </filter-mapping>
     <!-- servlet请求分发器 -->
     <servlet>
         <servlet-name>springMvc</servlet-name>
         <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
         <init-param>
             <param-name>contextConfigLocation</param-name>
             <param-value>classpath:springMVC.xml</param-value>
         </init-param>
         <!-- 表示启动容器时初始化该Servlet -->
         <load-on-startup>1</load-on-startup>
     </servlet>
     <servlet-mapping>
         <servlet-name>springMvc</servlet-name>
         <!-- 这是拦截请求, "/"代表拦截所有请求,"*.do"拦截所有.do请求 -->
         <url-pattern>/</url-pattern>
         <!--<url-pattern>*.do</url-pattern>-->
     </servlet-mapping>
 </web-app>



3. SpringMVC.xml的配置

<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"
   xsi:schemaLocation="
    http://www.springframework.org/schema/mvc
    http://www.springframework.org/schema/mvc/spring-mvc.xsd
    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">

<!-- 开启扫描器 -->
<context:component-scan base-package="com.xxxx.ssm.controller"></context:component-scan>

<!-- mvc 注解驱动 并添加json 支持 -->
<mvc:annotation-driven>
    <mvc:message-converters>
        <!-- 返回信息为字符串时 处理 -->
        <bean class="org.springframework.http.converter.StringHttpMessageConverter"/>
        <!-- 将对象转换为json 对象 -->
        <bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"/>
    </mvc:message-converters>
</mvc:annotation-driven>
 <!-- 使用默认的 Servlet 来响应静态文件 -->
   <mvc:default-servlet-handler/>
   <!-- 配置视图解析器 -->
   <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"
         id="internalResourceViewResolver">
       <!-- 前缀:在WEB-INF目录下的jsp目录下 -->
       <property name="prefix" value="/"/>
       <!-- 后缀:以.jsp结尾的资源 -->
       <property name="suffix" value=".jsp"/>
   </bean>
   <!-- 文件上传 -->
   <bean id="multipartResolver"
         class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
       <!-- 允许文件上传的最大尺寸 -->
       <property name="maxUploadSize">
           <value>104857600</value>
       </property>
       <!--
         设置文件放入临时文件夹的最大大小限制。
         此值是阈值,低于此值,则保存在内存中,如高于此值,则生成硬盘上的临时文件。
       -->
       <property name="maxInMemorySize">
           <value>4096</value>
       </property>
   </bean>
   <!--拦截器-->
</beans>



4. Spring.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:aop="http://www.springframework.org/schema/aop" 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/aop
        http://www.springframework.org/schema/aop/spring-aop.xsd
        http://www.springframework.org/schema/tx
        http://www.springframework.org/schema/tx/spring-tx.xsd">
<!-- 扫描基本包 -->
<context:component-scan base-package="com.xxxx.ssm" >
    <!--排除controller-->
    <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>

<!-- 加载properties 配置文件 -->
<context:property-placeholder location="classpath:db.properties" />

<!-- aop -->
<aop:aspectj-autoproxy />

<!-- 配置c3p0 数据源 -->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
    <property name="driverClass" value="${jdbc.driver}"></property>
    <property name="jdbcUrl" value="${jdbc.url}"></property>
    <property name="user" value="${jdbc.username}"></property>
    <property name="password" value="${jdbc.password}"></property>
</bean>

<!-- 配置事务管理器 -->
<bean id="txManager"
      class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
    <property name="dataSource" ref="dataSource"></property>
</bean>

<!-- 设置事物增强 -->
<tx:advice id="txAdvice" transaction-manager="txManager">
    <tx:attributes>
        <tx:method name="add*" propagation="REQUIRED" />
        <tx:method name="insert*" propagation="REQUIRED" />
        <tx:method name="update*" propagation="REQUIRED" />
        <tx:method name="delete*" propagation="REQUIRED" />
    </tx:attributes>
</tx:advice>

<!-- aop 切面配置 -->
<aop:config>
    <aop:pointcut id="servicePointcut"
                  expression="execution(* com.xxxx.ssm.service..*.*(..))" />
    <aop:advisor advice-ref="txAdvice" pointcut-ref="servicePointcut" />
</aop:config>

<!-- 配置 sqlSessionFactory -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
    <property name="dataSource" ref="dataSource"></property>
    <property name="configLocation" value="classpath:mybatis.xml" />
    <property name="mapperLocations" value="classpath:com/xxxx/ssm/mapper/*.xml" />
</bean>

<!-- 配置扫描器 -->
<bean  class="org.mybatis.spring.mapper.MapperScannerConfigurer">
    <!-- 扫描com.xxxx.ssm.dao这个包以及它的子包下的所有映射接口类 -->
    <property name="basePackage" value="com.xxxx.ssm.mapper" />
    <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" />
</bean>
</beans>
  1. db.properties

    jdbc.driver=com.mysql.cj.jdbc.Driver
    jdbc.url=jdbc:mysql://localhost:3306/数据库名?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8&useSSL=false
    jdbc.username=root
    jdbc.password=数据库密码
    

    6.log4j.properties

    log4j.rootLogger=DEBUG, Console
    # Console
    log4j.appender.Console=org.apache.log4j.ConsoleAppender
    log4j.appender.Console.layout=org.apache.log4j.PatternLayout
    log4j.appender.Console.layout.ConversionPattern=%d [%t] %-5p [%c] - %m%n
    log4j.logger.java.sql.ResultSet=INFO
    log4j.logger.org.apache=INFO
    log4j.logger.java.sql.Connection=DEBUG
    log4j.logger.java.sql.Statement=DEBUG
    log4j.logger.java.sql.PreparedStatement=DEBUG
    



二、SSM整合实现简单的CRUD

  1. 在src/main/创建resources文件夹和java文件夹–>在java下创建包名为com.xxxx.ssm

    下面创建bean、controller、mapper(dao)、service、utils子包

  2. bean下创建java类User

    package com.xxxx.ssm.bean;
    import java.util.Date;
    public class User {
        private Integer userId;
        private String userName;
        private String userPwd;
        private String userEmail;
        private Date createDate;
        private Date updateDate;
    
        public User() {
        }
    
        public Integer getUserId() {
            return userId;
        }
    
        public void setUserId(Integer userId) {
            this.userId = userId;
        }
    
        public String getUserName() {
            return userName;
        }
    
        public void setUserName(String userName) {
            this.userName = userName;
        }
    
        public String getUserPwd() {
            return userPwd;
        }
    
        public void setUserPwd(String userPwd) {
            this.userPwd = userPwd;
        }
    
        public String getUserEmail() {
            return userEmail;
        }
    
        public void setUserEmail(String userEmail) {
            this.userEmail = userEmail;
        }
    
        public Date getCreateDate() {
            return createDate;
        }
    
        public void setCreateDate(Date createDate) {
            this.createDate = createDate;
        }
    
        public Date getUpdateDate() {
            return updateDate;
        }
    
        public void setUpdateDate(Date updateDate) {
            this.updateDate = updateDate;
        }
        @Override
        public String toString() {
            return "User{" +
                    "userId=" + userId +
                    ", userName='" + userName + '\'' +
                    ", userPwd='" + userPwd + '\'' +
                    ", userEmail='" + userEmail + '\'' +
                    ", createDate=" + createDate +
                    ", updateDate=" + updateDate +
                    '}';
        }
    }
    
  3. mapper下创建UserMapper接口和UserMapper.xml用于写SQL语句

    package com.xxxx.ssm.mapper;
    import com.xxxx.ssm.bean.User;
    
    import java.util.List;
    
    public interface UserMapper {
        //根据ID查询一条记录
        public User selectUserById(int id);
        //查询所有的数据,分页显示
        public List<User> selectAll();
        //删除用户
        int deletUserById(int id);
        //添加一个用户
        int insertUser(User user);
        //更新
        public int updateUser(User user);
        //动态添加
        int insertUserSelectKey(User user);
        //动态sql更新
        int DynamicSqlUpdate(User user);
    }
    
  4. service下创建UserService接口 和UserServiceImpl实现类

    package com.xxxx.ssm.service;
    import com.xxxx.ssm.bean.User;
    import java.util.List;
    
    public interface UserService {
        //根据ID查询对象
        User queryUserById(Integer id);
    
        //查询信息
        public List<User> queryAll();
    
        int removeUserById(Integer id);
        //添加一条数据
        int addUser(User user);
        //更新用户数据
        int changeUser(User user);
       //动态Sql添加
        int addUserBatch(User user);
        //动态SQL更新
        int DynamicSqlUpdate(User user);
    
    }
    

    UserService实现类

    package com.xxxx.ssm.service;
    import com.xxxx.ssm.bean.User;
    import com.xxxx.ssm.mapper.UserMapper;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.stereotype.Service;
    import java.util.List;
    
    @Service
    public class UserServiceImpl  implements UserService{
    
        @Autowired
        private UserMapper userMapper;
    
        @Override
        public User queryUserById(Integer id) {
           return userMapper.selectUserById(id);
        }
    
        @Override
        public List<User> queryAll() {
            return userMapper.selectAll();
        }
    
        @Override
        public int removeUserById(Integer id) {
            return userMapper.deletUserById(id);
        }
    
        @Override
        public int addUser(User user) {
            return  userMapper.insertUser(user);
        }
    
        @Override
        public int changeUser(User user) {
            return userMapper.updateUser(user);
        }
    
        @Override
        public int addUserBatch(User user) {
            return userMapper.insertUserSelectKey(user);
        }
    
        @Override
        public int DynamicSqlUpdate(User user) {
            return userMapper.DynamicSqlUpdate(user);
        }
    }
    
    
  5. controller下创建UserController类,在控制器里调用Service,在Service层调用Dao层

    结果通过前端地址栏URL带参数的形式发送请求获取查询结果并展示到相应的页面

package com.xxxx.ssm.controller;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xxxx.ssm.bean.User;
import com.xxxx.ssm.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@Controller
public class UserController {

    @Autowired
    private UserService userService;


    @RequestMapping("one")
    public  String testqueryUserById(Integer id, Model model){
        //根据ID查询对象信息
        User user = userService.queryUserById(id);
        System.out.println(user+"<<<<<");
        //存储
        model.addAttribute("user",user);
        //转发
        return "hello";
    }

    @RequestMapping("page")
    public  String testPage(@RequestParam(defaultValue = "1")Integer pageNum, Model model){
        //分页插件初始化单位
        Integer pageSize=3;
        PageHelper.startPage(pageNum,pageSize);
        //根据ID查询对象信息
        List<User> ulist = userService.queryAll();
        //分页
        PageInfo<User> plist=new PageInfo<User>(ulist);
        System.out.println(plist);
        //存储
        model.addAttribute("plist",plist);
        //转发
        return "pages";
    }
}
  1. hello.jsp页面和pages.jsp页面

    <%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
    <%--引入核心标签库--%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <html>
    <head>
        <title>Title</title>
    </head>
    <body>
    ${user}--hello.jsp
    <hr>
    ${plist.list}
    <hr>
    当前为第${plist.pageNum}页/共${plist.pages}页,总数据记录${plist.total}条
    <hr>
    <a href="page?pageNum=${plist.navigateFirstPage }">首页</a>
    <a href="page?pageNum=${plist.prePage}">上一页</a>
    <a href="page?pageNum=${plist.nextPage}">下一页</a>
    <a href="page?pageNum=${plist.navigateLastPage}">末页</a>
    </body>
    </html>
    
    

    pages.jsp页面,对应从数据库中查出所有的用户数据,然后把数据渲染到页面上并实现分页!

    <%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
    <%--引入核心标签库--%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <html>
    <head>
        <title>Title</title>
    </head>
    <body>
    <table>
        <tr>
            <th>编号</th>
            <th>名称</th>
            <th>密码</th>
            <th>邮箱</th>
            <th>创建时间</th>
            <th>修改时间</th>
            <th>操作</th>
        </tr>
        <c:forEach items="${plist.list}" var="tt">
            <tr>
                <td>${tt.userId}</td>
                <td>${tt.userName}</td>
                <td>${tt.userPwd}</td>
                <td>${tt.userEmail}</td>
                <td>${tt.createDate}</td>
                <td>${tt.updateDate}</td>
                <td>添加</td>
                <td>删除</td>
            </tr>
        </c:forEach>
        <tr>
            <td>
                <a href="page?pageNum=${plist.navigateFirstPage }">首页</a>
            </td>
            <td>
                <a href="page?pageNum=${plist.prePage}">上一页</a>
            </td>
            <td>
                <a href="page?pageNum=${plist.nextPage}">下一页</a>
            </td>
            <td>
                <a href="page?pageNum=${plist.navigateLastPage}">末页</a>
            </td>
        </tr>
    </table>
    <hr>
    当前为第${plist.pageNum}页/共${plist.pages}页,总数据记录${plist.total}条
    </body>
    </html>
    
    

    tb_user数据表,数据表的字段要和User类的属性对应或者添加自动转换为驼峰命名的配置

    SET NAMES utf8mb4;
    SET FOREIGN_KEY_CHECKS = 0;
    
    -- ----------------------------
    -- Table structure for tb_user
    -- ----------------------------
    DROP TABLE IF EXISTS `tb_user`;
    CREATE TABLE `tb_user`  (
      `user_id` int(11) NOT NULL AUTO_INCREMENT,
      `user_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
      `user_pwd` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
      `user_email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
      `create_date` datetime(0) NULL DEFAULT NULL,
      `update_date` datetime(0) NULL DEFAULT NULL,
      PRIMARY KEY (`user_id`) USING BTREE
    ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
    
    -- ----------------------------
    -- Records of tb_user
    -- ----------------------------
    INSERT INTO `tb_user` VALUES (1, '张三', 'wxc1111', 'wxc12@126.com', '2021-06-17 11:08:44', '2021-06-09 11:08:47');
    INSERT INTO `tb_user` VALUES (2, '李四', 'wxc11222222', 'wxc12@126.com', '2021-06-17 11:08:44', '2021-06-09 11:08:47');
    INSERT INTO `tb_user` VALUES (3, '王五', 'wxc11222222', 'wxc12@126.com', '2021-06-17 11:08:44', '2021-06-09 11:08:47');
    INSERT INTO `tb_user` VALUES (4, '哈哈哈', 'wxc11222222', 'wxc12@126.com', '2021-06-17 11:08:44', '2021-06-09 11:08:47');
    INSERT INTO `tb_user` VALUES (5, '王飒', 'wxc1111', 'wxc12@126.com', '2021-06-09 11:10:21', '2021-06-17 11:08:44');
    INSERT INTO `tb_user` VALUES (6, '王晓霞', 'wxc1111', 'wxc12@126.com', '2021-06-23 11:12:11', '2021-06-22 11:12:14');
    INSERT INTO `tb_user` VALUES (7, '刘德华', 'wxc11222222', 'wxc12@126.com', '2021-06-09 11:10:21', '2021-06-17 11:08:44');
    INSERT INTO `tb_user` VALUES (9, '张三丰', 'wxc11222222', 'wxc12@126.com', '2021-06-23 17:48:54', '2021-06-23 17:48:54');
    INSERT INTO `tb_user` VALUES (10, '王晓霞', 'wxc11222222', 'wxc12@126.com', NULL, NULL);
    
    SET FOREIGN_KEY_CHECKS = 1;
    

在这里插入图片描述



版权声明:本文为m0_46168848原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。