StableVersion4.3/HL_FristAidPlatform_DataBase/Base/T_Base_MPDSDB.cs

63 lines
1.9 KiB
C#
Raw Permalink Normal View History

2024-03-11 09:47:34 +08:00
using HL_FristAidPlatform_Help;
using HL_FristAidPlatform_IDataBase;
using HL_FristAidPlatform_Models;
using SqlSugar;
using System.Collections.Generic;
namespace HL_FristAidPlatform_DataBase
{
/// <summary>
/// MPDS
/// </summary>
public class T_Base_MPDSDB : BaseDB, IT_Base_MPDS
{
public SqlSugarClient db = GetClient();
/// <summary>
/// 根据类型获取MPDS针状集合
/// </summary>
/// <param name="type"></param>
/// <returns></returns>
public TableModel<T_Base_MPDS> GetListOfType(int type)
{
var data = db.Queryable<T_Base_MPDS>().Where(i => i.MPDSType == type).ToList();
TableModel<T_Base_MPDS> t = new TableModel<T_Base_MPDS>();
t.Code = 0;
t.PageCount = data.Count;
t.TotalNumber = data.Count;
t.Data = data;
t.Msg = "成功";
return t;
}
/// <summary>
///
/// </summary>
/// <param name="type"></param>
/// <returns></returns>
public List<T_Base_MPDS> GetListOfTypeGroup(int type)
{
int groupLimit=7;
List<T_Base_MPDS> list = new List<T_Base_MPDS>();
List<T_Base_MPDS> data = new List<T_Base_MPDS>();
data = db.Queryable<T_Base_MPDS>().Where(i => i.MPDSType == type).Select(i=>new T_Base_MPDS()).ToList();
int total = data.Count;
int group = total / groupLimit;
int start=1;
int end= groupLimit;
for (int i = 1; i <= group; i++)
{
//data.ForEach(i=>i.){ };
List<T_Base_MPDS> list1 = new List<T_Base_MPDS>();
list1[start] = data[start];
start = groupLimit + 1;
end = start + groupLimit-1;
list.AddRange(list1);
}
return list;
}
}
}