191 lines
6.5 KiB
C#
191 lines
6.5 KiB
C#
|
using HL_FristAidPlatform_Help;
|
|||
|
using HL_FristAidPlatform_IDataBase;
|
|||
|
using HL_FristAidPlatform_Models;
|
|||
|
using SqlSugar;
|
|||
|
|
|||
|
namespace HL_FristAidPlatform_DataBase
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// 会议图片
|
|||
|
/// </summary>
|
|||
|
public class T_Service_Meeting_ImageDB : BaseDB, IT_Service_Meeting_Image
|
|||
|
{
|
|||
|
public SqlSugarClient db = GetClient();
|
|||
|
|
|||
|
#region 增
|
|||
|
/// <summary>
|
|||
|
/// 新增
|
|||
|
/// </summary>
|
|||
|
/// <param name="model">实体</param>
|
|||
|
/// <returns></returns>
|
|||
|
public bool Add(T_Service_Meeting_Image model)
|
|||
|
{
|
|||
|
return db.Insertable(model).ExecuteCommand() == 0 ? false : true;
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 新增 仅更新赋值的字段
|
|||
|
/// </summary>
|
|||
|
/// <param name="model">实体类</param>
|
|||
|
/// <returns></returns>
|
|||
|
public int AddNotNullColumns(T_Service_Meeting_Image model)
|
|||
|
{
|
|||
|
return db.Insertable(model).IgnoreColumns(ignoreNullColumn: true).ExecuteCommand();
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 新增 仅更新赋值的字段
|
|||
|
/// 用于移动端
|
|||
|
/// </summary>
|
|||
|
/// <param name="model">实体类</param>
|
|||
|
/// <returns></returns>
|
|||
|
public int AddForApp(T_Service_Meeting_Image model)
|
|||
|
{
|
|||
|
return db.Insertable(model).IgnoreColumns(ignoreNullColumn: true).ExecuteCommand();
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 删
|
|||
|
/// <summary>
|
|||
|
/// 删除一条数据
|
|||
|
/// </summary>
|
|||
|
public bool Delete(long ID)
|
|||
|
{
|
|||
|
return db.Deleteable<T_Service_Meeting_Image>(it => it.ID == ID).ExecuteCommand() == 0 ? false : true; ;
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 逻辑删除
|
|||
|
/// </summary>
|
|||
|
/// <param name="model">实体类</param>
|
|||
|
/// <returns></returns>
|
|||
|
public int LogicalDelete(T_Service_Meeting_Image model)
|
|||
|
{
|
|||
|
return db.Updateable(model).UpdateColumns(it => new { it.DeleteFlag, it.EditorID, it.Editor, it.EditTime }).Where(it => it.ID == model.ID).ExecuteCommand();
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 删除
|
|||
|
/// 用于移动端
|
|||
|
/// </summary>
|
|||
|
/// <param name="model">实体类,ID必填</param>
|
|||
|
/// <returns></returns>
|
|||
|
public int DeleteForApp(T_Service_Meeting_Image model)
|
|||
|
{
|
|||
|
return db.Updateable(model).UpdateColumns(it => new { it.DeleteFlag, it.EditorID, it.Editor, it.EditTime }).ExecuteCommand();
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 改
|
|||
|
/// <summary>
|
|||
|
/// 更新一条数据
|
|||
|
/// </summary>
|
|||
|
public bool Update(T_Service_Meeting_Image model)
|
|||
|
{
|
|||
|
return db.Updateable(model).ExecuteCommand() == 0 ? false : true;
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 仅更新赋值的字段
|
|||
|
/// </summary>
|
|||
|
/// <param name="model">实体类</param>
|
|||
|
/// <returns></returns>
|
|||
|
public int UpdateNotNullColumns(T_Service_Meeting_Image model)
|
|||
|
{
|
|||
|
return db.Updateable(model).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 修改--仅更新赋值的字段
|
|||
|
/// 用于移动端
|
|||
|
/// </summary>
|
|||
|
/// <param name="model">实体类</param>
|
|||
|
/// <returns></returns>
|
|||
|
public int UpdateForApp(T_Service_Meeting_Image model)
|
|||
|
{
|
|||
|
return db.Updateable(model).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 查
|
|||
|
/// <summary>
|
|||
|
/// 得到一个对象实体
|
|||
|
/// </summary>
|
|||
|
public T_Service_Meeting_Image GetModel(long ID)
|
|||
|
{
|
|||
|
return db.Queryable<T_Service_Meeting_Image>().First(it => it.ID == ID);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 得到一个对象实体
|
|||
|
/// 用于移动端
|
|||
|
/// </summary>
|
|||
|
/// <param name="id">患者编号</param>
|
|||
|
/// <param name="guid">GUID</param>
|
|||
|
/// <returns></returns>
|
|||
|
public TableModel<T_Service_Meeting_Image> GetModelForApp(long id, string guid)
|
|||
|
{
|
|||
|
TableModel<T_Service_Meeting_Image> t = new TableModel<T_Service_Meeting_Image>();
|
|||
|
var listMode = db.Queryable<T_Service_Meeting_Image>()
|
|||
|
.Where(it => it.DeleteFlag == 0)
|
|||
|
.WhereIF(id > 0, it => it.ID == id && it.DeleteFlag == 0)
|
|||
|
.WhereIF(!string.IsNullOrEmpty(guid), it => it.GUID == guid).ToList();
|
|||
|
|
|||
|
t.Code = 0;
|
|||
|
t.PageCount = listMode.Count;
|
|||
|
t.TotalNumber = listMode.Count;
|
|||
|
t.Data = listMode;
|
|||
|
t.Msg = "成功";
|
|||
|
return t;
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获得数据列表
|
|||
|
/// </summary>
|
|||
|
/// <param name="meetingGuid">会议编号</param>
|
|||
|
/// <param name="keyWord">关键词</param>
|
|||
|
/// <returns></returns>
|
|||
|
public TableModel<T_Service_Meeting_Image> GetList(string meetingGuid, string keyWord)
|
|||
|
{
|
|||
|
TableModel<T_Service_Meeting_Image> t = new TableModel<T_Service_Meeting_Image>();
|
|||
|
|
|||
|
var listMode = db.Queryable<T_Service_Meeting_Image>()
|
|||
|
.Where(it => it.MeetingGUID == meetingGuid && it.DeleteFlag == 0)
|
|||
|
.WhereIF(!string.IsNullOrEmpty(keyWord), it => it.PhotoName.Contains(keyWord))
|
|||
|
.OrderBy((it) => it.CreationDate, OrderByType.Desc).ToList();
|
|||
|
|
|||
|
t.Code = 0;
|
|||
|
t.PageCount = listMode.Count;
|
|||
|
t.TotalNumber = listMode.Count;
|
|||
|
t.Data = listMode;
|
|||
|
t.Msg = "成功";
|
|||
|
return t;
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获得数据列表
|
|||
|
/// 用于移动端
|
|||
|
/// </summary>
|
|||
|
/// <param name="meetingGuid">会议编号</param>
|
|||
|
/// <param name="keyWord">关键词</param>
|
|||
|
/// <returns></returns>
|
|||
|
public TableModel<T_Service_Meeting_Image> GetListForApp(string meetingGuid, string keyWord)
|
|||
|
{
|
|||
|
TableModel<T_Service_Meeting_Image> t = new TableModel<T_Service_Meeting_Image>();
|
|||
|
|
|||
|
var listMode = db.Queryable<T_Service_Meeting_Image>()
|
|||
|
.Where(it => it.MeetingGUID == meetingGuid && it.DeleteFlag == 0)
|
|||
|
.WhereIF(!string.IsNullOrEmpty(keyWord), it => it.PhotoName.Contains(keyWord))
|
|||
|
.OrderBy((it) => it.CreationDate, OrderByType.Desc).ToList();
|
|||
|
|
|||
|
t.Code = 0;
|
|||
|
t.PageCount = listMode.Count;
|
|||
|
t.TotalNumber = listMode.Count;
|
|||
|
t.Data = listMode;
|
|||
|
t.Msg = "成功";
|
|||
|
return t;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|