|
|
|
@ -47,9 +47,16 @@ public class CodeFormSetService : IFormSetService
|
|
|
|
|
public DataResult<List<CodeFormSetRes>> GetListByPage(PageRequest request)
|
|
|
|
|
{
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
#region 添加系统参数 是否租户共享信息
|
|
|
|
|
var query = tenantDb.Queryable<CodeFormSet>();
|
|
|
|
|
var config = db.Queryable<SysConfig>().Where(x => x.Status == StatusEnum.Enable && x.Code == "IsTenantShareInfo").First();
|
|
|
|
|
|
|
|
|
|
if (config.IsNotNull() && config.Value == "TRUE")
|
|
|
|
|
query.ClearFilter<IOrgId>();
|
|
|
|
|
#endregion
|
|
|
|
|
//序列化查询条件
|
|
|
|
|
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
|
|
|
|
|
var data = tenantDb.Queryable<CodeFormSet>()
|
|
|
|
|
var data = query
|
|
|
|
|
.Where(whereList)
|
|
|
|
|
.Select<CodeFormSetRes>().ToQueryPage(request.PageCondition);
|
|
|
|
|
return data;
|
|
|
|
@ -63,15 +70,20 @@ public class CodeFormSetService : IFormSetService
|
|
|
|
|
public DataResult EditFormSet(CodeFormSetReq req)
|
|
|
|
|
{
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
//var orgId = user.GetOrgId();
|
|
|
|
|
if (req.Id == 0)
|
|
|
|
|
{
|
|
|
|
|
if (tenantDb.Queryable<CodeFormSet>()
|
|
|
|
|
.Where(x => x.OrgId == user.OrgId && x.PermissionId == req.PermissionId && x.FormNo == req.FormNo &&x.TaskStatus == req.TaskStatus).Any())
|
|
|
|
|
{
|
|
|
|
|
return DataResult.Failed("表单设置已存在!", MultiLanguageConst.FormSetExist);
|
|
|
|
|
}
|
|
|
|
|
#region 添加系统参数 是否租户共享信息
|
|
|
|
|
var query = tenantDb.Queryable<CodeFormSet>();
|
|
|
|
|
var config = db.Queryable<SysConfig>().Where(x => x.Status == StatusEnum.Enable && x.Code == "IsTenantShareInfo").First();
|
|
|
|
|
|
|
|
|
|
if (config.IsNotNull() && config.Value == "TRUE")
|
|
|
|
|
query.ClearFilter<IOrgId>();
|
|
|
|
|
#endregion
|
|
|
|
|
if (query
|
|
|
|
|
.Where(x => x.PermissionId == req.PermissionId && x.FormNo == req.FormNo && x.TaskStatus == req.TaskStatus && x.Id != req.Id).Any())
|
|
|
|
|
{
|
|
|
|
|
return DataResult.Failed("表单设置已存在!", MultiLanguageConst.FormSetExist);
|
|
|
|
|
}
|
|
|
|
|
if (req.Id == 0)
|
|
|
|
|
{
|
|
|
|
|
var data = req.Adapt<CodeFormSet>();
|
|
|
|
|
data.DefaultContent = req.Content;
|
|
|
|
|
var entity = tenantDb.Insertable(data).ExecuteReturnEntity();
|
|
|
|
@ -80,7 +92,7 @@ public class CodeFormSetService : IFormSetService
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var info = tenantDb.Queryable<CodeFormSet>().Where(x => x.Id == req.Id).First();
|
|
|
|
|
var info = query.Where(x => x.Id == req.Id).First();
|
|
|
|
|
|
|
|
|
|
info = req.Adapt(info);
|
|
|
|
|
|
|
|
|
@ -97,7 +109,14 @@ public class CodeFormSetService : IFormSetService
|
|
|
|
|
public DataResult<CodeFormSetRes> GetFormSetInfo(string id)
|
|
|
|
|
{
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
var data = tenantDb.Queryable<CodeFormSet>()
|
|
|
|
|
#region 添加系统参数 是否租户共享信息
|
|
|
|
|
var query = tenantDb.Queryable<CodeFormSet>();
|
|
|
|
|
var config = db.Queryable<SysConfig>().Where(x => x.Status == StatusEnum.Enable && x.Code == "IsTenantShareInfo").First();
|
|
|
|
|
|
|
|
|
|
if (config.IsNotNull() && config.Value == "TRUE")
|
|
|
|
|
query.ClearFilter<IOrgId>();
|
|
|
|
|
#endregion
|
|
|
|
|
var data = query
|
|
|
|
|
.Where(x => x.Id == long.Parse(id) && x.Status == StatusEnum.Enable)
|
|
|
|
|
.Select<CodeFormSetRes>()
|
|
|
|
|
.First();
|
|
|
|
@ -157,7 +176,14 @@ public class CodeFormSetService : IFormSetService
|
|
|
|
|
public async Task<DataResult<List<CodeFormSetRes>>> GetFormSetListByModule(string permissionId)
|
|
|
|
|
{
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
var data = await tenantDb.Queryable<CodeFormSet>()
|
|
|
|
|
#region 添加系统参数 是否租户共享信息
|
|
|
|
|
var query = tenantDb.Queryable<CodeFormSet>();
|
|
|
|
|
var config = db.Queryable<SysConfig>().Where(x => x.Status == StatusEnum.Enable && x.Code == "IsTenantShareInfo").First();
|
|
|
|
|
|
|
|
|
|
if (config.IsNotNull() && config.Value == "TRUE")
|
|
|
|
|
query.ClearFilter<IOrgId>();
|
|
|
|
|
#endregion
|
|
|
|
|
var data = await query
|
|
|
|
|
.Where(x => x.PermissionId == long.Parse(permissionId) && x.Status == StatusEnum.Enable)
|
|
|
|
|
.Select<CodeFormSetRes>()
|
|
|
|
|
.ToListAsync();
|
|
|
|
@ -167,7 +193,14 @@ public class CodeFormSetService : IFormSetService
|
|
|
|
|
public DataResult BatchDelFormSet(IdModel req)
|
|
|
|
|
{
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
var list = tenantDb.Queryable<CodeFormSet>().Where(x => req.Ids.Contains(x.Id)).ToList();
|
|
|
|
|
#region 添加系统参数 是否租户共享信息
|
|
|
|
|
var query = tenantDb.Queryable<CodeFormSet>();
|
|
|
|
|
var config = db.Queryable<SysConfig>().Where(x => x.Status == StatusEnum.Enable && x.Code == "IsTenantShareInfo").First();
|
|
|
|
|
|
|
|
|
|
if (config.IsNotNull() && config.Value == "TRUE")
|
|
|
|
|
query.ClearFilter<IOrgId>();
|
|
|
|
|
#endregion
|
|
|
|
|
var list = query.Where(x => req.Ids.Contains(x.Id)).ToList();
|
|
|
|
|
if (list.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
tenantDb.Deleteable(list).ExecuteCommand();
|
|
|
|
@ -182,7 +215,14 @@ public class CodeFormSetService : IFormSetService
|
|
|
|
|
public DataResult SetPublicFormSet(CodeFormSetPublicStatusReq req)
|
|
|
|
|
{
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
var info = tenantDb.Queryable<CodeFormSet>().Where(x => x.Id == req.Id).First();
|
|
|
|
|
#region 添加系统参数 是否租户共享信息
|
|
|
|
|
var query = tenantDb.Queryable<CodeFormSet>();
|
|
|
|
|
var config = db.Queryable<SysConfig>().Where(x => x.Status == StatusEnum.Enable && x.Code == "IsTenantShareInfo").First();
|
|
|
|
|
|
|
|
|
|
if (config.IsNotNull() && config.Value == "TRUE")
|
|
|
|
|
query.ClearFilter<IOrgId>();
|
|
|
|
|
#endregion
|
|
|
|
|
var info = query.Where(x => x.Id == req.Id).First();
|
|
|
|
|
|
|
|
|
|
if (info.IsNull())
|
|
|
|
|
{
|
|
|
|
@ -204,7 +244,14 @@ public class CodeFormSetService : IFormSetService
|
|
|
|
|
public async Task<DataResult> FormSetCopy(string id)
|
|
|
|
|
{
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
var info = await tenantDb.Queryable<CodeFormSet>().Where(x => x.Id == long.Parse(id)).FirstAsync();
|
|
|
|
|
#region 添加系统参数 是否租户共享信息
|
|
|
|
|
var query = tenantDb.Queryable<CodeFormSet>();
|
|
|
|
|
var config = db.Queryable<SysConfig>().Where(x => x.Status == StatusEnum.Enable && x.Code == "IsTenantShareInfo").First();
|
|
|
|
|
|
|
|
|
|
if (config.IsNotNull() && config.Value == "TRUE")
|
|
|
|
|
query.ClearFilter<IOrgId>();
|
|
|
|
|
#endregion
|
|
|
|
|
var info = await query.Where(x => x.Id == long.Parse(id)).FirstAsync();
|
|
|
|
|
|
|
|
|
|
var data = info.Adapt<CodeFormSet>();
|
|
|
|
|
data.Id = 0;
|
|
|
|
|