feiyu02
2025-08-14 f373bbf83d9d2a7e5f96118d7dcd658c9fea8bc8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="application/msword; charset=utf-8"/>
    <title>toWord</title>
    <style type="text/css">
        .bg {
            font-size: 14.5px;
            font-weight: bold;
            color: #000;
            background-color: #D7D7D7;
        }
 
        table {
            border-width: 1px;
            border-style: solid;
            border-color: black;
            table-layout: fixed;
        }
 
        tr {
            height: 32px;
            font-size: 12px;
        }
 
        td {
            padding-left: 10px;
            border-width: 1px;
            border-style: solid;
            border-color: black;
            height: 32px;
            overflow: hidden;
            word-break: break-all;
            word-wrap: break-word;
            font-size: 14.5px;
        }
 
        .bg td {
            font-size: 14.5px;
        }
 
        tr td {
            font-size: 14.5px;
        }
 
        .specialHeight {
            height: 40px;
        }
 
        .first_title {
            height: 60px;
            line-height: 60px;
            margin: 0;
            font-weight: bold;
            font-size: 21px;
        }
 
        .second_title {
            height: 40px;
            line-height: 40px;
            margin: 0;
            font-size: 18.5px;
        }
 
        .doc_title {
            font-size: 42.5px;
            text-align: center;
        }
 
        .download_btn {
            float: right;
        }
 
        body {
            font-family: 思源黑体 Normal;
        }
    </style>
</head>
 
<body>
<div style="width:800px; margin: 0 auto">
    <div>
        <p class="doc_title" th:text="${info.title +'('+ info.version +')'}"></p>
        <a class="download_btn" th:if="${download == 1}" th:href="${'/downloadWord?url='+ url}">下载文档</a>
        <br>
    </div>
    <div th:each="tableMap, tableMapStat:${tableMap}" style="margin-bottom:20px;">
        <!--这个是类的说明-->
        <h4 class="first_title" th:text="${tableMapStat.count} + '. ' + ${tableMap.key}"></h4>
        <div th:each="table,tableStat:${tableMap.value}">
 
            <!--这个是每个请求的说明,方便生成文档后进行整理-->
            <h5 class="second_title" th:text="${tableStat.count} + ')' + ${table.tag}"></h5>
 
            <table border="1" cellspacing="0" cellpadding="0" width="100%">
                <tr class="bg">
                    <td colspan="5" th:text="${table.tag}"></td>
                </tr>
                <tr>
                    <td width="25%">接口描述</td>
                    <td colspan="4" th:text="${table.description}"></td>
                </tr>
                <tr>
                    <td>URL</td>
                    <td colspan="4" th:text="${table.url}"></td>
                </tr>
                <tr>
                    <td>请求方式</td>
                    <td colspan="4" th:text="${#strings.toUpperCase(table.requestType)}"></td>
                </tr>
                <tr>
                    <td>请求类型</td>
                    <td colspan="4" th:text="${table.requestForm}"></td>
                </tr>
                <tr>
                    <td>返回类型</td>
                    <td colspan="4" th:text="${table.responseForm}"></td>
                </tr>
 
                <tr class="bg">
                    <td>参数名</td>
                    <td width="15%">数据类型</td>
                    <td width="15%">参数类型</td>
                    <td width="15%">是否必填</td>
                    <td width="29%">说明</td>
                </tr>
 
                <th:block th:each="request, c:${table.requestList}">
                    <tr>
                        <td align="left" th:text="${c.count} + '.' + ${request.name}"></td>
                        <td th:text="${request.type}"></td>
                        <td th:text="${request.paramType}"></td>
                        <td th:if="${request.require}" th:text="Y"></td>
                        <td th:if="${!request.require}" th:text="N"></td>
                        <td th:text="${request.remark}"></td>
                        <!--                        <td th:if="${request.modelAttr}" th:text="asdfagadfg"></td>-->
                    </tr>
                    <th:block th:if="${request.modelAttr}">
                        <tbody th:include="this::request(${request.modelAttr.properties},${c.count} + '.', 1)"/>
                    </th:block>
 
 
                </th:block>
 
                <tr class="bg">
                    <td>状态码</td>
                    <td colspan="2">描述</td>
                    <td colspan="2">说明</td>
                </tr>
 
                <tr th:each="response:${table.responseList}">
                    <td th:text="${response.name}"></td>
                    <td colspan="2" th:text="${response.description}"></td>
                    <td colspan="2" th:text="${response.remark}"></td>
                </tr>
 
                <tr class="bg">
                    <td>返回属性名</td>
                    <td colspan="2">类型</td>
                    <td colspan="2">说明</td>
                </tr>
 
                <!--               对返回参数 递归生成行-->
                <tbody th:include="this::response(${table.modelAttr.properties},'', 1)"/>
 
<!--                <tr class="bg">-->
<!--                    <td colspan="5">示例</td>-->
<!--                </tr>-->
<!--                <tr class="specialHeight">-->
<!--                    <td class="bg">请求参数</td>-->
<!--                    <td colspan="4" th:text="${table.requestParam}"></td>-->
<!--                </tr>-->
<!--                <tr class="specialHeight">-->
<!--                    <td class="bg">返回值</td>-->
<!--                    <td colspan="4" th:text="${table.responseParam}"></td>-->
<!--                </tr>-->
 
            </table>
        </div>
    </div>
</div>
 
<th:block th:fragment="request(properties,count, lv)">
    <th:block th:each="p,c : ${properties}">
        <tr>
            <td align="left" th:text="${count} + '' + ${c.count} + '.' + ${p.name}"
                th:style="|padding-left:${10*lv}px|"></td>
            <td th:text="${p.type}"></td>
            <td></td>
            <td th:if="${p.require}" th:text="Y"></td>
            <td th:if="${!p.require}" th:text="N"></td>
            <td th:text="${p.description}"></td>
        </tr>
        <th:block th:unless="${#lists.isEmpty(p.properties)}"
                  th:include="this::request(${p.properties},${count} + '' + ${c.count} + '.',${lv+1})"/>
    </th:block>
</th:block>
 
<th:block th:fragment="response(properties,count, lv)">
    <th:block th:each="p,c : ${properties}">
        <tr>
            <td align="left" th:text="${count} + '' + ${c.count} + '.' + ${p.name}"
                th:style="|padding-left:${10*lv}px|"></td>
            <td colspan="2" th:text="${p.type}"></td>
            <td colspan="2" th:text="${p.description}"></td>
        </tr>
        <th:block th:unless="${#lists.isEmpty(p.properties)}"
                  th:include="this::response(${p.properties},${count} + '' + ${c.count} + '.',${lv+1})"/>
    </th:block>
</th:block>
</body>
</html>