添加业务层

This commit is contained in:
gongxh
2022-05-05 18:01:29 +08:00
parent 64ab02ec4c
commit 6635db5425
41 changed files with 3869 additions and 3 deletions

View File

@@ -0,0 +1,112 @@
//模板信息:{"Template":{"Language":"C#"}}
//输出信息:{"Extension":".cs","FileName":"DAL\\LastPattleNumDAL"}
using System;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using LeadDataBaseUtility;
namespace CleanMachine.DAL
{
/// <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>
public bool Add(CleanMachine.Model.LastPattleNum model)
{
string strSql = $@"INSERT INTO CM_LastPattleNum
(Key,Value)
values
(@Key,@Value) ";
return LeadDbHelperSQLite.Execute(strSql, model) > 0;
}
/// <summary>
/// 更新一个数据
/// </summary>
public bool Update(CleanMachine.Model.LastPattleNum model)
{
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>
public IEnumerable<CleanMachine.Model.LastPattleNum> GetList(string strWhere, object Params = null)
{
string strSql = $@"SELECT * FROM CM_LastPattleNum ";
if (strWhere.Trim() != "")
{
strSql += $" WHERE {strWhere}";
}
return LeadDbHelperSQLite.Query<CleanMachine.Model.LastPattleNum>(strSql, Params);
}
/// <summary>
/// 获取一个对象
/// </summary>
public CleanMachine.Model.LastPattleNum GetModel(string Key)
{
return this.GetList("Key=@Key", new { Key }).FirstOrDefault();
}
#endregion
/// <summary>
/// 查询数据
/// </summary>
// public IEnumerable<CleanMachine.Model.LastPattleNum> GetModelList(RuleGroup rule)
// {
// var tuper = _dbhelper.BuildRuleGroupStr(rule);
// return this.GetList(tuper.where, tuper.Param);
// }
}
}