89 lines
3.9 KiB
C#
89 lines
3.9 KiB
C#
using HL_FristAidPlatform_Help;
|
|
using HL_FristAidPlatform_IDataBase;
|
|
using HL_FristAidPlatform_Models;
|
|
using SqlSugar;
|
|
using System.Collections.Generic;
|
|
|
|
namespace HL_FristAidPlatform_DataBase
|
|
{
|
|
public class T_Base_ProvinceDB : BaseDB, IT_Base_Province
|
|
{
|
|
public SqlSugarClient db = GetClient();
|
|
public bool Add(T_Base_Province province)
|
|
{
|
|
return db.Insertable(province).IgnoreColumns(ignoreNullColumn: true).ExecuteCommand() == 1 ? true : false;
|
|
}
|
|
|
|
public bool Dels(dynamic[] guids)
|
|
{
|
|
return db.Deleteable<T_Base_Province>().In(new dynamic[] { guids }).ExecuteCommand() == 1 ? true : false;
|
|
}
|
|
|
|
public bool Update(T_Base_Province province)
|
|
{
|
|
return db.Updateable(province).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand() == 1 ? true : false;
|
|
}
|
|
|
|
public T_Base_Province Get(string guid)
|
|
{
|
|
return db.Queryable<T_Base_Province>().First(it => it.GUID == guid);
|
|
}
|
|
|
|
public TableModel<T_Base_Province> GetPageList(int pageIndex, int pageSize)
|
|
{
|
|
int total = 0;
|
|
List<T_Base_Province> data = db.Queryable<T_Base_Province>().ToPageList(pageIndex, pageSize, ref total);
|
|
TableModel<T_Base_Province> t = new TableModel<T_Base_Province>();
|
|
t.Code = 0;
|
|
t.PageCount = data.Count;
|
|
t.TotalNumber = total;
|
|
t.Data = data;
|
|
t.Msg = "成功";
|
|
return t;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据所属系统获取列表--无分页
|
|
/// </summary>
|
|
/// <param name="systemModuleId">所属系统编号</param>
|
|
/// <returns></returns>
|
|
public TableModel<T_Base_Province> GetList(long systemModuleId)
|
|
{
|
|
TableModel<T_Base_Province> t = new TableModel<T_Base_Province>();
|
|
var listMode = db.Queryable<T_Base_Province>().OrderBy(it => it.OrderBy).ToList();
|
|
//var listMode = db.Queryable<T_Base_Province>().Where(it => it.SystemModuleID == systemModuleId).OrderBy(it => it.OrderBy).ToList();
|
|
|
|
t.Code = 0;
|
|
t.PageCount = listMode.Count;
|
|
t.TotalNumber = listMode.Count;
|
|
t.Data = listMode;
|
|
t.Msg = "成功";
|
|
return t;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据所属系统获取列表--分页
|
|
/// </summary>
|
|
/// <param name="pageIndex">起始页</param>
|
|
/// <param name="pageSize">每页条数</param>
|
|
/// <param name="systemModuleId">所属系统编号</param>
|
|
/// <param name="keyWord">关键词</param>
|
|
/// <returns></returns>
|
|
public TableModel<T_Base_Province> GetPageListBySystemModule(int pageIndex, int pageSize, long systemModuleId, string keyWord)
|
|
{
|
|
int TotalNumber = 0;
|
|
TableModel<T_Base_Province> t = new TableModel<T_Base_Province>();
|
|
|
|
//var listMode = db.Queryable<T_Base_Province>().Where(it => it.SystemModuleID == systemModuleId).WhereIF(!string.IsNullOrEmpty(keyWord), it => it.Abbreviation.Contains(keyWord) || it.Initials.Contains(keyWord) || it.PymCode.Contains(keyWord) || it.WbmCode.Contains(keyWord) || it.ProvinceCode.Contains(keyWord) || it.ProvinceName.Contains(keyWord)).OrderBy(it => it.OrderBy).ToPageList(pageIndex, pageSize, ref TotalNumber);
|
|
var listMode = db.Queryable<T_Base_Province>().WhereIF(!string.IsNullOrEmpty(keyWord), it => it.Abbreviation.Contains(keyWord) || it.Initials.Contains(keyWord) || it.PymCode.Contains(keyWord) || it.WbmCode.Contains(keyWord) || it.ProvinceCode.Contains(keyWord) || it.ProvinceName.Contains(keyWord)).OrderBy(it => it.OrderBy).ToPageList(pageIndex, pageSize, ref TotalNumber);
|
|
|
|
t.Code = 0;
|
|
t.PageCount = listMode.Count;
|
|
t.TotalNumber = TotalNumber;
|
|
t.Data = listMode;
|
|
t.Msg = "成功";
|
|
return t;
|
|
}
|
|
}
|
|
}
|