mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-07-16 16:50:54 +08:00
#I7A7YE 建议加入打印功能
This commit is contained in:
parent
319986ae1c
commit
852d52436a
@ -0,0 +1,63 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// This code was generated by a CodeSmith Template.
|
||||||
|
//
|
||||||
|
// DO NOT MODIFY contents of this file. Changes to this
|
||||||
|
// file will be lost if the code is regenerated.
|
||||||
|
// Author:Yubao Li
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
using System;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using OpenAuth.Repository.Core;
|
||||||
|
|
||||||
|
namespace OpenAuth.App.Request
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
|
||||||
|
public class AddOrUpdateSysPrinterPlanReq
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///方案名称
|
||||||
|
/// </summary>
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///方案ID
|
||||||
|
/// </summary>
|
||||||
|
public string Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///创建人
|
||||||
|
/// </summary>
|
||||||
|
public string CreateUser { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///数据源;打印方案对应的数据来源SQL
|
||||||
|
/// </summary>
|
||||||
|
public string SourceSql { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///中文视图名;设计打印方案时,提供中文快捷按钮的视图来源
|
||||||
|
/// </summary>
|
||||||
|
public string CloumnView { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///打印方案内容;打印方案JSON对象
|
||||||
|
/// </summary>
|
||||||
|
public string PlanContent { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///创建日期
|
||||||
|
/// </summary>
|
||||||
|
public DateTime CreateTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///是否可用
|
||||||
|
/// </summary>
|
||||||
|
public bool Disable { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
namespace OpenAuth.App.Request
|
||||||
|
{
|
||||||
|
public class QuerySysPrinterPlanListReq : PageReq
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
75
OpenAuth.App/SysPrinterPlanApp/SysPrinterPlanApp.cs
Normal file
75
OpenAuth.App/SysPrinterPlanApp/SysPrinterPlanApp.cs
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using OpenAuth.App.Interface;
|
||||||
|
using OpenAuth.App.Request;
|
||||||
|
using OpenAuth.App.Response;
|
||||||
|
using OpenAuth.Repository;
|
||||||
|
using OpenAuth.Repository.Domain;
|
||||||
|
using OpenAuth.Repository.Interface;
|
||||||
|
|
||||||
|
|
||||||
|
namespace OpenAuth.App
|
||||||
|
{
|
||||||
|
public class SysPrinterPlanApp : BaseStringApp<SysPrinterPlan, OpenAuthDBContext>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 加载列表
|
||||||
|
/// </summary>
|
||||||
|
public async Task<TableData> Load(QuerySysPrinterPlanListReq request)
|
||||||
|
{
|
||||||
|
var loginContext = _auth.GetCurrentUser();
|
||||||
|
if (loginContext == null)
|
||||||
|
{
|
||||||
|
throw new CommonException("登录已过期", Define.INVALID_TOKEN);
|
||||||
|
}
|
||||||
|
|
||||||
|
var columnFields = loginContext.GetTableColumns("SysPrinterPlan");
|
||||||
|
if (columnFields == null || columnFields.Count == 0)
|
||||||
|
{
|
||||||
|
throw new Exception("请在代码生成界面配置SysPrinterPlan表的字段属性");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = new TableData();
|
||||||
|
var objs = GetDataPrivilege("u");
|
||||||
|
if (!string.IsNullOrEmpty(request.key))
|
||||||
|
{
|
||||||
|
//增加筛选条件,如:
|
||||||
|
objs = objs.Where(u => u.Name.Contains(request.key));
|
||||||
|
}
|
||||||
|
|
||||||
|
var propertyStr = string.Join(',', columnFields.Select(u => u.ColumnName));
|
||||||
|
result.columnFields = columnFields;
|
||||||
|
result.data = objs.OrderBy(u => u.Id)
|
||||||
|
.Skip((request.page - 1) * request.limit)
|
||||||
|
.Take(request.limit).Select($"new ({propertyStr})");
|
||||||
|
result.count = await objs.CountAsync();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Add(AddOrUpdateSysPrinterPlanReq obj)
|
||||||
|
{
|
||||||
|
//程序类型取入口应用的名称,可以根据自己需要调整
|
||||||
|
var addObj = obj.MapTo<SysPrinterPlan>();
|
||||||
|
//addObj.Time = DateTime.Now;
|
||||||
|
Repository.Add(addObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update(AddOrUpdateSysPrinterPlanReq obj)
|
||||||
|
{
|
||||||
|
UnitWork.Update<SysPrinterPlan>(u => u.Id == obj.Id, u => new SysPrinterPlan
|
||||||
|
{
|
||||||
|
Name = obj.Name,
|
||||||
|
SourceSql = obj.SourceSql,
|
||||||
|
PlanContent = obj.PlanContent
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public SysPrinterPlanApp(IUnitWork<OpenAuthDBContext> unitWork,
|
||||||
|
IRepository<SysPrinterPlan, OpenAuthDBContext> repository, IAuth auth) : base(unitWork, repository, auth)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
75
OpenAuth.Repository/Domain/SysPrinterPlan.cs
Normal file
75
OpenAuth.Repository/Domain/SysPrinterPlan.cs
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// This code was generated by a CodeSmith Template.
|
||||||
|
//
|
||||||
|
// DO NOT MODIFY contents of this file. Changes to this
|
||||||
|
// file will be lost if the code is regenerated.
|
||||||
|
// Author:Yubao Li
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using OpenAuth.Repository.Core;
|
||||||
|
|
||||||
|
namespace OpenAuth.Repository.Domain
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
[Table("SysPrinterPlan")]
|
||||||
|
public class SysPrinterPlan : StringEntity
|
||||||
|
{
|
||||||
|
public SysPrinterPlan()
|
||||||
|
{
|
||||||
|
this.Name = "";
|
||||||
|
this.CreateUser = "";
|
||||||
|
this.SourceSql = "";
|
||||||
|
this.CloumnView = "";
|
||||||
|
this.PlanContent = "";
|
||||||
|
this.CreateTime = DateTime.Now;
|
||||||
|
this.Disable = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///方案名称
|
||||||
|
/// </summary>
|
||||||
|
[Description("方案名称")]
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///创建人
|
||||||
|
/// </summary>
|
||||||
|
[Description("创建人")]
|
||||||
|
public string CreateUser { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///数据源;打印方案对应的数据来源SQL
|
||||||
|
/// </summary>
|
||||||
|
[Description("数据源;打印方案对应的数据来源SQL")]
|
||||||
|
public string SourceSql { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///中文视图名;设计打印方案时,提供中文快捷按钮的视图来源
|
||||||
|
/// </summary>
|
||||||
|
[Description("中文视图名;设计打印方案时,提供中文快捷按钮的视图来源")]
|
||||||
|
public string CloumnView { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///打印方案内容;打印方案JSON对象
|
||||||
|
/// </summary>
|
||||||
|
[Description("打印方案内容;打印方案JSON对象")]
|
||||||
|
public string PlanContent { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///创建日期
|
||||||
|
/// </summary>
|
||||||
|
[Description("创建日期")]
|
||||||
|
public DateTime CreateTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///是否可用
|
||||||
|
/// </summary>
|
||||||
|
[Description("是否可用")]
|
||||||
|
public bool Disable { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -1,124 +1,124 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
using Infrastructure;
|
using Infrastructure;
|
||||||
using Infrastructure.Extensions;
|
using Infrastructure.Extensions;
|
||||||
using Infrastructure.Utilities;
|
using Infrastructure.Utilities;
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
|
|
||||||
using OpenAuth.Repository.Domain;
|
using OpenAuth.Repository.Domain;
|
||||||
using OpenAuth.Repository.QueryObj;
|
using OpenAuth.Repository.QueryObj;
|
||||||
|
|
||||||
namespace OpenAuth.Repository
|
namespace OpenAuth.Repository
|
||||||
{
|
{
|
||||||
|
|
||||||
public partial class OpenAuthDBContext : DbContext
|
public partial class OpenAuthDBContext : DbContext
|
||||||
{
|
{
|
||||||
|
|
||||||
private ILoggerFactory _LoggerFactory;
|
private ILoggerFactory _LoggerFactory;
|
||||||
private IHttpContextAccessor _httpContextAccessor;
|
private IHttpContextAccessor _httpContextAccessor;
|
||||||
private IConfiguration _configuration;
|
private IConfiguration _configuration;
|
||||||
private IOptions<AppSetting> _appConfiguration;
|
private IOptions<AppSetting> _appConfiguration;
|
||||||
|
|
||||||
public OpenAuthDBContext(DbContextOptions<OpenAuthDBContext> options, ILoggerFactory loggerFactory,
|
public OpenAuthDBContext(DbContextOptions<OpenAuthDBContext> options, ILoggerFactory loggerFactory,
|
||||||
IHttpContextAccessor httpContextAccessor, IConfiguration configuration, IOptions<AppSetting> appConfiguration)
|
IHttpContextAccessor httpContextAccessor, IConfiguration configuration, IOptions<AppSetting> appConfiguration)
|
||||||
: base(options)
|
: base(options)
|
||||||
{
|
{
|
||||||
_LoggerFactory = loggerFactory;
|
_LoggerFactory = loggerFactory;
|
||||||
_httpContextAccessor = httpContextAccessor;
|
_httpContextAccessor = httpContextAccessor;
|
||||||
_configuration = configuration;
|
_configuration = configuration;
|
||||||
_appConfiguration = appConfiguration;
|
_appConfiguration = appConfiguration;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||||
{
|
{
|
||||||
optionsBuilder.EnableSensitiveDataLogging(true); //允许打印参数
|
optionsBuilder.EnableSensitiveDataLogging(true); //允许打印参数
|
||||||
optionsBuilder.UseLoggerFactory(_LoggerFactory);
|
optionsBuilder.UseLoggerFactory(_LoggerFactory);
|
||||||
InitTenant(optionsBuilder);
|
InitTenant(optionsBuilder);
|
||||||
base.OnConfiguring(optionsBuilder);
|
base.OnConfiguring(optionsBuilder);
|
||||||
}
|
}
|
||||||
|
|
||||||
//初始化多租户信息,根据租户id调整数据库
|
//初始化多租户信息,根据租户id调整数据库
|
||||||
private void InitTenant(DbContextOptionsBuilder optionsBuilder)
|
private void InitTenant(DbContextOptionsBuilder optionsBuilder)
|
||||||
{
|
{
|
||||||
|
|
||||||
var tenantId = _httpContextAccessor.GetTenantId();
|
var tenantId = _httpContextAccessor.GetTenantId();
|
||||||
string connect = _configuration.GetConnectionString(tenantId);
|
string connect = _configuration.GetConnectionString(tenantId);
|
||||||
if(string.IsNullOrEmpty(connect))
|
if(string.IsNullOrEmpty(connect))
|
||||||
{
|
{
|
||||||
throw new Exception($"未能找到租户{tenantId}对应的连接字符串信息");
|
throw new Exception($"未能找到租户{tenantId}对应的连接字符串信息");
|
||||||
}
|
}
|
||||||
|
|
||||||
//这个地方如果用IOption,在单元测试的时候会获取不到AppSetting的值😅
|
//这个地方如果用IOption,在单元测试的时候会获取不到AppSetting的值😅
|
||||||
var dbtypes = _configuration.GetSection("AppSetting:DbTypes").GetChildren()
|
var dbtypes = _configuration.GetSection("AppSetting:DbTypes").GetChildren()
|
||||||
.ToDictionary(x => x.Key, x => x.Value);
|
.ToDictionary(x => x.Key, x => x.Value);
|
||||||
|
|
||||||
var dbType = dbtypes[tenantId];
|
var dbType = dbtypes[tenantId];
|
||||||
if(dbType == Define.DBTYPE_SQLSERVER)
|
if(dbType == Define.DBTYPE_SQLSERVER)
|
||||||
{
|
{
|
||||||
optionsBuilder.UseSqlServer(connect);
|
optionsBuilder.UseSqlServer(connect);
|
||||||
}
|
}
|
||||||
else if(dbType == Define.DBTYPE_MYSQL) //mysql
|
else if(dbType == Define.DBTYPE_MYSQL) //mysql
|
||||||
{
|
{
|
||||||
optionsBuilder.UseMySql(connect, new MySqlServerVersion(new Version(8, 0, 11)));
|
optionsBuilder.UseMySql(connect, new MySqlServerVersion(new Version(8, 0, 11)));
|
||||||
}
|
}
|
||||||
else if(dbType == Define.DBTYPE_PostgreSQL) //PostgreSQL
|
else if(dbType == Define.DBTYPE_PostgreSQL) //PostgreSQL
|
||||||
{
|
{
|
||||||
optionsBuilder.UseNpgsql(connect);
|
optionsBuilder.UseNpgsql(connect);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
optionsBuilder.UseOracle(connect, options => options.UseOracleSQLCompatibility("11"));
|
optionsBuilder.UseOracle(connect, options => options.UseOracleSQLCompatibility("11"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
modelBuilder.Entity<DataPrivilegeRule>()
|
modelBuilder.Entity<DataPrivilegeRule>()
|
||||||
.HasKey(c => new { c.Id });
|
.HasKey(c => new { c.Id });
|
||||||
modelBuilder.Entity<SysTableColumn>().HasNoKey();
|
modelBuilder.Entity<SysTableColumn>().HasNoKey();
|
||||||
modelBuilder.Entity<QueryStringObj>().HasNoKey();
|
modelBuilder.Entity<QueryStringObj>().HasNoKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual DbSet<Application> Applications { get; set; }
|
public virtual DbSet<Application> Applications { get; set; }
|
||||||
public virtual DbSet<Category> Categories { get; set; }
|
public virtual DbSet<Category> Categories { get; set; }
|
||||||
public virtual DbSet<CategoryType> CategoryTypes { get; set; }
|
public virtual DbSet<CategoryType> CategoryTypes { get; set; }
|
||||||
public virtual DbSet<FlowInstance> FlowInstances { get; set; }
|
public virtual DbSet<FlowInstance> FlowInstances { get; set; }
|
||||||
public virtual DbSet<FlowInstanceOperationHistory> FlowInstanceOperationHistorys { get; set; }
|
public virtual DbSet<FlowInstanceOperationHistory> FlowInstanceOperationHistorys { get; set; }
|
||||||
public virtual DbSet<FlowInstanceTransitionHistory> FlowInstanceTransitionHistorys { get; set; }
|
public virtual DbSet<FlowInstanceTransitionHistory> FlowInstanceTransitionHistorys { get; set; }
|
||||||
public virtual DbSet<FlowScheme> FlowSchemes { get; set; }
|
public virtual DbSet<FlowScheme> FlowSchemes { get; set; }
|
||||||
public virtual DbSet<Form> Forms { get; set; }
|
public virtual DbSet<Form> Forms { get; set; }
|
||||||
public virtual DbSet<Module> Modules { get; set; }
|
public virtual DbSet<Module> Modules { get; set; }
|
||||||
public virtual DbSet<ModuleElement> ModuleElements { get; set; }
|
public virtual DbSet<ModuleElement> ModuleElements { get; set; }
|
||||||
public virtual DbSet<SysOrg> Orgs { get; set; }
|
public virtual DbSet<SysOrg> Orgs { get; set; }
|
||||||
public virtual DbSet<Relevance> Relevances { get; set; }
|
public virtual DbSet<Relevance> Relevances { get; set; }
|
||||||
public virtual DbSet<Resource> Resources { get; set; }
|
public virtual DbSet<Resource> Resources { get; set; }
|
||||||
public virtual DbSet<Role> Roles { get; set; }
|
public virtual DbSet<Role> Roles { get; set; }
|
||||||
public virtual DbSet<User> Users { get; set; }
|
public virtual DbSet<User> Users { get; set; }
|
||||||
public virtual DbSet<UploadFile> UploadFiles { get; set; }
|
public virtual DbSet<UploadFile> UploadFiles { get; set; }
|
||||||
|
public virtual DbSet<SysPrinterPlan> SysPrinterPlans { get; set; }
|
||||||
public virtual DbSet<FrmLeaveReq> FrmLeaveReqs { get; set; }
|
public virtual DbSet<FrmLeaveReq> FrmLeaveReqs { get; set; }
|
||||||
|
public virtual DbSet<SysLog> SysLogs { get; set; }
|
||||||
public virtual DbSet<SysLog> SysLogs { get; set; }
|
public virtual DbSet<SysMessage> SysMessages { get; set; }
|
||||||
|
public virtual DbSet<DataPrivilegeRule> DataPrivilegeRules { get; set; }
|
||||||
public virtual DbSet<SysMessage> SysMessages { get; set; }
|
|
||||||
|
public virtual DbSet<WmsInboundOrderDtbl> WmsInboundOrderDtbls { get; set; }
|
||||||
public virtual DbSet<DataPrivilegeRule> DataPrivilegeRules { get; set; }
|
public virtual DbSet<WmsInboundOrderTbl> WmsInboundOrderTbls { get; set; }
|
||||||
|
public virtual DbSet<OpenJob> OpenJobs { get; set; }
|
||||||
public virtual DbSet<WmsInboundOrderDtbl> WmsInboundOrderDtbls { get; set; }
|
public virtual DbSet<BuilderTable> BuilderTables { get; set; }
|
||||||
public virtual DbSet<WmsInboundOrderTbl> WmsInboundOrderTbls { get; set; }
|
public virtual DbSet<BuilderTableColumn> BuilderTableColumns { get; set; }
|
||||||
public virtual DbSet<OpenJob> OpenJobs { get; set; }
|
//非数据库表格
|
||||||
public virtual DbSet<BuilderTable> BuilderTables { get; set; }
|
public virtual DbSet<QueryStringObj> QueryStringObjs { get; set; }
|
||||||
public virtual DbSet<BuilderTableColumn> BuilderTableColumns { get; set; }
|
public virtual DbSet<SysTableColumn> SysTableColumns { get; set; }
|
||||||
//非数据库表格
|
|
||||||
public virtual DbSet<QueryStringObj> QueryStringObjs { get; set; }
|
|
||||||
public virtual DbSet<SysTableColumn> SysTableColumns { get; set; }
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
113
OpenAuth.WebApi/Controllers/SysPrinterPlansController.cs
Normal file
113
OpenAuth.WebApi/Controllers/SysPrinterPlansController.cs
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Infrastructure;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using OpenAuth.App;
|
||||||
|
using OpenAuth.App.Request;
|
||||||
|
using OpenAuth.App.Response;
|
||||||
|
using OpenAuth.Repository.Domain;
|
||||||
|
|
||||||
|
namespace OpenAuth.WebApi.Controllers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 打印模板接口
|
||||||
|
/// </summary>
|
||||||
|
[Route("api/[controller]/[action]")]
|
||||||
|
[ApiController]
|
||||||
|
[ApiExplorerSettings(GroupName = "打印模板接口_SysPrinterPlans")]
|
||||||
|
public class SysPrinterPlansController : ControllerBase
|
||||||
|
{
|
||||||
|
private readonly SysPrinterPlanApp _app;
|
||||||
|
|
||||||
|
//获取详情
|
||||||
|
[HttpGet]
|
||||||
|
public Response<SysPrinterPlan> Get(string id)
|
||||||
|
{
|
||||||
|
var result = new Response<SysPrinterPlan>();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
result.Result = _app.Get(id);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
result.Code = 500;
|
||||||
|
result.Message = ex.InnerException?.Message ?? ex.Message;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//添加
|
||||||
|
[HttpPost]
|
||||||
|
public Response Add(AddOrUpdateSysPrinterPlanReq obj)
|
||||||
|
{
|
||||||
|
var result = new Response();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_app.Add(obj);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
result.Code = 500;
|
||||||
|
result.Message = ex.InnerException?.Message ?? ex.Message;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//修改
|
||||||
|
[HttpPost]
|
||||||
|
public Response Update(AddOrUpdateSysPrinterPlanReq obj)
|
||||||
|
{
|
||||||
|
var result = new Response();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_app.Update(obj);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
result.Code = 500;
|
||||||
|
result.Message = ex.InnerException?.Message ?? ex.Message;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 加载列表
|
||||||
|
/// </summary>
|
||||||
|
[HttpGet]
|
||||||
|
public async Task<TableData> Load([FromQuery]QuerySysPrinterPlanListReq request)
|
||||||
|
{
|
||||||
|
return await _app.Load(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 批量删除
|
||||||
|
/// </summary>
|
||||||
|
[HttpPost]
|
||||||
|
public Response Delete([FromBody]string[] ids)
|
||||||
|
{
|
||||||
|
var result = new Response();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_app.Delete(ids);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
result.Code = 500;
|
||||||
|
result.Message = ex.InnerException?.Message ?? ex.Message;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SysPrinterPlansController(SysPrinterPlanApp app)
|
||||||
|
{
|
||||||
|
_app = app;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user