fix 查询优化
This commit is contained in:
@@ -1,15 +1,11 @@
|
||||
using Dlhis.Basic.BusinessPlace.Response;
|
||||
using Dlhis.Basic.Device.Response;
|
||||
using Dlhis.Basic.Device.Services;
|
||||
using Dlhis.Basic.Organization.Request;
|
||||
using Dlhis.Basic.Organization.Response;
|
||||
using Dlhis.Basic.Organization.Services;
|
||||
using Dlhis.Basic.Organization.Services.Implements;
|
||||
using Dlhis.Entity.Device.Entities;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Org.BouncyCastle.Asn1.Ocsp;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Controllers;
|
||||
|
||||
@@ -32,7 +28,7 @@ public class GainfoPermissionsController : ControllerBase
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("placesByGainfo")]
|
||||
public async Task<Pagination<BusinessPlaceResponse>> GetPlaceByGainfoAsync([FromQuery]DeviceAssRequest request)
|
||||
public async Task<Pagination<BusinessPlaceResponse>> GetPlaceByGainfoAsync([FromQuery] DeviceAssRequest request)
|
||||
{
|
||||
return await _gainfoPermissions.GetPlaceByGainfoAsync(request);
|
||||
}
|
||||
@@ -55,7 +51,7 @@ public class GainfoPermissionsController : ControllerBase
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("assignDeviceCodes")]
|
||||
public async Task<Pagination<DevicePageResponse>> GetAssignDeviceCodesAsync([FromQuery]DeviceAssRequest request)
|
||||
public async Task<Pagination<DevicePageResponse>> GetAssignDeviceCodesAsync([FromQuery] DeviceAssRequest request)
|
||||
{
|
||||
return await _gainfoPermissions.GetAssignDeviceCodesAsync(request);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Request
|
||||
namespace Dlhis.Basic.Organization.Request;
|
||||
|
||||
public class DeviceAssRequest : PageDto
|
||||
{
|
||||
public class DeviceAssRequest : PageDto
|
||||
{
|
||||
[Required]
|
||||
public string UserNo { get; set; }
|
||||
}
|
||||
[Required]
|
||||
public string UserNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备类型
|
||||
/// </summary>
|
||||
[EnumDataType(typeof(DeviceTypeEnumType))]
|
||||
public DeviceTypeEnumType? DeviceType { get; set; }
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Dlhis.Basic.BusinessPlace.Response;
|
||||
using Dlhis.Basic.Device.Request;
|
||||
using Dlhis.Basic.Device.Response;
|
||||
using Dlhis.Basic.Device.Services;
|
||||
using Dlhis.Basic.Organization.Request;
|
||||
@@ -10,7 +9,6 @@ using Dlhis.Entity.Canteen.Enums;
|
||||
using Dlhis.Entity.Device.Entities;
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
using Dlhis.Entity.Sys.Enums;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.SqlSugar.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
@@ -157,6 +155,7 @@ public class GainfoPermissions : IGainfoPermissions
|
||||
.LeftJoin<DeviceTemplateEntity>((d, dt) => d.TemplateCode == dt.Code)
|
||||
.LeftJoin<DeviceRegistryEntity>((d, dt, dr) => d.UniqueNo == dr.DeviceUniqueNo)
|
||||
.LeftJoin<BusinessPlaceEntity>((d, dt, dr, bp) => dr.BusinessPlaceCode == bp.Code)
|
||||
.WhereIF(request.DeviceType.HasValue, d => d.Type == request.DeviceType)
|
||||
.Where(d => ids.Contains(d.Code))
|
||||
.Select((d, dt, dr, bp) => new DevicePageResponse
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@ public class DepartmentEntity : SugarBaseEntity
|
||||
/// <summary>
|
||||
/// 部门号
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "部门号", IsNullable = false)]
|
||||
[SugarColumn(ColumnDescription = "部门号", IsNullable = false, UniqueGroupNameList = new[] { "idx_Department_No" })]
|
||||
public string No { get; set; }
|
||||
|
||||
/// <summary>
|
||||
@@ -24,6 +24,6 @@ public class DepartmentEntity : SugarBaseEntity
|
||||
/// <summary>
|
||||
/// 部门名称
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "部门名称" , IsNullable = false)]
|
||||
[SugarColumn(ColumnDescription = "部门名称", IsNullable = false)]
|
||||
public string Name { get; set; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user