去除引用common.props
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
using Aop.Api.Domain;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.Common.Enums;
|
||||
@@ -7,20 +6,15 @@ using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.Systems.Entitys.Permission;
|
||||
using JNPF.Systems.Entitys.System;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using JNPF.VisualDev;
|
||||
using JNPF.VisualDev.Entitys;
|
||||
using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
|
||||
using JNPF.VisualDev.Interfaces;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.BasicData.Entitys.Dto.BasProcess;
|
||||
using Tnb.BasicData.Interfaces;
|
||||
|
||||
namespace Tnb.BasicData
|
||||
{
|
||||
@@ -64,21 +58,16 @@ namespace Tnb.BasicData
|
||||
/// <returns></returns>
|
||||
private async Task<dynamic> GetList(VisualDevModelListQueryInput input)
|
||||
{
|
||||
var result = new SqlSugarPagedList<ProcessListOutput>();
|
||||
var db = _repository.AsSugarClient();
|
||||
var organize = await db.Queryable<OrganizeEntity>().FirstAsync(it => it.EnCode == input.station_code && it.Category == DictConst.RegionCategoryStationCode);
|
||||
SqlSugarPagedList<ProcessListOutput> result = new();
|
||||
ISqlSugarClient db = _repository.AsSugarClient();
|
||||
OrganizeEntity organize = await db.Queryable<OrganizeEntity>().FirstAsync(it => it.EnCode == input.station_code && it.Category == DictConst.RegionCategoryStationCode);
|
||||
if (organize != null)
|
||||
{
|
||||
var whereExpr = Expressionable.Create<BasProcess, BasProcessStation>();
|
||||
var curProcessIds = await db.Queryable<BasProcessStation>().Where(it => it.station_id == organize.Id).Select(it => it.process_id).Distinct().ToListAsync();
|
||||
if (curProcessIds?.Count > 0)
|
||||
{
|
||||
whereExpr = whereExpr.And((a, b) => curProcessIds.Contains(a.id)).Or((a, b) => string.IsNullOrEmpty(b.process_id));
|
||||
}
|
||||
else
|
||||
{
|
||||
whereExpr = whereExpr.And((a, b) => string.IsNullOrEmpty(b.process_id));
|
||||
}
|
||||
Expressionable<BasProcess, BasProcessStation> whereExpr = Expressionable.Create<BasProcess, BasProcessStation>();
|
||||
List<string> curProcessIds = await db.Queryable<BasProcessStation>().Where(it => it.station_id == organize.Id).Select(it => it.process_id).Distinct().ToListAsync();
|
||||
whereExpr = curProcessIds?.Count > 0
|
||||
? whereExpr.And((a, b) => curProcessIds.Contains(a.id)).Or((a, b) => string.IsNullOrEmpty(b.process_id))
|
||||
: whereExpr.And((a, b) => string.IsNullOrEmpty(b.process_id));
|
||||
result = await db.Queryable<BasProcess>().LeftJoin<BasProcessStation>((a, b) => a.id == b.process_id).Where(whereExpr.ToExpression()).Select(a => new ProcessListOutput
|
||||
{
|
||||
id = a.id,
|
||||
@@ -118,8 +107,8 @@ namespace Tnb.BasicData
|
||||
|
||||
string processId = visualDevModelDataCrInput.data["ReturnIdentity"].ToString() ?? "";
|
||||
|
||||
List<BasProcessStation> list = new List<BasProcessStation>();
|
||||
foreach (var item in (JArray)visualDevModelDataCrInput.data["station"])
|
||||
List<BasProcessStation> list = new();
|
||||
foreach (JToken item in (JArray)visualDevModelDataCrInput.data["station"])
|
||||
{
|
||||
|
||||
string processStationId = SnowflakeIdHelper.NextId();
|
||||
@@ -134,11 +123,10 @@ namespace Tnb.BasicData
|
||||
});
|
||||
}
|
||||
|
||||
await _repository.AsSugarClient().Insertable<BasProcessStation>(list).ExecuteCommandAsync();
|
||||
_ = await _repository.AsSugarClient().Insertable<BasProcessStation>(list).ExecuteCommandAsync();
|
||||
});
|
||||
|
||||
if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
return result.IsSuccess ? "保存成功" : result.ErrorMessage;
|
||||
return !result.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : (dynamic)(result.IsSuccess ? "保存成功" : result.ErrorMessage);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user