codegen.xsd 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <xs:schema id="codegen" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  3. <xs:element name="config">
  4. <xs:complexType>
  5. <xs:sequence>
  6. <!--变量 -->
  7. <xs:element name="variables" maxOccurs="1">
  8. <xs:complexType>
  9. <xs:sequence>
  10. <xs:element name="variable" maxOccurs="unbounded">
  11. <xs:complexType>
  12. <xs:attributeGroup ref="variableAttr"></xs:attributeGroup>
  13. </xs:complexType>
  14. </xs:element>
  15. </xs:sequence>
  16. </xs:complexType>
  17. </xs:element>
  18. <!--模板 -->
  19. <xs:element name="templates" maxOccurs="1" minOccurs="1">
  20. <xs:complexType>
  21. <xs:sequence minOccurs="1" maxOccurs="unbounded">
  22. <xs:element name="template">
  23. <xs:complexType>
  24. <xs:attributeGroup ref="templateAttr"></xs:attributeGroup>
  25. </xs:complexType>
  26. </xs:element>
  27. </xs:sequence>
  28. <xs:attribute name="basepath" type="xs:string">
  29. <xs:annotation>
  30. <xs:documentation>模板的基路径.</xs:documentation>
  31. </xs:annotation>
  32. </xs:attribute>
  33. </xs:complexType>
  34. </xs:element>
  35. <!-- 生成文件模版 -->
  36. <xs:element name="files" maxOccurs="1" minOccurs="0">
  37. <xs:complexType>
  38. <xs:sequence minOccurs="1" maxOccurs="unbounded">
  39. <xs:element name="file">
  40. <xs:complexType>
  41. <xs:attributeGroup ref="fileAttr"></xs:attributeGroup>
  42. </xs:complexType>
  43. </xs:element>
  44. </xs:sequence>
  45. <xs:attribute name="baseDir" type="xs:string">
  46. <xs:annotation>
  47. <xs:documentation>生成文件的基路径.</xs:documentation>
  48. </xs:annotation>
  49. </xs:attribute>
  50. </xs:complexType>
  51. </xs:element>
  52. <!--表变量 -->
  53. <xs:element name="table" minOccurs="0" maxOccurs="unbounded">
  54. <xs:complexType>
  55. <xs:sequence maxOccurs="unbounded" minOccurs="1">
  56. <!--表级别变量 -->
  57. <xs:element name="variable" minOccurs="0" maxOccurs="unbounded">
  58. <xs:complexType>
  59. <xs:attributeGroup ref="variableAttr"></xs:attributeGroup>
  60. </xs:complexType>
  61. </xs:element>
  62. <xs:element name="subtable" minOccurs="0" maxOccurs="unbounded">
  63. <xs:complexType>
  64. <xs:sequence maxOccurs="unbounded" minOccurs="1">
  65. <xs:element name="variable" minOccurs="0" maxOccurs="unbounded">
  66. <xs:complexType>
  67. <xs:attributeGroup ref="variableAttr"></xs:attributeGroup>
  68. </xs:complexType>
  69. </xs:element>
  70. </xs:sequence>
  71. <xs:attributeGroup ref="tableAttr"></xs:attributeGroup>
  72. </xs:complexType>
  73. </xs:element>
  74. </xs:sequence>
  75. <xs:attribute name="tableName" type="xs:string" use="required">
  76. <xs:annotation>
  77. <xs:documentation>数据库表名.</xs:documentation>
  78. </xs:annotation>
  79. </xs:attribute>
  80. </xs:complexType>
  81. </xs:element>
  82. <xs:element name="genAll" minOccurs="0" maxOccurs="1">
  83. <xs:complexType>
  84. <xs:sequence maxOccurs="unbounded" minOccurs="1">
  85. <xs:element name="file">
  86. <xs:annotation>
  87. <xs:documentation>需要生成的文件</xs:documentation>
  88. </xs:annotation>
  89. <xs:complexType>
  90. <xs:sequence>
  91. <xs:element name="variable" minOccurs="0" maxOccurs="unbounded">
  92. <xs:complexType>
  93. <xs:attributeGroup ref="variableAttr"></xs:attributeGroup>
  94. </xs:complexType>
  95. </xs:element>
  96. </xs:sequence>
  97. <xs:attributeGroup ref="batFleAttr"></xs:attributeGroup>
  98. </xs:complexType>
  99. </xs:element>
  100. </xs:sequence>
  101. <xs:attribute name="tableNames" type="xs:string" use="optional">
  102. <xs:annotation>
  103. <xs:documentation>数据库表名,使用逗号分割.</xs:documentation>
  104. </xs:annotation>
  105. </xs:attribute>
  106. </xs:complexType>
  107. </xs:element>
  108. </xs:sequence>
  109. </xs:complexType>
  110. </xs:element>
  111. <!--模板属性 -->
  112. <xs:attributeGroup name="templateAttr">
  113. <xs:attribute name="id" type="xs:string" use="required">
  114. <xs:annotation>
  115. <xs:documentation>
  116. 模版ID
  117. </xs:documentation>
  118. </xs:annotation>
  119. </xs:attribute>
  120. <xs:attribute name="path" type="xs:string" use="required">
  121. <xs:annotation>
  122. <xs:documentation>
  123. 模板路径
  124. </xs:documentation>
  125. </xs:annotation>
  126. </xs:attribute>
  127. </xs:attributeGroup>
  128. <!--变量属性 -->
  129. <xs:attributeGroup name="variableAttr">
  130. <xs:attribute name="name" use="required" type="xs:string">
  131. </xs:attribute>
  132. <xs:attribute name="value" type="xs:string" use="required"></xs:attribute>
  133. </xs:attributeGroup>
  134. <!--文件属性-->
  135. <xs:attributeGroup name="fileAttr">
  136. <xs:attribute name="refTemplate" type="xs:string" use="required" >
  137. <xs:annotation>
  138. <xs:documentation>
  139. 引用的模板,引用模板的ID
  140. </xs:documentation>
  141. </xs:annotation>
  142. </xs:attribute>
  143. <xs:attribute name="filename" type="xs:string" use="required">
  144. <xs:annotation>
  145. <xs:documentation>
  146. 生成的文件名称.
  147. </xs:documentation>
  148. </xs:annotation>
  149. </xs:attribute>
  150. <xs:attribute name="dir" type="xs:string" use="required">
  151. <xs:annotation>
  152. <xs:documentation>
  153. 生成的文件存放的目录.
  154. </xs:documentation>
  155. </xs:annotation>
  156. </xs:attribute>
  157. <xs:attribute name="sub" type="xs:boolean" use="optional" default="false">
  158. <xs:annotation>
  159. <xs:documentation>
  160. 子表生成文件
  161. </xs:documentation>
  162. </xs:annotation>
  163. </xs:attribute>
  164. <xs:attribute name="override" type="xs:boolean" use="optional" default="false">
  165. <xs:annotation>
  166. <xs:documentation>
  167. 是否覆盖原有文件 默认为false
  168. </xs:documentation>
  169. </xs:annotation>
  170. </xs:attribute>
  171. <xs:attribute name="append" type="xs:boolean" use="optional">
  172. <xs:annotation>
  173. <xs:documentation>是否添加</xs:documentation>
  174. </xs:annotation>
  175. </xs:attribute>
  176. <xs:attribute name="insertTag" default="&lt;!--insertbefore--&gt;">
  177. <xs:annotation>
  178. <xs:documentation>标签功能,新增的内容插在之前</xs:documentation>
  179. </xs:annotation>
  180. </xs:attribute>
  181. <xs:attribute name="startTag" default="start{tabname}">
  182. <xs:annotation>
  183. <xs:documentation>起始标签</xs:documentation>
  184. </xs:annotation>
  185. </xs:attribute>
  186. <xs:attribute name="endTag" default="end{tabname}">
  187. <xs:annotation>
  188. <xs:documentation>结束标签</xs:documentation>
  189. </xs:annotation>
  190. </xs:attribute>
  191. </xs:attributeGroup>
  192. <xs:attributeGroup name="tableAttr">
  193. <xs:attribute name="tablename" type="xs:string" use="required">
  194. <xs:annotation>
  195. <xs:documentation>
  196. 表名
  197. </xs:documentation>
  198. </xs:annotation>
  199. </xs:attribute>
  200. <xs:attribute name="foreignKey" type="xs:string" use="required">
  201. <xs:annotation>
  202. <xs:documentation>
  203. 外键
  204. </xs:documentation>
  205. </xs:annotation>
  206. </xs:attribute>
  207. </xs:attributeGroup>
  208. <xs:attributeGroup name="batFleAttr">
  209. <xs:attribute name="refTemplate" type="xs:string" use="required">
  210. <xs:annotation>
  211. <xs:documentation>
  212. 引用的模板,引用模板的ID
  213. </xs:documentation>
  214. </xs:annotation>
  215. </xs:attribute>
  216. <xs:attribute name="filename" type="xs:string" use="optional">
  217. <xs:annotation>
  218. <xs:documentation>
  219. 生成的文件名称.
  220. </xs:documentation>
  221. </xs:annotation>
  222. </xs:attribute>
  223. <xs:attribute name="extName" type="xs:string" use="optional">
  224. <xs:annotation>
  225. <xs:documentation>
  226. 文件扩展名 如: .htm
  227. </xs:documentation>
  228. </xs:annotation>
  229. </xs:attribute>
  230. <xs:attribute name="dir" type="xs:string" use="required">
  231. <xs:annotation>
  232. <xs:documentation>
  233. 生成的文件存放的目录.
  234. </xs:documentation>
  235. </xs:annotation>
  236. </xs:attribute>
  237. <xs:attribute name="genMode" type="GenModel" use="required">
  238. <xs:annotation>
  239. <xs:documentation>
  240. 产生一个文件/产生多个文件
  241. </xs:documentation>
  242. </xs:annotation>
  243. </xs:attribute>
  244. </xs:attributeGroup>
  245. <xs:simpleType name="GenModel">
  246. <xs:restriction base="xs:string">
  247. <xs:enumeration value="MultiFile">
  248. <xs:annotation>
  249. <xs:documentation>产生多个文件,这个时候需要填写扩展名属性</xs:documentation>
  250. </xs:annotation>
  251. </xs:enumeration>
  252. <xs:enumeration value="SingleFile">
  253. <xs:annotation>
  254. <xs:documentation>产生一个文件,这个时候需要填写文件名称</xs:documentation>
  255. </xs:annotation>
  256. </xs:enumeration>
  257. </xs:restriction>
  258. </xs:simpleType>
  259. </xs:schema>