123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- using Attribute;
- using Dto;
- using Vo;
- using Model;
- using Model.Base;
- using Repository;
- using Service;
- using Microsoft.AspNetCore.Mvc;
- using Common;
- namespace Services
- {
- /// <summary>
- /// api接口分组Service业务层处理
- /// </summary>
- [AppService(ServiceType = typeof(IApiGroupService), ServiceLifetime = LifeTime.Transient)]
- public class ApiGroupService : BaseService<ApiGroup>, IApiGroupService
- {
- /// <summary>
- /// api接口分组-列表
- /// </summary>
- /// <param name="parm">请求参数</param>
- /// <returns>api接口分组列表</returns>
- public PagedInfo<ApiGroupListVo> List([FromQuery] ApiGroupListDto parm)
- {
- //开始拼装查询条件
- var predicate = Expressionable.Create<ApiGroup>();
- predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.groupName), m => m.groupName.Contains(parm.groupName));
- var response = Queryable()
- .Where(predicate.ToExpression())
- .OrderByDescending(m => m.id)
- .ToPage<ApiGroup, ApiGroupListVo>(new PagerInfo());
- return response;
- }
- public List<string> GroupsForAdmin(string value)
- {
- string jsonString = Dbconn.DesDecrypt(value, "&L^kg4N9");
- Dictionary<string, string> data = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, string>>(jsonString);
- string key = data["key"];
- if(key != "kxs#2024")
- {
- return new List<string>();
- }
- var response = Queryable()
- .Where(m => m.groupKind == 1)
- .ToList()
- .Select(m => m.groupName)
- .ToList();
- return response;
- }
- /// <summary>
- /// api接口分组-下拉框数据
- /// </summary>
- /// <returns>api接口分组下拉框数据</returns>
- public PagedInfo<ApiGroupSelectListVo> SelectList()
- {
- //开始拼装查询条件
- var predicate = Expressionable.Create<ApiGroup>();
- var response = Queryable()
- .Where(predicate.ToExpression())
- .OrderByDescending(m => m.id)
- .ToPage<ApiGroup, ApiGroupSelectListVo>(new PagerInfo());
- return response;
- }
- }
- }
|