• SpringMVC+Spring+Mybatis+Generator工具


    • Generator工作空间准备

    • 配置文件(generator.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="E:generatormysql-connector-java-5.1.10-bin.jar" />
        <!--classPathEntry location="C:oracleproduct10.2.0db_1jdbclibojdbc14.jar" /-->
        <context id="DB2Tables" targetRuntime="MyBatis3">
            <commentGenerator>
                <property name="suppressAllComments" value="true" />
            </commentGenerator>
            <!-- 数据库链接URL、用户名、密码 -->
            <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://localhost:3306/uracsdb" userId="root" password="root"/>
            <!--jdbcConnection driverClass="oracle.jdbc.driver.OracleDriver" connectionURL="jdbc:oracle:thin:@localhost:1521:orcl" userId="msa" password="msa">
            </jdbcConnection-->
            <javaTypeResolver>
                <property name="forceBigDecimals" value="false" />
            </javaTypeResolver>
            <!-- 生成模型的包名和位置 -->
            <javaModelGenerator targetPackage="bling.model" targetProject="E:generatorsrc">
                <property name="enableSubPackages" value="true" />
                <property name="trimStrings" value="true" />
            </javaModelGenerator>
            <!-- 生成的映射文件包名和位置 -->
            <sqlMapGenerator targetPackage="bling.mapping" targetProject="E:generatorsrc">
                <property name="enableSubPackages" value="true" />
            </sqlMapGenerator>
            <!-- 生成DAO的包名和位置 -->
            <javaClientGenerator type="XMLMAPPER" targetPackage="bling.dao" targetProject="E:generatorsrc">
                <property name="enableSubPackages" value="true" />
            </javaClientGenerator>
            <!-- 要生成那些表(更改tableName和domainObjectName就可以) -->
            <table tableName="t_app_user" domainObjectName="User" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" />
            <table tableName="t_app_menu" domainObjectName="Menu" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" />
            <table tableName="t_app_role_menu" domainObjectName="RoleMenu" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" />
            <table tableName="t_app_role" domainObjectName="Role" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" />
            <table tableName="t_app_user_role" domainObjectName="UserRole" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" />
        </context>
    </generatorConfiguration>
    • 生成语句

      到generator文件夹下,按住shift+鼠标右键点击“在此处打开命令窗口(win7)”,输入以下命令即可在src中生成需要的代码:dao、mapping、model

      java -jar mybatis-generator-core-1.3.2.jar -configfile generator.xml -overwrite

  • 相关阅读:
    css报模块没找到 分析思路 从后往前找,先定位最后blue.less 解决:iview升级4.0 css没改导致编译不过去
    将config从内部移动到外部 3部曲
    iviewadmin url 加入 Router base #viewDesignAdmin
    phpStudy
    rimraf node_modules 突然不能用了 怀疑是yarn的问题,从环境变量将yarn删掉,能用了
    this.current = params.page || 1 (前提是params对象一定要存在)
    onOK Modal.warning iview 要写一个函数 套上,不然会得不到异步调用,直接弹出的时候就执行了
    ant-design-pro 如何打包成 本地html,双击即可查看
    iview mock main.js
    svelte & Polymer Project
  • 原文地址:https://www.cnblogs.com/yangml/p/3835034.html
Copyright © 2020-2023  润新知