<?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>

    <context id="mysqlgenerator" targetRuntime="MyBatis3">
        <property name="autoDelimitKeywords" value="true"/>
        <!--可以使用``包括字段名，避免字段名与sql保留字冲突报错-->
        <property name="beginningDelimiter" value="`"/>
        <property name="endingDelimiter" value="`"/>

        <!-- 自动生成toString方法 -->
        <plugin type="org.mybatis.generator.plugins.ToStringPlugin"/>
        <!-- 自动生成equals方法和hashcode方法 -->
        <plugin type="org.mybatis.generator.plugins.EqualsHashCodePlugin"/>

        <!-- 非官方插件 https://github.com/itfsw/mybatis-generator-plugin -->
        <!-- 查询单条数据插件 -->
        <plugin type="com.itfsw.mybatis.generator.plugins.SelectOneByExamplePlugin"/>
        <!-- 查询结果选择性返回插件 -->
        <plugin type="com.itfsw.mybatis.generator.plugins.SelectSelectivePlugin"/>
        <!-- Example Criteria 增强插件 -->
        <plugin type="com.itfsw.mybatis.generator.plugins.ExampleEnhancedPlugin"/>
        <!-- 数据Model属性对应Column获取插件 -->
        <plugin type="com.itfsw.mybatis.generator.plugins.ModelColumnPlugin"/>
        <!-- 逻辑删除插件 -->
        <plugin type="com.itfsw.mybatis.generator.plugins.LogicalDeletePlugin">
            <!-- 这里配置的是全局逻辑删除列和逻辑删除值，当然在table中配置的值会覆盖该全局配置 -->
            <!-- 逻辑删除列类型只能为数字、字符串或者布尔类型 -->
            <property name="logicalDeleteColumn" value="deleted"/>
            <!-- 逻辑删除-已删除值 -->
            <property name="logicalDeleteValue" value="1"/>
            <!-- 逻辑删除-未删除值 -->
            <property name="logicalUnDeleteValue" value="0"/>
        </plugin>
        <!-- 乐观锁插件 -->
        <plugin type="com.itfsw.mybatis.generator.plugins.OptimisticLockerPlugin"/>

        <commentGenerator>
            <property name="suppressDate" value="true"/>
            <!--<property name="suppressAllComments" value="true"/>-->
        </commentGenerator>

        <!--数据库连接信息-->
        <jdbcConnection driverClass="com.mysql.jdbc.Driver"
                        connectionURL="jdbc:mysql://127.0.0.1:3306/litemall?useUnicode=true&amp;characterEncoding=UTF-8&amp;serverTimezone=UTC&amp;verifyServerCertificate=false&amp;useSSL=false"
                        userId="litemall"
                        password="litemall123456"/>


        <javaModelGenerator targetPackage="org.linlinjava.litemall.db.domain" targetProject="src/main/java"/>
        <sqlMapGenerator targetPackage="org.linlinjava.litemall.db.dao" targetProject="src/main/resources"/>
        <javaClientGenerator type="XMLMAPPER" targetPackage="org.linlinjava.litemall.db.dao"
                             targetProject="src/main/java"/>
        <!--表名-->
        <table tableName="litemall_ad">
            <property name="versionColumn" value="version"/>
            <generatedKey column="id" sqlStatement="MySql" identity="true"/>
            <columnOverride javaType="java.time.LocalDateTime" column="start_time"/>
            <columnOverride javaType="java.time.LocalDateTime" column="end_time"/>
            <columnOverride javaType="java.time.LocalDateTime" column="add_time"/>
        </table>
        <table tableName="litemall_address">
            <property name="versionColumn" value="version"/>
            <generatedKey column="id" sqlStatement="MySql" identity="true"/>
            <columnOverride javaType="java.time.LocalDateTime" column="add_time"/>
        </table>
        <table tableName="litemall_admin">
            <property name="versionColumn" value="version"/>
            <generatedKey column="id" sqlStatement="MySql" identity="true"/>
            <columnOverride javaType="java.time.LocalDateTime" column="last_login_time"/>
            <columnOverride javaType="java.time.LocalDateTime" column="add_time"/>
        </table>
        <table tableName="litemall_brand">
            <property name="versionColumn" value="version"/>
            <generatedKey column="id" sqlStatement="MySql" identity="true"/>
            <columnOverride javaType="java.time.LocalDateTime" column="add_time"/>
        </table>
        <table tableName="litemall_cart">
            <property name="versionColumn" value="version"/>
            <generatedKey column="id" sqlStatement="MySql" identity="true"/>
            <columnOverride column="specifications" javaType="java.lang.String[]"
                            typeHandler="org.linlinjava.litemall.db.mybatis.JsonStringArrayTypeHandler"/>
            <columnOverride javaType="java.time.LocalDateTime" column="add_time"/>
        </table>
        <table tableName="litemall_category">
            <property name="versionColumn" value="version"/>
            <generatedKey column="id" sqlStatement="MySql" identity="true"/>
            <columnOverride javaType="java.time.LocalDateTime" column="add_time"/>
        </table>
        <table tableName="litemall_collect">
            <property name="versionColumn" value="version"/>
            <generatedKey column="id" sqlStatement="MySql" identity="true"/>
            <columnOverride javaType="java.time.LocalDateTime" column="add_time"/>
        </table>
        <table tableName="litemall_comment">
            <property name="versionColumn" value="version"/>
            <generatedKey column="id" sqlStatement="MySql" identity="true"/>
            <columnOverride javaType="java.time.LocalDateTime" column="add_time"/>
            <columnOverride column="pic_urls" javaType="java.lang.String[]"
                            typeHandler="org.linlinjava.litemall.db.mybatis.JsonStringArrayTypeHandler"/>
        </table>
        <table tableName="litemall_footprint">
            <property name="versionColumn" value="version"/>
            <generatedKey column="id" sqlStatement="MySql" identity="true"/>
            <columnOverride javaType="java.time.LocalDateTime" column="add_time"/>
        </table>
        <table tableName="litemall_goods">
            <property name="versionColumn" value="version"/>
            <generatedKey column="id" sqlStatement="MySql" identity="true"/>
            <columnOverride javaType="java.time.LocalDateTime" column="add_time"/>
            <columnOverride column="gallery" javaType="java.lang.String[]"
                            typeHandler="org.linlinjava.litemall.db.mybatis.JsonStringArrayTypeHandler"/>
        </table>
        <table tableName="litemall_goods_attribute">
            <property name="versionColumn" value="version"/>
            <generatedKey column="id" sqlStatement="MySql" identity="true"/>
            <columnOverride javaType="java.time.LocalDateTime" column="add_time"/>
        </table>
        <table tableName="litemall_goods_specification">
            <property name="versionColumn" value="version"/>
            <generatedKey column="id" sqlStatement="MySql" identity="true"/>
            <columnOverride javaType="java.time.LocalDateTime" column="add_time"/>
        </table>
        <table tableName="litemall_issue">
            <property name="versionColumn" value="version"/>
            <generatedKey column="id" sqlStatement="MySql" identity="true"/>
            <columnOverride javaType="java.time.LocalDateTime" column="add_time"/>
        </table>
        <table tableName="litemall_keyword">
            <property name="versionColumn" value="version"/>
            <generatedKey column="id" sqlStatement="MySql" identity="true"/>
            <columnOverride javaType="java.time.LocalDateTime" column="add_time"/>
        </table>
        <table tableName="litemall_order">
            <property name="versionColumn" value="version"/>
            <generatedKey column="id" sqlStatement="MySql" identity="true"/>
            <columnOverride javaType="java.time.LocalDateTime" column="add_time"/>
            <columnOverride javaType="java.time.LocalDateTime" column="pay_time"/>
            <columnOverride javaType="java.time.LocalDateTime" column="ship_time"/>
            <columnOverride javaType="java.time.LocalDateTime" column="confirm_time"/>
            <columnOverride javaType="java.time.LocalDateTime" column="end_time"/>
        </table>
        <table tableName="litemall_order_goods">
            <property name="versionColumn" value="version"/>
            <generatedKey column="id" sqlStatement="MySql" identity="true"/>
            <columnOverride column="specifications" javaType="java.lang.String[]"
                            typeHandler="org.linlinjava.litemall.db.mybatis.JsonStringArrayTypeHandler"/>
            <columnOverride javaType="java.time.LocalDateTime" column="add_time"/>
        </table>
        <table tableName="litemall_product">
            <property name="versionColumn" value="version"/>
            <generatedKey column="id" sqlStatement="MySql" identity="true"/>
            <columnOverride column="specifications" javaType="java.lang.String[]"
                            typeHandler="org.linlinjava.litemall.db.mybatis.JsonStringArrayTypeHandler"/>
            <columnOverride javaType="java.time.LocalDateTime" column="add_time"/>
        </table>
        <table tableName="litemall_region">
            <generatedKey column="id" sqlStatement="MySql" identity="true"/>
        </table>
        <table tableName="litemall_search_history">
            <property name="versionColumn" value="version"/>
            <generatedKey column="id" sqlStatement="MySql" identity="true"/>
            <columnOverride javaType="java.time.LocalDateTime" column="add_time"/>
        </table>
        <table tableName="litemall_storage">
            <property name="versionColumn" value="version"/>
            <generatedKey column="id" sqlStatement="MySql" identity="true"/>
            <columnOverride javaType="java.time.LocalDateTime" column="modified"/>
            <columnOverride javaType="java.time.LocalDateTime" column="add_time"/>
        </table>
        <table tableName="litemall_topic">
            <property name="versionColumn" value="version"/>
            <generatedKey column="id" sqlStatement="MySql" identity="true"/>
            <columnOverride column="goods" javaType="java.lang.Integer[]"
                            typeHandler="org.linlinjava.litemall.db.mybatis.JsonIntegerArrayTypeHandler"/>
            <columnOverride javaType="java.time.LocalDateTime" column="add_time"/>
        </table>
        <table tableName="litemall_user">
            <property name="versionColumn" value="version"/>
            <generatedKey column="id" sqlStatement="MySql" identity="true"/>
            <columnOverride javaType="java.time.LocalDate" column="birthday"/>
            <columnOverride javaType="java.time.LocalDateTime" column="last_login_time"/>
            <columnOverride javaType="java.time.LocalDateTime" column="add_time"/>
        </table>
        <table tableName="litemall_system">
            <property name="versionColumn" value="version"/>
            <generatedKey column="id" sqlStatement="MySql" identity="true"/>
        </table>

        <table tableName="litemall_user_formid">
            <property name="versionColumn" value="version"/>
            <generatedKey column="id" sqlStatement="MySql" identity="true"/>
            <columnOverride javaType="java.time.LocalDateTime" column="expire_time"/>
        </table>

        <table tableName="litemall_groupon_rules">
            <property name="versionColumn" value="version"/>
            <generatedKey column="id" sqlStatement="MySql" identity="true"/>
            <columnOverride javaType="java.time.LocalDateTime" column="add_time"/>
            <columnOverride javaType="java.time.LocalDateTime" column="expire_time"/>
        </table>
        <table tableName="litemall_groupon">
            <property name="versionColumn" value="version"/>
            <generatedKey column="id" sqlStatement="MySql" identity="true"/>
            <columnOverride javaType="java.time.LocalDateTime" column="add_time"/>
        </table>
    </context>
</generatorConfiguration>