|
|
@@ -25,12 +25,14 @@ namespace Controllers.Admin
|
|
|
private readonly IApiInfoService _ApiInfoService;
|
|
|
private readonly IApiGroupService _ApiGroupService;
|
|
|
private readonly IApiControllerService _ApiControllerService;
|
|
|
+ private readonly IDatabaseFieldService _DatabaseFieldService;
|
|
|
|
|
|
- public ApiInfoController(IApiInfoService ApiInfoService, IApiGroupService ApiGroupService, IApiControllerService ApiControllerService)
|
|
|
+ public ApiInfoController(IApiInfoService ApiInfoService, IApiGroupService ApiGroupService, IApiControllerService ApiControllerService, IDatabaseFieldService DatabaseFieldService)
|
|
|
{
|
|
|
_ApiInfoService = ApiInfoService;
|
|
|
_ApiGroupService = ApiGroupService;
|
|
|
_ApiControllerService = ApiControllerService;
|
|
|
+ _DatabaseFieldService = DatabaseFieldService;
|
|
|
}
|
|
|
|
|
|
/// <param name="page">分页参数</param>
|
|
|
@@ -96,6 +98,13 @@ namespace Controllers.Admin
|
|
|
serviceId = param.serviceId
|
|
|
});
|
|
|
}
|
|
|
+ foreach(var item in modal.apiParam)
|
|
|
+ {
|
|
|
+ var linkTablePrimaryKey = (_DatabaseFieldService.GetFirst(m => m.tableId == item.linkTableId && m.primaryKey) ?? _DatabaseFieldService.GetFirst(m => m.tableId == item.linkTableId)) ?? new DatabaseField();
|
|
|
+ item.linkTablePrimaryKeyId = linkTablePrimaryKey.id;
|
|
|
+ item.linkTablePrimaryKeyName = linkTablePrimaryKey.fieldName;
|
|
|
+ item.linkTablePrimaryKeyTitle = linkTablePrimaryKey.fieldTitle;
|
|
|
+ }
|
|
|
var response = _ApiInfoService.InsertReturnIdentity(modal);
|
|
|
return SUCCESS(response);
|
|
|
}
|
|
|
@@ -120,6 +129,13 @@ namespace Controllers.Admin
|
|
|
serviceId = param.serviceId
|
|
|
});
|
|
|
}
|
|
|
+ foreach(var item in modal.apiParam)
|
|
|
+ {
|
|
|
+ var linkTablePrimaryKey = (_DatabaseFieldService.GetFirst(m => m.tableId == item.linkTableId && m.primaryKey) ?? _DatabaseFieldService.GetFirst(m => m.tableId == item.linkTableId)) ?? new DatabaseField();
|
|
|
+ item.linkTablePrimaryKeyId = linkTablePrimaryKey.id;
|
|
|
+ item.linkTablePrimaryKeyName = linkTablePrimaryKey.fieldName;
|
|
|
+ item.linkTablePrimaryKeyTitle = linkTablePrimaryKey.fieldTitle;
|
|
|
+ }
|
|
|
var response = _ApiInfoService.Update(modal, true);
|
|
|
return SUCCESS(response);
|
|
|
}
|