using WcsMain.Common;
using WcsMain.DataBase.TableEntity;
using WcsMain.Constant.WcsAttribute.AutoFacAttribute;
namespace WcsMain.DataBase.Dao;
///
/// tbl_app_stocker 操作类
///
[Component]
public class AppStackerDao
{
///
/// 插入数据
///
///
///
public int? Insert(params AppStacker[] data)
{
try
{
return CommonTool.DbServe.Insertable(data).ExecuteCommand();
}
catch (Exception ex)
{
_ = ex;
return 0;
}
}
///
/// 删除一条数据,根据主键
///
///
///
public int? Delete(AppStacker appStacker)
{
try
{
return CommonTool.DbServe.Deleteable(appStacker).ExecuteCommand();
}
catch (Exception ex)
{
_ = ex;
return 0;
}
}
///
/// 修改一条数据
///
///
///
public int? Update(AppStacker appStacker)
{
try
{
return CommonTool.DbServe.Updateable(appStacker).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
}
catch (Exception ex)
{
_ = ex;
return 0;
}
}
///
/// 根据条件查询 ---- 不包括站台
///
///
///
public List? Select(AppStacker appStacker)
{
try
{
var sqlFuc = CommonTool.DbServe.Queryable()
.WhereIF(appStacker.StackerId != default, w => w.StackerId == appStacker.StackerId)
.WhereIF(appStacker.StackerName != default, w => w.StackerName == appStacker.StackerName)
.WhereIF(appStacker.StackerStatus != default, w => w.StackerStatus == appStacker.StackerStatus)
.WhereIF(appStacker.ForkStatus != default, w => w.ForkStatus == appStacker.ForkStatus)
.WhereIF(appStacker.ActionPlc != default, w => w.ActionPlc == appStacker.ActionPlc)
.WhereIF(appStacker.InStand != default, w => w.InStand == appStacker.InStand)
.WhereIF(appStacker.OutStand != default, w => w.OutStand == appStacker.OutStand)
.WhereIF(appStacker.Remark != default, w => w.Remark == appStacker.Remark);
return sqlFuc.ToList();
}
catch (Exception ex)
{
_ = ex;
return default;
}
}
///
/// 查询所有的数据
///
///
public List? Select() => Select(new AppStacker());
}