fix BasicType类型修正

This commit is contained in:
cheche
2024-01-09 16:28:58 +08:00
parent 3d911d4cdb
commit 2ac9e4ceb2
8 changed files with 98 additions and 81 deletions

View File

@@ -1,8 +1,5 @@
using System.Reflection;
using Dlhis.Common.Response;
using Dlhis.Entity.Basic.Entity;
using Kurisu.AspNetCore.Utils.Extensions;
using Kurisu.SqlSugar.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
@@ -16,14 +13,6 @@ namespace Dlhis.Common.EnumSetting;
[ApiController]
public class EnumsController : ControllerBase
{
private readonly IDbContext _dbContext;
public EnumsController(IDbContext dbContext)
{
_dbContext = dbContext;
}
/// <summary>
/// 获取所有枚举
/// </summary>
@@ -57,30 +46,4 @@ public class EnumsController : ControllerBase
};
});
}
/// <summary>
/// 获取档案类型数据
/// </summary>
/// <param name="code"></param>
/// <returns></returns>
public object GetTypes(string type)
{
var types = _dbContext.Queryable<GainfoTypeEntity>().Where(x => x.Type == type).ToList();
return types.Select(x =>
{
return new
{
Type = x.Type,
Data = types.Select(x => new GainfoTypeResponse
{
Id = x.Id,
Type = x.Type,
Code = x.Code,
Descript = x.Descript,
DescriptEn = x.DescriptEn,
Remark = x.Remark,
}).ToList()
};
});
}
}

View File

@@ -0,0 +1,48 @@
using Dlhis.Entity.Basic.Entity;
using Kurisu.SqlSugar.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace Dlhis.Common.EnumSetting;
/// <summary>
/// 类型
/// </summary>
[Authorize]
[Route("api/[controller]")]
[ApiController]
public class TypesController : ControllerBase
{
private readonly IDbContext _dbContext;
public TypesController(IDbContext dbContext)
{
_dbContext = dbContext;
}
/// <summary>
/// Basic类型表
/// </summary>
/// <returns></returns>
[HttpGet]
public object GetTypes()
{
var types = _dbContext.Queryable<BasicTypeEntity>().ToList().AsEnumerable();
var distinctTypes = types.Select(x => x.Type).Distinct();
return distinctTypes.Select(type =>
{
var date = types.Where(item => item.Type == type)
.Select(item => new
{
Key = item.Code,
Value = item.Descript
});
return new
{
Type = type,
Date = date
};
});
}
}

View File

@@ -0,0 +1,15 @@
using Kurisu.AspNetCore.Startup;
using Kurisu.SqlSugar.Extensions;
namespace Dlhis.Common.Packs
{
public class SqlSugarPack : BaseAppPack
{
public override bool IsBeforeUseRouting { get; }
public override void ConfigureServices(IServiceCollection services)
{
services.AddSqlSugar();
}
}
}

View File

@@ -1,38 +0,0 @@
using SqlSugar;
namespace Dlhis.Common.Response
{
public class GainfoTypeResponse
{
/// <summary>
/// id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 类型
/// </summary>
public string Type { get; set; }
/// <summary>
/// 编码
/// </summary>
public string Code { get; set; }
/// <summary>
/// 中文描述
/// </summary>
public string Descript { get; set; }
/// <summary>
/// 英文描述
/// </summary>
public string DescriptEn { get; set; }
/// <summary>
/// 备注
/// </summary>
public string Remark { get; set; }
}
}

View File

@@ -4,5 +4,28 @@
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"SwaggerOptions": {
"Enable": true,
"Authority": "https://yikatong.isawesome.cn/oauth2",
"ClientId": "4fb184324eac4180",
"ClientSecret": "8ac8f235152f1524",
"Scopes": {
"openid": "openid",
"profile": "profile",
"yikatong": "yikatong"
}
},
"IdentityServerOptions": {
"Authority": "https://yikatong.isawesome.cn/oauth2",
"RequireHttpsMetadata": true,
"Issuer": "identity.isawesome.cn",
"Audience": "",
"Pat": {
"Enable": false,
"Scheme": "token",
"ClientId": "reference",
"ClientSecret": "123456"
}
}
}

View File

@@ -5,6 +5,14 @@
"Microsoft.AspNetCore": "Warning"
}
},
"SqlSugarOptions": {
"DefaultConnectionString": "server=192.168.199.124;port=3306;userid=root;password=dlhis123;database=yikatong;charset=utf8mb4;",
"SlaveConnectionString": [],
"Timeout": 30,
"SlowSqlTime": 1,
"EnableSqlLog": true
},
"AllowedHosts": "*",
"SwaggerOptions": {
"Enable": true,

View File

@@ -3,10 +3,10 @@
namespace Dlhis.Entity.Basic.Entity
{
/// <summary>
/// 用户档案类型表
/// Basic类型表
/// </summary>
[SugarTable(TableName = "GainfoType", TableDescription = "用户档案类型表")]
public class GainfoTypeEntity : SugarBaseEntity
[SugarTable(TableName = "BasicType", TableDescription = "Basic类型表")]
public class BasicTypeEntity : SugarBaseEntity
{
/// <summary>
/// 类型

View File

@@ -11,8 +11,6 @@ using Dlhis.ScheduledTask.Configurations;
using Kurisu.SqlSugar.Services;
using Dlhis.Entity.Basic.Entity;
using Dlhis.ScheduledTask.Wsproxy.Dlhis.JinkoHr.WsProxy;
using System.Net;
using System;
using Dlhis.Entity.Basic.Enums;
namespace Dlhis.ScheduledTask.Job
@@ -166,7 +164,7 @@ namespace Dlhis.ScheduledTask.Job
{
SapNo = item.ano,
No = item.guestno,
GType = item.@class,
//GType = item.@class,
Name = item.gname,
Code = item.ename,
CountryNo = item.country,