Переглянути джерело

Merge branch 'test' of http://110.188.24.182:10023/Fengwo/hotline into test

田爽 3 місяців тому
батько
коміт
3fe60f2c0f

+ 1 - 0
src/Hotline.Api/Controllers/CallController.cs

@@ -21,6 +21,7 @@ using XF.Domain.Exceptions;
 using XF.Utility.EnumExtensions;
 using XF.Domain.Repository;
 using MapsterMapper;
+using SqlSugar;
 
 namespace Hotline.Api.Controllers
 {

+ 1 - 4
src/Hotline.Api/Controllers/CaseController.cs

@@ -12,13 +12,10 @@ using Hotline.Share.Tools;
 using Hotline.Share.Enums.Caselibrary;
 using Hotline.Application.ExportWord;
 using Hotline.Application.Tools;
-using Hotline.Share.Dtos.Planlibrary;
-using Hotline.Share.Enums.Planlibrary;
 using Hotline.Share.Enums.Article;
 using XF.Utility.EnumExtensions;
 using Hotline.Share.Dtos.Order;
 using Hotline.Application.ExportExcel;
-using System.Threading;
 
 namespace Hotline.Api.Controllers
 {
@@ -156,7 +153,7 @@ namespace Hotline.Api.Controllers
                 {
                     Id = x.Id.SelectAll(),
                     CaseNum = SqlFunc.Subqueryable<CaseRelationType>().LeftJoin<CaseList>((kr, k) => kr.CaseId == k.Id)
-                         .Where((kr, k) => kr.CaseTypeSpliceName.StartsWith(x.SpliceName))
+                         .Where((kr, k) => kr.CaseTypeId == x.Id)
                          .DistinctCount(kr => kr.CaseId)
                 }
                 )

+ 3 - 7
src/Hotline.Api/Controllers/PlanController.cs

@@ -14,10 +14,6 @@ using Hotline.Application.ExportWord;
 using Hotline.Application.Tools;
 using Hotline.Share.Enums.Article;
 using XF.Utility.EnumExtensions;
-using Quartz.Simpl;
-using DocumentFormat.OpenXml.Office2010.Excel;
-using Hotline.Share.Dtos.Caselibrary;
-using Hotline.Share.Dtos.Knowledge;
 using Hotline.Share.Dtos.Order;
 using Hotline.Application.ExportExcel;
 
@@ -151,13 +147,13 @@ namespace Hotline.Api.Controllers
             return await _planTypeRepository.Queryable()
                 .WhereIF(IsEnable.HasValue, x => x.IsEnable == IsEnable)
                 .Where(x => SqlFunc.Subqueryable<PlanTypeOrg>().Where(to => to.TypeId == x.Id).Any() ||
-                SqlFunc.Subqueryable<PlanTypeOrg>().Where(to => to.TypeId == x.Id).NotAny()
+                            SqlFunc.Subqueryable<PlanTypeOrg>().Where(to => to.TypeId == x.Id).NotAny()
                 )
                 .Select(x => new PlanTypeDto()
                 {
                     Id = x.Id.SelectAll(),
                     PlanNum = SqlFunc.Subqueryable<PlanRelationType>().LeftJoin<PlanList>((kr, k) => kr.PlanId == k.Id)
-                         .Where((kr, k) => kr.PlanTypeSpliceName.StartsWith(x.SpliceName))
+                         .Where((kr, k) => kr.PlanTypeId == x.Id)
                          .DistinctCount(kr => kr.PlanId)
                 }
                 )
@@ -325,7 +321,7 @@ namespace Hotline.Api.Controllers
                 if (planDto.ApplyStatus == EPlanApplyStatus.Add)
                 {
                     planDto.Status = EPlanStatus.OnShelf;
-                    planDto.OnShelfTime = DateTime.Now; 
+                    planDto.OnShelfTime = DateTime.Now;
                 }
                 if (planDto.ApplyStatus == EPlanApplyStatus.Update)
                 {

+ 2 - 0
src/Hotline.Api/Controllers/XthxController.cs

@@ -5,6 +5,7 @@ using Hotline.Settings;
 using Hotline.Share.Dtos.CallCenter;
 using Hotline.Share.Enums.CallCenter;
 using MapsterMapper;
+using Microsoft.AspNetCore.Authorization;
 using Microsoft.AspNetCore.Mvc;
 using SqlSugar;
 using System.Text.Json;
@@ -55,6 +56,7 @@ namespace Hotline.Api.Controllers
         /// <param name="dto"></param>
         /// <returns></returns>
         [HttpPost("status/add")]
+        [AllowAnonymous]
         public async Task<string> AddOperationAsync([FromBody] TelOperationXthxDto dto)
         {
             #region 描述

+ 36 - 20
src/Hotline.Application/Caselibrary/CaseApplication.cs

@@ -20,6 +20,7 @@ using Hotline.KnowledgeBase;
 using Hotline.Share.Enums.Planlibrary;
 using System.Numerics;
 using Hotline.Share.Dtos.Planlibrary;
+using Hotline.Planlibrary;
 
 namespace Hotline.Application.Caselibrary
 {
@@ -32,7 +33,6 @@ namespace Hotline.Application.Caselibrary
         #region 注册
 
         private readonly IRepository<CaseList> _caseListRepository;                           //案例库列表
-        private readonly IRepository<CaseRelationType> _caseRelationTypeRepository;           //案例库关联类型
         private readonly IRepository<CaseType> _caseTypeRepository;                           //案例库分类管理
         private readonly IRepository<CaseTypeOrg> _caseTypeOrgRepository;                     //案例库分类关联机构
         private readonly IRepository<CaseCollect> _caseCollectRepository;                     //案例库收藏评分
@@ -46,7 +46,6 @@ namespace Hotline.Application.Caselibrary
 
         public CaseApplication(
             IRepository<CaseList> caseListRepository,
-            IRepository<CaseRelationType> caseRelationTypeRepository,
             IRepository<CaseType> caseTypeRepository,
             IRepository<CaseTypeOrg> caseTypeOrgRepository,
             IRepository<CaseCollect> caseCollectRepository,
@@ -59,7 +58,6 @@ namespace Hotline.Application.Caselibrary
             IBulletinApplication bulletinApplication)
         {
             _caseListRepository = caseListRepository;
-            _caseRelationTypeRepository = caseRelationTypeRepository;
             _caseTypeRepository = caseTypeRepository;
             _caseTypeOrgRepository = caseTypeOrgRepository;
             _caseCollectRepository = caseCollectRepository;
@@ -175,7 +173,7 @@ namespace Hotline.Application.Caselibrary
                 throw UserFriendlyException.SameMessage("存在子级分类!");
 
             //查询是否有案例分类
-            var checkKnowledge = await _caseListRepository.CountAsync(p => p.CaseTypes.Any(t => t.CaseId == Id), cancellationToken);
+            var checkKnowledge = await _caseListRepository.CountAsync(p => p.CaseTypes.Any(t => t.Id == Id), cancellationToken);
             if (checkKnowledge > 0)
                 throw UserFriendlyException.SameMessage("分类存在案例!");
 
@@ -251,7 +249,7 @@ namespace Hotline.Application.Caselibrary
                                                                                               (x.Status == ECaseStatus.Revert && x.CreatorId == _sessionContext.UserId) ||
                                                                                               (x.Status == ECaseStatus.NewDrafts && x.CreatorId == _sessionContext.UserId))
 
-                .WhereIF(!string.IsNullOrEmpty(typeSpliceName), x => x.CaseTypes.Any(t => t.CaseTypeSpliceName.StartsWith(typeSpliceName)))
+                .WhereIF(!string.IsNullOrEmpty(typeSpliceName), x => x.CaseTypes.Any(t => t.SpliceName.StartsWith(typeSpliceName)))
 
                 .WhereIF(pagedDto.CreationTimeStart.HasValue, x => x.CreationTime >= pagedDto.CreationTimeStart)
                 .WhereIF(pagedDto.CreationTimeEnd.HasValue, x => x.CreationTime <= pagedDto.CreationTimeEnd)
@@ -296,26 +294,32 @@ namespace Hotline.Application.Caselibrary
         /// <returns></returns>
         public async Task<string> AddCaseAsync(AddCaseListDto dto, CancellationToken cancellationToken)
         {
-            var pList = _mapper.Map<CaseList>(dto);
+            var cList = _mapper.Map<CaseList>(dto);
 
             var any = await _caseListRepository.Queryable().Where(x => x.Status == ECaseStatus.OnShelf && x.Title == dto.Title).AnyAsync();
             if (any)
                 throw UserFriendlyException.SameMessage("当前案例标题存在重复标题!");
 
-            pList.InitId();
+            cList.InitId();
 
             if (dto.Files != null && dto.Files.Count > 0)
-                pList.FileJson = await _fileRepository.AddFileAsync(dto.Files, pList.Id, "", cancellationToken);
-            await _caseListRepository.AddAsync(pList, cancellationToken);
+                cList.FileJson = await _fileRepository.AddFileAsync(dto.Files, cList.Id, "", cancellationToken);
 
             if (dto.CaseTypes.Any())
             {
-                List<CaseRelationType> types = _mapper.Map<List<CaseRelationType>>(dto.CaseTypes);
-                types.ForEach(x => x.CaseId = pList.Id);
-                await _caseRelationTypeRepository.AddRangeAsync(types, cancellationToken);
+                cList.CaseTypes = dto.CaseTypes.Select(d => new CaseType
+                {
+                    Id = d.Id,
+                    Name = d.Name,
+                    SpliceName = d.SpliceName
+                }).ToList();
             }
 
-            return pList.Id;
+            await _caseListRepository.AddNav(cList)
+                                     .Include(d => d.CaseTypes)
+                                     .ExecuteCommandAsync();
+
+            return cList.Id;
         }
 
         #endregion
@@ -359,20 +363,32 @@ namespace Hotline.Application.Caselibrary
                     Case.FileJson = new List<Share.Dtos.File.FileJson>();
             }
 
-            await _caseListRepository.UpdateNullAsync(Case, cancellationToken);
 
             if (dto.ApplyStatus != ECaseApplyStatus.Delete)
             {
                 if (dto.CaseTypes.Any())
                 {
-                    var anyRelationTypes = await _caseRelationTypeRepository.Queryable().Where(x => x.CaseId == Case.Id).ToListAsync();
-                    if (anyRelationTypes.Any())
-                        await _caseRelationTypeRepository.RemoveRangeAsync(anyRelationTypes);
-                    List<CaseRelationType> types = _mapper.Map<List<CaseRelationType>>(dto.CaseTypes);
-                    types.ForEach(x => x.CaseId = dto.Id);
-                    await _caseRelationTypeRepository.AddRangeAsync(types, cancellationToken);
+                    Case.CaseTypes = dto.CaseTypes.Select(d => new CaseType
+                    {
+                        Id = d.Id
+                    }).ToList();
+
+                    await _caseListRepository.UpdateNav(Case)
+                        .Include(d => d.CaseTypes, new UpdateNavOptions
+                        {
+                            ManyToManyIsUpdateA = true
+                        })
+                        .ExecuteCommandAsync();
+                }
+                else
+                {
+                    await _caseListRepository.UpdateAsync(Case, cancellationToken);
                 }
             }
+            else
+            {
+                await _caseListRepository.UpdateAsync(Case, cancellationToken);
+            }
         }
 
         #endregion

+ 40 - 25
src/Hotline.Application/Planlibrary/PlanApplication.cs

@@ -15,9 +15,7 @@ using Hotline.Application.Bulletin;
 using Hotline.Share.Tools;
 using Hotline.Application.Tools;
 using SqlSugar;
-using Hotline.KnowledgeBase;
-using Hotline.Repository.SqlSugar.Knowledge;
-using Hotline.Share.Enums.KnowledgeBase;
+using System.Numerics;
 using Microsoft.AspNetCore.Http;
 using Hotline.Share.Enums.Caselibrary;
 
@@ -32,7 +30,6 @@ namespace Hotline.Application.Planlibrary
         #region 注册
 
         private readonly IRepository<PlanList> _planListRepository;                      //预案库列表
-        private readonly IRepository<PlanRelationType> _planRelationTypeRepository;      //预案库关联类型
         private readonly IRepository<PlanType> _planTypeRepository;                      //预案库分类管理
         private readonly IRepository<PlanTypeOrg> _planTypeOrgRepository;                //预案库分类关联机构
         private readonly IRepository<PlanCollect> _planCollectRepository;                //预案库收藏评分
@@ -44,7 +41,6 @@ namespace Hotline.Application.Planlibrary
 
         public PlanApplication(
             IRepository<PlanList> planListRepository,
-            IRepository<PlanRelationType> planRelationTypeRepository,
             IRepository<PlanType> planTypeRepository,
             IRepository<PlanTypeOrg> planTypeOrgRepository,
             ISessionContext sessionContext,
@@ -55,7 +51,6 @@ namespace Hotline.Application.Planlibrary
             IRepository<PlanCollect> planCollectRepository)
         {
             _planListRepository = planListRepository;
-            _planRelationTypeRepository = planRelationTypeRepository;
             _planTypeRepository = planTypeRepository;
             _planTypeOrgRepository = planTypeOrgRepository;
             _sessionContext = sessionContext;
@@ -169,7 +164,7 @@ namespace Hotline.Application.Planlibrary
                 throw UserFriendlyException.SameMessage("存在子级分类!");
 
             //查询是否有预案分类
-            var checkKnowledge = await _planListRepository.CountAsync(p => p.PlanTypes.Any(t => t.PlanId == Id), cancellationToken);
+            var checkKnowledge = await _planListRepository.CountAsync(p => p.PlanTypes.Any(t => t.Id == Id), cancellationToken);
             if (checkKnowledge > 0)
                 throw UserFriendlyException.SameMessage("分类存在预案!");
 
@@ -248,7 +243,7 @@ namespace Hotline.Application.Planlibrary
                                                                                               (x.Status == EPlanStatus.Revert && x.CreatorId == _sessionContext.UserId) ||
                                                                                               (x.Status == EPlanStatus.NewDrafts && x.CreatorId == _sessionContext.UserId))
 
-                .WhereIF(!string.IsNullOrEmpty(typeSpliceName), x => x.PlanTypes.Any(t => t.PlanTypeSpliceName.StartsWith(typeSpliceName)))
+                .WhereIF(!string.IsNullOrEmpty(typeSpliceName), x => x.PlanTypes.Any(t => t.SpliceName.StartsWith(typeSpliceName)))
                 .WhereIF(!string.IsNullOrEmpty(hotspotHotSpotFullName), x => x.HotspotType.HotSpotFullName.EndsWith(hotspotHotSpotFullName!))
 
                 .WhereIF(pagedDto.CreationTimeStart.HasValue, x => x.CreationTime >= pagedDto.CreationTimeStart)
@@ -298,15 +293,20 @@ namespace Hotline.Application.Planlibrary
 
             if (dto.Files != null && dto.Files.Count > 0)
                 pList.FileJson = await _fileRepository.AddFileAsync(dto.Files, pList.Id, "", cancellationToken);
-            await _planListRepository.AddAsync(pList, cancellationToken);
 
             if (dto.PlanTypes.Any())
             {
-                List<PlanRelationType> types = _mapper.Map<List<PlanRelationType>>(dto.PlanTypes);
-                types.ForEach(x => x.PlanId = pList.Id);
-                await _planRelationTypeRepository.AddRangeAsync(types, cancellationToken);
+                pList.PlanTypes = dto.PlanTypes.Select(d => new PlanType
+                {
+                    Id = d.Id,
+                    Name = d.Name,
+                    SpliceName = d.SpliceName
+                }).ToList();
             }
 
+            await _planListRepository.AddNav(pList)
+                                     .Include(d => d.PlanTypes)
+                                     .ExecuteCommandAsync();
             return pList.Id;
         }
 
@@ -353,20 +353,32 @@ namespace Hotline.Application.Planlibrary
                     plan.FileJson = new List<Share.Dtos.File.FileJson>();
             }
 
-            await _planListRepository.UpdateNullAsync(plan, cancellationToken);
 
             if (dto.ApplyStatus != EPlanApplyStatus.Delete)
             {
                 if (dto.PlanTypes.Any())
                 {
-                    var anyRelationTypes = await _planRelationTypeRepository.Queryable().Where(x => x.PlanId == plan.Id).ToListAsync();
-                    if (anyRelationTypes.Any())
-                        await _planRelationTypeRepository.RemoveRangeAsync(anyRelationTypes);
-                    List<PlanRelationType> types = _mapper.Map<List<PlanRelationType>>(dto.PlanTypes);
-                    types.ForEach(x => x.PlanId = dto.Id);
-                    await _planRelationTypeRepository.AddRangeAsync(types, cancellationToken);
+                    plan.PlanTypes = dto.PlanTypes.Select(d => new PlanType
+                    {
+                        Id = d.Id,
+                    }).ToList();
+
+                    await _planListRepository.UpdateNav(plan)
+                        .Include(d => d.PlanTypes, new UpdateNavOptions
+                        {
+                            ManyToManyIsUpdateA = true
+                        })
+                        .ExecuteCommandAsync();
+                }
+                else
+                {
+                    await _planListRepository.UpdateAsync(plan, cancellationToken);
                 }
             }
+            else
+            {
+                await _planListRepository.UpdateAsync(plan, cancellationToken);
+            }
         }
 
         #endregion
@@ -438,7 +450,10 @@ namespace Hotline.Application.Planlibrary
         /// <returns></returns>
         public async Task<PlanInfoDto> GetPlanAsync(string Id, bool? IsAddPv, CancellationToken cancellationToken)
         {
-            var plan = await _planListRepository.GetAsync(Id);
+            var plan = await _planListRepository.Queryable()
+                        .Includes(x => x.PlanTypes)
+                        .FirstAsync(p => p.Id == Id, cancellationToken);
+            //var plan = await _planListRepository.GetAsync(Id);
             if (plan == null)
                 throw UserFriendlyException.SameMessage("预案库查询失败");
             ;
@@ -455,11 +470,11 @@ namespace Hotline.Application.Planlibrary
                 planInfoDto.HotspotName = hot.HotSpotFullName;
 
             // 分类
-            var relationType = await _planRelationTypeRepository.QueryAsync(x => x.PlanId == Id && x.CreatorId == _sessionContext.UserId);
-            if (relationType != null)
-            {
-                planInfoDto.PlanTypes = _mapper.Map<List<PlanRelationTypeDto>>(relationType);
-            }
+            //var relationType = await _planRelationTypeRepository.QueryAsync(x => x.PlanId == Id);
+            //if (relationType != null)
+            //{
+            //    planInfoDto.PlanTypes = _mapper.Map<List<PlanRelationTypeDto>>(relationType);
+            //}
 
             // 收藏
             var collect = await _planCollectRepository.GetAsync(x => x.PlanId == Id && x.CreatorId == _sessionContext.UserId);

+ 4 - 4
src/Hotline.Share/Dtos/Caselibrary/CaseDataDto.cs

@@ -125,7 +125,7 @@ namespace Hotline.Share.Dtos.Caselibrary
 
             if (CaseTypes != null && CaseTypes.Any())
             {
-                var names = CaseTypes.Select(x => x.CaseTypeName).ToList();
+                var names = CaseTypes.Select(x => x.Name).ToList();
                 return string.Join(",", names);
             }
             return "";
@@ -172,18 +172,18 @@ namespace Hotline.Share.Dtos.Caselibrary
         /// <summary>
         /// 案例库类型ID
         /// </summary>
-        public string CaseTypeId { get; set; }
+        public string Id { get; set; }
 
         /// <summary>
         /// 案例库类型名称
         /// </summary>
-        public string CaseTypeName { get; set; }
+        public string Name { get; set; }
 
 
         /// <summary>
         /// 案例库类型名称
         /// </summary>
-        public string CaseTypeSpliceName { get; set; }
+        public string SpliceName { get; set; }
     }
 }
 

+ 1 - 1
src/Hotline.Share/Dtos/Caselibrary/CaseListDto.cs

@@ -394,7 +394,7 @@ namespace Hotline.Share.Dtos.Caselibrary
 
             if (CaseTypes != null && CaseTypes.Any())
             {
-                var names = CaseTypes.Select(x => x.CaseTypeName).ToList();
+                var names = CaseTypes.Select(x => x.Name).ToList();
                 return string.Join(",", names);
             }
             return "";

+ 1 - 1
src/Hotline.Share/Dtos/Order/Detail/OrderFlowTraceDto.cs

@@ -25,7 +25,7 @@ public class OrderFlowTraceDto
     /// <summary>
     /// 交班人部门
     /// </summary>
-    public string AssignOrgName { get; set; }
+    public string AssignerOrgName { get; set; }
 
     /// <summary>
     /// 受理人

+ 25 - 6
src/Hotline.Share/Dtos/Planlibrary/PlanDataDto.cs

@@ -113,7 +113,7 @@ namespace Hotline.Share.Dtos.Planlibrary
         /// <summary>
         /// 预案分类
         /// </summary>
-        public List<PlanRelationTypeDto> PlanTypes { get; set; }
+        public List<PlanRelationTypeDto2> PlanTypes { get; set; }
 
         /// <summary>
         /// 预案分类名称
@@ -124,12 +124,12 @@ namespace Hotline.Share.Dtos.Planlibrary
         /// 获取预案分类名称
         /// </summary>
         /// <returns></returns>
-        public string GetPlanTypeText(List<PlanRelationTypeDto> items)
+        public string GetPlanTypeText(List<PlanRelationTypeDto2> items)
         {
 
             if (PlanTypes != null && PlanTypes.Any())
             {
-                var names = PlanTypes.Select(x => x.PlanTypeName).ToList();
+                var names = PlanTypes.Select(x => x.Name).ToList();
                 return string.Join(",", names);
             }
             return "";
@@ -164,18 +164,37 @@ namespace Hotline.Share.Dtos.Planlibrary
         /// <summary>
         /// 预案库类型ID
         /// </summary>
-        public string PlanTypeId { get; set; }
+        public string Id { get; set; }
+
+        /// <summary>
+        /// 预案库类型名称
+        /// </summary>
+        public string Name { get; set; }
+
+
+        /// <summary>
+        /// 预案库类型名称
+        /// </summary>
+        public string SpliceName { get; set; }
+    }
+
+    public record PlanRelationTypeDto2
+    {
+        /// <summary>
+        /// 预案库类型ID
+        /// </summary>
+        public string Id { get; set; }
 
         /// <summary>
         /// 预案库类型名称
         /// </summary>
-        public string PlanTypeName { get; set; }
+        public string Name { get; set; }
 
 
         /// <summary>
         /// 预案库类型名称
         /// </summary>
-        public string PlanTypeSpliceName { get; set; }
+        public string SpliceName { get; set; }
     }
 }
 

+ 3 - 3
src/Hotline.Share/Dtos/Planlibrary/PlanListDto.cs

@@ -341,7 +341,7 @@ namespace Hotline.Share.Dtos.Planlibrary
         /// <summary>
         /// 预案分类
         /// </summary>
-        public List<PlanRelationTypeDto> PlanTypes { get; set; }
+        public List<PlanRelationTypeDto2> PlanTypes { get; set; }
 
         /// <summary>
         /// 预案分类名称
@@ -352,12 +352,12 @@ namespace Hotline.Share.Dtos.Planlibrary
         /// 获取预案分类名称
         /// </summary>
         /// <returns></returns>
-        public string GetPlanTypeText(List<PlanRelationTypeDto> items)
+        public string GetPlanTypeText(List<PlanRelationTypeDto2> items)
         {
 
             if (PlanTypes != null && PlanTypes.Any())
             {
-                var names = PlanTypes.Select(x => x.PlanTypeName).ToList();
+                var names = PlanTypes.Select(x => x.Name).ToList();
                 return string.Join(",", names);
             }
             return "";

+ 20 - 1
src/Hotline.Share/Dtos/TrCallCenter/TrTelDao.cs

@@ -1,4 +1,5 @@
 
+using Hotline.Share.Dtos.Caselibrary;
 using Hotline.Share.Dtos.FlowEngine.Workflow;
 using Hotline.Share.Dtos.Order;
 using Hotline.Share.Enums.CallCenter;
@@ -1261,7 +1262,25 @@ namespace Hotline.Share.Dtos.TrCallCenter
         /// <summary>
         /// 时长(单位:秒)
         /// </summary>
-        public double? RestDuration { get; set; }
+        public decimal RestDuration { get; set; }
+
+        /// <summary>
+        /// 案例分类名称
+        /// </summary>
+        public decimal RestDuration2 => GetRestDuration(RestDuration);
+
+        /// <summary>
+        /// 获取案例分类名称
+        /// </summary>
+        /// <returns></returns>
+        public decimal GetRestDuration(decimal value)
+        {
+            if (value != 0)
+            {
+                return Math.Round(value, 2);
+            }
+            return 0;
+        }
 
         /// <summary>
         /// 备注(冗余)

+ 0 - 5
src/Hotline/CallCenter/Tels/TelOperationXthx.cs

@@ -1,11 +1,6 @@
 using Hotline.Share.Enums.CallCenter;
 using SqlSugar;
-using System;
-using System.Collections.Generic;
 using System.ComponentModel;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 using XF.Domain.Repository;
 
 namespace Hotline.CallCenter.Tels

+ 7 - 5
src/Hotline/CaseLibrary/CaseList.cs

@@ -1,5 +1,4 @@
 using Hotline.Settings;
-using Hotline.Settings.Hotspots;
 using Hotline.Users;
 using SqlSugar;
 using System.ComponentModel;
@@ -193,10 +192,13 @@ public class CaseList : CreationEntity
     public Knowledge? Knowledge { get; set; }
 
     /// <summary>
-	/// 案例库类型关联ID
-	/// </summary>
-	[Navigate(NavigateType.OneToMany, nameof(CaseRelationType.CaseId))]
-    public List<CaseRelationType> CaseTypes { get; set; }
+    /// 案例库类型关联ID
+    /// </summary>
+    //[Navigate(NavigateType.OneToMany, nameof(CaseRelationType.CaseId))]
+    //   public List<CaseRelationType> CaseTypes { get; set; }
+
+    [Navigate(typeof(CaseRelationType), nameof(CaseRelationType.CaseId), nameof(CaseRelationType.CaseTypeId))]
+    public List<CaseType> CaseTypes { get; set; }
 
     /// <summary>
     /// 附件

+ 3 - 23
src/Hotline/CaseLibrary/CaseRelationType.cs

@@ -1,6 +1,5 @@
-using SqlSugar;
-using System.ComponentModel;
-using XF.Domain.Repository;
+using System.ComponentModel;
+using XF.Domain.Entities;
 
 namespace Hotline.CaseLibrary;
 
@@ -8,10 +7,7 @@ namespace Hotline.CaseLibrary;
 /// 案例库关联类型
 /// </summary>
 [Description("案例库关联类型")]
-[SugarIndex("index_caseRelationType_caseId", nameof(CaseRelationType.CaseId), OrderByType.Desc)]
-[SugarIndex("index_caseRelationType_typeId", nameof(CaseRelationType.CaseTypeId), OrderByType.Desc)]
-[SugarIndex("index_caseRelationType_spliceName", nameof(CaseRelationType.CaseTypeSpliceName), OrderByType.Desc)]
-public class CaseRelationType : FullStateEntity
+public class CaseRelationType : ITable, IEntity
 {
     /// <summary>
     /// 案例库ID
@@ -22,21 +18,5 @@ public class CaseRelationType : FullStateEntity
     /// 案例库类型ID
     /// </summary>
     public string CaseTypeId { get; set; }
-
-    /// <summary>
-    /// 案例库类型名称
-    /// </summary>
-    public string CaseTypeName { get; set; }
-
-    /// <summary>
-    /// 案例库类型名称
-    /// </summary>
-    public string CaseTypeSpliceName { get; set; }
-
-    /// <summary>
-    /// 案例库类型
-    /// </summary>
-    [Navigate(NavigateType.OneToOne, nameof(CaseTypeId))]
-    public CaseType CaseType { get; set; }
 }
 

+ 7 - 2
src/Hotline/Planlibrary/PlanList.cs

@@ -175,8 +175,13 @@ public class PlanList : CreationEntity
     /// <summary>
 	/// 预案库类型关联ID
 	/// </summary>
-	[Navigate(NavigateType.OneToMany, nameof(PlanRelationType.PlanId))]
-    public List<PlanRelationType> PlanTypes { get; set; }
+	//[Navigate(NavigateType.OneToMany, nameof(PlanRelationType.PlanId))]
+    //public List<PlanRelationType> PlanTypes { get; set; }
+
+
+    [Navigate(typeof(PlanRelationType), nameof(PlanRelationType.PlanId), nameof(PlanRelationType.PlanTypeId))]
+    public List<PlanType> PlanTypes { get; set; }
+
 
     /// <summary>
     /// 附件

+ 4 - 22
src/Hotline/Planlibrary/PlanRelationType.cs

@@ -1,6 +1,6 @@
 using SqlSugar;
 using System.ComponentModel;
-using XF.Domain.Repository;
+using XF.Domain.Entities;
 
 namespace Hotline.Planlibrary;
 
@@ -8,35 +8,17 @@ namespace Hotline.Planlibrary;
 /// 预案库关联类型
 /// </summary>
 [Description("预案库关联类型")]
-[SugarIndex("index_planRelationType_planId", nameof(PlanRelationType.PlanId), OrderByType.Desc)]
-[SugarIndex("index_planRelationType_typeId", nameof(PlanRelationType.PlanTypeId), OrderByType.Desc)]
-[SugarIndex("index_planRelationType_spliceName", nameof(PlanRelationType.PlanTypeSpliceName), OrderByType.Desc)]
-public class PlanRelationType : FullStateEntity
+public class PlanRelationType : ITable, IEntity
 {
     /// <summary>
     /// 预案库ID
     /// </summary>
+    [SugarColumn(IsPrimaryKey = true)]
     public string PlanId { get; set; }
 
     /// <summary>
     /// 预案库类型ID
     /// </summary>
+    [SugarColumn(IsPrimaryKey = true)]
     public string PlanTypeId { get; set; }
-
-    /// <summary>
-    /// 预案库类型名称
-    /// </summary>
-    public string PlanTypeName { get; set; }
-
-    /// <summary>
-    /// 预案库类型名称
-    /// </summary>
-    public string PlanTypeSpliceName { get; set; }
-
-    /// <summary>
-    /// 预案库类型
-    /// </summary>
-    [Navigate(NavigateType.OneToOne, nameof(PlanTypeId))]
-    public PlanType PlanType { get; set; }
 }
-