ApiInfo.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453
  1. using System.Linq;
  2. using Custom;
  3. using Mapster;
  4. using Util;
  5. using static System.Runtime.InteropServices.JavaScript.JSType;
  6. namespace Model
  7. {
  8. /// <summary>
  9. /// 接口信息 api_info
  10. /// </summary>
  11. [SugarTable("api_info", "接口信息")]
  12. [Tenant("0")]
  13. public class ApiInfo
  14. {
  15. /// <summary>
  16. /// ID
  17. /// </summary>
  18. [SugarColumn(ColumnDescription = "ID", IsPrimaryKey = true, IsIdentity = true, ColumnName = "id")]
  19. public int id { get; set; }
  20. /// <summary>
  21. /// 版本号
  22. /// </summary>
  23. [SugarColumn(ColumnDescription = "版本号", ColumnName = "version")]
  24. public int version { get; set; }
  25. /// <summary>
  26. /// 删除标记
  27. /// </summary>
  28. [SugarColumn(ColumnDescription = "删除标记", ColumnName = "del_flag")]
  29. public int delFlag { get; set; }
  30. /// <summary>
  31. /// 创建时间
  32. /// </summary>
  33. [SugarColumn(ColumnDescription = "创建时间", ColumnName = "create_time")]
  34. public DateTime? createTime { get; set; }
  35. /// <summary>
  36. /// 更新时间
  37. /// </summary>
  38. [SugarColumn(ColumnDescription = "更新时间", ColumnName = "update_time")]
  39. public DateTime? updateTime { get; set; }
  40. /// <summary>
  41. /// 创建人
  42. /// </summary>
  43. [SugarColumn(ColumnDescription = "创建人", Length = 32, ColumnName = "create_by")]
  44. public string? createBy { get; set; }
  45. /// <summary>
  46. /// 更新人
  47. /// </summary>
  48. [SugarColumn(ColumnDescription = "更新人", Length = 32, ColumnName = "update_by")]
  49. public string? updateBy { get; set; }
  50. /// <summary>
  51. /// 服务ID
  52. /// </summary>
  53. [SugarColumn(ColumnDescription = "服务ID", ColumnName = "service_id")]
  54. public int serviceId { get; set; }
  55. /// <summary>
  56. /// 接口分组ID
  57. /// </summary>
  58. [SugarColumn(ColumnDescription = "接口分组ID", ColumnName = "group_id")]
  59. public int groupId { get; set; }
  60. [SugarColumn(IsIgnore = true)]
  61. public string groupName { get; set; }
  62. [SugarColumn(IsIgnore = true)]
  63. public string groupTitle { get; set; }
  64. /// <summary>
  65. /// 板块名称
  66. /// </summary>
  67. [SugarColumn(ColumnDescription = "板块名称", Length = 50, ColumnName = "tab_name")]
  68. public string? tabName { get; set; }
  69. /// <summary>
  70. /// 接口名称
  71. /// </summary>
  72. [SugarColumn(ColumnDescription = "接口名称", Length = 100, ColumnName = "api_name")]
  73. public string? apiName { get; set; }
  74. /// <summary>
  75. /// 控制器文件路径
  76. /// </summary>
  77. [SugarColumn(ColumnDescription = "控制器文件路径", Length = 50, ColumnName = "controller_file_path")]
  78. public string? controllerFilePath { get; set; }
  79. [SugarColumn(IsIgnore = true)]
  80. public string? controllerName
  81. {
  82. get
  83. {
  84. return PublicFunction.transferName(controllerFilePath, 1);
  85. }
  86. }
  87. [SugarColumn(IsIgnore = true)]
  88. public string? controllerNameUpper
  89. {
  90. get
  91. {
  92. return PublicFunction.transferName(controllerFilePath);
  93. }
  94. }
  95. /// <summary>
  96. /// 使用场景
  97. /// </summary>
  98. [SugarColumn(ColumnDescription = "使用场景", ColumnName = "usage_scenarios")]
  99. public int usageScenarios { get; set; }
  100. /// <summary>
  101. /// 接口类型
  102. /// </summary>
  103. [SugarColumn(ColumnDescription = "接口类型", ColumnName = "api_kind")]
  104. public int apiKind { get; set; }
  105. /// <summary>
  106. /// 方法名
  107. /// </summary>
  108. [SugarColumn(ColumnDescription = "方法名", Length = 100, ColumnName = "method_name")]
  109. public string? methodName { get; set; }
  110. [SugarColumn(IsIgnore = true)]
  111. public string? methodNameUpper
  112. {
  113. get
  114. {
  115. return PublicFunction.transferName(methodName);
  116. }
  117. }
  118. [SugarColumn(IsIgnore = true)]
  119. public string? methodNameFirstUpper
  120. {
  121. get
  122. {
  123. return PublicFunction.transferName(methodName, 1);
  124. }
  125. }
  126. /// <summary>
  127. /// 接口表述
  128. /// </summary>
  129. [SugarColumn(ColumnDescription = "接口表述", Length = 255, ColumnName = "api_detail")]
  130. public string? apiDetail { get; set; }
  131. /// <summary>
  132. /// 接口参数
  133. /// </summary>
  134. [SugarColumn(ColumnDescription = "接口参数", ColumnName = "api_param", IsJson = true, ColumnDataType = "json")]
  135. public List<ApiParamObject> apiParam { get; set; }
  136. [SugarColumn(IsIgnore = true)]
  137. public int apiParamCount
  138. {
  139. get
  140. {
  141. if (apiParam != null)
  142. {
  143. return apiParam.Count(m => m.reqParam);
  144. }
  145. else
  146. {
  147. return 0;
  148. }
  149. }
  150. }
  151. [SugarColumn(IsIgnore = true)]
  152. public int apiResParamCount
  153. {
  154. get
  155. {
  156. if (apiParam != null)
  157. {
  158. return apiParam.Count(m => m.resParam);
  159. }
  160. else
  161. {
  162. return 0;
  163. }
  164. }
  165. }
  166. [SugarColumn(IsIgnore = true)]
  167. public string? apiParamFirstParam
  168. {
  169. get
  170. {
  171. if (apiParamCount > 0)
  172. {
  173. return apiParam.FirstOrDefault(m => m.reqParam)?.fieldName ?? "";
  174. }
  175. else
  176. {
  177. return "";
  178. }
  179. }
  180. }
  181. [SugarColumn(IsIgnore = true)]
  182. public string? apiParamFirstParamUpper
  183. {
  184. get
  185. {
  186. return PublicFunction.transferName(apiParamFirstParam);
  187. }
  188. }
  189. [SugarColumn(IsIgnore = true)]
  190. public string? apiParamFirstParamFirstUpper
  191. {
  192. get
  193. {
  194. return PublicFunction.transferName(apiParamFirstParam, 1);
  195. }
  196. }
  197. [SugarColumn(IsIgnore = true)]
  198. public string? apiParamFirstParamType
  199. {
  200. get
  201. {
  202. if (apiParamCount > 0)
  203. {
  204. return apiParam.FirstOrDefault(m => m.reqParam)?.fieldType ?? "";
  205. }
  206. else
  207. {
  208. return "";
  209. }
  210. }
  211. }
  212. [SugarColumn(IsIgnore = true)]
  213. public bool apiParamFirstParamCustomFlag
  214. {
  215. get
  216. {
  217. if (apiParamCount > 0)
  218. {
  219. return apiParam.FirstOrDefault(m => m.reqParam)?.customFlag ?? true;
  220. }
  221. else
  222. {
  223. return true;
  224. }
  225. }
  226. }
  227. /// <summary>
  228. /// 关联表ID
  229. /// </summary>
  230. [SugarColumn(ColumnDescription = "关联表ID", ColumnName = "link_table_id")]
  231. public int linkTableId { get; set; }
  232. [SugarColumn(IsIgnore = true)]
  233. public string? linkTableTitle { get; set; }
  234. [SugarColumn(IsIgnore = true)]
  235. public string? linkTableName { get; set; }
  236. [SugarColumn(IsIgnore = true)]
  237. public string? linkTableNameUpper
  238. {
  239. get
  240. {
  241. return PublicFunction.transferName(linkTableName);
  242. }
  243. }
  244. [SugarColumn(IsIgnore = true)]
  245. public string? linkTableNameFirstUpper
  246. {
  247. get
  248. {
  249. return PublicFunction.transferName(linkTableName, 1);
  250. }
  251. }
  252. [SugarColumn(IsIgnore = true)]
  253. public int linkTableSplitKind { get; set; }
  254. /// <summary>
  255. /// 分页
  256. /// </summary>
  257. [SugarColumn(ColumnDescription = "分页", ColumnName = "page_flag")]
  258. public bool pageFlag { get; set; }
  259. }
  260. public class ApiParamObject
  261. {
  262. public int id { get; set; }
  263. /// <summary>
  264. /// 字段名称
  265. /// </summary>
  266. public string fieldTitle { get; set; }
  267. /// <summary>
  268. /// 字段名
  269. /// </summary>
  270. public string fieldName { get; set; }
  271. public string fieldNameUpper
  272. {
  273. get
  274. {
  275. return PublicFunction.transferName(fieldName);
  276. }
  277. }
  278. public string fieldNameFirstUpper
  279. {
  280. get
  281. {
  282. return PublicFunction.transferName(fieldName, 1);
  283. }
  284. }
  285. /// <summary>
  286. /// 字段类型
  287. /// </summary>
  288. public string fieldType { get; set; }
  289. /// <summary>
  290. /// 控件类型
  291. /// </summary>
  292. public string editType { get; set; }
  293. public EditTypeFrontend editTypeData { get; set; }
  294. /// <summary>
  295. /// 请求参数
  296. /// </summary>
  297. public bool reqParam { get; set; }
  298. /// <summary>
  299. /// 返回字段
  300. /// </summary>
  301. public bool resParam { get; set; }
  302. /// <summary>
  303. /// 自定义
  304. /// </summary>
  305. public bool customFlag { get; set; }
  306. /// <summary>
  307. /// 返回类型
  308. /// </summary>
  309. public string resType { get; set; }
  310. /// <summary>
  311. /// 验证属性
  312. /// </summary>
  313. public string[] checkAttribute { get; set; }
  314. public string checkAttributeString
  315. {
  316. get
  317. {
  318. if (checkAttribute != null)
  319. {
  320. return string.Join(",", checkAttribute);
  321. }
  322. else
  323. {
  324. return "";
  325. }
  326. }
  327. }
  328. /// <summary>
  329. /// 排序方式
  330. /// </summary>
  331. public string sortMode { get; set; }
  332. /// <summary>
  333. /// 字段说明
  334. /// </summary>
  335. public string fieldDetail { get; set; }
  336. /// <summary>
  337. /// 关联表ID
  338. /// </summary>
  339. public int linkTableId { get; set; }
  340. public string? linkTableTitle { get; set; }
  341. public string? linkTableName { get; set; }
  342. public string? linkTableNameUpper
  343. {
  344. get
  345. {
  346. return PublicFunction.transferName(linkTableName);
  347. }
  348. }
  349. public string? linkTableNameFirstUpper
  350. {
  351. get
  352. {
  353. return PublicFunction.transferName(linkTableName, 1);
  354. }
  355. }
  356. /// <summary>
  357. /// 关联表主键字段
  358. /// </summary>
  359. public string? linkTablePrimaryKeyName { get; set; }
  360. /// <summary>
  361. /// 关联参数
  362. /// </summary>
  363. public List<ApiParamObject> linkParam { get; set; }
  364. /// <summary>
  365. /// 关联参数数量
  366. /// </summary>
  367. public int linkParamCount
  368. {
  369. get
  370. {
  371. if (linkParam != null)
  372. {
  373. return linkParam.Count;
  374. }
  375. else
  376. {
  377. return 0;
  378. }
  379. }
  380. }
  381. }
  382. }