From b83311c14efa84cdb11221e7ebb1749bb9eb236a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E4=B8=8D=E5=81=9A=E7=A0=81=E5=86=9C?= <599854767@qq.com>
Date: Tue, 6 Dec 2022 14:49:30 +0800
Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E6=AD=A5master=E5=88=86=E6=94=AF?=
=?UTF-8?q?=E5=B7=AE=E5=BC=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Controllers/Business/GendemoController.cs | 167 ------------------
.../System/CodeGeneratorController.cs | 4 +-
.../Controllers/System/SysConfigController.cs | 14 +-
.../System/SysDictTypeController.cs | 13 +-
.../Controllers/System/SysNoticeController.cs | 4 +-
ZR.Model/Dto/Business/GendemoDto.cs | 40 -----
ZR.Model/Models/Business/Gendemo.cs | 103 -----------
ZR.Repository/ZR.Repository.csproj | 10 +-
ZR.Service/Business/GendemoService.cs | 49 -----
.../IBusinessService/IGendemoService.cs | 20 ---
ZR.Service/ZR.Service.csproj | 5 -
11 files changed, 26 insertions(+), 403 deletions(-)
delete mode 100644 ZR.Admin.WebApi/Controllers/Business/GendemoController.cs
delete mode 100644 ZR.Model/Dto/Business/GendemoDto.cs
delete mode 100644 ZR.Model/Models/Business/Gendemo.cs
delete mode 100644 ZR.Service/Business/GendemoService.cs
delete mode 100644 ZR.Service/Business/IBusinessService/IGendemoService.cs
diff --git a/ZR.Admin.WebApi/Controllers/Business/GendemoController.cs b/ZR.Admin.WebApi/Controllers/Business/GendemoController.cs
deleted file mode 100644
index eafcbb51..00000000
--- a/ZR.Admin.WebApi/Controllers/Business/GendemoController.cs
+++ /dev/null
@@ -1,167 +0,0 @@
-using Microsoft.AspNetCore.Mvc;
-using System;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-using Infrastructure;
-using Infrastructure.Attribute;
-using Infrastructure.Enums;
-using Infrastructure.Model;
-using Mapster;
-using ZR.Model.Dto;
-using ZR.Model.Models;
-using ZR.Service.Business.IBusinessService;
-using ZR.Admin.WebApi.Extensions;
-using ZR.Admin.WebApi.Filters;
-using ZR.Common;
-using Infrastructure.Extensions;
-using System.Linq;
-
-namespace ZR.Admin.WebApi.Controllers
-{
- ///
- /// 演示Controller
- ///
- /// @author zz
- /// @date 2022-03-31
- ///
- [Verify]
- [Route("business/GenDemo")]
- public class GenDemoController : BaseController
- {
- ///
- /// 演示接口
- ///
- private readonly IGenDemoService _GenDemoService;
-
- public GenDemoController(IGenDemoService GenDemoService)
- {
- _GenDemoService = GenDemoService;
- }
-
- ///
- /// 查询演示列表
- ///
- ///
- ///
- [HttpGet("list")]
- [ActionPermissionFilter(Permission = "business:gendemo:list")]
- public IActionResult QueryGenDemo([FromQuery] GenDemoQueryDto parm)
- {
- var response = _GenDemoService.GetList(parm);
- return SUCCESS(response);
- }
-
-
- ///
- /// 查询演示详情
- ///
- ///
- ///
- [HttpGet("{Id}")]
- [ActionPermissionFilter(Permission = "business:gendemo:query")]
- public IActionResult GetGenDemo(int Id)
- {
- var response = _GenDemoService.GetFirst(x => x.Id == Id);
-
- return SUCCESS(response);
- }
-
- ///
- /// 添加演示
- ///
- ///
- [HttpPost]
- [ActionPermissionFilter(Permission = "business:gendemo:add")]
- [Log(Title = "演示", BusinessType = BusinessType.INSERT)]
- public IActionResult AddGenDemo([FromBody] GenDemoDto parm)
- {
- if (parm == null)
- {
- throw new CustomException("请求参数错误");
- }
- //从 Dto 映射到 实体
- var modal = parm.Adapt().ToCreate(HttpContext);
-
- var response = _GenDemoService.Insert(modal, it => new
- {
- it.Name,
- it.Icon,
- it.ShowStatus,
- it.Sex,
- it.Sort,
- it.Remark,
- it.BeginTime,
- it.EndTime,
- it.Feature,
- });
- return ToResponse(response);
- }
-
- ///
- /// 更新演示
- ///
- ///
- [HttpPut]
- [ActionPermissionFilter(Permission = "business:gendemo:edit")]
- [Log(Title = "演示", BusinessType = BusinessType.UPDATE)]
- public IActionResult UpdateGenDemo([FromBody] GenDemoDto parm)
- {
- if (parm == null)
- {
- throw new CustomException("请求实体不能为空");
- }
- //从 Dto 映射到 实体
- var modal = parm.Adapt().ToUpdate(HttpContext);
-
- var response = _GenDemoService.Update(w => w.Id == modal.Id, it => new GenDemo()
- {
- //Update 字段映射
- Name = modal.Name,
- Icon = modal.Icon,
- ShowStatus = modal.ShowStatus,
- Sex = modal.Sex,
- Sort = modal.Sort,
- Remark = modal.Remark,
- BeginTime = modal.BeginTime,
- EndTime = modal.EndTime,
- Feature = modal.Feature,
- });
-
- return ToResponse(response);
- }
-
- ///
- /// 删除演示
- ///
- ///
- [HttpDelete("{ids}")]
- [ActionPermissionFilter(Permission = "business:gendemo:delete")]
- [Log(Title = "演示", BusinessType = BusinessType.DELETE)]
- public IActionResult DeleteGenDemo(string ids)
- {
- int[] idsArr = Tools.SpitIntArrary(ids);
- if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
-
- var response = _GenDemoService.Delete(idsArr);
-
- return ToResponse(response);
- }
-
- ///
- /// 导出演示
- ///
- ///
- [Log(Title = "演示", BusinessType = BusinessType.EXPORT, IsSaveResponseData = false)]
- [HttpGet("export")]
- [ActionPermissionFilter(Permission = "business:gendemo:export")]
- public IActionResult Export([FromQuery] GenDemoQueryDto parm)
- {
- parm.PageSize = 10000;
- var list = _GenDemoService.GetList(parm).Result;
-
- string sFileName = ExportExcel(list, "GenDemo", "演示");
- return SUCCESS(new { path = "/export/" + sFileName, fileName = sFileName });
- }
-
- }
-}
\ No newline at end of file
diff --git a/ZR.Admin.WebApi/Controllers/System/CodeGeneratorController.cs b/ZR.Admin.WebApi/Controllers/System/CodeGeneratorController.cs
index ef1ff3d5..37eb242d 100644
--- a/ZR.Admin.WebApi/Controllers/System/CodeGeneratorController.cs
+++ b/ZR.Admin.WebApi/Controllers/System/CodeGeneratorController.cs
@@ -269,9 +269,9 @@ namespace ZR.Admin.WebApi.Controllers
dto.GenTable = genTableInfo;
//自定义路径
if (genTableInfo.GenType == "1")
- {
+ {
string tempPath = WebHostEnvironment.ContentRootPath;
- var parentPath = Directory.GetParent(tempPath)?.Parent?.FullName;
+ var parentPath = tempPath[..tempPath.LastIndexOf(@"\")];
//代码生成文件夹路径
dto.GenCodePath = genTableInfo.GenPath.IsEmpty() ? parentPath : genTableInfo.GenPath;
}
diff --git a/ZR.Admin.WebApi/Controllers/System/SysConfigController.cs b/ZR.Admin.WebApi/Controllers/System/SysConfigController.cs
index 92370965..b50c99ab 100644
--- a/ZR.Admin.WebApi/Controllers/System/SysConfigController.cs
+++ b/ZR.Admin.WebApi/Controllers/System/SysConfigController.cs
@@ -44,11 +44,11 @@ namespace ZR.Admin.WebApi.Controllers
{
var predicate = Expressionable.Create();
- predicate = predicate.AndIF(!parm.ConfigType.IsEmpty(),m => m.ConfigType == parm.ConfigType);
- predicate = predicate.AndIF(!parm.ConfigName.IsEmpty(),m => m.ConfigName.Contains(parm.ConfigType));
- predicate = predicate.AndIF(!parm.ConfigKey.IsEmpty(),m => m.ConfigKey.Contains(parm.ConfigKey));
- predicate = predicate.AndIF(!parm.BeginTime.IsEmpty(),m => m.Create_time >= parm.BeginTime );
- predicate = predicate.AndIF(!parm.BeginTime.IsEmpty(),m => m.Create_time <= parm.EndTime);
+ predicate = predicate.AndIF(!parm.ConfigType.IsEmpty(), m => m.ConfigType == parm.ConfigType);
+ predicate = predicate.AndIF(!parm.ConfigName.IsEmpty(), m => m.ConfigName.Contains(parm.ConfigType));
+ predicate = predicate.AndIF(!parm.ConfigKey.IsEmpty(), m => m.ConfigKey.Contains(parm.ConfigKey));
+ predicate = predicate.AndIF(!parm.BeginTime.IsEmpty(), m => m.Create_time >= parm.BeginTime);
+ predicate = predicate.AndIF(!parm.BeginTime.IsEmpty(), m => m.Create_time <= parm.EndTime);
var response = _SysConfigService.GetPages(predicate.ToExpression(), parm);
@@ -78,11 +78,11 @@ namespace ZR.Admin.WebApi.Controllers
[AllowAnonymous]
public IActionResult GetConfigKey(string configKey)
{
- var response = _SysConfigService.Queryable().First(f=> f.ConfigKey == configKey);
+ var response = _SysConfigService.Queryable().First(f => f.ConfigKey == configKey);
return SUCCESS(response?.ConfigValue);
}
-
+
///
/// 添加参数配置
///
diff --git a/ZR.Admin.WebApi/Controllers/System/SysDictTypeController.cs b/ZR.Admin.WebApi/Controllers/System/SysDictTypeController.cs
index 3a0e94a9..f70cb3cd 100644
--- a/ZR.Admin.WebApi/Controllers/System/SysDictTypeController.cs
+++ b/ZR.Admin.WebApi/Controllers/System/SysDictTypeController.cs
@@ -1,12 +1,15 @@
using Infrastructure.Attribute;
using Infrastructure.Enums;
using Infrastructure.Model;
+using Mapster;
using Microsoft.AspNetCore.Mvc;
+using System;
using ZR.Admin.WebApi.Extensions;
using ZR.Admin.WebApi.Filters;
using ZR.Common;
using ZR.Model;
using ZR.Model.System;
+using ZR.Model.System.Dto;
using ZR.Service.System.IService;
namespace ZR.Admin.WebApi.Controllers.System
@@ -55,13 +58,14 @@ namespace ZR.Admin.WebApi.Controllers.System
///
/// 添加字典类型
///
- ///
+ ///
///
[ActionPermissionFilter(Permission = "system:dict:add")]
[Log(Title = "字典操作", BusinessType = BusinessType.INSERT)]
[HttpPost("edit")]
- public IActionResult Add([FromBody] SysDictType dict)
+ public IActionResult Add([FromBody] SysDictTypeDto dto)
{
+ SysDictType dict = dto.Adapt();
if (UserConstants.NOT_UNIQUE.Equals(SysDictService.CheckDictTypeUnique(dict)))
{
return ToResponse(ApiResult.Error($"新增字典'{dict.DictName}'失败,字典类型已存在"));
@@ -74,14 +78,15 @@ namespace ZR.Admin.WebApi.Controllers.System
///
/// 修改字典类型
///
- ///
+ ///
///
[ActionPermissionFilter(Permission = "system:dict:edit")]
[Log(Title = "字典操作", BusinessType = BusinessType.UPDATE)]
[Route("edit")]
[HttpPut]
- public IActionResult Edit([FromBody] SysDictType dict)
+ public IActionResult Edit([FromBody] SysDictTypeDto dto)
{
+ SysDictType dict = dto.Adapt();
if (UserConstants.NOT_UNIQUE.Equals(SysDictService.CheckDictTypeUnique(dict)))
{
return ToResponse(ApiResult.Error($"修改字典'{dict.DictName}'失败,字典类型已存在"));
diff --git a/ZR.Admin.WebApi/Controllers/System/SysNoticeController.cs b/ZR.Admin.WebApi/Controllers/System/SysNoticeController.cs
index 98f89478..8b7d251c 100644
--- a/ZR.Admin.WebApi/Controllers/System/SysNoticeController.cs
+++ b/ZR.Admin.WebApi/Controllers/System/SysNoticeController.cs
@@ -62,7 +62,7 @@ namespace ZR.Admin.WebApi.Controllers.System
predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.NoticeTitle), m => m.NoticeTitle.Contains(parm.NoticeTitle));
predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.NoticeType), m => m.NoticeType == parm.NoticeType);
- predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.CreateBy), m => m.Create_by.Contains(parm.CreateBy) || m.Update_by.Contains(parm.CreateBy));
+ predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.CreateBy), m => m.Create_by.Contains(parm.CreateBy) || m.Update_by.Contains(parm.CreateBy));
predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.Status), m => m.Status == parm.Status);
var response = _SysNoticeService.GetPages(predicate.ToExpression(), parm);
return SUCCESS(response);
@@ -110,7 +110,7 @@ namespace ZR.Admin.WebApi.Controllers.System
it.Create_by,
it.Create_time
});
-
+
return SUCCESS(result);
}
diff --git a/ZR.Model/Dto/Business/GendemoDto.cs b/ZR.Model/Dto/Business/GendemoDto.cs
deleted file mode 100644
index 0276c459..00000000
--- a/ZR.Model/Dto/Business/GendemoDto.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using ZR.Model.Dto;
-using ZR.Model.Models;
-
-namespace ZR.Model.Dto
-{
- ///
- /// 演示输入对象
- ///
- public class GenDemoDto
- {
- [Required(ErrorMessage = "id不能为空")]
- public int Id { get; set; }
- [Required(ErrorMessage = "名称不能为空")]
- public string Name { get; set; }
- public string Icon { get; set; }
- [Required(ErrorMessage = "显示状态不能为空")]
- public int ShowStatus { get; set; }
- public int? Sex { get; set; }
- public int? Sort { get; set; }
- public string Remark { get; set; }
- public DateTime? BeginTime { get; set; }
- public DateTime? EndTime { get; set; }
- public string Feature { get; set; }
- }
-
- ///
- /// 演示查询对象
- ///
- public class GenDemoQueryDto : PagerInfo
- {
- public int? Id { get; set; }
- public string Name { get; set; }
- public int? ShowStatus { get; set; }
- public DateTime? BeginAddTime { get; set; }
- public DateTime? EndAddTime { get; set; }
- }
-}
diff --git a/ZR.Model/Models/Business/Gendemo.cs b/ZR.Model/Models/Business/Gendemo.cs
deleted file mode 100644
index ae8a9132..00000000
--- a/ZR.Model/Models/Business/Gendemo.cs
+++ /dev/null
@@ -1,103 +0,0 @@
-using System;
-using System.Collections.Generic;
-using SqlSugar;
-using OfficeOpenXml.Attributes;
-
-namespace ZR.Model.Models
-{
- ///
- /// 演示,数据实体对象
- ///
- /// @author zz
- /// @date 2022-03-31
- ///
- [SugarTable("gen_demo")]
- public class GenDemo
- {
- ///
- /// 描述 : id
- /// 空值 : false
- ///
- [EpplusTableColumn(Header = "id")]
- [SqlSugar.SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
- public int Id { get; set; }
-
- ///
- /// 描述 : 名称
- /// 空值 : false
- ///
- [EpplusTableColumn(Header = "名称")]
- public string Name { get; set; }
-
- ///
- /// 描述 : 图片
- /// 空值 : true
- ///
- [EpplusTableColumn(Header = "图片")]
- public string Icon { get; set; }
-
- ///
- /// 描述 : 显示状态
- /// 空值 : false
- ///
- [EpplusTableColumn(Header = "显示状态")]
- public int ShowStatus { get; set; }
-
- ///
- /// 描述 : 添加时间
- /// 空值 : true
- ///
- [EpplusTableColumn(Header = "添加时间", NumberFormat = "yyyy-MM-dd HH:mm:ss")]
- public DateTime? AddTime { get; set; }
-
- ///
- /// 描述 : 用户性别
- /// 空值 : true
- ///
- [EpplusTableColumn(Header = "用户性别")]
- public int? Sex { get; set; }
-
- ///
- /// 描述 : 排序
- /// 空值 : true
- ///
- [EpplusTableColumn(Header = "排序")]
- public int? Sort { get; set; }
-
- ///
- /// 描述 : 备注
- /// 空值 : true
- ///
- [EpplusTableColumn(Header = "备注")]
- public string Remark { get; set; }
-
- ///
- /// 描述 : 开始时间
- /// 空值 : true
- ///
- [EpplusTableColumn(Header = "开始时间", NumberFormat = "yyyy-MM-dd HH:mm:ss")]
- public DateTime? BeginTime { get; set; }
-
- ///
- /// 描述 : 结束时间
- /// 空值 : true
- ///
- [EpplusTableColumn(Header = "结束时间", NumberFormat = "yyyy-MM-dd HH:mm:ss")]
- public DateTime? EndTime { get; set; }
-
- ///
- /// 描述 : 特征
- /// 空值 : true
- ///
- [EpplusTableColumn(Header = "特征")]
- public string Feature { get; set; }
-
- ///
- /// 描述 : 父级id
- /// 空值 : true
- ///
- [EpplusTableColumn(Header = "父级id")]
- public int? ParentId { get; set; }
-
- }
-}
\ No newline at end of file
diff --git a/ZR.Repository/ZR.Repository.csproj b/ZR.Repository/ZR.Repository.csproj
index 2d93f250..5900cca2 100644
--- a/ZR.Repository/ZR.Repository.csproj
+++ b/ZR.Repository/ZR.Repository.csproj
@@ -4,6 +4,12 @@
net7.0
+
+
+
+
+
+
@@ -17,8 +23,4 @@
-
-
-
-
diff --git a/ZR.Service/Business/GendemoService.cs b/ZR.Service/Business/GendemoService.cs
deleted file mode 100644
index d733707d..00000000
--- a/ZR.Service/Business/GendemoService.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-using Infrastructure;
-using Infrastructure.Attribute;
-using ZR.Model;
-using ZR.Model.Dto;
-using ZR.Model.Models;
-using ZR.Repository;
-using ZR.Service.Business.IBusinessService;
-using System;
-using SqlSugar;
-using System.Collections.Generic;
-
-namespace ZR.Service.Business
-{
- ///
- /// 演示Service业务层处理
- ///
- /// @author zz
- /// @date 2022-03-31
- ///
- [AppService(ServiceType = typeof(IGenDemoService), ServiceLifetime = LifeTime.Transient)]
- public class GenDemoService : BaseService, IGenDemoService
- {
- #region 业务逻辑代码
-
- ///
- /// 查询演示列表
- ///
- ///
- ///
- public PagedInfo GetList(GenDemoQueryDto parm)
- {
- //开始拼装查询条件
- var predicate = Expressionable.Create();
-
- //搜索条件查询语法参考Sqlsugar
- predicate = predicate.AndIF(parm.Id != null, it => it.Id == parm.Id);
- predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.Name), it => it.Name == parm.Name);
- predicate = predicate.AndIF(parm.ShowStatus != null, it => it.ShowStatus == parm.ShowStatus);
- predicate = predicate.AndIF(parm.BeginAddTime == null, it => it.AddTime >= DateTime.Now.AddDays(-1));
- predicate = predicate.AndIF(parm.BeginAddTime != null, it => it.AddTime >= parm.BeginAddTime && it.AddTime <= parm.EndAddTime);
- var response = Queryable()
- .Where(predicate.ToExpression())
- .ToPage(parm);
- return response;
- }
-
- #endregion
- }
-}
\ No newline at end of file
diff --git a/ZR.Service/Business/IBusinessService/IGendemoService.cs b/ZR.Service/Business/IBusinessService/IGendemoService.cs
deleted file mode 100644
index ea2bd18f..00000000
--- a/ZR.Service/Business/IBusinessService/IGendemoService.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using System;
-using ZR.Model;
-using ZR.Model.Dto;
-using ZR.Model.Models;
-using System.Collections.Generic;
-
-namespace ZR.Service.Business.IBusinessService
-{
- ///
- /// 演示service接口
- ///
- /// @author zz
- /// @date 2022-03-31
- ///
- public interface IGenDemoService : IBaseService
- {
- PagedInfo GetList(GenDemoQueryDto parm);
-
- }
-}
diff --git a/ZR.Service/ZR.Service.csproj b/ZR.Service/ZR.Service.csproj
index 0c394e25..f03125bf 100644
--- a/ZR.Service/ZR.Service.csproj
+++ b/ZR.Service/ZR.Service.csproj
@@ -9,9 +9,4 @@
-
-
-
-
-