zoukankan      html  css  js  c++  java
  • maven整合SSM总结

    1.注意别打错字!

    2.利用MyBatis Generator自动创建代码时候注意

    generatorConfig.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE generatorConfiguration
    PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
    "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
    <generatorConfiguration>
    <!-- 数据库驱动-->
    <classPathEntry location="mysql-connector-java-5.1.25-bin.jar"/>
    <context id="DB2Tables" targetRuntime="MyBatis3">
    <commentGenerator>
    <property name="suppressDate" value="true"/>
    <!-- 是否去除自动生成的注释 true:是 : false:否 -->
    <property name="suppressAllComments" value="true"/>
    </commentGenerator>
    <!--数据库链接URL,用户名、密码 -->
    <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://127.0.0.1/db_124" userId="root" password="123456">
    </jdbcConnection>
    <javaTypeResolver>
    <property name="forceBigDecimals" value="false"/>
    </javaTypeResolver>
    <!-- 生成模型的包名和位置-->
    <javaModelGenerator targetPackage="com.ssm.entity" targetProject="src">
    <property name="enableSubPackages" value="true"/>
    <property name="trimStrings" value="true"/>
    </javaModelGenerator>
    <!-- 生成映射文件的包名和位置-->
    <sqlMapGenerator targetPackage="com.ssm.mapping" targetProject="src">
    <property name="enableSubPackages" value="true"/>
    </sqlMapGenerator>
    <!-- 生成DAO的包名和位置-->
    <javaClientGenerator type="XMLMAPPER" targetPackage="com.ssm.dao" targetProject="src">
    <property name="enableSubPackages" value="true"/>
    </javaClientGenerator>
    <!-- 要生成的表 tableName是数据库中的表名或视图名 domainObjectName是实体类名-->
    <table tableName="user_t" domainObjectName="User" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
    </context>
    </generatorConfiguration>

      当以上这些完成之后,只需要打开控制台,进入lib目录下,执行脚本:

    Java -jar mybatis-generator-core-1.3.2.jar -configfile generatorConfig.xml -overwrite

           即可。

    ....

  • 相关阅读:
    WSL下的Ubuntu 18.04LTS配置软件源和系统更新
    宝塔 5.9.2 最终版 专业版
    宝塔面板7.2.0学习版集合--包含(专业版、企业版及部分插件)
    网络安全学习和CTF必不可少的一些网站
    Hello Blog !
    如何解决机器学习树集成模型的解释性问题
    机器学习建模老司机的几点思考与总结
    2019 秋招提前批蘑菇街一面面经(带答案)
    Java 最全异常讲解
    Spring Context 你真的懂了吗
  • 原文地址:https://www.cnblogs.com/dafanshu1996/p/6502994.html
Copyright © 2011-2022 走看看