【优化】移除旧版自定义交易组件。

This commit is contained in:
jianweie code
2023-09-02 01:49:22 +08:00
parent 651dc6b231
commit 0a07f3e005
108 changed files with 181 additions and 14817 deletions

View File

@@ -1,38 +0,0 @@
/***********************************************************************
* Project: CoreCms
* ProjectName: 核心内容管理系统
* Web: https://www.corecms.net
* Author: 大灰灰
* Email: jianweie@163.com
* CreateTime: 2021/8/1 22:53:11
* 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 WeChatTransactionComponentAuditCategoryAuditLogRepository : BaseRepository<WeChatTransactionComponentAuditCategoryAuditLog>, IWeChatTransactionComponentAuditCategoryAuditLogRepository
{
private readonly IUnitOfWork _unitOfWork;
public WeChatTransactionComponentAuditCategoryAuditLogRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
{
_unitOfWork = unitOfWork;
}
}
}

View File

@@ -1,169 +0,0 @@
/***********************************************************************
* Project: CoreCms
* ProjectName: 核心内容管理系统
* Web: https://www.corecms.net
* Author: 大灰灰
* Email: jianweie@163.com
* CreateTime: 2021/7/14 23:14:23
* 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 WeChatTransactionComponentAuditCategoryRepository : BaseRepository<WeChatTransactionComponentAuditCategory>, IWeChatTransactionComponentAuditCategoryRepository
{
private readonly IUnitOfWork _unitOfWork;
public WeChatTransactionComponentAuditCategoryRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
{
_unitOfWork = unitOfWork;
}
#region ==========================================================
/// <summary>
/// 重写异步更新方法
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
public async Task<AdminUiCallBack> UpdateAsync(WeChatTransactionComponentAuditCategory entity)
{
var jm = new AdminUiCallBack();
var oldModel = await DbClient.Queryable<WeChatTransactionComponentAuditCategory>().In(entity.id).SingleAsync();
if (oldModel == null)
{
jm.msg = "不存在此信息";
return jm;
}
//事物处理过程开始
//oldModel.id = entity.id;
oldModel.licenseImage = entity.licenseImage;
oldModel.level1 = entity.level1;
oldModel.level1Name = entity.level1Name;
oldModel.level2 = entity.level2;
oldModel.level2Name = entity.level2Name;
oldModel.level3 = entity.level3;
oldModel.level3Name = entity.level3Name;
oldModel.certificateImage = entity.certificateImage;
//oldModel.auditId = entity.auditId;
//oldModel.status = entity.status;
//oldModel.brandId = entity.brandId;
//oldModel.rejectReason = entity.rejectReason;
//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>
/// 重写删除指定ID的数据
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public async Task<AdminUiCallBack> DeleteByIdAsync(object id)
{
var jm = new AdminUiCallBack();
var bl = await DbClient.Deleteable<WeChatTransactionComponentAuditCategory>(id).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<WeChatTransactionComponentAuditCategory>> QueryPageAsync(Expression<Func<WeChatTransactionComponentAuditCategory, bool>> predicate,
Expression<Func<WeChatTransactionComponentAuditCategory, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
int pageSize = 20, bool blUseNoLock = false)
{
RefAsync<int> totalCount = 0;
List<WeChatTransactionComponentAuditCategory> page;
if (blUseNoLock)
{
page = await DbClient.Queryable<WeChatTransactionComponentAuditCategory>()
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
.WhereIF(predicate != null, predicate).Select(p => new WeChatTransactionComponentAuditCategory
{
id = p.id,
licenseImage = p.licenseImage,
level1 = p.level1,
level1Name = p.level1Name,
level2 = p.level2,
level2Name = p.level2Name,
level3 = p.level3,
level3Name = p.level3Name,
certificateImage = p.certificateImage,
auditId = p.auditId,
status = p.status,
brandId = p.brandId,
rejectReason = p.rejectReason,
createTime = p.createTime,
}).With(SqlWith.NoLock).ToPageListAsync(pageIndex, pageSize, totalCount);
}
else
{
page = await DbClient.Queryable<WeChatTransactionComponentAuditCategory>()
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
.WhereIF(predicate != null, predicate).Select(p => new WeChatTransactionComponentAuditCategory
{
id = p.id,
licenseImage = p.licenseImage,
level1 = p.level1,
level1Name = p.level1Name,
level2 = p.level2,
level2Name = p.level2Name,
level3 = p.level3,
level3Name = p.level3Name,
certificateImage = p.certificateImage,
auditId = p.auditId,
status = p.status,
brandId = p.brandId,
rejectReason = p.rejectReason,
createTime = p.createTime,
}).ToPageListAsync(pageIndex, pageSize, totalCount);
}
var list = new PageList<WeChatTransactionComponentAuditCategory>(page, pageIndex, pageSize, totalCount);
return list;
}
#endregion
}
}

View File

@@ -1,37 +0,0 @@
/***********************************************************************
* Project: CoreCms
* ProjectName: 核心内容管理系统
* Web: https://www.corecms.net
* Author: 大灰灰
* Email: jianweie@163.com
* CreateTime: 2022/3/21 3:30: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 WeChatTransactionComponentBrandAuditLogRepository : BaseRepository<WeChatTransactionComponentBrandAuditLog>, IWeChatTransactionComponentBrandAuditLogRepository
{
private readonly IUnitOfWork _unitOfWork;
public WeChatTransactionComponentBrandAuditLogRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
{
_unitOfWork = unitOfWork;
}
}
}

View File

@@ -1,204 +0,0 @@
/***********************************************************************
* Project: CoreCms
* ProjectName: 核心内容管理系统
* Web: https://www.corecms.net
* Author: 大灰灰
* Email: jianweie@163.com
* CreateTime: 2022/3/20 1:19:25
* 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 WeChatTransactionComponentBrandAuditRepository : BaseRepository<WeChatTransactionComponentBrandAudit>, IWeChatTransactionComponentBrandAuditRepository
{
private readonly IUnitOfWork _unitOfWork;
public WeChatTransactionComponentBrandAuditRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
{
_unitOfWork = unitOfWork;
}
#region ==========================================================
/// <summary>
/// 重写异步插入方法
/// </summary>
/// <param name="entity">实体数据</param>
/// <returns></returns>
public async Task<AdminUiCallBack> InsertAsync(WeChatTransactionComponentBrandAudit entity)
{
var jm = new AdminUiCallBack();
entity.createTime = DateTime.Now;
entity.status = (int)CoreCms.Net.WeChat.Service.TransactionComponent.Enum.AuditEnum.AuditCategoryStatus.;
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(WeChatTransactionComponentBrandAudit entity)
{
var jm = new AdminUiCallBack();
var oldModel = await DbClient.Queryable<WeChatTransactionComponentBrandAudit>().In(entity.id).SingleAsync();
if (oldModel == null)
{
jm.msg = "不存在此信息";
return jm;
}
//事物处理过程开始
//oldModel.id = entity.id;
oldModel.license = entity.license;
oldModel.brand_audit_type = entity.brand_audit_type;
oldModel.trademark_type = entity.trademark_type;
oldModel.brand_management_type = entity.brand_management_type;
oldModel.commodity_origin_type = entity.commodity_origin_type;
oldModel.brand_wording = entity.brand_wording;
oldModel.sale_authorization = entity.sale_authorization;
oldModel.trademark_registration_certificate = entity.trademark_registration_certificate;
oldModel.trademark_change_certificate = entity.trademark_change_certificate;
oldModel.trademark_registrant = entity.trademark_registrant;
oldModel.trademark_registrant_nu = entity.trademark_registrant_nu;
oldModel.trademark_authorization_period = entity.trademark_authorization_period;
oldModel.trademark_registration_application = entity.trademark_registration_application;
oldModel.trademark_applicant = entity.trademark_applicant;
oldModel.trademark_application_time = entity.trademark_application_time;
oldModel.imported_goods_form = entity.imported_goods_form;
oldModel.scene_group_list = entity.scene_group_list;
//事物处理过程结束
var bl = await DbClient.Updateable(oldModel).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<WeChatTransactionComponentBrandAudit>(id).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<WeChatTransactionComponentBrandAudit>> QueryPageAsync(Expression<Func<WeChatTransactionComponentBrandAudit, bool>> predicate,
Expression<Func<WeChatTransactionComponentBrandAudit, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
int pageSize = 20, bool blUseNoLock = false)
{
RefAsync<int> totalCount = 0;
List<WeChatTransactionComponentBrandAudit> page;
if (blUseNoLock)
{
page = await DbClient.Queryable<WeChatTransactionComponentBrandAudit>()
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
.WhereIF(predicate != null, predicate).Select(p => new WeChatTransactionComponentBrandAudit
{
id = p.id,
license = p.license,
brand_audit_type = p.brand_audit_type,
trademark_type = p.trademark_type,
brand_management_type = p.brand_management_type,
commodity_origin_type = p.commodity_origin_type,
brand_wording = p.brand_wording,
sale_authorization = p.sale_authorization,
trademark_registration_certificate = p.trademark_registration_certificate,
trademark_change_certificate = p.trademark_change_certificate,
trademark_registrant = p.trademark_registrant,
trademark_registrant_nu = p.trademark_registrant_nu,
trademark_authorization_period = p.trademark_authorization_period,
trademark_registration_application = p.trademark_registration_application,
trademark_applicant = p.trademark_applicant,
trademark_application_time = p.trademark_application_time,
imported_goods_form = p.imported_goods_form,
scene_group_list = p.scene_group_list,
audit_id = p.audit_id,
status = p.status,
brandId = p.brandId,
rejectReason = p.rejectReason,
createTime = p.createTime,
}).With(SqlWith.NoLock).ToPageListAsync(pageIndex, pageSize, totalCount);
}
else
{
page = await DbClient.Queryable<WeChatTransactionComponentBrandAudit>()
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
.WhereIF(predicate != null, predicate).Select(p => new WeChatTransactionComponentBrandAudit
{
id = p.id,
license = p.license,
brand_audit_type = p.brand_audit_type,
trademark_type = p.trademark_type,
brand_management_type = p.brand_management_type,
commodity_origin_type = p.commodity_origin_type,
brand_wording = p.brand_wording,
sale_authorization = p.sale_authorization,
trademark_registration_certificate = p.trademark_registration_certificate,
trademark_change_certificate = p.trademark_change_certificate,
trademark_registrant = p.trademark_registrant,
trademark_registrant_nu = p.trademark_registrant_nu,
trademark_authorization_period = p.trademark_authorization_period,
trademark_registration_application = p.trademark_registration_application,
trademark_applicant = p.trademark_applicant,
trademark_application_time = p.trademark_application_time,
imported_goods_form = p.imported_goods_form,
scene_group_list = p.scene_group_list,
audit_id = p.audit_id,
status = p.status,
brandId = p.brandId,
rejectReason = p.rejectReason,
createTime = p.createTime,
}).ToPageListAsync(pageIndex, pageSize, totalCount);
}
var list = new PageList<WeChatTransactionComponentBrandAudit>(page, pageIndex, pageSize, totalCount);
return list;
}
#endregion
}
}

View File

@@ -1,98 +0,0 @@
/***********************************************************************
* Project: CoreCms
* ProjectName: 核心内容管理系统
* Web: https://www.corecms.net
* Author: 大灰灰
* Email: jianweie@163.com
* CreateTime: 2021/7/11 23:48:58
* 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.IRepository;
using CoreCms.Net.IRepository.UnitOfWork;
using CoreCms.Net.Model.ViewModels.Basics;
using SqlSugar;
namespace CoreCms.Net.Repository
{
/// <summary>
/// 自定义交易组件快递公司 接口实现
/// </summary>
public class WeChatTransactionComponentDeliveryCompanyRepository : BaseRepository<WeChatTransactionComponentDeliveryCompany>, IWeChatTransactionComponentDeliveryCompanyRepository
{
private readonly IUnitOfWork _unitOfWork;
public WeChatTransactionComponentDeliveryCompanyRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
{
_unitOfWork = unitOfWork;
}
#region ==========================================================
/// <summary>
/// 获取缓存的所有数据
/// </summary>
/// <returns></returns>
public async Task<List<WeChatTransactionComponentDeliveryCompany>> GetCaChe()
{
var list = await DbClient.Queryable<WeChatTransactionComponentDeliveryCompany>().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<WeChatTransactionComponentDeliveryCompany>> QueryPageAsync(Expression<Func<WeChatTransactionComponentDeliveryCompany, bool>> predicate,
Expression<Func<WeChatTransactionComponentDeliveryCompany, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
int pageSize = 20, bool blUseNoLock = false)
{
RefAsync<int> totalCount = 0;
List<WeChatTransactionComponentDeliveryCompany> page;
if (blUseNoLock)
{
page = await DbClient.Queryable<WeChatTransactionComponentDeliveryCompany>()
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
.WhereIF(predicate != null, predicate).Select(p => new WeChatTransactionComponentDeliveryCompany
{
deliveryId = p.deliveryId,
deliveryName = p.deliveryName,
}).With(SqlWith.NoLock).ToPageListAsync(pageIndex, pageSize, totalCount);
}
else
{
page = await DbClient.Queryable<WeChatTransactionComponentDeliveryCompany>()
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
.WhereIF(predicate != null, predicate).Select(p => new WeChatTransactionComponentDeliveryCompany
{
deliveryId = p.deliveryId,
deliveryName = p.deliveryName,
}).ToPageListAsync(pageIndex, pageSize, totalCount);
}
var list = new PageList<WeChatTransactionComponentDeliveryCompany>(page, pageIndex, pageSize, totalCount);
return list;
}
#endregion
}
}

View File

@@ -1,38 +0,0 @@
/***********************************************************************
* Project: CoreCms
* ProjectName: 核心内容管理系统
* Web: https://www.corecms.net
* Author: 大灰灰
* Email: jianweie@163.com
* CreateTime: 2021/8/1 22:18:06
* 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 WeChatTransactionComponentGoodAuditLogRepository : BaseRepository<WeChatTransactionComponentGoodAuditLog>, IWeChatTransactionComponentGoodAuditLogRepository
{
private readonly IUnitOfWork _unitOfWork;
public WeChatTransactionComponentGoodAuditLogRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
{
_unitOfWork = unitOfWork;
}
}
}

View File

@@ -1,270 +0,0 @@
/***********************************************************************
* Project: CoreCms
* ProjectName: 核心内容管理系统
* Web: https://www.corecms.net
* Author: 大灰灰
* Email: jianweie@163.com
* CreateTime: 2021/7/4 2:52:27
* Description: 暂无
***********************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
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.IRepository;
using CoreCms.Net.IRepository.UnitOfWork;
using CoreCms.Net.Model.ViewModels.Basics;
using CoreCms.Net.Model.ViewModels.UI;
using SqlSugar;
namespace CoreCms.Net.Repository
{
/// <summary>
/// 自定义交易组件商品列表 接口实现
/// </summary>
public class WeChatTransactionComponentGoodRepository : BaseRepository<WeChatTransactionComponentGood>, IWeChatTransactionComponentGoodRepository
{
private readonly IUnitOfWork _unitOfWork;
public WeChatTransactionComponentGoodRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
{
_unitOfWork = unitOfWork;
}
#region ==========================================================
/// <summary>
/// 重写异步插入方法
/// </summary>
/// <param name="entity">实体数据</param>
/// <returns></returns>
public async Task<AdminUiCallBack> InsertAsync(WeChatTransactionComponentGood entity)
{
var jm = new AdminUiCallBack();
var isHave = await DbClient.Queryable<WeChatTransactionComponentGood>()
.AnyAsync(p => p.outProductId == entity.outProductId);
if (isHave)
{
jm.msg = "已经存在相同数据";
return jm;
}
if (entity.sku == null || entity.sku.Count < 0)
{
jm.msg = "请提交sku列表";
return jm;
}
var isSelectCount = entity.sku.Count(p => p.isSelect == true);
if (isSelectCount <= 0)
{
jm.msg = "请至少勾选一个需要提交的sku";
return jm;
}
try
{
_unitOfWork.BeginTran();
var id = await DbClient.Insertable(entity).ExecuteReturnIdentityAsync();
if (id <= 0)
{
_unitOfWork.RollbackTran();
jm.msg = GlobalConstVars.DataHandleEx;
return jm;
}
entity.sku.ForEach(p =>
{
p.skuId = 0;
p.outProductId = entity.outProductId;
p.skuCode = p.barCode;
});
await DbClient.Insertable(entity.sku).ExecuteCommandAsync();
_unitOfWork.CommitTran();
jm.code = 0;
jm.msg = GlobalConstVars.CreateSuccess;
}
catch (Exception e)
{
_unitOfWork.RollbackTran();
jm.msg = GlobalConstVars.DataHandleEx;
jm.data = e;
}
return jm;
}
/// <summary>
/// 重写异步更新方法
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
public async Task<AdminUiCallBack> UpdateAsync(WeChatTransactionComponentGood entity)
{
var jm = new AdminUiCallBack();
var oldModel = await DbClient.Queryable<WeChatTransactionComponentGood>().In(entity.id).SingleAsync();
if (oldModel == null)
{
jm.msg = "不存在此信息";
return jm;
}
//事物处理过程开始
//oldModel.id = entity.id;
oldModel.productId = entity.productId;
oldModel.createTime = entity.createTime;
oldModel.outProductId = entity.outProductId;
oldModel.title = entity.title;
oldModel.path = entity.path;
oldModel.headImg = entity.headImg;
oldModel.qualificationPics = entity.qualificationPics;
oldModel.descInfoDesc = entity.descInfoDesc;
oldModel.descInfoImgs = entity.descInfoImgs;
oldModel.thirdCatId = entity.thirdCatId;
oldModel.brandId = entity.brandId;
oldModel.infoVersion = entity.infoVersion;
oldModel.lastPostTime = entity.lastPostTime;
oldModel.updateTime = entity.updateTime;
oldModel.thirdCatName = entity.thirdCatName;
//事物处理过程结束
var bl = await DbClient.Updateable(oldModel).ExecuteCommandHasChangeAsync();
if (entity.sku == null || entity.sku.Count < 0)
{
jm.msg = "请提交sku列表";
return jm;
}
var isSelectCount = entity.sku.Count(p => p.isSelect == true);
if (isSelectCount <= 0)
{
jm.msg = "请至少勾选一个需要提交的sku";
return jm;
}
var oldSku = await DbClient.Queryable<WeChatTransactionComponentGoodSKU>()
.Where(p => p.outProductId == oldModel.outProductId).ToListAsync();
oldSku.ForEach(p =>
{
var newSku = entity.sku.Find(o => o.outSkuId == p.outSkuId);
if (newSku != null)
{
p.thumbImg = newSku.thumbImg;
p.costprice = newSku.costprice;
p.salePrice = newSku.salePrice;
p.marketPrice = newSku.marketPrice;
p.stockNum = newSku.stockNum;
p.isSelect = newSku.isSelect;
}
});
await DbClient.Updateable(oldSku).ExecuteCommandAsync();
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<WeChatTransactionComponentGood>(id).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<WeChatTransactionComponentGood>> QueryPageAsync(Expression<Func<WeChatTransactionComponentGood, bool>> predicate,
Expression<Func<WeChatTransactionComponentGood, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
int pageSize = 20, bool blUseNoLock = false)
{
RefAsync<int> totalCount = 0;
List<WeChatTransactionComponentGood> page;
if (blUseNoLock)
{
page = await DbClient.Queryable<WeChatTransactionComponentGood>()
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
.WhereIF(predicate != null, predicate).Select(p => new WeChatTransactionComponentGood
{
id = p.id,
productId = p.productId,
createTime = p.createTime,
outProductId = p.outProductId,
title = p.title,
path = p.path,
headImg = p.headImg,
qualificationPics = p.qualificationPics,
//descInfoDesc = p.descInfoDesc,
descInfoImgs = p.descInfoImgs,
thirdCatId = p.thirdCatId,
thirdCatName = p.thirdCatName,
brandId = p.brandId,
infoVersion = p.infoVersion,
lastPostTime = p.lastPostTime,
updateTime = p.updateTime,
}).With(SqlWith.NoLock).ToPageListAsync(pageIndex, pageSize, totalCount);
}
else
{
page = await DbClient.Queryable<WeChatTransactionComponentGood>()
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
.WhereIF(predicate != null, predicate).Select(p => new WeChatTransactionComponentGood
{
id = p.id,
productId = p.productId,
createTime = p.createTime,
outProductId = p.outProductId,
title = p.title,
path = p.path,
headImg = p.headImg,
qualificationPics = p.qualificationPics,
//descInfoDesc = p.descInfoDesc,
descInfoImgs = p.descInfoImgs,
thirdCatId = p.thirdCatId,
thirdCatName = p.thirdCatName,
brandId = p.brandId,
infoVersion = p.infoVersion,
lastPostTime = p.lastPostTime,
updateTime = p.updateTime,
}).ToPageListAsync(pageIndex, pageSize, totalCount);
}
var list = new PageList<WeChatTransactionComponentGood>(page, pageIndex, pageSize, totalCount);
return list;
}
#endregion
}
}

View File

@@ -1,54 +0,0 @@
/***********************************************************************
* Project: CoreCms
* ProjectName: 核心内容管理系统
* Web: https://www.corecms.net
* Author: 大灰灰
* Email: jianweie@163.com
* CreateTime: 2021/7/5 23:23:30
* 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.IRepository;
using CoreCms.Net.IRepository.UnitOfWork;
using CoreCms.Net.Model.ViewModels.Basics;
using CoreCms.Net.Model.ViewModels.UI;
using SqlSugar;
namespace CoreCms.Net.Repository
{
/// <summary>
/// 自定义交易组件商品关联sku列表 接口实现
/// </summary>
public class WeChatTransactionComponentGoodSKURepository : BaseRepository<WeChatTransactionComponentGoodSKU>, IWeChatTransactionComponentGoodSKURepository
{
private readonly IUnitOfWork _unitOfWork;
public WeChatTransactionComponentGoodSKURepository(IUnitOfWork unitOfWork) : base(unitOfWork)
{
_unitOfWork = unitOfWork;
}
/// <summary>
/// 重写异步更新方法
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
public async Task<AdminUiCallBack> UpdateAsync(List<WeChatTransactionComponentGoodSKU> 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;
}
}
}

View File

@@ -1,35 +0,0 @@
/***********************************************************************
* Project: CoreCms
* ProjectName: 核心内容管理系统
* Web: https://www.corecms.net
* Author: 大灰灰
* Email: jianweie@163.com
* CreateTime: 2021/7/10 23:44:16
* 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.IRepository;
using CoreCms.Net.IRepository.UnitOfWork;
using SqlSugar;
namespace CoreCms.Net.Repository
{
/// <summary>
/// 自定义交易组件提交订单 接口实现
/// </summary>
public class WeChatTransactionComponentOrderRepository : BaseRepository<WeChatTransactionComponentOrder>, IWeChatTransactionComponentOrderRepository
{
private readonly IUnitOfWork _unitOfWork;
public WeChatTransactionComponentOrderRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
{
_unitOfWork = unitOfWork;
}
}
}

View File

@@ -1,101 +0,0 @@
/***********************************************************************
* Project: CoreCms
* ProjectName: 核心内容管理系统
* Web: https://www.corecms.net
* Author: 大灰灰
* Email: jianweie@163.com
* CreateTime: 2021/7/3 16:30:55
* 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.IRepository;
using CoreCms.Net.IRepository.UnitOfWork;
using CoreCms.Net.Model.ViewModels.Basics;
using CoreCms.Net.Model.ViewModels.UI;
using SqlSugar;
namespace CoreCms.Net.Repository
{
/// <summary>
/// 自定义交易组件三级类目 接口实现
/// </summary>
public class WeChatTransactionComponentThirdCategoryRepository : BaseRepository<WeChatTransactionComponentThirdCategory>, IWeChatTransactionComponentThirdCategoryRepository
{
public WeChatTransactionComponentThirdCategoryRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
{
}
#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<WeChatTransactionComponentThirdCategory>> QueryPageAsync(Expression<Func<WeChatTransactionComponentThirdCategory, bool>> predicate,
Expression<Func<WeChatTransactionComponentThirdCategory, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
int pageSize = 20, bool blUseNoLock = false)
{
RefAsync<int> totalCount = 0;
List<WeChatTransactionComponentThirdCategory> page;
if (blUseNoLock)
{
page = await DbClient.Queryable<WeChatTransactionComponentThirdCategory>()
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
.WhereIF(predicate != null, predicate).Select(p => new WeChatTransactionComponentThirdCategory
{
id = p.id,
third_cat_id = p.third_cat_id,
third_cat_name = p.third_cat_name,
qualification = p.qualification,
qualification_type = p.qualification_type,
product_qualification = p.product_qualification,
product_qualification_type = p.product_qualification_type,
second_cat_id = p.second_cat_id,
second_cat_name = p.second_cat_name,
first_cat_id = p.first_cat_id,
first_cat_name = p.first_cat_name,
createTime = p.createTime,
}).With(SqlWith.NoLock).ToPageListAsync(pageIndex, pageSize, totalCount);
}
else
{
page = await DbClient.Queryable<WeChatTransactionComponentThirdCategory>()
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
.WhereIF(predicate != null, predicate).Select(p => new WeChatTransactionComponentThirdCategory
{
id = p.id,
third_cat_id = p.third_cat_id,
third_cat_name = p.third_cat_name,
qualification = p.qualification,
qualification_type = p.qualification_type,
product_qualification = p.product_qualification,
product_qualification_type = p.product_qualification_type,
second_cat_id = p.second_cat_id,
second_cat_name = p.second_cat_name,
first_cat_id = p.first_cat_id,
first_cat_name = p.first_cat_name,
createTime = p.createTime,
}).ToPageListAsync(pageIndex, pageSize, totalCount);
}
var list = new PageList<WeChatTransactionComponentThirdCategory>(page, pageIndex, pageSize, totalCount);
return list;
}
#endregion
}
}