|
|
@@ -7,18 +7,27 @@ using Vo.Admin;
|
|
|
using Mapster;
|
|
|
using Infrastructure;
|
|
|
using Dto.Client;
|
|
|
+using Custom;
|
|
|
+using Feign;
|
|
|
+using Common;
|
|
|
+using Util;
|
|
|
|
|
|
|
|
|
namespace Controllers.Client
|
|
|
{
|
|
|
public class MakeCodeController : BaseController
|
|
|
{
|
|
|
+ private readonly IDatabaseInfoService _DatabaseInfoService;
|
|
|
private readonly IDatabaseTableService _DatabaseTableService;
|
|
|
+ private readonly IApiGroupService _ApiGroupService;
|
|
|
+ private readonly IApiInfoService _ApiInfoService;
|
|
|
|
|
|
-
|
|
|
- public MakeCodeController(IDatabaseTableService DatabaseTableService)
|
|
|
+ public MakeCodeController(IDatabaseInfoService DatabaseInfoService, IDatabaseTableService DatabaseTableService, IApiGroupService ApiGroupService, IApiInfoService ApiInfoService)
|
|
|
{
|
|
|
+ _DatabaseInfoService = DatabaseInfoService;
|
|
|
_DatabaseTableService = DatabaseTableService;
|
|
|
+ _ApiGroupService = ApiGroupService;
|
|
|
+ _ApiInfoService = ApiInfoService;
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -31,7 +40,40 @@ namespace Controllers.Client
|
|
|
[Route("/v1/omega_source/MakeCode/getMakeCodeList")]
|
|
|
public IActionResult getMakeCodeList([FromQuery] MakeCodeDto param)
|
|
|
{
|
|
|
-
|
|
|
+ try
|
|
|
+ {
|
|
|
+ TokenModel loginUser = JwtUtil.GetLoginUser(HttpContext);
|
|
|
+ loginUser.username = "lcl";
|
|
|
+ ProjectService baseInfo = IProject.getProjectService(param.serviceId);
|
|
|
+ List<int> databaseIds = Tools.SpitIntArrary(baseInfo.databaseList).ToList();
|
|
|
+ foreach(var databaseId in databaseIds)
|
|
|
+ {
|
|
|
+ var tables = _DatabaseTableService.GetList(a => a.databaseId == databaseId);
|
|
|
+ foreach(var table in tables)
|
|
|
+ {
|
|
|
+ _DatabaseTableService.makeJavaModel(baseInfo, table, loginUser);
|
|
|
+ _DatabaseTableService.makeJavaService(baseInfo, table, loginUser);
|
|
|
+ _DatabaseTableService.makeJavaServiceImpl(baseInfo, table, loginUser);
|
|
|
+ _DatabaseTableService.makeJavaMapper(baseInfo, table, loginUser);
|
|
|
+ _DatabaseTableService.makeJavaMapperXml(baseInfo, table, loginUser);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ var apiGroups = _ApiGroupService.GetList(a => a.serviceId == param.serviceId);
|
|
|
+ foreach(var apiGroup in apiGroups)
|
|
|
+ {
|
|
|
+ var apiInfos = _ApiInfoService.GetList(a => a.groupId == apiGroup.id);
|
|
|
+ foreach(var apiInfo in apiInfos)
|
|
|
+ {
|
|
|
+ _DatabaseTableService.makeJavaDto(baseInfo, apiInfo, loginUser);
|
|
|
+ _DatabaseTableService.makeJavaVo(baseInfo, apiInfo, loginUser);
|
|
|
+ }
|
|
|
+ _DatabaseTableService.makeJavaController(baseInfo, apiGroup.groupNameUpper, loginUser);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch(Exception ex)
|
|
|
+ {
|
|
|
+ Function.WriteLog(ex.ToString(), "测试生成代码异常");
|
|
|
+ }
|
|
|
return SUCCESS("ok");
|
|
|
}
|
|
|
|