Files
CleanMachine/CleanMachine.DAL/CM/LastPattleNumDAL.cs

116 lines
3.2 KiB
C#
Raw Permalink Normal View History

2022-05-05 18:01:29 +08:00
//模板信息:{"Template":{"Language":"C#"}}
2022-05-05 20:18:34 +08:00
//输出信息:{"Extension":".cs","FileName":"DAL\\CM\\LastPattleNumDAL"}
2022-05-05 18:01:29 +08:00
using System;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using LeadDataBaseUtility;
2022-05-05 20:18:34 +08:00
namespace CleanMachine.DAL.CM
2022-05-05 18:01:29 +08:00
{
/// <summary>
///
/// </summary>
public class LastPattleNumDAL
{
public LastPattleNumDAL()
{
}
#region 一般方法
/// <summary>
/// 存在
/// </summary>
public bool Exists(string Key)
{
string strSql = @"SELECT count(1) from CM_LastPattleNum WHERE Key=@Key ";
return LeadDbHelperSQLite.ExecuteScalar<int>(strSql, new { Key }) > 0;
}
/// <summary>
/// 添加一个数据
/// </summary>
2022-05-05 20:18:34 +08:00
public bool Add(CleanMachine.Model.CM.LastPattleNum model)
2022-05-05 18:01:29 +08:00
{
string strSql = $@"INSERT INTO CM_LastPattleNum
(Key,Value)
values
(@Key,@Value) ";
return LeadDbHelperSQLite.Execute(strSql, model) > 0;
}
/// <summary>
/// 更新一个数据
/// </summary>
2022-05-05 20:18:34 +08:00
public bool Update(CleanMachine.Model.CM.LastPattleNum model)
2022-05-05 18:01:29 +08:00
{
string strSql = $@"UPDATE CM_LastPattleNum SET
Value=@Value
WHERE Key=@Key ";
return LeadDbHelperSQLite.Execute(strSql, model) > 0;
}
/// <summary>
/// 删除一个数据
/// </summary>
public bool Delete(string strWhere, object Params = null)
{
string strSql = $@"DELETE FROM CM_LastPattleNum ";
if (strWhere.Trim() != "")
{
strSql += $" WHERE {strWhere}";
}
return LeadDbHelperSQLite.Execute(strSql, Params) > 0;
}
/// <summary>
/// 删除一个数据
/// </summary>
public bool Delete(string Key)
{
return this.Delete("Key=@Key ", new { Key }) ;
}
/// <summary>
/// 获得数据列表
/// </summary>
2022-05-05 20:18:34 +08:00
public IEnumerable<CleanMachine.Model.CM.LastPattleNum> GetList(string strWhere, object Params = null)
2022-05-05 18:01:29 +08:00
{
string strSql = $@"SELECT * FROM CM_LastPattleNum ";
if (strWhere.Trim() != "")
{
strSql += $" WHERE {strWhere}";
}
2022-05-05 20:18:34 +08:00
return LeadDbHelperSQLite.Query<CleanMachine.Model.CM.LastPattleNum>(strSql, Params);
2022-05-05 18:01:29 +08:00
}
/// <summary>
/// 获取一个对象
/// </summary>
2022-05-05 20:18:34 +08:00
public CleanMachine.Model.CM.LastPattleNum GetModel(string Key)
2022-05-05 18:01:29 +08:00
{
return this.GetList("Key=@Key", new { Key }).FirstOrDefault();
}
#endregion
2022-05-05 20:18:34 +08:00
2022-05-05 20:42:02 +08:00
2022-05-05 18:01:29 +08:00
/// <summary>
/// 查询数据
/// </summary>
2022-05-05 20:18:34 +08:00
// public IEnumerable<CleanMachine.Model.CM.LastPattleNum> GetModelList(RuleGroup rule)
2022-05-05 18:01:29 +08:00
// {
// var tuper = _dbhelper.BuildRuleGroupStr(rule);
// return this.GetList(tuper.where, tuper.Param);
// }
}
}