升级替换部分代码生成功能模板引擎为Jnt
This commit is contained in:
@@ -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