<html>
<head><title>数据库设计文档 -- {{ dbName }}</title>
    <style type='text/css'>body, td {
        font-family: verdana;
        font-size: 12px;
        line-height: 150%;
    }

    table {
        width: 100%;
        background-color: #ccc;
        margin: 5px 0;
    }

    td {
        background-color: #fff;
        padding: 3px;
        padding-left: 10px;
    }

    thead td {
        text-align: center;
        font-weight: bold;
        background-color: #eee;
    }

    a:link, a:visited, a:active {
        color: #015FB6;
        text-decoration: none;
    }

    a:hover {
        color: #E33E06;
    }</style>
</head>
<body style='text-align:center;'>
<div style='width:800px; margin:20px auto; text-align:left;'>
    <a name='index'>
        <H2 style='text-align:center; line-height:50px;'>数据库设计文档</H2>
        <div><b>数据库名：{{ dbName }}</b></div>
        <table cellspacing='1' cellpadding='0'>
            <thead>
            <tr>
                <td style='width:40px; '>序号</td>
                <td>表名</td>
                <td>说明</td>
            </tr>
            </thead>
            {% for x in rows %}
                <tr>
                    <td style='text-align:center;'>{{ x.index }}</td>
                    <td><a href='#{{ x.tableName }}'>{{ x.tableName }}</a></td>
                    <td>{{ x.table_comment }}</td>
                </tr>
            {% endfor %}
                  {% for x in rowView %}
                <tr>
                    <td style='text-align:center;'>{{ x.index }}</td>
                    <td><a href='#{{ x.tableName }}'>{{ x.tableName }}</a></td>
                    <td>{{ x.table_comment }}</td>
                </tr>
            {% endfor %}
        </table>
    </a>
    {% for x in rows %}
        <a name='{{ x.tableName }}'></a>
        <div style='margin-top:30px;'><a href='#index'
                                         style='float:right; margin-top:6px;'>返回目录</a><b>表名：{{ x.tableName }}</b>
        </div>
        <div>说明：{{ x.table_comment }}</div>
        <div>数据列：</div>
        <table cellspacing='1' cellpadding='0'>
            <thead>
            <tr>
                <td style='width:40px; '>序号</td>
                <td>名称</td>
                <td>数据类型</td>
                <td>长度</td>
                <td>小数位</td>
                <td>允许空值</td>
                <td>主键</td>
                <td>默认值</td>
                <td>说明</td>
            </tr>
            </thead>
            {% for z in x.fields %}
            <tr>
                <td style='text-align:center;'>{{ z.ORDINAL_POSITION }}</td>
                <td>{{ z.column_name }}</td>
                <td align='center'>{{ z.DATA_TYPE }}</td>
                <td align='center'>{{ z.CHARACTER_MAXIMUM_LENGTH }}</td>
                <td align='center'>{{ z.numeric_scale }}</td>
                <td align='center'>{{ z.IS_NULLABLE }}</td>
                <td align='center'>{{ z.COLUMN_KEY }}</td>
                <td>{{ z.COLUMN_DEFAULT }}</td>
                <td>{{ z.COLUMN_COMMENT }}</td>
            </tr>
                {% endfor %}
        </table>
    {% endfor %}
        {% for x in rowView %}
        <a name='{{ x.tableName }}'></a>
        <div style='margin-top:30px;'><a href='#index'
                                         style='float:right; margin-top:6px;'>返回目录</a><b>表名：{{ x.tableName }}</b>
        </div>
        <div>说明：{{ x.table_comment }}</div>
        <div>数据列：</div>
        <table cellspacing='1' cellpadding='0'>
            <thead>
            <tr>
                <td style='width:40px; '>序号</td>
                <td>名称</td>
                <td>数据类型</td>
                <td>长度</td>
                <td>小数位</td>
                <td>允许空值</td>
                <td>主键</td>
                <td>默认值</td>
                <td>说明</td>
            </tr>
            </thead>
            {% for z in x.fields %}
            <tr>
                <td style='text-align:center;'>{{ z.ORDINAL_POSITION }}</td>
                <td>{{ z.column_name }}</td>
                <td align='center'>{{ z.DATA_TYPE }}</td>
                <td align='center'>{{ z.CHARACTER_MAXIMUM_LENGTH }}</td>
                <td align='center'>{{ z.numeric_scale }}</td>
                <td align='center'>{{ z.IS_NULLABLE }}</td>
                <td align='center'>{{ z.COLUMN_KEY }}</td>
                <td>{{ z.COLUMN_DEFAULT }}</td>
                <td>{{ z.COLUMN_COMMENT }}</td>
            </tr>
                {% endfor %}
        </table>
    {% endfor %}
</div>
</body>
</html>