新增代码生成到指定菜单目录下下
This commit is contained in:
@@ -5,6 +5,7 @@ using Mapster;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Newtonsoft.Json;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -89,7 +90,8 @@ namespace ZR.Admin.WebApi.Controllers
|
||||
|
||||
var genTableInfo = GenTableService.GetGenTableInfo(dto.TableId);
|
||||
genTableInfo.Columns = GenTableColumnService.GenTableColumns(dto.TableId);
|
||||
|
||||
Dictionary<string, object> options = JsonConvert.DeserializeObject<Dictionary<string, object>>(genTableInfo.Options);
|
||||
dto.ParentMenuId = (long)options.GetValueOrDefault("parentMenuId", 0);
|
||||
dto.GenTable = genTableInfo;
|
||||
//生成代码
|
||||
CodeGeneratorTool.Generate(genTableInfo, dto);
|
||||
@@ -211,6 +213,7 @@ namespace ZR.Admin.WebApi.Controllers
|
||||
if (genTableDto == null) throw new CustomException("请求参数错误");
|
||||
var genTable = genTableDto.Adapt<GenTable>().ToUpdate(HttpContext);
|
||||
|
||||
genTable.Options = JsonConvert.SerializeObject(new { parentMenuId = genTableDto.ParentMenuId });
|
||||
int rows = GenTableService.UpdateGenTable(genTable);
|
||||
if (rows > 0)
|
||||
{
|
||||
|
||||
@@ -20,8 +20,8 @@ namespace ZR.Admin.WebApi.Controllers
|
||||
/// <summary>
|
||||
/// 代码生成演示Controller
|
||||
///
|
||||
/// @author zhaorui
|
||||
/// @date 2021-09-24
|
||||
/// @author zr
|
||||
/// @date 2021-09-27
|
||||
/// </summary>
|
||||
[Verify]
|
||||
[Route("business/Gendemo")]
|
||||
|
||||
Reference in New Issue
Block a user