Przeglądaj źródła

生成模板管理接口

lichunlei 5 miesięcy temu
rodzic
commit
b9ec373fbd

+ 108 - 0
Controllers/Admin/MakeTemplateController.cs

@@ -0,0 +1,108 @@
+using Vo;
+using Microsoft.AspNetCore.Mvc;
+using Model;
+using Services;
+using Model.Base;
+using Vo.Admin;
+using Mapster;
+using Infrastructure;
+
+
+namespace Controllers.Admin
+{
+    /// <summary>
+    /// MakeTemplate)Controller
+    /// </summary>
+    // [Route("${Router}$")]
+    // [ApiExplorerSettings(GroupName = "MakeTemplate")]
+    public class MakeTemplateController : BaseController
+    {
+        /// <summary>
+        /// api分组接口
+        /// </summary>
+        private readonly IMakeTemplateService _MakeTemplateService;
+
+
+        public MakeTemplateController(IMakeTemplateService MakeTemplateService)
+        {
+            _MakeTemplateService = MakeTemplateService;
+
+        }
+
+        /// <summary>
+        /// 列表
+        /// </summary>
+        /// <param name="page">分页对象</param>
+        /// <param name="param">参数请求体</param>
+        /// <returns>列表</returns>
+        [HttpGet]
+        [Route("/v1/omega_make/MakeTemplate/getMakeTemplateList")]
+        public IActionResult getMakeTemplateList([FromQuery] PagerInfo page, [FromQuery] MakeTemplate param)
+        {
+            var response = _MakeTemplateService.getMakeTemplateList(page, param);
+            return SUCCESS(response);
+        }
+
+
+        /// <summary>
+        /// 详情
+        /// </summary>
+        /// <param name="param">参数请求体</param>
+        /// <returns>详情</returns>
+        [HttpGet]
+        [Route("/v1/omega_make/MakeTemplate/getMakeTemplateQuery")]
+        public IActionResult getMakeTemplateQuery([FromQuery] MakeTemplate param)
+        {
+            var response = _MakeTemplateService.GetFirst(m => m.id == param.id).Adapt<GetMakeTemplateQueryVo>();
+            return SUCCESS(response);
+        }
+
+
+        /// <summary>
+        /// 添加
+        /// </summary>
+        /// <param name="param">参数请求体</param>
+        /// <returns>添加</returns>
+        [HttpPost]
+        [Route("/v1/omega_make/MakeTemplate/addMakeTemplate")]
+        public IActionResult addMakeTemplate([FromBody] MakeTemplate param)
+        {
+            var modal = param.Adapt<MakeTemplate>().ToCreate(HttpContext);
+            var response = _MakeTemplateService.InsertReturnIdentity(modal);
+            return SUCCESS(response);
+        }
+
+
+        /// <summary>
+        /// 修改
+        /// </summary>
+        /// <param name="param">参数请求体</param>
+        /// <returns>修改</returns>
+        [HttpPut]
+        [Route("/v1/omega_make/MakeTemplate/updateMakeTemplate")]
+        public IActionResult updateMakeTemplate([FromBody] MakeTemplate param)
+        {
+            var modal = param.Adapt<MakeTemplate>().ToCreate(HttpContext);
+            var response = _MakeTemplateService.Update(modal, true);
+            return SUCCESS(response);
+        }
+
+
+        /// <summary>
+        /// 删除
+        /// </summary>
+        /// <param name="id">ID</param>
+        /// <returns>删除</returns>
+        [HttpDelete]
+        [Route("/v1/omega_make/MakeTemplate/deleteMakeTemplate/{id}")]
+        public IActionResult deleteMakeTemplate(int id)
+        {
+            var response = _MakeTemplateService.Delete(id);
+            return SUCCESS(response);
+        }
+
+
+
+
+    }
+}

+ 105 - 0
Controllers/Admin/MakeTemplateGategoryController.cs

@@ -0,0 +1,105 @@
+using Vo;
+using Microsoft.AspNetCore.Mvc;
+using Model;
+using Services;
+using Model.Base;
+using Vo.Admin;
+using Mapster;
+using Infrastructure;
+
+
+namespace Controllers.Admin
+{
+    /// <summary>
+    /// MakeTemplateGategory)Controller
+    /// </summary>
+    // [Route("${Router}$")]
+    // [ApiExplorerSettings(GroupName = "MakeTemplateGategory")]
+    public class MakeTemplateGategoryController : BaseController
+    {
+        private readonly IMakeTemplateGategoryService _MakeTemplateGategoryService;
+
+
+        public MakeTemplateGategoryController(IMakeTemplateGategoryService MakeTemplateGategoryService)
+        {
+            _MakeTemplateGategoryService = MakeTemplateGategoryService;
+
+        }
+
+        /// <summary>
+        /// 列表
+        /// </summary>
+        /// <param name="page">分页对象</param>
+        /// <param name="param">参数请求体</param>
+        /// <returns>列表</returns>
+        [HttpGet]
+        [Route("/v1/omega_make/MakeTemplateGategory/getMakeTemplateGategoryList")]
+        public IActionResult getMakeTemplateGategoryList()
+        {
+            var response = _MakeTemplateGategoryService.getMakeTemplateGategoryList();
+            return SUCCESS(response);
+        }
+
+
+        /// <summary>
+        /// 详情
+        /// </summary>
+        /// <param name="param">参数请求体</param>
+        /// <returns>详情</returns>
+        [HttpGet]
+        [Route("/v1/omega_make/MakeTemplateGategory/getMakeTemplateGategoryQuery")]
+        public IActionResult getMakeTemplateGategoryQuery([FromQuery] MakeTemplateGategory param)
+        {
+            var response = _MakeTemplateGategoryService.GetFirst(m => m.id == param.id).Adapt<GetMakeTemplateGategoryQueryVo>();
+            return SUCCESS(response);
+        }
+
+
+        /// <summary>
+        /// 添加
+        /// </summary>
+        /// <param name="param">参数请求体</param>
+        /// <returns>添加</returns>
+        [HttpPost]
+        [Route("/v1/omega_make/MakeTemplateGategory/addMakeTemplateGategory")]
+        public IActionResult addMakeTemplateGategory([FromBody] MakeTemplateGategory param)
+        {
+            var modal = param.Adapt<MakeTemplateGategory>().ToCreate(HttpContext);
+            var response = _MakeTemplateGategoryService.InsertReturnIdentity(modal);
+            return SUCCESS(response);
+        }
+
+
+        /// <summary>
+        /// 修改
+        /// </summary>
+        /// <param name="param">参数请求体</param>
+        /// <returns>修改</returns>
+        [HttpPut]
+        [Route("/v1/omega_make/MakeTemplateGategory/updateMakeTemplateGategory")]
+        public IActionResult updateMakeTemplateGategory([FromBody] MakeTemplateGategory param)
+        {
+            var modal = param.Adapt<MakeTemplateGategory>().ToCreate(HttpContext);
+            var response = _MakeTemplateGategoryService.Update(modal, true);
+            return SUCCESS(response);
+        }
+
+
+        /// <summary>
+        /// 删除
+        /// </summary>
+        /// <param name="id">ID</param>
+        /// <returns>删除</returns>
+        [HttpDelete]
+        [Route("/v1/omega_make/MakeTemplateGategory/deleteMakeTemplateGategory/{id}")]
+        public IActionResult deleteMakeTemplateGategory(int id)
+        {
+            var response = _MakeTemplateGategoryService.Delete(id);
+            return SUCCESS(response);
+        }
+
+
+
+
+    }
+}

+ 92 - 0
Model/Database/MakeTemplate.cs

@@ -0,0 +1,92 @@
+using Mapster;
+
+
+namespace Model
+{
+    /// <summary>
+    /// 生成模板 make_template
+    /// </summary>
+    [SugarTable("make_template", "生成模板")]
+    [Tenant("0")]
+    public class MakeTemplate
+    {
+        /// <summary>
+        /// ID
+        /// </summary>
+        [SugarColumn(ColumnDescription = "ID", IsPrimaryKey = true, IsIdentity = true, ColumnName = "id")]
+        public int id { get; set; }
+
+
+        /// <summary>
+        /// 版本号
+        /// </summary>
+        [SugarColumn(ColumnDescription = "版本号", ColumnName = "version")]
+        public int version { get; set; }
+
+
+        /// <summary>
+        /// 删除标记
+        /// </summary>
+        [SugarColumn(ColumnDescription = "删除标记", ColumnName = "del_flag")]
+        public int delFlag { get; set; }
+
+
+        /// <summary>
+        /// 创建时间
+        /// </summary>
+        [SugarColumn(ColumnDescription = "创建时间", ColumnName = "create_time")]
+        public DateTime? createTime { get; set; }
+
+
+        /// <summary>
+        /// 更新时间
+        /// </summary>
+        [SugarColumn(ColumnDescription = "更新时间", ColumnName = "update_time")]
+        public DateTime? updateTime { get; set; }
+
+
+        /// <summary>
+        /// 创建人
+        /// </summary>
+        [SugarColumn(ColumnDescription = "创建人", Length = 32, ColumnName = "create_by")]
+        public string? createBy { get; set; }
+
+
+        /// <summary>
+        /// 更新人
+        /// </summary>
+        [SugarColumn(ColumnDescription = "更新人", Length = 32, ColumnName = "update_by")]
+        public string? updateBy { get; set; }
+
+
+        /// <summary>
+        /// 分类ID
+        /// </summary>
+        [SugarColumn(ColumnDescription = "分类ID", ColumnName = "gategory_id")]
+        public int gategoryId { get; set; }
+
+
+        /// <summary>
+        /// 模板名称
+        /// </summary>
+        [SugarColumn(ColumnDescription = "模板名称", Length = 50, ColumnName = "template_name")]
+        public string? templateName { get; set; }
+
+
+        /// <summary>
+        /// 模板介绍
+        /// </summary>
+        [SugarColumn(ColumnDescription = "模板介绍", Length = 255, ColumnName = "template_detail")]
+        public string? templateDetail { get; set; }
+
+
+        /// <summary>
+        /// 模板内容
+        /// </summary>
+        [SugarColumn(ColumnDescription = "模板内容", ColumnName = "template_content")]
+        public string? templateContent { get; set; }
+
+
+
+    }
+}

+ 85 - 0
Model/Database/MakeTemplateGategory.cs

@@ -0,0 +1,85 @@
+using Mapster;
+
+
+namespace Model
+{
+    /// <summary>
+    /// 生成模板分类 make_template_gategory
+    /// </summary>
+    [SugarTable("make_template_gategory", "生成模板分类")]
+    [Tenant("0")]
+    public class MakeTemplateGategory
+    {
+        /// <summary>
+        /// ID
+        /// </summary>
+        [SugarColumn(ColumnDescription = "ID", IsPrimaryKey = true, IsIdentity = true, ColumnName = "id")]
+        public int id { get; set; }
+
+
+        /// <summary>
+        /// 版本号
+        /// </summary>
+        [SugarColumn(ColumnDescription = "版本号", ColumnName = "version")]
+        public int version { get; set; }
+
+
+        /// <summary>
+        /// 删除标记
+        /// </summary>
+        [SugarColumn(ColumnDescription = "删除标记", ColumnName = "del_flag")]
+        public int delFlag { get; set; }
+
+
+        /// <summary>
+        /// 创建时间
+        /// </summary>
+        [SugarColumn(ColumnDescription = "创建时间", ColumnName = "create_time")]
+        public DateTime? createTime { get; set; }
+
+
+        /// <summary>
+        /// 更新时间
+        /// </summary>
+        [SugarColumn(ColumnDescription = "更新时间", ColumnName = "update_time")]
+        public DateTime? updateTime { get; set; }
+
+
+        /// <summary>
+        /// 创建人
+        /// </summary>
+        [SugarColumn(ColumnDescription = "创建人", Length = 32, ColumnName = "create_by")]
+        public string? createBy { get; set; }
+
+
+        /// <summary>
+        /// 更新人
+        /// </summary>
+        [SugarColumn(ColumnDescription = "更新人", Length = 32, ColumnName = "update_by")]
+        public string? updateBy { get; set; }
+
+
+        /// <summary>
+        /// 分类名称
+        /// </summary>
+        [SugarColumn(ColumnDescription = "分类名称", Length = 50, ColumnName = "gategory_name")]
+        public string? gategoryName { get; set; }
+
+
+        /// <summary>
+        /// 父级ID
+        /// </summary>
+        [SugarColumn(ColumnDescription = "父级ID", ColumnName = "parent_id")]
+        public int parentId { get; set; }
+
+
+        /// <summary>
+        /// 分类介绍
+        /// </summary>
+        [SugarColumn(ColumnDescription = "分类介绍", Length = 255, ColumnName = "gategory_detail")]
+        public string? gategoryDetail { get; set; }
+
+
+
+    }
+}

+ 36 - 0
Model/Vo/Admin/GetMakeTemplateGategoryListVo.cs

@@ -0,0 +1,36 @@
+using Newtonsoft.Json;
+
+namespace Vo.Admin
+{
+    /// <summary>
+    /// 列表
+    /// </summary>
+    public class GetMakeTemplateGategoryListVo
+    {
+        /// <summary>
+        /// ID
+        /// </summary>
+        public int id { get; set; }
+
+
+        /// <summary>
+        /// 分类名称
+        /// </summary>
+        public string gategoryName { get; set; }
+
+
+        /// <summary>
+        /// 分类介绍
+        /// </summary>
+        public string gategoryDetail { get; set; }
+
+
+        /// <summary>
+        /// 子集
+        /// </summary>
+        public List<GetMakeTemplateGategoryListVo> children { get; set; }
+
+
+
+    }
+}

+ 30 - 0
Model/Vo/Admin/GetMakeTemplateGategoryQueryVo.cs

@@ -0,0 +1,30 @@
+using Newtonsoft.Json;
+
+namespace Vo.Admin
+{
+    /// <summary>
+    /// 详情
+    /// </summary>
+    public class GetMakeTemplateGategoryQueryVo
+    {
+        /// <summary>
+        /// ID
+        /// </summary>
+        public int id { get; set; }
+
+
+        /// <summary>
+        /// 分类名称
+        /// </summary>
+        public string gategoryName { get; set; }
+
+
+        /// <summary>
+        /// 父级ID
+        /// </summary>
+        public int parentId { get; set; }
+
+
+
+    }
+}

+ 30 - 0
Model/Vo/Admin/GetMakeTemplateListVo.cs

@@ -0,0 +1,30 @@
+using Newtonsoft.Json;
+
+namespace Vo.Admin
+{
+    /// <summary>
+    /// 列表
+    /// </summary>
+    public class GetMakeTemplateListVo
+    {
+        /// <summary>
+        /// ID
+        /// </summary>
+        public int id { get; set; }
+
+
+        /// <summary>
+        /// 分类ID
+        /// </summary>
+        public int gategoryId { get; set; }
+
+
+        /// <summary>
+        /// 模板名称
+        /// </summary>
+        public string templateName { get; set; }
+
+
+
+    }
+}

+ 42 - 0
Model/Vo/Admin/GetMakeTemplateQueryVo.cs

@@ -0,0 +1,42 @@
+using Newtonsoft.Json;
+
+namespace Vo.Admin
+{
+    /// <summary>
+    /// 详情
+    /// </summary>
+    public class GetMakeTemplateQueryVo
+    {
+        /// <summary>
+        /// ID
+        /// </summary>
+        public int id { get; set; }
+
+
+        /// <summary>
+        /// 分类ID
+        /// </summary>
+        public int gategoryId { get; set; }
+
+
+        /// <summary>
+        /// 模板名称
+        /// </summary>
+        public string templateName { get; set; }
+
+
+        /// <summary>
+        /// 模板介绍
+        /// </summary>
+        public string templateDetail { get; set; }
+
+
+        /// <summary>
+        /// 模板内容
+        /// </summary>
+        public string templateContent { get; set; }
+
+
+
+    }
+}

+ 22 - 0
Services/IService/IMakeTemplateGategoryService.cs

@@ -0,0 +1,22 @@
+using Model;
+using Model.Base;
+using Microsoft.AspNetCore.Mvc;
+using Vo.Admin;
+
+
+namespace Services
+{
+    public interface IMakeTemplateGategoryService : IBaseService<MakeTemplateGategory>
+    {
+        /// <summary>
+        /// 生成模板分类-列表
+        /// </summary>
+        /// <param name="param">参数请求体</param>
+        /// <param name="page">分页参数</param>
+        /// <returns>列表</returns>
+        List<GetMakeTemplateGategoryListVo> getMakeTemplateGategoryList(int parentId = 0);
+
+
+
+    }
+}

+ 22 - 0
Services/IService/IMakeTemplateService.cs

@@ -0,0 +1,22 @@
+using Model;
+using Model.Base;
+using Microsoft.AspNetCore.Mvc;
+using Vo.Admin;
+
+
+namespace Services
+{
+    public interface IMakeTemplateService : IBaseService<MakeTemplate>
+    {
+        /// <summary>
+        /// 生成模板-列表
+        /// </summary>
+        /// <param name="param">参数请求体</param>
+        /// <param name="page">分页参数</param>
+        /// <returns>列表</returns>
+        PagedInfo<GetMakeTemplateListVo> getMakeTemplateList([FromQuery] PagerInfo page, [FromQuery] MakeTemplate param);
+
+
+
+    }
+}

+ 44 - 0
Services/MakeTemplateGategoryService.cs

@@ -0,0 +1,44 @@
+using Attribute;
+using Model;
+using Model.Base;
+using Repository;
+using Service;
+using Microsoft.AspNetCore.Mvc;
+using Vo.Admin;
+using Mapster;
+
+
+namespace Services
+{
+    /// <summary>
+    /// 生成模板分类Service业务层处理
+    /// </summary>
+    [AppService(ServiceType = typeof(IMakeTemplateGategoryService), ServiceLifetime = LifeTime.Transient)]
+    public class MakeTemplateGategoryService : BaseService<MakeTemplateGategory>, IMakeTemplateGategoryService
+    {
+        /// <summary>
+        /// 生成模板分类-列表
+        /// </summary>
+        /// <param name="param">参数请求体</param>
+        /// <param name="page">分页参数</param>
+        /// <returns>列表</returns>
+        public List<GetMakeTemplateGategoryListVo> getMakeTemplateGategoryList(int parentId = 0)
+        {
+            //拼装查询条件
+            var predicate = Expressionable.Create<MakeTemplateGategory>();
+            predicate = predicate.And(m => m.parentId == parentId);
+            var response = Queryable()
+                .Where(predicate.ToExpression())
+                .OrderByDescending(m => m.id)
+                .ToList().Adapt<List<GetMakeTemplateGategoryListVo>>();
+            foreach(var sub in response)
+            {
+                sub.children = getMakeTemplateGategoryList(sub.id);
+            }
+            return response;
+        }
+
+
+
+    }
+}

+ 40 - 0
Services/MakeTemplateService.cs

@@ -0,0 +1,40 @@
+using Attribute;
+using Model;
+using Model.Base;
+using Repository;
+using Service;
+using Microsoft.AspNetCore.Mvc;
+using Vo.Admin;
+
+
+namespace Services
+{
+    /// <summary>
+    /// 生成模板Service业务层处理
+    /// </summary>
+    [AppService(ServiceType = typeof(IMakeTemplateService), ServiceLifetime = LifeTime.Transient)]
+    public class MakeTemplateService : BaseService<MakeTemplate>, IMakeTemplateService
+    {
+        /// <summary>
+        /// 生成模板-列表
+        /// </summary>
+        /// <param name="param">参数请求体</param>
+        /// <param name="page">分页参数</param>
+        /// <returns>列表</returns>
+        public PagedInfo<GetMakeTemplateListVo> getMakeTemplateList([FromQuery] PagerInfo page, [FromQuery] MakeTemplate param)
+        {
+            //拼装查询条件
+            var predicate = Expressionable.Create<MakeTemplate>();
+            predicate = predicate.AndIF(param.gategoryId > 0, m => m.gategoryId == param.gategoryId);
+            predicate = predicate.AndIF(!string.IsNullOrEmpty(param.templateName), m => m.templateName.Contains(param.templateName));
+            var response = Queryable()
+                .Where(predicate.ToExpression())
+                .OrderByDescending(m => m.id)
+                .ToPage<MakeTemplate, GetMakeTemplateListVo>(page);
+            return response;
+        }
+
+
+
+    }
+}