后端【新增】新增商家转账功能后台处理及接口回调获取。

This commit is contained in:
jianweie code
2025-07-29 00:51:57 +08:00
parent 596225acb1
commit c8b4bbd78d
38 changed files with 3385 additions and 436 deletions

View File

@@ -0,0 +1,212 @@
/***********************************************************************
* Project: CoreCms
* ProjectName: 核心内容管理系统
* Web: https://www.corecms.net
* Author: 大灰灰
* Email: jianweie@163.com
* CreateTime: 2025/7/21 20:36:56
* Description: 暂无
***********************************************************************/
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Threading.Tasks;
using CoreCms.Net.Caching.Manual;
using CoreCms.Net.Configuration;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.ViewModels.Basics;
using CoreCms.Net.IRepository;
using CoreCms.Net.IRepository.UnitOfWork;
using CoreCms.Net.Model.ViewModels.UI;
using SqlSugar;
namespace CoreCms.Net.Repository
{
/// <summary>
/// 微信支付平台证书 接口实现
/// </summary>
public class CoreCmsWeChatPayPlatformCertificateRepository : BaseRepository<CoreCmsWeChatPayPlatformCertificate>, ICoreCmsWeChatPayPlatformCertificateRepository
{
private readonly IUnitOfWork _unitOfWork;
public CoreCmsWeChatPayPlatformCertificateRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
{
_unitOfWork = unitOfWork;
}
#region ==========================================================
/// <summary>
/// 重写异步插入方法
/// </summary>
/// <param name="entity">实体数据</param>
/// <returns></returns>
public async Task<AdminUiCallBack> InsertAsync(CoreCmsWeChatPayPlatformCertificate entity)
{
var jm = new AdminUiCallBack();
var bl = await DbClient.Insertable(entity).ExecuteReturnIdentityAsync() > 0;
jm.code = bl ? 0 : 1;
jm.msg = bl ? GlobalConstVars.CreateSuccess : GlobalConstVars.CreateFailure;
return jm;
}
/// <summary>
/// 重写异步更新方法
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
public async Task<AdminUiCallBack> UpdateAsync(CoreCmsWeChatPayPlatformCertificate entity)
{
var jm = new AdminUiCallBack();
var oldModel = await DbClient.Queryable<CoreCmsWeChatPayPlatformCertificate>().In(entity.id).SingleAsync();
if (oldModel == null)
{
jm.msg = "不存在此信息";
return jm;
}
//事物处理过程开始
oldModel.id = entity.id;
oldModel.algorithmType = entity.algorithmType;
oldModel.certificate = entity.certificate;
oldModel.effectiveTime = entity.effectiveTime;
oldModel.expireTime = entity.expireTime;
oldModel.serialNumber = entity.serialNumber;
oldModel.merchantId = entity.merchantId;
oldModel.createTime = entity.createTime;
oldModel.updataTime = entity.updataTime;
//事物处理过程结束
var bl = await DbClient.Updateable(oldModel).ExecuteCommandHasChangeAsync();
jm.code = bl ? 0 : 1;
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
return jm;
}
/// <summary>
/// 重写异步更新方法
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
public async Task<AdminUiCallBack> UpdateAsync(List<CoreCmsWeChatPayPlatformCertificate> entity)
{
var jm = new AdminUiCallBack();
var bl = await DbClient.Updateable(entity).ExecuteCommandHasChangeAsync();
jm.code = bl ? 0 : 1;
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
return jm;
}
/// <summary>
/// 重写删除指定ID的数据
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public async Task<AdminUiCallBack> DeleteByIdAsync(object id)
{
var jm = new AdminUiCallBack();
var bl = await DbClient.Deleteable<CoreCmsWeChatPayPlatformCertificate>(id).ExecuteCommandHasChangeAsync();
jm.code = bl ? 0 : 1;
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
return jm;
}
/// <summary>
/// 重写删除指定ID集合的数据(批量删除)
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
public async Task<AdminUiCallBack> DeleteByIdsAsync(int[] ids)
{
var jm = new AdminUiCallBack();
var bl = await DbClient.Deleteable<CoreCmsWeChatPayPlatformCertificate>().In(ids).ExecuteCommandHasChangeAsync();
jm.code = bl ? 0 : 1;
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
return jm;
}
#endregion ==========================================================
#region ==========================================================
/// <summary>
/// 获取缓存的所有数据
/// </summary>
/// <returns></returns>
public async Task<List<CoreCmsWeChatPayPlatformCertificate>> GetCaChe()
{
var list = await DbClient.Queryable<CoreCmsWeChatPayPlatformCertificate>().With(SqlWith.NoLock).WithCache().ToListAsync();
return list;
}
#endregion ==========================================================
#region
/// <summary>
/// 重写根据条件查询分页数据
/// </summary>
/// <param name="predicate">判断集合</param>
/// <param name="orderByType">排序方式</param>
/// <param name="pageIndex">当前页面索引</param>
/// <param name="pageSize">分布大小</param>
/// <param name="orderByExpression"></param>
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
/// <returns></returns>
public async Task<IPageList<CoreCmsWeChatPayPlatformCertificate>> QueryPageAsync(Expression<Func<CoreCmsWeChatPayPlatformCertificate, bool>> predicate,
Expression<Func<CoreCmsWeChatPayPlatformCertificate, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
int pageSize = 20, bool blUseNoLock = false)
{
RefAsync<int> totalCount = 0;
List<CoreCmsWeChatPayPlatformCertificate> page;
if (blUseNoLock)
{
page = await DbClient.Queryable<CoreCmsWeChatPayPlatformCertificate>()
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
.WhereIF(predicate != null, predicate).Select(p => new CoreCmsWeChatPayPlatformCertificate
{
id = p.id,
algorithmType = p.algorithmType,
certificate = p.certificate,
effectiveTime = p.effectiveTime,
expireTime = p.expireTime,
serialNumber = p.serialNumber,
merchantId = p.merchantId,
createTime = p.createTime,
updataTime = p.updataTime,
}).With(SqlWith.NoLock).ToPageListAsync(pageIndex, pageSize, totalCount);
}
else
{
page = await DbClient.Queryable<CoreCmsWeChatPayPlatformCertificate>()
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
.WhereIF(predicate != null, predicate).Select(p => new CoreCmsWeChatPayPlatformCertificate
{
id = p.id,
algorithmType = p.algorithmType,
certificate = p.certificate,
effectiveTime = p.effectiveTime,
expireTime = p.expireTime,
serialNumber = p.serialNumber,
merchantId = p.merchantId,
createTime = p.createTime,
updataTime = p.updataTime,
}).ToPageListAsync(pageIndex, pageSize, totalCount);
}
var list = new PageList<CoreCmsWeChatPayPlatformCertificate>(page, pageIndex, pageSize, totalCount);
return list;
}
#endregion
}
}

View File

@@ -1,9 +1,9 @@
/***********************************************************************
* Project: CoreCms
* ProjectName: 核心内容管理系统
* Web: https://www.corecms.net
* Author: 大灰灰
* Email: jianweie@163.com
* ProjectName: 核心内容管理系统
* Web: https://www.corecms.net
* Author: 大灰灰
* Email: jianweie@163.com
* CreateTime: 2023/4/22 23:40:15
* Description: 暂无
***********************************************************************/
@@ -29,12 +29,13 @@ namespace CoreCms.Net.Repository
public class WeChatPayConfigRepository : BaseRepository<CoreCmsWeChatPayConfig>, IWeChatPayConfigRepository
{
private readonly IUnitOfWork _unitOfWork;
public WeChatPayConfigRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
{
_unitOfWork = unitOfWork;
}
#region ==========================================================
#region ==========================================================
/// <summary>
/// 重写异步插入方法
@@ -64,11 +65,11 @@ namespace CoreCms.Net.Repository
var oldModel = await DbClient.Queryable<CoreCmsWeChatPayConfig>().In(entity.id).SingleAsync();
if (oldModel == null)
{
jm.msg = "不存在此信息";
return jm;
jm.msg = "不存在此信息";
return jm;
}
//事物处理过程开始
oldModel.id = entity.id;
//oldModel.id = entity.id;
oldModel.appId = entity.appId;
oldModel.mchId = entity.mchId;
oldModel.apiKey = entity.apiKey;
@@ -83,7 +84,14 @@ namespace CoreCms.Net.Repository
oldModel.isEnable = entity.isEnable;
oldModel.isDefault = entity.isDefault;
oldModel.appType = entity.appType;
oldModel.payType = entity.payType;
oldModel.certificateSerialNumber = entity.certificateSerialNumber;
oldModel.certificatePrivateKey = entity.certificatePrivateKey;
oldModel.platformSerialNumber = entity.platformSerialNumber;
oldModel.platformPublicKeyId = entity.platformPublicKeyId;
oldModel.platformPublicKey = entity.platformPublicKey;
oldModel.transferBillsUrl = entity.transferBillsUrl;
//事物处理过程结束
var bl = await DbClient.Updateable(oldModel).ExecuteCommandHasChangeAsync();
jm.code = bl ? 0 : 1;
@@ -140,9 +148,9 @@ namespace CoreCms.Net.Repository
return jm;
}
#endregion
#endregion ==========================================================
#region ==========================================================
#region ==========================================================
/// <summary>
/// 获取缓存的所有数据
@@ -150,14 +158,14 @@ namespace CoreCms.Net.Repository
/// <returns></returns>
public async Task<List<CoreCmsWeChatPayConfig>> GetCaChe()
{
var list = await DbClient.Queryable<CoreCmsWeChatPayConfig>().With(SqlWith.NoLock).WithCache().ToListAsync();
var list = await DbClient.Queryable<CoreCmsWeChatPayConfig>().With(SqlWith.NoLock).WithCache().ToListAsync();
return list;
}
#endregion
#endregion ==========================================================
#region
/// <summary>
/// 重写根据条件查询分页数据
/// </summary>
@@ -180,22 +188,28 @@ namespace CoreCms.Net.Repository
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
.WhereIF(predicate != null, predicate).Select(p => new CoreCmsWeChatPayConfig
{
id = p.id,
appId = p.appId,
mchId = p.mchId,
apiKey = p.apiKey,
apiV3Key = p.apiV3Key,
certificate = p.certificate,
rsaPublicKey = p.rsaPublicKey,
subAppId = p.subAppId,
subMchId = p.subMchId,
notifyUrl = p.notifyUrl,
refundUrl = p.refundUrl,
jumpUrl = p.jumpUrl,
isEnable = p.isEnable,
isDefault = p.isDefault,
appType = p.appType,
id = p.id,
appId = p.appId,
mchId = p.mchId,
apiKey = p.apiKey,
apiV3Key = p.apiV3Key,
certificate = p.certificate,
rsaPublicKey = p.rsaPublicKey,
subAppId = p.subAppId,
subMchId = p.subMchId,
notifyUrl = p.notifyUrl,
refundUrl = p.refundUrl,
jumpUrl = p.jumpUrl,
isEnable = p.isEnable,
isDefault = p.isDefault,
appType = p.appType,
payType = p.payType,
certificateSerialNumber = p.certificateSerialNumber,
certificatePrivateKey = p.certificatePrivateKey,
platformSerialNumber = p.platformSerialNumber,
platformPublicKey = p.platformPublicKey,
platformPublicKeyId = p.platformPublicKeyId,
transferBillsUrl = p.transferBillsUrl
}).With(SqlWith.NoLock).ToPageListAsync(pageIndex, pageSize, totalCount);
}
else
@@ -204,29 +218,33 @@ namespace CoreCms.Net.Repository
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
.WhereIF(predicate != null, predicate).Select(p => new CoreCmsWeChatPayConfig
{
id = p.id,
appId = p.appId,
mchId = p.mchId,
apiKey = p.apiKey,
apiV3Key = p.apiV3Key,
certificate = p.certificate,
rsaPublicKey = p.rsaPublicKey,
subAppId = p.subAppId,
subMchId = p.subMchId,
notifyUrl = p.notifyUrl,
refundUrl = p.refundUrl,
jumpUrl = p.jumpUrl,
isEnable = p.isEnable,
isDefault = p.isDefault,
appType = p.appType,
id = p.id,
appId = p.appId,
mchId = p.mchId,
apiKey = p.apiKey,
apiV3Key = p.apiV3Key,
certificate = p.certificate,
rsaPublicKey = p.rsaPublicKey,
subAppId = p.subAppId,
subMchId = p.subMchId,
notifyUrl = p.notifyUrl,
refundUrl = p.refundUrl,
jumpUrl = p.jumpUrl,
isEnable = p.isEnable,
isDefault = p.isDefault,
appType = p.appType,
certificateSerialNumber = p.certificateSerialNumber,
certificatePrivateKey = p.certificatePrivateKey,
platformSerialNumber = p.platformSerialNumber,
platformPublicKey = p.platformPublicKey,
platformPublicKeyId = p.platformPublicKeyId,
transferBillsUrl = p.transferBillsUrl
}).ToPageListAsync(pageIndex, pageSize, totalCount);
}
var list = new PageList<CoreCmsWeChatPayConfig>(page, pageIndex, pageSize, totalCount);
return list;
}
#endregion
#endregion
}
}
}

View File

@@ -0,0 +1,195 @@
/***********************************************************************
* Project: CoreCms
* ProjectName: 核心内容管理系统
* Web: https://www.corecms.net
* Author: 大灰灰
* Email: jianweie@163.com
* CreateTime: 2025/7/28 23:08:04
* Description: 暂无
***********************************************************************/
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Threading.Tasks;
using CoreCms.Net.Caching.Manual;
using CoreCms.Net.Configuration;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.ViewModels.Basics;
using CoreCms.Net.IRepository;
using CoreCms.Net.IRepository.UnitOfWork;
using CoreCms.Net.Model.ViewModels.UI;
using SqlSugar;
namespace CoreCms.Net.Repository
{
/// <summary>
/// 用户提现使用商家转账微信回调通知 接口实现
/// </summary>
public class CoreCmsUserTocashWeChatNotifyRepository : BaseRepository<CoreCmsUserTocashWeChatNotify>, ICoreCmsUserTocashWeChatNotifyRepository
{
private readonly IUnitOfWork _unitOfWork;
public CoreCmsUserTocashWeChatNotifyRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
{
_unitOfWork = unitOfWork;
}
#region ==========================================================
/// <summary>
/// 重写异步插入方法
/// </summary>
/// <param name="entity">实体数据</param>
/// <returns></returns>
public async Task<AdminUiCallBack> InsertAsync(CoreCmsUserTocashWeChatNotify entity)
{
var jm = new AdminUiCallBack();
var bl = await DbClient.Insertable(entity).ExecuteReturnIdentityAsync() > 0;
jm.code = bl ? 0 : 1;
jm.msg = bl ? GlobalConstVars.CreateSuccess : GlobalConstVars.CreateFailure;
return jm;
}
/// <summary>
/// 重写异步更新方法
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
public async Task<AdminUiCallBack> UpdateAsync(CoreCmsUserTocashWeChatNotify entity)
{
var jm = new AdminUiCallBack();
var oldModel = await DbClient.Queryable<CoreCmsUserTocashWeChatNotify>().In(entity.id).SingleAsync();
if (oldModel == null)
{
jm.msg = "不存在此信息";
return jm;
}
//事物处理过程开始
oldModel.id = entity.id;
oldModel.callBackId = entity.callBackId;
oldModel.create_time = entity.create_time;
oldModel.resource_type = entity.resource_type;
oldModel.event_type = entity.event_type;
oldModel.summary = entity.summary;
oldModel.resource = entity.resource;
oldModel.createTime = entity.createTime;
//事物处理过程结束
var bl = await DbClient.Updateable(oldModel).ExecuteCommandHasChangeAsync();
jm.code = bl ? 0 : 1;
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
return jm;
}
/// <summary>
/// 重写异步更新方法
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
public async Task<AdminUiCallBack> UpdateAsync(List<CoreCmsUserTocashWeChatNotify> entity)
{
var jm = new AdminUiCallBack();
var bl = await DbClient.Updateable(entity).ExecuteCommandHasChangeAsync();
jm.code = bl ? 0 : 1;
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
return jm;
}
/// <summary>
/// 重写删除指定ID的数据
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public async Task<AdminUiCallBack> DeleteByIdAsync(object id)
{
var jm = new AdminUiCallBack();
var bl = await DbClient.Deleteable<CoreCmsUserTocashWeChatNotify>(id).ExecuteCommandHasChangeAsync();
jm.code = bl ? 0 : 1;
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
return jm;
}
/// <summary>
/// 重写删除指定ID集合的数据(批量删除)
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
public async Task<AdminUiCallBack> DeleteByIdsAsync(int[] ids)
{
var jm = new AdminUiCallBack();
var bl = await DbClient.Deleteable<CoreCmsUserTocashWeChatNotify>().In(ids).ExecuteCommandHasChangeAsync();
jm.code = bl ? 0 : 1;
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
return jm;
}
#endregion ==========================================================
#region
/// <summary>
/// 重写根据条件查询分页数据
/// </summary>
/// <param name="predicate">判断集合</param>
/// <param name="orderByType">排序方式</param>
/// <param name="pageIndex">当前页面索引</param>
/// <param name="pageSize">分布大小</param>
/// <param name="orderByExpression"></param>
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
/// <returns></returns>
public async Task<IPageList<CoreCmsUserTocashWeChatNotify>> QueryPageAsync(Expression<Func<CoreCmsUserTocashWeChatNotify, bool>> predicate,
Expression<Func<CoreCmsUserTocashWeChatNotify, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
int pageSize = 20, bool blUseNoLock = false)
{
RefAsync<int> totalCount = 0;
List<CoreCmsUserTocashWeChatNotify> page;
if (blUseNoLock)
{
page = await DbClient.Queryable<CoreCmsUserTocashWeChatNotify>()
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
.WhereIF(predicate != null, predicate).Select(p => new CoreCmsUserTocashWeChatNotify
{
id = p.id,
callBackId = p.callBackId,
create_time = p.create_time,
resource_type = p.resource_type,
event_type = p.event_type,
summary = p.summary,
resource = p.resource,
createTime = p.createTime,
}).With(SqlWith.NoLock).ToPageListAsync(pageIndex, pageSize, totalCount);
}
else
{
page = await DbClient.Queryable<CoreCmsUserTocashWeChatNotify>()
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
.WhereIF(predicate != null, predicate).Select(p => new CoreCmsUserTocashWeChatNotify
{
id = p.id,
callBackId = p.callBackId,
create_time = p.create_time,
resource_type = p.resource_type,
event_type = p.event_type,
summary = p.summary,
resource = p.resource,
createTime = p.createTime,
}).ToPageListAsync(pageIndex, pageSize, totalCount);
}
var list = new PageList<CoreCmsUserTocashWeChatNotify>(page, pageIndex, pageSize, totalCount);
return list;
}
#endregion
}
}

View File

@@ -0,0 +1,201 @@
/***********************************************************************
* Project: CoreCms
* ProjectName: 核心内容管理系统
* Web: https://www.corecms.net
* Author: 大灰灰
* Email: jianweie@163.com
* CreateTime: 2025/7/23 16:37:18
* Description: 暂无
***********************************************************************/
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Threading.Tasks;
using CoreCms.Net.Caching.Manual;
using CoreCms.Net.Configuration;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.ViewModels.Basics;
using CoreCms.Net.IRepository;
using CoreCms.Net.IRepository.UnitOfWork;
using CoreCms.Net.Model.ViewModels.UI;
using SqlSugar;
namespace CoreCms.Net.Repository
{
/// <summary>
/// 用户提现使用商家转账回调记录 接口实现
/// </summary>
public class CoreCmsUserTocashWeChatResponseRepository : BaseRepository<CoreCmsUserTocashWeChatResponse>, ICoreCmsUserTocashWeChatResponseRepository
{
private readonly IUnitOfWork _unitOfWork;
public CoreCmsUserTocashWeChatResponseRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
{
_unitOfWork = unitOfWork;
}
#region ==========================================================
/// <summary>
/// 重写异步插入方法
/// </summary>
/// <param name="entity">实体数据</param>
/// <returns></returns>
public async Task<AdminUiCallBack> InsertAsync(CoreCmsUserTocashWeChatResponse entity)
{
var jm = new AdminUiCallBack();
var bl = await DbClient.Insertable(entity).ExecuteReturnIdentityAsync() > 0;
jm.code = bl ? 0 : 1;
jm.msg = bl ? GlobalConstVars.CreateSuccess : GlobalConstVars.CreateFailure;
return jm;
}
/// <summary>
/// 重写异步更新方法
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
public async Task<AdminUiCallBack> UpdateAsync(CoreCmsUserTocashWeChatResponse entity)
{
var jm = new AdminUiCallBack();
var oldModel = await DbClient.Queryable<CoreCmsUserTocashWeChatResponse>().In(entity.id).SingleAsync();
if (oldModel == null)
{
jm.msg = "不存在此信息";
return jm;
}
//事物处理过程开始
oldModel.id = entity.id;
oldModel.out_bill_no = entity.out_bill_no;
oldModel.transfer_bill_no = entity.transfer_bill_no;
oldModel.create_time = entity.create_time;
oldModel.state = entity.state;
oldModel.package_info = entity.package_info;
oldModel.code = entity.code;
oldModel.message = entity.message;
oldModel.detail = entity.detail;
oldModel.createTime = entity.createTime;
//事物处理过程结束
var bl = await DbClient.Updateable(oldModel).ExecuteCommandHasChangeAsync();
jm.code = bl ? 0 : 1;
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
return jm;
}
/// <summary>
/// 重写异步更新方法
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
public async Task<AdminUiCallBack> UpdateAsync(List<CoreCmsUserTocashWeChatResponse> entity)
{
var jm = new AdminUiCallBack();
var bl = await DbClient.Updateable(entity).ExecuteCommandHasChangeAsync();
jm.code = bl ? 0 : 1;
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
return jm;
}
/// <summary>
/// 重写删除指定ID的数据
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public async Task<AdminUiCallBack> DeleteByIdAsync(object id)
{
var jm = new AdminUiCallBack();
var bl = await DbClient.Deleteable<CoreCmsUserTocashWeChatResponse>(id).ExecuteCommandHasChangeAsync();
jm.code = bl ? 0 : 1;
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
return jm;
}
/// <summary>
/// 重写删除指定ID集合的数据(批量删除)
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
public async Task<AdminUiCallBack> DeleteByIdsAsync(int[] ids)
{
var jm = new AdminUiCallBack();
var bl = await DbClient.Deleteable<CoreCmsUserTocashWeChatResponse>().In(ids).ExecuteCommandHasChangeAsync();
jm.code = bl ? 0 : 1;
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
return jm;
}
#endregion ==========================================================
#region
/// <summary>
/// 重写根据条件查询分页数据
/// </summary>
/// <param name="predicate">判断集合</param>
/// <param name="orderByType">排序方式</param>
/// <param name="pageIndex">当前页面索引</param>
/// <param name="pageSize">分布大小</param>
/// <param name="orderByExpression"></param>
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
/// <returns></returns>
public async Task<IPageList<CoreCmsUserTocashWeChatResponse>> QueryPageAsync(Expression<Func<CoreCmsUserTocashWeChatResponse, bool>> predicate,
Expression<Func<CoreCmsUserTocashWeChatResponse, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
int pageSize = 20, bool blUseNoLock = false)
{
RefAsync<int> totalCount = 0;
List<CoreCmsUserTocashWeChatResponse> page;
if (blUseNoLock)
{
page = await DbClient.Queryable<CoreCmsUserTocashWeChatResponse>()
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
.WhereIF(predicate != null, predicate).Select(p => new CoreCmsUserTocashWeChatResponse
{
id = p.id,
out_bill_no = p.out_bill_no,
transfer_bill_no = p.transfer_bill_no,
create_time = p.create_time,
state = p.state,
package_info = p.package_info,
code = p.code,
message = p.message,
detail = p.detail,
createTime = p.createTime,
}).With(SqlWith.NoLock).ToPageListAsync(pageIndex, pageSize, totalCount);
}
else
{
page = await DbClient.Queryable<CoreCmsUserTocashWeChatResponse>()
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
.WhereIF(predicate != null, predicate).Select(p => new CoreCmsUserTocashWeChatResponse
{
id = p.id,
out_bill_no = p.out_bill_no,
transfer_bill_no = p.transfer_bill_no,
create_time = p.create_time,
state = p.state,
package_info = p.package_info,
code = p.code,
message = p.message,
detail = p.detail,
createTime = p.createTime,
}).ToPageListAsync(pageIndex, pageSize, totalCount);
}
var list = new PageList<CoreCmsUserTocashWeChatResponse>(page, pageIndex, pageSize, totalCount);
return list;
}
#endregion
}
}