97 lines
2.7 KiB
C#
97 lines
2.7 KiB
C#
using LeadDataBaseUtility;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace CleanMachine.DAL.CM
|
|
{
|
|
public class ShiftCountDAL
|
|
{
|
|
public ShiftCountDAL()
|
|
{
|
|
|
|
}
|
|
#region 一般方法
|
|
/// <summary>
|
|
/// 存在
|
|
/// </summary>
|
|
public bool Exists(DateTime DateTime)
|
|
{
|
|
string strSql = @"SELECT count(1) from CM_SHIFT_COUNT WHERE DateTime=@DateTime ";
|
|
return LeadDbHelperSQLite.ExecuteScalar<int>(strSql, new { DateTime }) > 0;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加一个数据
|
|
/// </summary>
|
|
public bool Add(CleanMachine.Model.CM.ShiftCount model)
|
|
{
|
|
string strSql = $@"INSERT INTO CM_SHIFT_COUNT
|
|
(DateTime,count,UserCode)
|
|
values
|
|
(@DateTime,@Count,@UserCode) ";
|
|
return LeadDbHelperSQLite.Execute(strSql, model) > 0;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 更新一个数据
|
|
/// </summary>
|
|
public bool Update(CleanMachine.Model.CM.ShiftCount model)
|
|
{
|
|
string strSql = $@"UPDATE CM_SHIFT_COUNT SET
|
|
count=@Count,UserCode=@UserCode
|
|
WHERE DateTime=@DateTime ";
|
|
return LeadDbHelperSQLite.Execute(strSql, model) > 0;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 删除一个数据
|
|
/// </summary>
|
|
public bool Delete(string strWhere, object Params = null)
|
|
{
|
|
string strSql = $@"DELETE FROM CM_SHIFT_COUNT ";
|
|
if (strWhere.Trim() != "")
|
|
{
|
|
strSql += $" WHERE {strWhere}";
|
|
}
|
|
return LeadDbHelperSQLite.Execute(strSql, Params) > 0;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 删除一个数据
|
|
/// </summary>
|
|
public bool Delete(DateTime DateTime)
|
|
{
|
|
return this.Delete("DateTime=@DateTime ", new { DateTime });
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获得数据列表
|
|
/// </summary>
|
|
public IEnumerable<CleanMachine.Model.CM.ShiftCount> GetList(string strWhere, object Params = null)
|
|
{
|
|
string strSql = $@"SELECT * FROM CM_SHIFT_COUNT ";
|
|
if (strWhere.Trim() != "")
|
|
{
|
|
strSql += $" WHERE {strWhere}";
|
|
}
|
|
return LeadDbHelperSQLite.Query <CleanMachine.Model.CM.ShiftCount> (strSql, Params);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取一个对象
|
|
/// </summary>
|
|
public CleanMachine.Model.CM.ShiftCount GetModel(DateTime DateTime)
|
|
{
|
|
return this.GetList("DateTime=@DateTime", new { DateTime }).FirstOrDefault();
|
|
}
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|