高级条件查询设置及修改获取模块新增信息

master
ZR20090193-陈敬勇 8 months ago
parent b9861d6f1b
commit a085e94557

@ -32,10 +32,5 @@ public interface IFormSetService
DataResult<CodeFormSetRes> GetFormSetInfo(string id);
/// <summary>
/// 获取模块新增信息
/// </summary>
/// <param name="id">权限模块id</param>
/// <returns></returns>
Task<DataResult<FormSetCreateRes>> GetFormSetCreateInfoAsync(string id);
}

@ -95,40 +95,5 @@ public class CodeFormSetService : IFormSetService
.First();
return DataResult<CodeFormSetRes>.Success(data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取模块新增信息
/// </summary>
/// <param name="id">权限模块id</param>
/// <returns></returns>
public async Task<DataResult<FormSetCreateRes>> GetFormSetCreateInfoAsync(string id)
{
var res = new FormSetCreateRes();
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
//判断有没有自己设置的模板
var ownSet = await tenantDb.Queryable<CodeFormSet>()
.Where(x => x.PermissionId == long.Parse(id) && x.CreateBy == long.Parse(user.UserId))
.Select<FormSetCreateRes>()
.FirstAsync();
if (ownSet != null)
{
return await Task.FromResult(DataResult<FormSetCreateRes>.Success(ownSet));
}
else
{
var publicSet = await tenantDb.Queryable<CodeFormSet>()
.Where(x => x.PermissionId == long.Parse(id))
.Select<FormSetCreateRes>()
.FirstAsync();
if (publicSet != null)
{
return await Task.FromResult(DataResult<FormSetCreateRes>.Success(publicSet));
}
else
{
return await Task.FromResult(DataResult<FormSetCreateRes>.Failed(MultiLanguageConst.FormSetNotExist));
}
}
}
}

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DS.WMS.Core.System.Dtos
{
/// <summary>
/// 用户高级查询条件设置请求
/// </summary>
public class UserQuerySetUpdateReq
{
/// <summary>
/// 权限Id
/// </summary>
public long? PermissionId { get; set; }
/// <summary>
/// 高级查询条件设置
/// </summary>
public string Content { get; set; }
}
}

@ -0,0 +1,32 @@
using SqlSugar;
namespace DS.WMS.Core.System.Entity;
/// <summary>
/// 用户高级查询条件设置
/// </summary>
[SqlSugar.SugarTable("sys_query_set")]
public class SysQuerySet
{
/// <summary>
/// ID
/// </summary>
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
public int Id { get; set; }
/// <summary>
/// 用户id
/// </summary>
public long? UserId { get; set; }
/// <summary>
/// 权限Id
/// </summary>
public long? PermissionId { get; set; }
/// <summary>
/// 查询条件设置
/// </summary>
[SugarColumn(ColumnDescription = "查询条件设置", IsNullable = true, ColumnDataType = StaticConfig.CodeFirst_BigString)]
public string Content { get; set; }
}

@ -225,4 +225,26 @@ public interface IClientCommonService
/// </summary>
/// <returns></returns>
public DataResult<List<CodeServiceSelectRes>> GetServiceSelectList();
/// <summary>
/// 获取用户高级查询设置
/// </summary>
/// <param name="permissionId"></param>
/// <returns></returns>
public DataResult<SysQuerySet> GetUserQuerySet(string permissionId);
/// <summary>
/// 更新用户高级查询设置
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
public DataResult UpdateUserQuerySet(UserQuerySetUpdateReq req);
/// <summary>
/// 获取模块新增信息
/// </summary>
/// <param name="id">权限模块id</param>
/// <returns></returns>
Task<DataResult<FormSetCreateRes>> GetFormSetCreateInfoAsync(string id);
}

@ -681,4 +681,87 @@ public class ClientCommonService : IClientCommonService
).ToList();
return DataResult<List<UserSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
#region 用户高级查询条件设置
/// <summary>
/// 获取用户高级查询条件设置
/// </summary>
/// <param name="permissionId"></param>
/// <returns></returns>
public DataResult<SysQuerySet> GetUserQuerySet(string permissionId)
{
var info = db.Queryable<SysQuerySet>()
.Where(x => x.UserId == long.Parse(user.UserId) && x.PermissionId == long.Parse(permissionId)).First();
return DataResult<SysQuerySet>.Success(info);
}
/// <summary>
/// 更新用户高级查询条件设置
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
public DataResult UpdateUserQuerySet(UserQuerySetUpdateReq req)
{
var info = db.Queryable<SysQuerySet>()
.Where(x => x.UserId == long.Parse(user.UserId) && x.PermissionId == req.PermissionId).First();
if (info.IsNull())
{
var entity = new SysQuerySet
{
UserId = long.Parse(user.UserId),
PermissionId = req.PermissionId,
Content = req.Content
};
db.Insertable(entity).ExecuteCommand();
}
else
{
info.Content = req.Content;
db.Updateable(info).ExecuteCommand();
}
return DataResult.Successed("更新成功");
}
#endregion
/// <summary>
/// 获取模块新增信息
/// </summary>
/// <param name="id">权限模块id</param>
/// <returns></returns>
public async Task<DataResult<FormSetCreateRes>> GetFormSetCreateInfoAsync(string id)
{
var res = new FormSetCreateRes();
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
//判断有没有自己设置的模板
var ownSet = await tenantDb.Queryable<CodeFormSet>()
.Where(x => x.PermissionId == long.Parse(id) && x.CreateBy == long.Parse(user.UserId))
.Select<FormSetCreateRes>()
.FirstAsync();
if (ownSet != null)
{
return await Task.FromResult(DataResult<FormSetCreateRes>.Success(ownSet));
}
else
{
var publicSet = await tenantDb.Queryable<CodeFormSet>()
.Where(x => x.PermissionId == long.Parse(id))
.Select<FormSetCreateRes>()
.FirstAsync();
if (publicSet != null)
{
return await Task.FromResult(DataResult<FormSetCreateRes>.Success(publicSet));
}
else
{
return await Task.FromResult(DataResult<FormSetCreateRes>.Failed(MultiLanguageConst.FormSetNotExist));
}
}
}
}

@ -417,4 +417,44 @@ public class ClientCommonController : ApiController
var res = _invokeService.GetServiceSelectList();
return res;
}
/// <summary>
/// 获取用户高级查询条件设置
/// </summary>
/// <param name="permissionId">权限模块id</param>
/// <returns></returns>
[HttpGet]
[Route("GetUserQuerySet")]
public DataResult<SysQuerySet> GetUserQuerySet([FromQuery] string permissionId)
{
var res = _invokeService.GetUserQuerySet(permissionId);
return res;
}
/// <summary>
/// 更新用户高级查询条件设置
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
[Route("UpdateUserQuerySet")]
public DataResult UpdateUserQuerySet([FromBody] UserQuerySetUpdateReq req)
{
var res = _invokeService.UpdateUserQuerySet(req);
return res;
}
/// <summary>
/// 获取模块新增信息
/// </summary>
/// <param name="id">权限模块Id</param>
/// <returns></returns>
[HttpGet]
[Route("GetFormSetCreateInfoAsync")]
public async Task<DataResult<FormSetCreateRes>> GetFormSetCreateInfoAsync([FromQuery] string id)
{
var res = await _invokeService.GetFormSetCreateInfoAsync(id);
return res;
}
}

@ -62,16 +62,5 @@ public class FormSetController : ApiController
return res;
}
/// <summary>
/// 获取模块新增信息
/// </summary>
/// <param name="id">权限模块Id</param>
/// <returns></returns>
[HttpGet]
[Route("GetFormSetCreateInfoAsync")]
public async Task<DataResult<FormSetCreateRes>> GetFormSetCreateInfoAsync([FromQuery] string id)
{
var res = await _invokeService.GetFormSetCreateInfoAsync(id);
return res;
}
}

@ -1013,3 +1013,24 @@
2024-04-08 10:09:10.2901 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.MainApi\bin\Debug\net8.0\nlog.config
2024-04-08 10:09:10.2901 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-04-08 10:09:10.3066 Info Configuration initialized.
2024-04-08 13:48:40.3741 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-04-08 13:48:40.4078 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-04-08 13:48:40.4078 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-04-08 13:48:40.4457 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-04-08 13:48:40.4724 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.MainApi\bin\Debug\net8.0\nlog.config
2024-04-08 13:48:40.4846 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-04-08 13:48:40.5011 Info Configuration initialized.
2024-04-08 13:59:14.5993 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-04-08 13:59:14.6266 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-04-08 13:59:14.6266 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-04-08 13:59:14.6579 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-04-08 13:59:14.6716 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.MainApi\bin\Debug\net8.0\nlog.config
2024-04-08 13:59:14.6716 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-04-08 13:59:14.6971 Info Configuration initialized.
2024-04-08 14:09:10.4100 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-04-08 14:09:10.4380 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-04-08 14:09:10.4380 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-04-08 14:09:10.4667 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-04-08 14:09:10.4667 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.MainApi\bin\Debug\net8.0\nlog.config
2024-04-08 14:09:10.4872 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-04-08 14:09:10.4984 Info Configuration initialized.

Loading…
Cancel
Save