修改模型
This commit is contained in:
112
CleanMachine.DAL/SYS/ParameterDAL.cs
Normal file
112
CleanMachine.DAL/SYS/ParameterDAL.cs
Normal file
@@ -0,0 +1,112 @@
|
||||
|
||||
//模板信息:{"Template":{"Language":"C#"}}
|
||||
//输出信息:{"Extension":".cs","FileName":"DAL\\SYS\\ParameterDAL"}
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using LeadDataBaseUtility;
|
||||
|
||||
namespace CleanMachine.DAL.SYS
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class ParameterDAL
|
||||
{
|
||||
|
||||
|
||||
|
||||
public ParameterDAL()
|
||||
{
|
||||
|
||||
}
|
||||
#region 一般方法
|
||||
/// <summary>
|
||||
/// 存在
|
||||
/// </summary>
|
||||
public bool Exists(int ParameterId)
|
||||
{
|
||||
string strSql = @"SELECT count(1) from SYS_PARAMETER WHERE PARAMETER_ID=@ParameterId ";
|
||||
return LeadDbHelperSQLite.ExecuteScalar<int>(strSql, new { ParameterId }) > 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加一个数据
|
||||
/// </summary>
|
||||
public bool Add(CleanMachine.Model.SYS.Parameter model)
|
||||
{
|
||||
string strSql = $@"INSERT INTO SYS_PARAMETER
|
||||
(PARAMETER_ID,PARAMETER_CODE,PARAMETER_NAME,PARAMETER_VALUE,PARAMETER_TYPE,USED_FLAG,DEL_FLAG,CREATE_BY,CREATE_TIME,UPDATE_BY,UPDATE_TIME,DATA_VERSION,REMARKS1,REMARKS2,REMARKS3,REMARKS4,REMARKS5)
|
||||
values
|
||||
(@ParameterId,@ParameterCode,@ParameterName,@ParameterValue,@ParameterType,@UsedFlag,@DelFlag,@CreateBy,@CreateTime,@UpdateBy,@UpdateTime,@DataVersion,@Remarks1,@Remarks2,@Remarks3,@Remarks4,@Remarks5) ";
|
||||
return LeadDbHelperSQLite.Execute(strSql, model) > 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新一个数据
|
||||
/// </summary>
|
||||
public bool Update(CleanMachine.Model.SYS.Parameter model)
|
||||
{
|
||||
string strSql = $@"UPDATE SYS_PARAMETER SET
|
||||
PARAMETER_CODE=@ParameterCode,PARAMETER_NAME=@ParameterName,PARAMETER_VALUE=@ParameterValue,PARAMETER_TYPE=@ParameterType,USED_FLAG=@UsedFlag,DEL_FLAG=@DelFlag,CREATE_BY=@CreateBy,CREATE_TIME=@CreateTime,UPDATE_BY=@UpdateBy,UPDATE_TIME=@UpdateTime,DATA_VERSION=@DataVersion,REMARKS1=@Remarks1,REMARKS2=@Remarks2,REMARKS3=@Remarks3,REMARKS4=@Remarks4,REMARKS5=@Remarks5
|
||||
WHERE PARAMETER_ID=@ParameterId ";
|
||||
return LeadDbHelperSQLite.Execute(strSql, model) > 0;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 删除一个数据
|
||||
/// </summary>
|
||||
public bool Delete(string strWhere, object Params = null)
|
||||
{
|
||||
string strSql = $@"DELETE FROM SYS_PARAMETER ";
|
||||
if (strWhere.Trim() != "")
|
||||
{
|
||||
strSql += $" WHERE {strWhere}";
|
||||
}
|
||||
return LeadDbHelperSQLite.Execute(strSql, Params) > 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除一个数据
|
||||
/// </summary>
|
||||
public bool Delete(int ParameterId)
|
||||
{
|
||||
return this.Delete("PARAMETER_ID=@ParameterId ", new { ParameterId }) ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获得数据列表
|
||||
/// </summary>
|
||||
public IEnumerable<CleanMachine.Model.SYS.Parameter> GetList(string strWhere, object Params = null)
|
||||
{
|
||||
string strSql = $@"SELECT * FROM SYS_PARAMETER ";
|
||||
if (strWhere.Trim() != "")
|
||||
{
|
||||
strSql += $" WHERE {strWhere}";
|
||||
}
|
||||
return LeadDbHelperSQLite.Query<CleanMachine.Model.SYS.Parameter>(strSql, Params);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取一个对象
|
||||
/// </summary>
|
||||
public CleanMachine.Model.SYS.Parameter GetModel(int ParameterId)
|
||||
{
|
||||
return this.GetList("PARAMETER_ID=@ParameterId", new { ParameterId }).FirstOrDefault();
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 查询数据
|
||||
/// </summary>
|
||||
// public IEnumerable<CleanMachine.Model.SYS.Parameter> GetModelList(RuleGroup rule)
|
||||
// {
|
||||
// var tuper = _dbhelper.BuildRuleGroupStr(rule);
|
||||
// return this.GetList(tuper.where, tuper.Param);
|
||||
// }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user