同步master分支差异
This commit is contained in:
parent
cfc8eee2a3
commit
b83311c14e
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 演示Controller
|
||||
///
|
||||
/// @author zz
|
||||
/// @date 2022-03-31
|
||||
/// </summary>
|
||||
[Verify]
|
||||
[Route("business/GenDemo")]
|
||||
public class GenDemoController : BaseController
|
||||
{
|
||||
/// <summary>
|
||||
/// 演示接口
|
||||
/// </summary>
|
||||
private readonly IGenDemoService _GenDemoService;
|
||||
|
||||
public GenDemoController(IGenDemoService GenDemoService)
|
||||
{
|
||||
_GenDemoService = GenDemoService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询演示列表
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("list")]
|
||||
[ActionPermissionFilter(Permission = "business:gendemo:list")]
|
||||
public IActionResult QueryGenDemo([FromQuery] GenDemoQueryDto parm)
|
||||
{
|
||||
var response = _GenDemoService.GetList(parm);
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 查询演示详情
|
||||
/// </summary>
|
||||
/// <param name="Id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{Id}")]
|
||||
[ActionPermissionFilter(Permission = "business:gendemo:query")]
|
||||
public IActionResult GetGenDemo(int Id)
|
||||
{
|
||||
var response = _GenDemoService.GetFirst(x => x.Id == Id);
|
||||
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加演示
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[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<GenDemo>().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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新演示
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[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<GenDemo>().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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除演示
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 导出演示
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[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 });
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -44,11 +44,11 @@ namespace ZR.Admin.WebApi.Controllers
|
||||
{
|
||||
var predicate = Expressionable.Create<SysConfig>();
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 添加参数配置
|
||||
/// </summary>
|
||||
|
||||
@ -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
|
||||
/// <summary>
|
||||
/// 添加字典类型
|
||||
/// </summary>
|
||||
/// <param name="dict"></param>
|
||||
/// <param name="dto"></param>
|
||||
/// <returns></returns>
|
||||
[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<SysDictType>();
|
||||
if (UserConstants.NOT_UNIQUE.Equals(SysDictService.CheckDictTypeUnique(dict)))
|
||||
{
|
||||
return ToResponse(ApiResult.Error($"新增字典'{dict.DictName}'失败,字典类型已存在"));
|
||||
@ -74,14 +78,15 @@ namespace ZR.Admin.WebApi.Controllers.System
|
||||
/// <summary>
|
||||
/// 修改字典类型
|
||||
/// </summary>
|
||||
/// <param name="dict"></param>
|
||||
/// <param name="dto"></param>
|
||||
/// <returns></returns>
|
||||
[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<SysDictType>();
|
||||
if (UserConstants.NOT_UNIQUE.Equals(SysDictService.CheckDictTypeUnique(dict)))
|
||||
{
|
||||
return ToResponse(ApiResult.Error($"修改字典'{dict.DictName}'失败,字典类型已存在"));
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 演示输入对象
|
||||
/// </summary>
|
||||
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; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 演示查询对象
|
||||
/// </summary>
|
||||
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; }
|
||||
}
|
||||
}
|
||||
@ -1,103 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using SqlSugar;
|
||||
using OfficeOpenXml.Attributes;
|
||||
|
||||
namespace ZR.Model.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// 演示,数据实体对象
|
||||
///
|
||||
/// @author zz
|
||||
/// @date 2022-03-31
|
||||
/// </summary>
|
||||
[SugarTable("gen_demo")]
|
||||
public class GenDemo
|
||||
{
|
||||
/// <summary>
|
||||
/// 描述 : id
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "id")]
|
||||
[SqlSugar.SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 描述 : 名称
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "名称")]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 描述 : 图片
|
||||
/// 空值 : true
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "图片")]
|
||||
public string Icon { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 描述 : 显示状态
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "显示状态")]
|
||||
public int ShowStatus { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 描述 : 添加时间
|
||||
/// 空值 : true
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "添加时间", NumberFormat = "yyyy-MM-dd HH:mm:ss")]
|
||||
public DateTime? AddTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 描述 : 用户性别
|
||||
/// 空值 : true
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "用户性别")]
|
||||
public int? Sex { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 描述 : 排序
|
||||
/// 空值 : true
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "排序")]
|
||||
public int? Sort { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 描述 : 备注
|
||||
/// 空值 : true
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "备注")]
|
||||
public string Remark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 描述 : 开始时间
|
||||
/// 空值 : true
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "开始时间", NumberFormat = "yyyy-MM-dd HH:mm:ss")]
|
||||
public DateTime? BeginTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 描述 : 结束时间
|
||||
/// 空值 : true
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "结束时间", NumberFormat = "yyyy-MM-dd HH:mm:ss")]
|
||||
public DateTime? EndTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 描述 : 特征
|
||||
/// 空值 : true
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "特征")]
|
||||
public string Feature { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 描述 : 父级id
|
||||
/// 空值 : true
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "父级id")]
|
||||
public int? ParentId { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@ -4,6 +4,12 @@
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="Business\**" />
|
||||
<EmbeddedResource Remove="Business\**" />
|
||||
<None Remove="Business\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Infrastructure\Infrastructure.csproj" />
|
||||
<ProjectReference Include="..\ZR.Model\ZR.Model.csproj" />
|
||||
@ -17,8 +23,4 @@
|
||||
<PackageReference Include="SqlSugar.IOC" Version="1.9.0" />
|
||||
<PackageReference Include="SqlSugarCoreNoDrive" Version="5.1.3.33" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Business\" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 演示Service业务层处理
|
||||
///
|
||||
/// @author zz
|
||||
/// @date 2022-03-31
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(IGenDemoService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class GenDemoService : BaseService<GenDemo>, IGenDemoService
|
||||
{
|
||||
#region 业务逻辑代码
|
||||
|
||||
/// <summary>
|
||||
/// 查询演示列表
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
public PagedInfo<GenDemo> GetList(GenDemoQueryDto parm)
|
||||
{
|
||||
//开始拼装查询条件
|
||||
var predicate = Expressionable.Create<GenDemo>();
|
||||
|
||||
//搜索条件查询语法参考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
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 演示service接口
|
||||
///
|
||||
/// @author zz
|
||||
/// @date 2022-03-31
|
||||
/// </summary>
|
||||
public interface IGenDemoService : IBaseService<GenDemo>
|
||||
{
|
||||
PagedInfo<GenDemo> GetList(GenDemoQueryDto parm);
|
||||
|
||||
}
|
||||
}
|
||||
@ -9,9 +9,4 @@
|
||||
<ProjectReference Include="..\ZR.Repository\ZR.Repository.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Business\" />
|
||||
<Folder Include="Business\IBusinessService\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user