优化代码生成

This commit is contained in:
不做码农
2022-05-24 18:42:40 +08:00
21 changed files with 300 additions and 280 deletions

View File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using ZR.Model.Dto;
using ZR.Model.Models;
namespace ZR.Model.Dto
{
/// <summary>
/// 文章目录输入对象
/// </summary>
public class ArticleCategoryDto
{
[Required(ErrorMessage = "目录id不能为空")]
public int CategoryId { get; set; }
[Required(ErrorMessage = "目录名不能为空")]
public string Name { get; set; }
public DateTime? CreateTime { get; set; }
public int? ParentId { get; set; }
}
/// <summary>
/// 文章目录查询对象
/// </summary>
public class ArticleCategoryQueryDto : PagerInfo
{
}
}

View File

@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections.Generic;
using ZR.Model.System.Generate;
namespace ZR.Model.System.Dto
@@ -21,7 +19,7 @@ namespace ZR.Model.System.Dto
public string FunctionAuthor { get; set; }
public string GenType { get; set; }
public string GenPath { get; set; }
public string PermissionPrefix { get; set; }
//public string PermissionPrefix { get; set; }
public string Remark { get; set; }
/// <summary>
/// 额外参数
@@ -34,19 +32,19 @@ namespace ZR.Model.System.Dto
/// 额外参数
/// ****注意里面参数统一首字母小写*****
/// </summary>
public class Options
public class Params
{
public string treeCode { get; set; }
public string treeName { get; set; }
public string treeParentCode { get; set; }
public int? parentMenuId { get; set; }
public string sortField { get; set; }
public string sortType { get; set; }
public string TreeCode { get; set; }
public string TreeName { get; set; }
public string TreeParentCode { get; set; }
public int? ParentMenuId { get; set; }
public string SortField { get; set; }
public string SortType { get; set; }
/// <summary>
/// 额外参数字符串
/// </summary>
public string checkedBtn { get; set; }
public string permissionPrefix { get; set; }
public string CheckedBtn { get; set; }
public string PermissionPrefix { get; set; }
}
public class GenTableColumnDto
{
@@ -59,6 +57,7 @@ namespace ZR.Model.System.Dto
public bool IsEdit { get; set; }
public bool IsList { get; set; }
public bool IsQuery { get; set; }
public bool IsSort { get; set; }
public bool IsRequired { get; set; }
/// <summary>
/// 显示类型(文本框、文本域、下拉框、复选框、单选框、日期控件)
@@ -73,6 +72,10 @@ namespace ZR.Model.System.Dto
/// 字典类型
/// </summary>
public string DictType { get; set; }
/// <summary>
/// 备注
/// </summary>
public string Remark { get; set; }
}
}

View File

@@ -72,38 +72,14 @@ namespace ZR.Model.System.Generate
/// <summary>
/// 其他生成选项
/// </summary>
public string Options { get; set; }
[SqlSugar.SugarColumn(IsJson = true)]
public Options Options { get; set; }
#region
/** 表列信息 */
[SqlSugar.SugarColumn(IsIgnore = true)]
public List<GenTableColumn> Columns { get; set; }
//以下 Options扩展字段
[SqlSugar.SugarColumn(IsIgnore = true)]
public object ParentMenuId { get; set; }
[SqlSugar.SugarColumn(IsIgnore = true)]
public object SortType { get; set; } = "asc";
[SqlSugar.SugarColumn(IsIgnore = true)]
public object SortField { get; set; } = string.Empty;
[SqlSugar.SugarColumn(IsIgnore = true)]
public object TreeCode { get; set; } = string.Empty;
[SqlSugar.SugarColumn(IsIgnore = true)]
public object TreeName { get; set; } = string.Empty;
[SqlSugar.SugarColumn(IsIgnore = true)]
public object TreeParentCode { get; set; }
[SqlSugar.SugarColumn(IsIgnore = true)]
public string PermissionPrefix { get; set; }
/// <summary>
/// 生成的按钮功能
/// </summary>
[SqlSugar.SugarColumn(IsIgnore = true)]
public int[] CheckedBtn { get; set; } = new int[] { 1, 2, 3 };
/// <summary>
/// 字表信息
/// </summary>
@@ -111,4 +87,23 @@ namespace ZR.Model.System.Generate
public GenTable SubTable { get; set; }
#endregion
}
public class Options
{
public long ParentMenuId { get; set; } = 0;
public string SortType { get; set; } = "asc";
public string SortField { get; set; } = string.Empty;
public string TreeCode { get; set; } = string.Empty;
public string TreeName { get; set; } = string.Empty;
public string TreeParentCode { get; set; } = string.Empty;
public string PermissionPrefix { get; set; }= string.Empty;
/// <summary>
/// 额外参数字符串
/// </summary>
public int[] CheckedBtn { get; set; } = new int[] { 1, 2, 3 };
/// <summary>
/// 列大小 12,24
/// </summary>
public int ColNum { get; set; } = 12;
}
}

View File

@@ -71,6 +71,10 @@ namespace ZR.Model.System.Generate
/// </summary>
public bool IsQuery { get; set; }
/// <summary>
/// 是否排序1是
/// </summary>
public bool IsSort { get; set; }
/// <summary>
/// 显示类型(文本框、文本域、下拉框、复选框、单选框、日期控件)
/// </summary>
public string HtmlType { get; set; }
@@ -95,15 +99,33 @@ namespace ZR.Model.System.Generate
}
}
/// <summary>
/// 前端排序字符串
/// </summary>
[SugarColumn(IsIgnore = true)]
public string SortStr
{
get
{
return IsSort ? " sortable" : "";
}
}
/// <summary>
/// C# 字段名 首字母小写,用于前端
/// </summary>
[SugarColumn(IsIgnore = true)]
public string CsharpFieldFl { get; set; }
/// <summary>
/// 字典集合
/// 前端 只读字段
/// </summary>
//[SqlSugar.SugarColumn(IsIgnore = true)]
//public List<SysDictData> DictDatas { get; set; }
[SugarColumn(IsIgnore = true)]
public string DisabledStr
{
get
{
return (((!IsInsert && !IsEdit) || IsPk) && !IsRequired) ? " :disabled=\"true\"" : "";
}
}
#endregion
}
}