升级替换部分代码生成功能模板引擎为Jnt
This commit is contained in:
@@ -36,8 +36,8 @@ namespace ZR.Admin.WebApi.Controllers
|
||||
private readonly ISysDictDataService SysDictDataService;
|
||||
private IWebHostEnvironment WebHostEnvironment;
|
||||
public CodeGeneratorController(
|
||||
IGenTableService genTableService,
|
||||
IGenTableColumnService genTableColumnService,
|
||||
IGenTableService genTableService,
|
||||
IGenTableColumnService genTableColumnService,
|
||||
ISysDictDataService dictDataService,
|
||||
IWebHostEnvironment webHostEnvironment)
|
||||
{
|
||||
@@ -148,11 +148,11 @@ namespace ZR.Admin.WebApi.Controllers
|
||||
BaseNameSpace = "ZR.",//导入默认命名空间前缀
|
||||
ModuleName = "business",//导入默认模块名
|
||||
ClassName = CodeGeneratorTool.GetClassName(tableName),
|
||||
BusinessName = CodeGeneratorTool.GetClassName(tableName),
|
||||
BusinessName = CodeGeneratorTool.GetBusinessName(tableName),
|
||||
FunctionAuthor = ConfigUtils.Instance.GetConfig(GenConstants.Gen_author),
|
||||
FunctionName = string.IsNullOrEmpty(tabInfo.Description) ? tableName : tabInfo.Description,
|
||||
TableName = tableName,
|
||||
TableComment = string.IsNullOrEmpty(tabInfo.Description) ? tableName : tabInfo.Description,
|
||||
FunctionName = string.IsNullOrEmpty(tabInfo.Description) ? tableName : tabInfo.Description,
|
||||
Create_by = userName,
|
||||
};
|
||||
genTable.TableId = GenTableService.ImportGenTable(genTable);
|
||||
@@ -223,9 +223,8 @@ namespace ZR.Admin.WebApi.Controllers
|
||||
dto.ZipPath = Path.Combine(WebHostEnvironment.WebRootPath, "Generatecode");
|
||||
dto.GenCodePath = Path.Combine(dto.ZipPath, DateTime.Now.ToString("yyyyMMdd"));
|
||||
dto.IsPreview = 1;
|
||||
dto.GenCodeFiles = new int[] { 1, 2, 3, 4, 5, 6, 7, 8 };
|
||||
//生成代码
|
||||
CodeGeneratorTool.Generate(genTableInfo, dto);
|
||||
CodeGeneratorTool.Generate(dto);
|
||||
|
||||
return SUCCESS(dto.GenCodes);
|
||||
}
|
||||
@@ -252,7 +251,7 @@ namespace ZR.Admin.WebApi.Controllers
|
||||
|
||||
dto.GenTable = genTableInfo;
|
||||
//生成代码
|
||||
CodeGeneratorTool.Generate(genTableInfo, dto);
|
||||
CodeGeneratorTool.Generate(dto);
|
||||
//下载文件
|
||||
FileHelper.ZipGenCode(dto);
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"commandName": "Project",
|
||||
"launchBrowser": false,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": ""
|
||||
"ASPNETCORE_ENVIRONMENT": "Production"
|
||||
},
|
||||
"applicationUrl": "http://localhost:8888"
|
||||
}
|
||||
|
||||
@@ -86,13 +86,6 @@ namespace ZR.Admin.WebApi
|
||||
}
|
||||
});
|
||||
|
||||
//jntģ<74><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȫ<EFBFBD>ֱ<EFBFBD><D6B1><EFBFBD>
|
||||
Engine.Configure((options) =>
|
||||
{
|
||||
options.Data.Set("author", Configuration["gen:author"]);
|
||||
options.Data.Set("time", DateTime.Now.ToString("yyyy-MM-dd"));
|
||||
//...<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
});
|
||||
}
|
||||
|
||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||
|
||||
@@ -15,27 +15,28 @@
|
||||
<ItemGroup>
|
||||
<Compile Remove="Filters\GlobalExceptionFilter.cs" />
|
||||
<Compile Remove="Middleware\RequestIPMiddleware.cs" />
|
||||
<Compile Remove="Template\Controller.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Template\Controller.tt" />
|
||||
<Content Remove="wwwroot\CodeGenTemplate\InputDtoTemplate.txt" />
|
||||
<Content Remove="wwwroot\CodeGenTemplate\ModelTemplate.txt" />
|
||||
<Content Remove="wwwroot\CodeGenTemplate\RepositoryTemplate.txt" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="EPPlus" Version="5.8.3" />
|
||||
<PackageReference Include="Hei.Captcha" Version="0.3.0" />
|
||||
<PackageReference Include="IPTools.China" Version="1.6.0" />
|
||||
<PackageReference Include="CSRedisCore" Version="3.6.5" />
|
||||
<PackageReference Include="Mapster" Version="7.0.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.0" NoWarn="NU1605" />
|
||||
<PackageReference Include="NETCore.Encrypt" Version="2.0.9" />
|
||||
<PackageReference Include="NLog" Version="4.7.5" />
|
||||
<PackageReference Include="NLog.Web.AspNetCore" Version="4.9.3" />
|
||||
<PackageReference Include="Snowflake.Core" Version="2.0.0" />
|
||||
<PackageReference Include="SqlSugar.IOC" Version="1.7.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.1.4" />
|
||||
<PackageReference Include="UAParser" Version="3.1.46" />
|
||||
<PackageReference Include="CSRedisCore" Version="3.6.5" />
|
||||
<PackageReference Include="Mapster" Version="7.0.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.0" NoWarn="NU1605" />
|
||||
<PackageReference Include="NETCore.Encrypt" Version="2.0.9" />
|
||||
<PackageReference Include="NLog" Version="4.7.5" />
|
||||
<PackageReference Include="NLog.Web.AspNetCore" Version="4.9.3" />
|
||||
<PackageReference Include="Snowflake.Core" Version="2.0.0" />
|
||||
<PackageReference Include="SqlSugar.IOC" Version="1.7.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.1.4" />
|
||||
<PackageReference Include="UAParser" Version="3.1.46" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -60,33 +61,6 @@
|
||||
<None Update="ip2region.db">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Template\ControllersTemplate.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Template\InputDtoTemplate.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Template\IServiceTemplate.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Template\ModelTemplate.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Template\RepositoryTemplate.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Template\ServiceTemplate.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Template\VueJsTemplate.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Template\VueTemplate.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="ZRAdmin.xml">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -95,16 +69,6 @@
|
||||
<Folder Include="wwwroot\Generatecode\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Resource Include="Template\RepositoryTemplate.txt" />
|
||||
<Resource Include="Template\ServiceTemplate.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
<Resource Include="Template\VueJsTemplate.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Service Include="{508349b6-6b84-4df5-91f0-309beebad82d}" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using System;
|
||||
using {ModelsNamespace}.Models;
|
||||
using ${options.ModelsNamespace}.Models;
|
||||
|
||||
namespace {IServicsNamespace}.Business
|
||||
namespace ${options.IServicsNamespace}.Business
|
||||
{
|
||||
/// <summary>
|
||||
/// {FunctionName}service接口
|
||||
/// ${genTable.FunctionName}service接口
|
||||
///
|
||||
/// @author {Author}
|
||||
/// @date {DateTime}
|
||||
/// @author ${replaceDto.Author}
|
||||
/// @date ${replaceDto.AddTime}
|
||||
/// </summary>
|
||||
public interface I{ModelTypeName}Service: IBaseService<{ModelTypeName}>
|
||||
public interface I${replaceDto.ModelTypeName}Service: IBaseService<${replaceDto.ModelTypeName}>
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
-- 菜单
|
||||
INSERT INTO sys_menu(menuName, parentId, orderNum, path, component, isFrame, isCache, menuType, visible, status, perms, icon, create_by, create_time, remark)
|
||||
VALUES ('{FunctionName}', {ParentId}, 1, '{ModuleName}/{ModelTypeName}', '{ModuleName}/{ViewsFileName}/index', 0, 0, 'C', '0', '0', '{Permission}:list', 'icon1', '', sysdate(), '{FunctionName}菜单');
|
||||
VALUES ('${genTable.functionName}', ${parentId}, 1, '${genTable.ModuleName}/${replaceDto.ModelTypeName}', '${genTable.ModuleName}/${replaceDto.ViewsFileName}/index', 0, 0, 'C', '0', '0', '${replaceDto.permission}:list', 'icon1', '', sysdate(), '${genTable.functionName}菜单');
|
||||
|
||||
-- 按钮父菜单id
|
||||
SELECT @menuId := LAST_INSERT_ID();
|
||||
|
||||
|
||||
INSERT INTO sys_menu(menuName, parentId, orderNum, path, component, isFrame, isCache, menuType, visible, status, perms, icon, create_time)
|
||||
VALUES ('{FunctionName}查询', @menuId, 1, '#', NULL, 0, 0, 'F', '0', '0', '{Permission}:query', '', sysdate());
|
||||
VALUES ('${genTable.functionName}查询', @menuId, 1, '#', NULL, 0, 0, 'F', '0', '0', '${replaceDto.permission}:query', '', sysdate());
|
||||
|
||||
INSERT INTO sys_menu(menuName, parentId, orderNum, path, component, isFrame, isCache, menuType, visible, status, perms, icon, create_time)
|
||||
VALUES ('{FunctionName}新增', @menuId, 2, '#', NULL, 0, 0, 'F', '0', '0', '{Permission}:add', '', sysdate());
|
||||
VALUES ('${genTable.functionName}新增', @menuId, 2, '#', NULL, 0, 0, 'F', '0', '0', '${replaceDto.permission}:add', '', sysdate());
|
||||
|
||||
INSERT INTO sys_menu(menuName, parentId, orderNum, path, component, isFrame, isCache, menuType, visible, status, perms, icon, create_time)
|
||||
VALUES ('{FunctionName}删除', @menuId, 3, '#', NULL, 0, 0, 'F', '0', '0', '{Permission}:delete', '', sysdate());
|
||||
VALUES ('${genTable.functionName}删除', @menuId, 3, '#', NULL, 0, 0, 'F', '0', '0', '${replaceDto.permission}:delete', '', sysdate());
|
||||
|
||||
INSERT INTO sys_menu(menuName, parentId, orderNum, path, component, isFrame, isCache, menuType, visible, status, perms, icon, create_time)
|
||||
VALUES ('{FunctionName}修改', @menuId, 4, '#', NULL, 0, 0, 'F', '0', '0', '{Permission}:update', '', sysdate());
|
||||
VALUES ('${genTable.functionName}修改', @menuId, 4, '#', NULL, 0, 0, 'F', '0', '0', '${replaceDto.permission}:update', '', sysdate());
|
||||
|
||||
INSERT INTO sys_menu(menuName, parentId, orderNum, path, component, isFrame, isCache, menuType, visible, status, perms, icon, create_time)
|
||||
VALUES ('{FunctionName}导出', @menuId, 5, '#', NULL, 0, 0, 'F', '0', '0', '{Permission}:export', '', sysdate());
|
||||
VALUES ('${genTable.functionName}导出', @menuId, 5, '#', NULL, 0, 0, 'F', '0', '0', '${replaceDto.permission}:export', '', sysdate());
|
||||
|
||||
SELECT * FROM sys_menu WHERE parentId = @menuId;
|
||||
SELECT * FROM sys_menu WHERE menuId = @menuId;
|
||||
@@ -1,23 +1,23 @@
|
||||
using Infrastructure;
|
||||
using Infrastructure.Attribute;
|
||||
using {ModelsNamespace}.Models;
|
||||
using {IRepositoriesNamespace};
|
||||
using ${options.ModelsNamespace}.Models;
|
||||
using ${options.IRepositoriesNamespace};
|
||||
|
||||
namespace {ServicesNamespace}.Business
|
||||
namespace ${options.ServicesNamespace}.Business
|
||||
{
|
||||
/// <summary>
|
||||
/// {FunctionName}Service业务层处理
|
||||
/// ${genTable.FunctionName}Service业务层处理
|
||||
///
|
||||
/// @author {Author}
|
||||
/// @date {DateTime}
|
||||
/// @author ${replaceDto.Author}
|
||||
/// @date ${replaceDto.AddTime}
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(I{ModelTypeName}Service), ServiceLifetime = LifeTime.Transient)]
|
||||
public class {ModelTypeName}Service : BaseService<{ModelTypeName}>, I{ModelTypeName}Service
|
||||
[AppService(ServiceType = typeof(I${replaceDto.ModelTypeName}Service), ServiceLifetime = LifeTime.Transient)]
|
||||
public class ${replaceDto.ModelTypeName}Service : BaseService<${replaceDto.ModelTypeName}>, I${replaceDto.ModelTypeName}Service
|
||||
{
|
||||
private readonly {ModelTypeName}Repository _{ModelTypeName}repository;
|
||||
public {ModelTypeName}Service({ModelTypeName}Repository repository) : base(repository)
|
||||
private readonly ${replaceDto.ModelTypeName}Repository _${replaceDto.ModelTypeName}repository;
|
||||
public ${replaceDto.ModelTypeName}Service(${replaceDto.ModelTypeName}Repository repository) : base(repository)
|
||||
{
|
||||
_{ModelTypeName}repository = repository;
|
||||
_${replaceDto.ModelTypeName}repository = repository;
|
||||
}
|
||||
|
||||
#region 业务逻辑代码
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
-- {FunctionName}菜单
|
||||
-- ${genTable.functionName}菜单
|
||||
INSERT INTO sys_menu(menuName, parentId, orderNum, path, component, isFrame, isCache, menuType, visible, status, perms, icon, create_time, remark)
|
||||
VALUES ('{FunctionName}', {ParentId}, 1, '{ModuleName}/{ModelTypeName}', '{ModuleName}/{ViewsFileName}/index', 0, 0, 'C', '0', '0', '{Permission}:list', 'icon1', GETDATE(), '{FunctionName}');
|
||||
VALUES ('${genTable.functionName}', ${parentId}, 1, '${genTable.ModuleName}/${replaceDto.ModelTypeName}', '${genTable.ModuleName}/${replaceDto.ViewsFileName}/index', 0, 0, 'C', '0', '0', '${replaceDto.permission}:list', 'icon1', GETDATE(), '${genTable.functionName}');
|
||||
|
||||
-- 按钮父菜单id
|
||||
declare @menuId int = @@identity
|
||||
|
||||
|
||||
INSERT INTO sys_menu(menuName, parentId, orderNum, path, component, isFrame, isCache, menuType, visible, status, perms, icon, create_by,create_time)
|
||||
VALUES ('{FunctionName}查询', @menuId, 1, '#', NULL, 0, 0, 'F', '0', '0', '{Permission}:query', '', '', GETDATE());
|
||||
VALUES ('${genTable.functionName}查询', @menuId, 1, '#', NULL, 0, 0, 'F', '0', '0', '${replaceDto.permission}:query', '', '', GETDATE());
|
||||
|
||||
INSERT INTO sys_menu(menuName, parentId, orderNum, path, component, isFrame, isCache, menuType, visible, status, perms, icon, create_by,create_time)
|
||||
VALUES ('{FunctionName}新增', @menuId, 2, '#', NULL, 0, 0, 'F', '0', '0', '{Permission}:add', '', '', GETDATE());
|
||||
VALUES ('${genTable.functionName}新增', @menuId, 2, '#', NULL, 0, 0, 'F', '0', '0', '${replaceDto.permission}:add', '', '', GETDATE());
|
||||
|
||||
INSERT INTO sys_menu(menuName, parentId, orderNum, path, component, isFrame, isCache, menuType, visible, status, perms, icon, create_by,create_time)
|
||||
VALUES ('{FunctionName}删除', @menuId, 3, '#', NULL, 0, 0, 'F', '0', '0', '{Permission}:delete', '', '', GETDATE());
|
||||
VALUES ('${genTable.functionName}删除', @menuId, 3, '#', NULL, 0, 0, 'F', '0', '0', '${replaceDto.permission}:delete', '', '', GETDATE());
|
||||
|
||||
INSERT INTO sys_menu(menuName, parentId, orderNum, path, component, isFrame, isCache, menuType, visible, status, perms, icon, create_by,create_time)
|
||||
VALUES ('{FunctionName}修改', @menuId, 4, '#', NULL, 0, 0, 'F', '0', '0', '{Permission}:update', '', '', GETDATE());
|
||||
VALUES ('${genTable.functionName}修改', @menuId, 4, '#', NULL, 0, 0, 'F', '0', '0', '${replaceDto.permission}:update', '', '', GETDATE());
|
||||
|
||||
INSERT INTO sys_menu(menuName, parentId, orderNum, path, component, isFrame, isCache, menuType, visible, status, perms, icon, create_by,create_time)
|
||||
VALUES ('{FunctionName}导出', @menuId, 5, '#', NULL, 0, 0, 'F', '0', '0', '{Permission}:export', '', '', GETDATE());
|
||||
VALUES ('${genTable.functionName}导出', @menuId, 5, '#', NULL, 0, 0, 'F', '0', '0', '${replaceDto.permission}:export', '', '', GETDATE());
|
||||
|
||||
SELECT * FROM sys_menu WHERE parentId = @menuId;
|
||||
SELECT * FROM sys_menu WHERE menuId = @menuId;
|
||||
34
ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplDto.txt
Normal file
34
ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplDto.txt
Normal file
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using ${options.ModelsNamespace}.Dto;
|
||||
using ${options.ModelsNamespace}.Models;
|
||||
|
||||
namespace ${options.DtosNamespace}.Dto
|
||||
{
|
||||
/// <summary>
|
||||
/// ${genTable.FunctionName}输入对象
|
||||
/// </summary>
|
||||
public class ${replaceDto.ModelTypeName}Dto
|
||||
{
|
||||
$foreach(item in genTable.Columns)
|
||||
$if((item.IsInsert || item.IsEdit || item.IsPk || item.IsIncrement))
|
||||
public $item.CsharpType$item.RequiredStr $item.CsharpField { get; set; }
|
||||
$end
|
||||
${end}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ${genTable.FunctionName}查询对象
|
||||
/// </summary>
|
||||
public class ${replaceDto.ModelTypeName}QueryDto : PagerInfo
|
||||
{
|
||||
$foreach(item in genTable.Columns)
|
||||
$if(item.IsQuery)
|
||||
public $item.CsharpType $item.CsharpField { get; set; }
|
||||
$end
|
||||
${end}
|
||||
|
||||
public DateTime? BeginTime { get; set; }
|
||||
public DateTime? EndTime { get; set; }
|
||||
}
|
||||
}
|
||||
27
ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplModel.txt
Normal file
27
ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplModel.txt
Normal file
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using SqlSugar;
|
||||
|
||||
namespace ${options.ModelsNamespace}.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// ${genTable.FunctionName},数据实体对象
|
||||
///
|
||||
/// @author ${replaceDto.Author}
|
||||
/// @date ${replaceDto.AddTime}
|
||||
/// </summary>
|
||||
[SugarTable("${replaceDto.TableName}")]
|
||||
public class ${replaceDto.ModelTypeName}
|
||||
{
|
||||
$foreach(item in genTable.Columns)
|
||||
/// <summary>
|
||||
/// 描述 : ${item.ColumnComment}
|
||||
/// 空值 :$if(item.IsRequired == "True") false $else true $end
|
||||
/// </summary>
|
||||
$if(item.IsPk || item.IsIncrement)
|
||||
[SqlSugar.SugarColumn(IsPrimaryKey = ${item.IsPk.ToString().ToLower()}, IsIdentity = ${item.IsIncrement.ToString().ToLower()})]
|
||||
$end
|
||||
public $item.CsharpType$item.RequiredStr $item.CsharpField { get; set; }
|
||||
${end}
|
||||
}
|
||||
}
|
||||
20
ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplRepository.txt
Normal file
20
ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplRepository.txt
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using Infrastructure.Attribute;
|
||||
using ${options.RepositoriesNamespace}.System;
|
||||
using ${options.ModelsNamespace}.Models;
|
||||
|
||||
namespace ${options.RepositoriesNamespace}
|
||||
{
|
||||
/// <summary>
|
||||
/// ${genTable.FunctionName}仓储
|
||||
///
|
||||
/// @author ${replaceDto.Author}
|
||||
/// @date ${replaceDto.AddTime}
|
||||
/// </summary>
|
||||
[AppService(ServiceLifetime = LifeTime.Transient)]
|
||||
public class ${replaceDto.ModelTypeName}Repository : BaseRepository<${replaceDto.ModelTypeName}>
|
||||
{
|
||||
#region 业务逻辑代码
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,66 +1,66 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
/**
|
||||
* {FunctionName}分页查询
|
||||
* ${genTable.functionName}分页查询
|
||||
* @param {查询条件} data
|
||||
*/
|
||||
export function list{ModelTypeName}(query) {
|
||||
export function list${replaceDto.ModelTypeName}(query) {
|
||||
return request({
|
||||
url: '{ModuleName}/{ModelTypeName}/list',
|
||||
url: '${genTable.ModuleName}/${replaceDto.ModelTypeName}/list',
|
||||
method: 'get',
|
||||
params: query,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增{FunctionName}
|
||||
* 新增${genTable.functionName}
|
||||
* @param data
|
||||
*/
|
||||
export function add{ModelTypeName}(data) {
|
||||
export function add${replaceDto.ModelTypeName}(data) {
|
||||
return request({
|
||||
url: '{ModuleName}/{ModelTypeName}',
|
||||
url: '${genTable.ModuleName}/${replaceDto.ModelTypeName}',
|
||||
method: 'post',
|
||||
data: data,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改{FunctionName}
|
||||
* 修改${genTable.functionName}
|
||||
* @param data
|
||||
*/
|
||||
export function update{ModelTypeName}(data) {
|
||||
export function update${replaceDto.ModelTypeName}(data) {
|
||||
return request({
|
||||
url: '{ModuleName}/{ModelTypeName}',
|
||||
url: '${genTable.ModuleName}/${replaceDto.ModelTypeName}',
|
||||
method: 'PUT',
|
||||
data: data,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取{FunctionName}详情
|
||||
* @param {Id} {FunctionName}Id
|
||||
* 获取${genTable.functionName}详情
|
||||
* @param {Id}
|
||||
*/
|
||||
export function get{ModelTypeName}(id) {
|
||||
export function get${replaceDto.ModelTypeName}(id) {
|
||||
return request({
|
||||
url: '{ModuleName}/{ModelTypeName}/' + id,
|
||||
url: '${genTable.ModuleName}/${replaceDto.ModelTypeName}/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* 删除${genTable.functionName}
|
||||
* @param {主键} pid
|
||||
*/
|
||||
export function del{ModelTypeName}(pid) {
|
||||
export function del${replaceDto.ModelTypeName}(pid) {
|
||||
return request({
|
||||
url: '{ModuleName}/{ModelTypeName}/' + pid,
|
||||
url: '${genTable.ModuleName}/${replaceDto.ModelTypeName}/' + pid,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
// 导出
|
||||
export function export{ModelTypeName}(query) {
|
||||
// 导出${genTable.functionName}
|
||||
export function export${replaceDto.ModelTypeName}(query) {
|
||||
return request({
|
||||
url: '{ModuleName}/{ModelTypeName}/export',
|
||||
url: '${genTable.ModuleName}/${replaceDto.ModelTypeName}/export',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user