表单设置修改

master
ZR20090193-陈敬勇 9 months ago
parent 8a0e94e5e6
commit 07d7215a45

@ -264,5 +264,9 @@ public static class MultiLanguageConst
public const string CodeStlModeImportNoData = "Code_StlMode_Import_No_Data";
[Description("存在已导入的结算方式")]
public const string CodeStlModeImportAlready = "Code_StlMode_Import_Already";
[Description("表单设置已存在")]
public const string FormSetExist = "Form_Set_Exist";
#endregion
}

@ -0,0 +1,22 @@
using System.ComponentModel;
namespace DS.Module.Core.Data;
/// <summary>
/// 机构实体基类
/// </summary>
public abstract class BaseOrgModel<TKey> : BaseModel<TKey>, IOrgId
{
/// <summary>
/// 主键ID
/// </summary>
[Description("主键ID")]
[SqlSugar.SugarColumn(IsPrimaryKey = true, Length = 100, ColumnDescription = "主键ID")]
public TKey Id { get; set; }
/// <summary>
/// 机构Id
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "机构Id", IsOnlyIgnoreUpdate = true)]
public long OrgId { get; set; } = 0;
}

@ -0,0 +1,57 @@
using DS.Module.Core;
using FluentValidation;
namespace DS.WMS.Core.Code.Dtos;
/// <summary>
/// 租户表单设置请求实体
/// </summary>
public class CodeFormSetReq
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 权限Id
/// </summary>
public long? PermissionId { get; set; }
/// <summary>
/// 表单设置
/// </summary>
public string Content { get; set; }
/// <summary>
/// 排序
/// </summary>
public int? OrderNo { get; set; } = 100;
/// <summary>
/// 状态 0 启用 1 禁用
/// </summary>
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
/// <summary>
/// 备注
/// </summary>
public string Note { get; set; } = "";
}
/// <summary>
/// 验证
/// </summary>
public class FormSetReqValidator : AbstractValidator<CodeFormSetReq>
{
/// <summary>
/// 构造函数
/// </summary>
public FormSetReqValidator()
{
this.RuleFor(o => o.PermissionId)
.NotEmpty().WithName("权限模块Id");
this.RuleFor(o => o.Content)
.NotEmpty().WithName("中文视图名");
}
}

@ -0,0 +1,42 @@
using DS.Module.Core;
namespace DS.WMS.Core.Code.Dtos;
/// <summary>
/// 租户表单设置返回实体
/// </summary>
public class CodeFormSetRes
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 权限Id
/// </summary>
public long? PermissionId { get; set; }
/// <summary>
/// 字段设置
/// </summary>
public string Content { get; set; }
/// <summary>
/// 状态 0 启用 1 禁用
/// </summary>
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
/// <summary>
/// 备注
/// </summary>
public string Note { get; set; } = "";
/// <summary>
/// 排序
/// </summary>
public int? OrderNo { get; set; } = 100;
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
}

@ -0,0 +1,34 @@
using DS.Module.Core;
using DS.Module.Core.Data;
using SqlSugar;
namespace DS.WMS.Core.Code.Entity;
/// <summary>
/// 租户表单设置
/// </summary>
[SqlSugar.SugarTable("op_code_form_set")]
public class CodeFormSet : BaseOrgModel<long>
{
/// <summary>
/// 权限Id
/// </summary>
public long? PermissionId { get; set; }
/// <summary>
/// 表单设置
/// </summary>
[SugarColumn(ColumnDescription = "表单设置", IsNullable = true, ColumnDataType=StaticConfig.CodeFirst_BigString)]
public string Content { get; set; }
/// <summary>
/// 排序号
/// </summary>
public string OrderNo { get; set; }
/// <summary>
/// 状态
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "状态")]
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
}

@ -1,8 +1,8 @@
using DS.Module.Core;
using DS.WMS.Core.Code.Dtos;
using DS.WMS.Core.System.Dtos;
using DS.WMS.Core.System.Entity;
namespace DS.WMS.Core.System.Interface;
namespace DS.WMS.Core.Code.Interface;
public interface IFormSetService
{
@ -11,7 +11,7 @@ public interface IFormSetService
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
DataResult<List<FormSetRes>> GetListByPage(PageRequest request);
DataResult<List<CodeFormSetRes>> GetListByPage(PageRequest request);
/// <summary>
@ -19,12 +19,12 @@ public interface IFormSetService
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
DataResult EditFormSet(FormSetReq model);
DataResult EditFormSet(CodeFormSetReq model);
/// <summary>
/// 获取详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
DataResult<FormSetRes> GetFormSetInfo(string id);
DataResult<CodeFormSetRes> GetFormSetInfo(string id);
}

@ -0,0 +1,95 @@
using DS.Module.Core;
using DS.Module.Core.Extensions;
using DS.Module.UserModule;
using DS.WMS.Core.Code.Dtos;
using DS.WMS.Core.Code.Entity;
using DS.WMS.Core.Code.Interface;
using DS.WMS.Core.System.Dtos;
using DS.WMS.Core.System.Entity;
using DS.WMS.Core.System.Interface;
using Mapster;
using Microsoft.Extensions.DependencyInjection;
using SqlSugar;
namespace DS.WMS.Core.Code.Method;
public class FormSetService : IFormSetService
{
private readonly IServiceProvider _serviceProvider;
private readonly ISqlSugarClient db;
private readonly IUser user;
/// <summary>
///
/// </summary>
/// <param name="serviceProvider"></param>
public FormSetService(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
db = _serviceProvider.GetRequiredService<ISqlSugarClient>();
user = _serviceProvider.GetRequiredService<IUser>();
}
/// <summary>
/// 列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public DataResult<List<CodeFormSetRes>> GetListByPage(PageRequest request)
{
//序列化查询条件
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
var data = db.Queryable<CodeFormSet>()
.LeftJoin<SysPermission>((a, b) => a.PermissionId == b.Id)
.Where(whereList)
.Select<CodeFormSetRes>().ToQueryPage(request.PageCondition);
return data;
}
/// <summary>
/// 编辑
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
public DataResult EditFormSet(CodeFormSetReq req)
{
if (req.Id == 0)
{
if (db.Queryable<CodeFormSet>()
.Where(x => x.OrgId == long.Parse(user.OrgId) && x.PermissionId == req.PermissionId).Any())
{
return DataResult.Failed("表单设置已存在!", MultiLanguageConst.FormSetExist);
}
var data = req.Adapt<CodeFormSet>();
var entity = db.Insertable(data).ExecuteReturnEntity();
return DataResult.Successed("添加成功!", entity.Id, MultiLanguageConst.DataCreateSuccess);
}
else
{
var info = db.Queryable<CodeFormSet>().Where(x => x.Id == req.Id).First();
info = req.Adapt(info);
db.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).EnableDiffLogEvent().ExecuteCommand();
return DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess);
}
}
/// <summary>
/// 详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public DataResult<CodeFormSetRes> GetFormSetInfo(string id)
{
var data = db.Queryable<CodeFormSet>()
.LeftJoin<SysPermission>((a, b) => a.PermissionId == b.Id)
.Where(x => x.Id == long.Parse(id))
.Select<CodeFormSetRes>()
.First();
return DataResult<CodeFormSetRes>.Success(data, MultiLanguageConst.DataQuerySuccess);
}
}

@ -1,6 +1,7 @@
using System.ComponentModel;
using DS.Module.Core;
using DS.Module.Core.Data;
using SqlSugar;
namespace DS.WMS.Core.Flow.Entity;
/// <summary>
@ -72,5 +73,6 @@ public class FlowInstance: BaseTenantModel<long>
/// <summary>
/// 流程内容
/// </summary>
[SugarColumn(ColumnDescription = "流程内容", IsNullable = true, ColumnDataType=StaticConfig.CodeFirst_BigString)]
public string Content { get; set; }
}

@ -31,6 +31,7 @@ public class FlowTemplate : BaseModel<long>
/// <summary>
/// 流程内容
/// </summary>
[SugarColumn(ColumnDescription = "内容", IsNullable = true, ColumnDataType=StaticConfig.CodeFirst_BigString)]
public string Content { get; set; }
/// <summary>

@ -30,6 +30,7 @@ public class FlowTemplateTenant : BaseTenantModel<long>
/// <summary>
/// 流程内容
/// </summary>
[SugarColumn(ColumnDescription = "内容", IsNullable = true, ColumnDataType=StaticConfig.CodeFirst_BigString)]
public string Content { get; set; }
/// <summary>

@ -1,17 +0,0 @@
namespace DS.WMS.Core.System.Dtos;
/// <summary>
/// 租户表单设置请求实体
/// </summary>
public class FormSetReq
{
/// <summary>
/// 权限Id
/// </summary>
public long? PermissionId { get; set; }
/// <summary>
/// 字段设置
/// </summary>
public string Content { get; set; }
}

@ -1,17 +0,0 @@
namespace DS.WMS.Core.System.Dtos;
/// <summary>
/// 租户表单设置返回实体
/// </summary>
public class FormSetRes
{
/// <summary>
/// 权限Id
/// </summary>
public long? PermissionId { get; set; }
/// <summary>
/// 字段设置
/// </summary>
public string Content { get; set; }
}

@ -1,5 +1,6 @@
using DS.Module.Core;
using DS.Module.Core.Data;
using SqlSugar;
namespace DS.WMS.Core.System.Entity;
@ -27,6 +28,7 @@ public class SysDataRule : BaseTenantModel<long>
/// <summary>
/// 权限规则
/// </summary>
[SugarColumn(ColumnDescription = "权限规则", IsNullable = true, ColumnDataType=StaticConfig.CodeFirst_BigString)]
public string DataRules { get; set; }
/// <summary>

@ -27,5 +27,6 @@ public class SysFieldSet
/// <summary>
/// 字段设置
/// </summary>
[SugarColumn(ColumnDescription = "字段设置", IsNullable = true, ColumnDataType=StaticConfig.CodeFirst_BigString)]
public string Content { get; set; }
}

@ -1,31 +0,0 @@
using SqlSugar;
namespace DS.WMS.Core.System.Entity;
/// <summary>
/// 租户表单设置
/// </summary>
[SqlSugar.SugarTable("sys_tenant_form_set")]
public class SysFormSet
{
/// <summary>
/// ID
/// </summary>
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
public int Id { get; set; }
/// <summary>
/// 租户id
/// </summary>
public long? TenantId { get; set; }
/// <summary>
/// 权限Id
/// </summary>
public long? PermissionId { get; set; }
/// <summary>
/// 表单设置
/// </summary>
public string Content { get; set; }
}

@ -1,4 +1,5 @@
using DS.Module.Core.Data;
using SqlSugar;
namespace DS.WMS.Core.System.Entity;
@ -31,6 +32,7 @@ public class SysNotice : BaseModel<string>
/// <summary>
/// 内容
/// </summary>
[SugarColumn(ColumnDescription = "内容", IsNullable = true, ColumnDataType=StaticConfig.CodeFirst_BigString)]
public string Content { get; set; }
/// <summary>

@ -366,14 +366,14 @@ public class CommonService : ICommonService
return DataResult<string>.Failed("密码错误!");
}
// //取第一个机构
// var orgRelation = db.Queryable<SysOrgUser>()
// .First(x => x.UserId == userInfo.Id);
//取第一个机构
var orgRelation = db.Queryable<SysOrgUser>()
.First(x => x.UserId == userInfo.Id);
var tokenModel = new JwtHelper.JwtTokenModel
{
Uid = userInfo.Id.ToString(),
Name = userInfo.UserName,
// OrgId = orgRelation.OrgId.ToString(),
OrgId = orgRelation.OrgId.ToString(),
TenantId = userInfo.TenantId.ToString(),
};
var token = JwtHelper.Encrypt(tokenModel, false, false);
@ -399,17 +399,17 @@ public class CommonService : ICommonService
{
var userId = long.Parse(user.UserId);
var tenantId = user.GetTenantId();
// //取第一个机构
// var orgRelations = db.Queryable<SysOrgUser>()
// .LeftJoin<SysOrg>((a,b)=>a.OrgId==b.Id)
// .Where(a => a.UserId == userId)
// .Select<UserOrgListRes>()
// .ToList();
//取第一个机构
var orgRelations = db.Queryable<SysOrgUser>()
.LeftJoin<SysOrg>((a,b)=>a.OrgId==b.Id)
.Where(a => a.UserId == userId)
.Select<UserOrgListRes>()
.ToList();
var tokenModel = new JwtHelper.JwtTokenModel
{
Uid = user.UserId,
Name = db.Queryable<SysUser>().Filter(null, true).First(x => x.Id == userId).UserName,
// OrgId = user.GetOrgId().ToString(),
OrgId = user.GetOrgId().ToString(),
TenantId = tenantId.ToString(),
};
var refreshToken = JwtHelper.Encrypt(tokenModel, true, false);
@ -426,7 +426,7 @@ public class CommonService : ICommonService
ClientId = a.ClientId,
IsLimitClient = a.IsLimitClient,
RefreshToken = refreshToken,
// UserOrgs = orgRelations,
UserOrgs = orgRelations,
// OrgId = a.OrgId.ToString(), CompanyName = a.CustomerName
})
.Mapper(it =>

@ -1,88 +0,0 @@
using DS.Module.Core;
using DS.Module.Core.Extensions;
using DS.Module.UserModule;
using DS.WMS.Core.System.Dtos;
using DS.WMS.Core.System.Entity;
using DS.WMS.Core.System.Interface;
using Mapster;
using Microsoft.Extensions.DependencyInjection;
using SqlSugar;
namespace DS.WMS.Core.System.Method;
public class FormSetService : IFormSetService
{
private readonly IServiceProvider _serviceProvider;
private readonly ISqlSugarClient db;
private readonly IUser user;
/// <summary>
///
/// </summary>
/// <param name="serviceProvider"></param>
public FormSetService(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
db = _serviceProvider.GetRequiredService<ISqlSugarClient>();
user = _serviceProvider.GetRequiredService<IUser>();
}
/// <summary>
/// 列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public DataResult<List<FormSetRes>> GetListByPage(PageRequest request)
{
//序列化查询条件
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
var data = db.Queryable<SysFormSet>()
.LeftJoin<SysPermission>((a, b) => a.PermissionId == b.Id)
.Where(whereList)
.Select<FormSetRes>().ToQueryPage(request.PageCondition);
return data;
}
/// <summary>
/// 编辑
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
public DataResult EditFormSet(FormSetReq req)
{
var info = db.Queryable<SysFormSet>()
.Where(x => x.TenantId == long.Parse(user.TenantId) && x.PermissionId == req.PermissionId).First();
if (info.IsNull())
{
var entity = new SysFormSet
{
TenantId = long.Parse(user.TenantId),
PermissionId = req.PermissionId,
Content = req.Content
};
db.Insertable(entity).ExecuteCommand();
}
else
{
info.Content = req.Content;
db.Updateable(info).ExecuteCommand();
}
return DataResult.Successed("更新成功",MultiLanguageConst.DataUpdateSuccess);
}
/// <summary>
/// 详情
/// </summary>
/// <param name="permissionId"></param>
/// <returns></returns>
public DataResult<FormSetRes> GetFormSetInfo(string permissionId)
{
var data = db.Queryable<SysFormSet>()
.LeftJoin<SysPermission>((a, b) => a.PermissionId == b.Id)
.Where(x => x.TenantId == long.Parse(user.TenantId) && x.PermissionId == long.Parse(permissionId))
.Select<FormSetRes>()
.First();
return DataResult<FormSetRes>.Success(data,MultiLanguageConst.DataQuerySuccess);
}
}

@ -1,4 +1,6 @@
using DS.Module.Core;
using DS.WMS.Core.Code.Dtos;
using DS.WMS.Core.Code.Interface;
using DS.WMS.Core.System.Dtos;
using DS.WMS.Core.System.Interface;
using Microsoft.AspNetCore.Mvc;
@ -28,7 +30,7 @@ public class FormSetController : ApiController
/// <returns></returns>
[HttpPost]
[Route("GetFormSetList")]
public DataResult<List<FormSetRes>> GetFormSetList([FromBody] PageRequest request)
public DataResult<List<CodeFormSetRes>> GetFormSetList([FromBody] PageRequest request)
{
var res = _invokeService.GetListByPage(request);
return res;
@ -41,7 +43,7 @@ public class FormSetController : ApiController
/// <returns></returns>
[HttpPost]
[Route("EditFormSet")]
public DataResult EditFormSet([FromBody] FormSetReq req)
public DataResult EditFormSet([FromBody] CodeFormSetReq req)
{
var res = _invokeService.EditFormSet(req);
return res;
@ -54,7 +56,7 @@ public class FormSetController : ApiController
/// <returns></returns>
[HttpGet]
[Route("GetFormSetInfo")]
public DataResult<FormSetRes> GetFormSetInfo([FromQuery] string permissionId)
public DataResult<CodeFormSetRes> GetFormSetInfo([FromQuery] string permissionId)
{
var res = _invokeService.GetFormSetInfo(permissionId);
return res;

Loading…
Cancel
Save