61 lines
2.2 KiB
C#
61 lines
2.2 KiB
C#
using HL_FristAidPlatform_Help;
|
|
using HL_FristAidPlatform_IDataBase;
|
|
using HL_FristAidPlatform_Models;
|
|
using SqlSugar;
|
|
|
|
namespace HL_FristAidPlatform_DataBase
|
|
{
|
|
public class T_Base_HospitalRightDB : BaseDB, IT_Base_HospitalRight
|
|
{
|
|
public SqlSugarClient db = GetClient();
|
|
public bool Add(T_Base_HospitalRight model)
|
|
{
|
|
return db.Insertable(model).IgnoreColumns(ignoreNullColumn: true).ExecuteCommand() == 1 ? true : false;
|
|
}
|
|
|
|
public bool Dels(dynamic[] ids)
|
|
{
|
|
return db.Deleteable<T_Base_HospitalRight>().In(new dynamic[] { ids }).ExecuteCommand() == 1 ? true : false;
|
|
}
|
|
|
|
public T_Base_HospitalRight Get(long id)
|
|
{
|
|
return db.Queryable<T_Base_HospitalRight>().First(it => it.ID == id);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据医院编号获取医院所开启的系统模块
|
|
/// </summary>
|
|
/// <param name="hospitalID">医院编号</param>
|
|
/// <returns></returns>
|
|
public TableModel<T_Base_HospitalRight> GetList(long hospitalID)
|
|
{
|
|
var listMode = db.Queryable<T_Base_HospitalRight>().WhereIF(hospitalID != 0, (HospitalRight) => HospitalRight.HospitalID == hospitalID && HospitalRight.DeleteFlag == 0).OrderBy((HospitalRight) => HospitalRight.SystemModuleID).ToList();
|
|
|
|
TableModel<T_Base_HospitalRight> t = new TableModel<T_Base_HospitalRight>();
|
|
t.Code = 0;
|
|
t.PageCount = listMode.Count;
|
|
t.TotalNumber = listMode.Count;
|
|
t.Data = listMode;
|
|
t.Msg = "成功";
|
|
return t;
|
|
}
|
|
|
|
public bool Update(T_Base_HospitalRight model)
|
|
{
|
|
return db.Updateable(model).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand() == 1 ? true : false;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 物理删除
|
|
/// 根据医院编号删除所拥有的模块
|
|
/// </summary>
|
|
/// <param name="hospitalID">医院编号</param>
|
|
/// <returns></returns>
|
|
public int PhysicalDelete(long hospitalID)
|
|
{
|
|
return db.Deleteable<T_Base_HospitalRight>().Where(it => it.HospitalID == hospitalID).ExecuteCommand();
|
|
}
|
|
}
|
|
}
|