mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2026-03-22 17:47:21 +08:00
### 0.6.0 专业版(大版本升级,破坏性升级,请酌情处理):
【新增】弃用现在sku前端,启用全新sku组件,更加灵活,体验更好。 【新增】新增通过商品序列获取sku全新列表功能。 【新增】仓储层底层增加二级缓存功能,后面将逐步完善底层缓存中心模块。 【新增】0元购,积分兑换模式下,也去计算用户是否科技升级。 【新增】数据及业务仓储增加二级缓存功能。curd可自主控制是否缓存和清除。 【新增】订单导出excel数据增加商品名称+货品sku组合展示的方式。 【新增】自定义交易组件增加【获取商家信息】【更新商家信息】两个接口处理。 【新增】增加公告列表及公告详情页面,首页组件公告点击跳转列表展示。 【新增】个人中心增加【公告中心】入口。 【新增】后台余额变动增加说明录入。 【调整】将前端能进行分包的文件夹都进行分包,减少主包占用,方便进行二开。 【调整】因ckeditor5存在图片不可设置宽度,上传不支持mp4,排版不畅等情况,降级使用ckeditor4版本。 【修复】修复0.5.5版本售后积分返还机制积分模式判断异常的问题。 【修复】修复使用积分全额抵扣,或其他优惠政策导致的0元购,未进行短信提醒及小票打印机未打印的问题。 【修复】修复更换ckeditor4编辑器后接龙添加编辑调用失败的问题。 【修复】修复积分全额抵扣,金额0元购的情况下,进行售后执行完毕,订单未完结的情况。 【优化】去除分销申请面板按钮无用并失效报错的customStyle属性。 【优化】优化部分方法中使用手写字符串的遗留问题,统一采用enum方式。 【优化】优化前端及接口部分命名错误的问题。错将skill误写成seckill。 【优化】去除uniapp端多个客服代码。 【优化】商品详情底部完善购物车数量显示的问题。 【优化】优化团购列表,拼团列表,秒杀页面页面样式布局差异问题。 【优化】调整支付结果界面样式效果,仿微信支付结果界面。更加清晰明朗。 【优化】优化售后提交页面json计算,开放当用户下单后但未发货情况下,可以申请直接售后的操作需求。 【优化】后台商家手机号码支持设置多个,使用小写逗号分隔,方便多个商家管理员接收下单提醒。 【优化】后台售后单审核,调整售后商品为必选项。
This commit is contained in:
@@ -15,10 +15,10 @@ 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.Loging;
|
||||
using CoreCms.Net.Model.ViewModels.Basics;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using NLog;
|
||||
using SqlSugar;
|
||||
@@ -174,22 +174,6 @@ namespace CoreCms.Net.Repository
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步更新方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> UpdateAsync(List<CoreCmsAgentGoods> 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>
|
||||
@@ -227,22 +211,6 @@ namespace CoreCms.Net.Repository
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写删除指定ID集合的数据(批量删除)
|
||||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> DeleteByIdsAsync(int[] ids)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Deleteable<CoreCmsAgentGoods>().In(ids).ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -257,7 +225,7 @@ namespace CoreCms.Net.Repository
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<IPageList<CoreCmsAgentGoods>> QueryPageAsync(Expression<Func<CoreCmsAgentGoods, bool>> predicate,
|
||||
public async Task<IPageList<CoreCmsAgentGoods>> QueryPageAsync(Expression<Func<CoreCmsAgentGoods, bool>> predicate,
|
||||
Expression<Func<CoreCmsAgentGoods, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false)
|
||||
{
|
||||
|
||||
@@ -15,9 +15,9 @@ 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.Basics;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using SqlSugar;
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="entity">实体数据</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> InsertAsync(CoreCmsAgentGrade entity)
|
||||
public async Task<AdminUiCallBack> InsertAsync(CoreCmsAgentGrade entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
@@ -49,18 +49,17 @@ namespace CoreCms.Net.Repository
|
||||
return jm;
|
||||
}
|
||||
|
||||
var id = await DbClient.Insertable(entity).ExecuteReturnIdentityAsync();
|
||||
var id = await DbClient.Insertable(entity).RemoveDataCache().ExecuteReturnIdentityAsync();
|
||||
var bl = id > 0;
|
||||
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.CreateSuccess : GlobalConstVars.CreateFailure;
|
||||
if (bl)
|
||||
{
|
||||
if (entity.isDefault == true)
|
||||
if (entity.isDefault)
|
||||
{
|
||||
await DbClient.Updateable<CoreCmsAgentGrade>().SetColumns(p => p.isDefault == false).Where(p => p.isDefault == true && p.id != id).ExecuteCommandAsync();
|
||||
await DbClient.Updateable<CoreCmsAgentGrade>().SetColumns(p => p.isDefault == false).Where(p => p.isDefault == true && p.id != id).RemoveDataCache().ExecuteCommandAsync();
|
||||
}
|
||||
await UpdateCaChe();
|
||||
}
|
||||
return jm;
|
||||
}
|
||||
@@ -70,7 +69,7 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> UpdateAsync(CoreCmsAgentGrade entity)
|
||||
public async Task<AdminUiCallBack> UpdateAsync(CoreCmsAgentGrade entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
@@ -107,7 +106,7 @@ namespace CoreCms.Net.Repository
|
||||
oldModel.description = entity.description;
|
||||
|
||||
//事物处理过程结束
|
||||
var bl = await DbClient.Updateable(oldModel).ExecuteCommandHasChangeAsync();
|
||||
var bl = await DbClient.Updateable(oldModel).RemoveDataCache().ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
|
||||
if (bl)
|
||||
@@ -115,29 +114,8 @@ namespace CoreCms.Net.Repository
|
||||
//其他处理
|
||||
if (entity.isDefault)
|
||||
{
|
||||
await DbClient.Updateable<CoreCmsAgentGrade>().SetColumns(it => it.isDefault == false).Where(p => p.isDefault == true && p.id != entity.id).ExecuteCommandAsync();
|
||||
await DbClient.Updateable<CoreCmsAgentGrade>().SetColumns(it => it.isDefault == false).Where(p => p.isDefault == true && p.id != entity.id).RemoveDataCache().ExecuteCommandAsync();
|
||||
}
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步更新方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> UpdateAsync(List<CoreCmsAgentGrade> entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Updateable(entity).ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
@@ -157,14 +135,13 @@ namespace CoreCms.Net.Repository
|
||||
jm.msg = "存在关联的分销用户数据,禁止删除";
|
||||
return jm;
|
||||
}
|
||||
|
||||
|
||||
var bl = await DbClient.Deleteable<CoreCmsAgentGrade>(id).ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
|
||||
if (bl)
|
||||
{
|
||||
await DbClient.Deleteable<CoreCmsAgentProducts>().Where(p => p.agentGradeId == id).ExecuteCommandHasChangeAsync();
|
||||
await UpdateCaChe();
|
||||
await DbClient.Deleteable<CoreCmsAgentProducts>().Where(p => p.agentGradeId == id).RemoveDataCache().ExecuteCommandHasChangeAsync();
|
||||
}
|
||||
return jm;
|
||||
}
|
||||
@@ -179,24 +156,12 @@ namespace CoreCms.Net.Repository
|
||||
/// <returns></returns>
|
||||
public async Task<List<CoreCmsAgentGrade>> GetCaChe()
|
||||
{
|
||||
var cache = ManualDataCache.Instance.Get<List<CoreCmsAgentGrade>>(GlobalConstVars.CacheCoreCmsAgentGrade);
|
||||
if (cache != null)
|
||||
{
|
||||
return cache;
|
||||
}
|
||||
return await UpdateCaChe();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新cache
|
||||
/// </summary>
|
||||
public async Task<List<CoreCmsAgentGrade>> UpdateCaChe()
|
||||
{
|
||||
var list = await DbClient.Queryable<CoreCmsAgentGrade>().With(SqlWith.NoLock).ToListAsync();
|
||||
ManualDataCache.Instance.Set(GlobalConstVars.CacheCoreCmsAgentGrade, list);
|
||||
var list = await DbClient.Queryable<CoreCmsAgentGrade>().With(SqlWith.NoLock).WithCache().ToListAsync();
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -211,7 +176,7 @@ namespace CoreCms.Net.Repository
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<IPageList<CoreCmsAgentGrade>> QueryPageAsync(Expression<Func<CoreCmsAgentGrade, bool>> predicate,
|
||||
public async Task<IPageList<CoreCmsAgentGrade>> QueryPageAsync(Expression<Func<CoreCmsAgentGrade, bool>> predicate,
|
||||
Expression<Func<CoreCmsAgentGrade, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false)
|
||||
{
|
||||
|
||||
@@ -33,183 +33,5 @@ namespace CoreCms.Net.Repository
|
||||
{
|
||||
_unitOfWork = unitOfWork;
|
||||
}
|
||||
|
||||
#region 实现重写增删改查操作==========================================================
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步插入方法
|
||||
/// </summary>
|
||||
/// <param name="entity">实体数据</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> InsertAsync(CoreCmsAgentOrderDetails 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 new async Task<AdminUiCallBack> UpdateAsync(CoreCmsAgentOrderDetails entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var oldModel = await DbClient.Queryable<CoreCmsAgentOrderDetails>().In(entity.id).SingleAsync();
|
||||
if (oldModel == null)
|
||||
{
|
||||
jm.msg = "不存在此信息";
|
||||
return jm;
|
||||
}
|
||||
//事物处理过程开始
|
||||
oldModel.id = entity.id;
|
||||
oldModel.agentOrderId = entity.agentOrderId;
|
||||
oldModel.orderId = entity.orderId;
|
||||
oldModel.productPrice = entity.productPrice;
|
||||
oldModel.amount = entity.amount;
|
||||
oldModel.goodId = entity.goodId;
|
||||
oldModel.name = entity.name;
|
||||
oldModel.addon = entity.addon;
|
||||
oldModel.productId = entity.productId;
|
||||
oldModel.productNums = entity.productNums;
|
||||
oldModel.promotionAmount = entity.promotionAmount;
|
||||
oldModel.imageUrl = entity.imageUrl;
|
||||
oldModel.remark = entity.remark;
|
||||
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 new async Task<AdminUiCallBack> UpdateAsync(List<CoreCmsAgentOrderDetails> 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 new async Task<AdminUiCallBack> DeleteByIdAsync(object id)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Deleteable<CoreCmsAgentOrderDetails>(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 new async Task<AdminUiCallBack> DeleteByIdsAsync(int[] ids)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Deleteable<CoreCmsAgentOrderDetails>().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 new async Task<IPageList<CoreCmsAgentOrderDetails>> QueryPageAsync(Expression<Func<CoreCmsAgentOrderDetails, bool>> predicate,
|
||||
Expression<Func<CoreCmsAgentOrderDetails, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false)
|
||||
{
|
||||
RefAsync<int> totalCount = 0;
|
||||
List<CoreCmsAgentOrderDetails> page;
|
||||
if (blUseNoLock)
|
||||
{
|
||||
page = await DbClient.Queryable<CoreCmsAgentOrderDetails>()
|
||||
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
|
||||
.WhereIF(predicate != null, predicate).Select(p => new CoreCmsAgentOrderDetails
|
||||
{
|
||||
id = p.id,
|
||||
agentOrderId = p.agentOrderId,
|
||||
orderId = p.orderId,
|
||||
productPrice = p.productPrice,
|
||||
amount = p.amount,
|
||||
goodId = p.goodId,
|
||||
name = p.name,
|
||||
addon = p.addon,
|
||||
productId = p.productId,
|
||||
productNums = p.productNums,
|
||||
promotionAmount = p.promotionAmount,
|
||||
imageUrl = p.imageUrl,
|
||||
remark = p.remark,
|
||||
createTime = p.createTime,
|
||||
|
||||
}).With(SqlWith.NoLock).ToPageListAsync(pageIndex, pageSize, totalCount);
|
||||
}
|
||||
else
|
||||
{
|
||||
page = await DbClient.Queryable<CoreCmsAgentOrderDetails>()
|
||||
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
|
||||
.WhereIF(predicate != null, predicate).Select(p => new CoreCmsAgentOrderDetails
|
||||
{
|
||||
id = p.id,
|
||||
agentOrderId = p.agentOrderId,
|
||||
orderId = p.orderId,
|
||||
productPrice = p.productPrice,
|
||||
amount = p.amount,
|
||||
goodId = p.goodId,
|
||||
name = p.name,
|
||||
addon = p.addon,
|
||||
productId = p.productId,
|
||||
productNums = p.productNums,
|
||||
promotionAmount = p.promotionAmount,
|
||||
imageUrl = p.imageUrl,
|
||||
remark = p.remark,
|
||||
createTime = p.createTime,
|
||||
|
||||
}).ToPageListAsync(pageIndex, pageSize, totalCount);
|
||||
}
|
||||
var list = new PageList<CoreCmsAgentOrderDetails>(page, pageIndex, pageSize, totalCount);
|
||||
return list;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace CoreCms.Net.Repository
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<IPageList<CoreCmsAgentOrder>> QueryPageAsync(Expression<Func<CoreCmsAgentOrder, bool>> predicate,
|
||||
public async Task<IPageList<CoreCmsAgentOrder>> QueryPageAsync(Expression<Func<CoreCmsAgentOrder, bool>> predicate,
|
||||
Expression<Func<CoreCmsAgentOrder, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false)
|
||||
{
|
||||
|
||||
@@ -15,10 +15,9 @@ 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 CoreCms.Net.Model.ViewModels.Basics;
|
||||
using SqlSugar;
|
||||
|
||||
namespace CoreCms.Net.Repository
|
||||
@@ -43,7 +42,7 @@ namespace CoreCms.Net.Repository
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<IPageList<CoreCmsAgentProducts>> QueryPageAsync(Expression<Func<CoreCmsAgentProducts, bool>> predicate,
|
||||
public async Task<IPageList<CoreCmsAgentProducts>> QueryPageAsync(Expression<Func<CoreCmsAgentProducts, bool>> predicate,
|
||||
Expression<Func<CoreCmsAgentProducts, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false)
|
||||
{
|
||||
|
||||
@@ -20,7 +20,6 @@ using CoreCms.Net.IRepository;
|
||||
using CoreCms.Net.IRepository.UnitOfWork;
|
||||
using CoreCms.Net.Model.ViewModels.Basics;
|
||||
using CoreCms.Net.Model.ViewModels.DTO;
|
||||
using CoreCms.Net.Model.ViewModels.DTO.Agent;
|
||||
using SqlSugar;
|
||||
|
||||
namespace CoreCms.Net.Repository
|
||||
@@ -45,7 +44,7 @@ namespace CoreCms.Net.Repository
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<IPageList<CoreCmsAgent>> QueryPageAsync(Expression<Func<CoreCmsAgent, bool>> predicate,
|
||||
public async Task<IPageList<CoreCmsAgent>> QueryPageAsync(Expression<Func<CoreCmsAgent, bool>> predicate,
|
||||
Expression<Func<CoreCmsAgent, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false)
|
||||
{
|
||||
|
||||
@@ -13,7 +13,6 @@ using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using CoreCms.Net.Configuration;
|
||||
using CoreCms.Net.Model.Entities;
|
||||
using CoreCms.Net.Model.ViewModels.Basics;
|
||||
using CoreCms.Net.IRepository;
|
||||
using CoreCms.Net.IRepository.UnitOfWork;
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -18,8 +18,6 @@ using CoreCms.Net.IRepository.UnitOfWork;
|
||||
using CoreCms.Net.Model.Entities;
|
||||
using CoreCms.Net.Model.Entities.Expression;
|
||||
using CoreCms.Net.Model.ViewModels.Basics;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using CoreCms.Net.Model.ViewModels.DTO;
|
||||
using CoreCms.Net.Utility.Helper;
|
||||
using SqlSugar;
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@ using CoreCms.Net.IRepository.UnitOfWork;
|
||||
using CoreCms.Net.Loging;
|
||||
using CoreCms.Net.Model.Entities;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using CoreCms.Net.Model.ViewModels.DTO;
|
||||
using CoreCms.Net.Utility.Helper;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace CoreCms.Net.Repository
|
||||
{
|
||||
var dt = DateTime.Now.AddDays(-8);
|
||||
|
||||
var types = new int[] { (int)GlobalEnumVars.BillPaymentsType.Common, (int)GlobalEnumVars.BillPaymentsType.PinTuan, (int)GlobalEnumVars.BillPaymentsType.Group, (int)GlobalEnumVars.BillPaymentsType.Skill, (int)GlobalEnumVars.BillPaymentsType.Bargain, (int)GlobalEnumVars.BillPaymentsType.Giveaway, (int)GlobalEnumVars.BillPaymentsType.Solitaire, (int)GlobalEnumVars.BillPaymentsType.TransactionComponent };
|
||||
var types = new int[] { (int)GlobalEnumVars.BillPaymentsType.Common, (int)GlobalEnumVars.BillPaymentsType.PinTuan, (int)GlobalEnumVars.BillPaymentsType.Group, (int)GlobalEnumVars.BillPaymentsType.Seckill, (int)GlobalEnumVars.BillPaymentsType.Bargain, (int)GlobalEnumVars.BillPaymentsType.Giveaway, (int)GlobalEnumVars.BillPaymentsType.Solitaire, (int)GlobalEnumVars.BillPaymentsType.TransactionComponent };
|
||||
|
||||
var list = await DbClient.Queryable<CoreCmsBillPayments>()
|
||||
.Where(p => p.createTime >= dt && p.status == (int)GlobalEnumVars.BillPaymentsStatus.Payed && types.Contains(p.type))
|
||||
@@ -75,7 +75,7 @@ namespace CoreCms.Net.Repository
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<IPageList<CoreCmsBillPayments>> QueryPageAsync(Expression<Func<CoreCmsBillPayments, bool>> predicate,
|
||||
public async Task<IPageList<CoreCmsBillPayments>> QueryPageAsync(Expression<Func<CoreCmsBillPayments, bool>> predicate,
|
||||
Expression<Func<CoreCmsBillPayments, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false)
|
||||
{
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace CoreCms.Net.Repository
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<IPageList<CoreCmsBillRefund>> QueryPageAsync(Expression<Func<CoreCmsBillRefund, bool>> predicate,
|
||||
public async Task<IPageList<CoreCmsBillRefund>> QueryPageAsync(Expression<Func<CoreCmsBillRefund, bool>> predicate,
|
||||
Expression<Func<CoreCmsBillRefund, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false)
|
||||
{
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="entity">实体数据</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> InsertAsync(List<CoreCmsContinuousCheckInRules> entity)
|
||||
public async Task<AdminUiCallBack> InsertAsync(List<CoreCmsContinuousCheckInRules> entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
@@ -66,8 +66,8 @@ namespace CoreCms.Net.Repository
|
||||
_unitOfWork.BeginTran();
|
||||
|
||||
//先清理掉数据,因为是配置数据,可直接删除添加新的
|
||||
await DbClient.Deleteable<CoreCmsContinuousCheckInRules>().Where(p => p.id > 0).ExecuteCommandAsync();
|
||||
await DbClient.Deleteable<CoreCmsContinuousCheckInRuleDetails>().Where(p => p.id > 0).ExecuteCommandAsync();
|
||||
await DbClient.Deleteable<CoreCmsContinuousCheckInRules>().Where(p => p.id > 0).RemoveDataCache().ExecuteCommandAsync();
|
||||
await DbClient.Deleteable<CoreCmsContinuousCheckInRuleDetails>().Where(p => p.id > 0).RemoveDataCache().ExecuteCommandAsync();
|
||||
|
||||
//遍历数据存值
|
||||
foreach (var item in entity)
|
||||
@@ -91,7 +91,6 @@ namespace CoreCms.Net.Repository
|
||||
jm.code = 0;
|
||||
jm.msg = "更新成功";
|
||||
|
||||
await UpdateCaChe();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -111,19 +110,6 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<List<CoreCmsContinuousCheckInRules>> GetCaChe()
|
||||
{
|
||||
var cache = ManualDataCache.Instance.Get<List<CoreCmsContinuousCheckInRules>>(GlobalConstVars.CacheCoreCmsContinuousCheckInRules);
|
||||
if (cache != null)
|
||||
{
|
||||
return cache;
|
||||
}
|
||||
return await UpdateCaChe();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新cache
|
||||
/// </summary>
|
||||
public async Task<List<CoreCmsContinuousCheckInRules>> UpdateCaChe()
|
||||
{
|
||||
var list = await DbClient.Queryable<CoreCmsContinuousCheckInRules>()
|
||||
.Select(p => new CoreCmsContinuousCheckInRules
|
||||
@@ -132,11 +118,11 @@ namespace CoreCms.Net.Repository
|
||||
days = p.days,
|
||||
})
|
||||
.Mapper(p => p.details, p => p.details.First().ruleId)
|
||||
.With(SqlWith.NoLock).ToListAsync();
|
||||
ManualDataCache.Instance.Set(GlobalConstVars.CacheCoreCmsContinuousCheckInRules, list);
|
||||
.With(SqlWith.NoLock).WithCache().ToListAsync();
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region 重写根据条件查询分页数据
|
||||
@@ -150,7 +136,7 @@ namespace CoreCms.Net.Repository
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<IPageList<CoreCmsContinuousCheckInRules>> QueryPageAsync(Expression<Func<CoreCmsContinuousCheckInRules, bool>> predicate,
|
||||
public async Task<IPageList<CoreCmsContinuousCheckInRules>> QueryPageAsync(Expression<Func<CoreCmsContinuousCheckInRules, bool>> predicate,
|
||||
Expression<Func<CoreCmsContinuousCheckInRules, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false)
|
||||
{
|
||||
|
||||
@@ -34,217 +34,29 @@ namespace CoreCms.Net.Repository
|
||||
_unitOfWork = unitOfWork;
|
||||
}
|
||||
|
||||
#region 实现重写增删改查操作==========================================================
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步插入方法
|
||||
/// </summary>
|
||||
/// <param name="entity">实体数据</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> InsertAsync(CoreCmsCumulativeCheckInRules 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;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步更新方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> InsertAsync(List<CoreCmsCumulativeCheckInRules> entity)
|
||||
public async Task<AdminUiCallBack> InsertAsync(List<CoreCmsCumulativeCheckInRules> entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Insertable(entity).ExecuteCommandAsync();
|
||||
jm.code = 0;
|
||||
jm.msg = GlobalConstVars.EditSuccess;
|
||||
await UpdateCaChe();
|
||||
return jm;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步更新方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> UpdateAsync(CoreCmsCumulativeCheckInRules entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var oldModel = await DbClient.Queryable<CoreCmsCumulativeCheckInRules>().In(entity.id).SingleAsync();
|
||||
if (oldModel == null)
|
||||
{
|
||||
jm.msg = "不存在此信息";
|
||||
return jm;
|
||||
}
|
||||
//事物处理过程开始
|
||||
oldModel.id = entity.id;
|
||||
oldModel.days = entity.days;
|
||||
oldModel.num = entity.num;
|
||||
oldModel.type = entity.type;
|
||||
|
||||
//事物处理过程结束
|
||||
var bl = await DbClient.Updateable(oldModel).ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步更新方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> UpdateAsync(List<CoreCmsCumulativeCheckInRules> entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Updateable(entity).ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写删除指定ID的数据
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> DeleteByIdAsync(object id)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Deleteable<CoreCmsCumulativeCheckInRules>(id).ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写删除指定ID集合的数据(批量删除)
|
||||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> DeleteByIdsAsync(int[] ids)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Deleteable<CoreCmsCumulativeCheckInRules>().In(ids).ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 获取缓存的所有数据==========================================================
|
||||
|
||||
/// <summary>
|
||||
/// 获取缓存的所有数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<List<CoreCmsCumulativeCheckInRules>> GetCaChe()
|
||||
{
|
||||
var cache = ManualDataCache.Instance.Get<List<CoreCmsCumulativeCheckInRules>>(GlobalConstVars.CacheCoreCmsCumulativeCheckInRules);
|
||||
if (cache != null)
|
||||
{
|
||||
return cache;
|
||||
}
|
||||
return await UpdateCaChe();
|
||||
return await DbClient.Queryable<CoreCmsCumulativeCheckInRules>().With(SqlWith.NoLock).WithCache().ToListAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新cache
|
||||
/// </summary>
|
||||
public async Task<List<CoreCmsCumulativeCheckInRules>> UpdateCaChe()
|
||||
{
|
||||
var list = await DbClient.Queryable<CoreCmsCumulativeCheckInRules>().With(SqlWith.NoLock).ToListAsync();
|
||||
ManualDataCache.Instance.Set(GlobalConstVars.CacheCoreCmsCumulativeCheckInRules, list);
|
||||
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 new async Task<IPageList<CoreCmsCumulativeCheckInRules>> QueryPageAsync(Expression<Func<CoreCmsCumulativeCheckInRules, bool>> predicate,
|
||||
Expression<Func<CoreCmsCumulativeCheckInRules, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false)
|
||||
{
|
||||
RefAsync<int> totalCount = 0;
|
||||
List<CoreCmsCumulativeCheckInRules> page;
|
||||
if (blUseNoLock)
|
||||
{
|
||||
page = await DbClient.Queryable<CoreCmsCumulativeCheckInRules>()
|
||||
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
|
||||
.WhereIF(predicate != null, predicate).Select(p => new CoreCmsCumulativeCheckInRules
|
||||
{
|
||||
id = p.id,
|
||||
days = p.days,
|
||||
num = p.num,
|
||||
type = p.type,
|
||||
|
||||
}).With(SqlWith.NoLock).ToPageListAsync(pageIndex, pageSize, totalCount);
|
||||
}
|
||||
else
|
||||
{
|
||||
page = await DbClient.Queryable<CoreCmsCumulativeCheckInRules>()
|
||||
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
|
||||
.WhereIF(predicate != null, predicate).Select(p => new CoreCmsCumulativeCheckInRules
|
||||
{
|
||||
id = p.id,
|
||||
days = p.days,
|
||||
num = p.num,
|
||||
type = p.type,
|
||||
|
||||
}).ToPageListAsync(pageIndex, pageSize, totalCount);
|
||||
}
|
||||
var list = new PageList<CoreCmsCumulativeCheckInRules>(page, pageIndex, pageSize, totalCount);
|
||||
return list;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace CoreCms.Net.Repository
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<IPageList<CoreCmsUserCheckIn>> QueryPageAsync(Expression<Func<CoreCmsUserCheckIn, bool>> predicate,
|
||||
public async Task<IPageList<CoreCmsUserCheckIn>> QueryPageAsync(Expression<Func<CoreCmsUserCheckIn, bool>> predicate,
|
||||
Expression<Func<CoreCmsUserCheckIn, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false)
|
||||
{
|
||||
|
||||
@@ -15,9 +15,9 @@ 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.Basics;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using SqlSugar;
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="entity">实体数据</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> InsertAsync(CoreCmsDistributionCondition entity)
|
||||
public async Task<AdminUiCallBack> InsertAsync(CoreCmsDistributionCondition entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
@@ -52,10 +52,6 @@ namespace CoreCms.Net.Repository
|
||||
var bl = await DbClient.Insertable(entity).ExecuteReturnIdentityAsync() > 0;
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.CreateSuccess : GlobalConstVars.CreateFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
@@ -65,7 +61,7 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> UpdateAsync(CoreCmsDistributionCondition entity)
|
||||
public async Task<AdminUiCallBack> UpdateAsync(CoreCmsDistributionCondition entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
@@ -91,30 +87,6 @@ namespace CoreCms.Net.Repository
|
||||
var bl = await DbClient.Updateable(oldModel).ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步更新方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> UpdateAsync(List<CoreCmsDistributionCondition> entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Updateable(entity).ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
@@ -124,69 +96,17 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> DeleteByIdAsync(object id)
|
||||
public async Task<AdminUiCallBack> DeleteByIdAsync(object id)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Deleteable<CoreCmsDistributionCondition>(id).ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写删除指定ID集合的数据(批量删除)
|
||||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> DeleteByIdsAsync(int[] ids)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Deleteable<CoreCmsDistributionCondition>().In(ids).ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 获取缓存的所有数据==========================================================
|
||||
|
||||
/// <summary>
|
||||
/// 获取缓存的所有数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<List<CoreCmsDistributionCondition>> GetCaChe()
|
||||
{
|
||||
var cache = ManualDataCache.Instance.Get<List<CoreCmsDistributionCondition>>(GlobalConstVars.CacheCoreCmsDistributionCondition);
|
||||
if (cache != null)
|
||||
{
|
||||
return cache;
|
||||
}
|
||||
return await UpdateCaChe();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新cache
|
||||
/// </summary>
|
||||
public async Task<List<CoreCmsDistributionCondition>> UpdateCaChe()
|
||||
{
|
||||
var list = await DbClient.Queryable<CoreCmsDistributionCondition>().With(SqlWith.NoLock).ToListAsync();
|
||||
ManualDataCache.Instance.Set(GlobalConstVars.CacheCoreCmsDistributionCondition, list);
|
||||
return list;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 重写根据条件查询分页数据
|
||||
@@ -200,7 +120,7 @@ namespace CoreCms.Net.Repository
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<IPageList<CoreCmsDistributionCondition>> QueryPageAsync(Expression<Func<CoreCmsDistributionCondition, bool>> predicate,
|
||||
public async Task<IPageList<CoreCmsDistributionCondition>> QueryPageAsync(Expression<Func<CoreCmsDistributionCondition, bool>> predicate,
|
||||
Expression<Func<CoreCmsDistributionCondition, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false)
|
||||
{
|
||||
|
||||
@@ -15,9 +15,9 @@ 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.Basics;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using SqlSugar;
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="entity">实体数据</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> InsertAsync(CoreCmsDistributionGrade entity)
|
||||
public async Task<AdminUiCallBack> InsertAsync(CoreCmsDistributionGrade entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace CoreCms.Net.Repository
|
||||
return jm;
|
||||
}
|
||||
|
||||
var id = await DbClient.Insertable(entity).ExecuteReturnIdentityAsync();
|
||||
var id = await DbClient.Insertable(entity).RemoveDataCache().ExecuteReturnIdentityAsync();
|
||||
var bl = id > 0;
|
||||
|
||||
jm.code = bl ? 0 : 1;
|
||||
@@ -58,9 +58,8 @@ namespace CoreCms.Net.Repository
|
||||
{
|
||||
if (entity.isDefault == true)
|
||||
{
|
||||
await DbClient.Updateable<CoreCmsDistributionGrade>().SetColumns(p => p.isDefault == false).Where(p => p.isDefault == true && p.id != id).ExecuteCommandAsync();
|
||||
await DbClient.Updateable<CoreCmsDistributionGrade>().SetColumns(p => p.isDefault == false).Where(p => p.isDefault == true && p.id != id).RemoveDataCache().ExecuteCommandAsync();
|
||||
}
|
||||
await UpdateCaChe();
|
||||
}
|
||||
return jm;
|
||||
}
|
||||
@@ -70,7 +69,7 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> UpdateAsync(CoreCmsDistributionGrade entity)
|
||||
public async Task<AdminUiCallBack> UpdateAsync(CoreCmsDistributionGrade entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
@@ -97,7 +96,6 @@ namespace CoreCms.Net.Repository
|
||||
return jm;
|
||||
}
|
||||
//事物处理过程开始
|
||||
//oldModel.id = entity.id;
|
||||
oldModel.name = entity.name;
|
||||
oldModel.isDefault = entity.isDefault;
|
||||
oldModel.isAutoUpGrade = entity.isAutoUpGrade;
|
||||
@@ -105,7 +103,7 @@ namespace CoreCms.Net.Repository
|
||||
oldModel.description = entity.description;
|
||||
|
||||
//事物处理过程结束
|
||||
var bl = await DbClient.Updateable(oldModel).ExecuteCommandHasChangeAsync();
|
||||
var bl = await DbClient.Updateable(oldModel).RemoveDataCache().ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
|
||||
if (bl)
|
||||
@@ -113,9 +111,8 @@ namespace CoreCms.Net.Repository
|
||||
//其他处理
|
||||
if (entity.isDefault)
|
||||
{
|
||||
await DbClient.Updateable<CoreCmsDistributionGrade>().SetColumns(it => it.isDefault == false).Where(p => p.isDefault == true && p.id != entity.id).ExecuteCommandAsync();
|
||||
await DbClient.Updateable<CoreCmsDistributionGrade>().SetColumns(it => it.isDefault == false).Where(p => p.isDefault == true && p.id != entity.id).RemoveDataCache().ExecuteCommandAsync();
|
||||
}
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
@@ -136,14 +133,13 @@ namespace CoreCms.Net.Repository
|
||||
jm.msg = "存在关联的分销用户数据,禁止删除";
|
||||
return jm;
|
||||
}
|
||||
var bl = await DbClient.Deleteable<CoreCmsDistributionGrade>(id).ExecuteCommandHasChangeAsync();
|
||||
var bl = await DbClient.Deleteable<CoreCmsDistributionGrade>(id).RemoveDataCache().ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
|
||||
if (bl)
|
||||
{
|
||||
await DbClient.Deleteable<CoreCmsDistributionCondition>().Where(p => p.gradeId == id).ExecuteCommandAsync();
|
||||
await DbClient.Deleteable<CoreCmsDistributionResult>().Where(p => p.gradeId == id).ExecuteCommandAsync();
|
||||
await UpdateCaChe();
|
||||
await DbClient.Deleteable<CoreCmsDistributionCondition>().Where(p => p.gradeId == id).RemoveDataCache().ExecuteCommandAsync();
|
||||
await DbClient.Deleteable<CoreCmsDistributionResult>().Where(p => p.gradeId == id).RemoveDataCache().ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
return jm;
|
||||
@@ -160,24 +156,11 @@ namespace CoreCms.Net.Repository
|
||||
/// <returns></returns>
|
||||
public async Task<List<CoreCmsDistributionGrade>> GetCaChe()
|
||||
{
|
||||
var cache = ManualDataCache.Instance.Get<List<CoreCmsDistributionGrade>>(GlobalConstVars.CacheCoreCmsDistributionGrade);
|
||||
if (cache != null)
|
||||
{
|
||||
return cache;
|
||||
}
|
||||
return await UpdateCaChe();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新cache
|
||||
/// </summary>
|
||||
public async Task<List<CoreCmsDistributionGrade>> UpdateCaChe()
|
||||
{
|
||||
var list = await DbClient.Queryable<CoreCmsDistributionGrade>().With(SqlWith.NoLock).ToListAsync();
|
||||
ManualDataCache.Instance.Set(GlobalConstVars.CacheCoreCmsDistributionGrade, list);
|
||||
var list = await DbClient.Queryable<CoreCmsDistributionGrade>().With(SqlWith.NoLock).WithCache().ToListAsync();
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -192,7 +175,7 @@ namespace CoreCms.Net.Repository
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<IPageList<CoreCmsDistributionGrade>> QueryPageAsync(Expression<Func<CoreCmsDistributionGrade, bool>> predicate,
|
||||
public async Task<IPageList<CoreCmsDistributionGrade>> QueryPageAsync(Expression<Func<CoreCmsDistributionGrade, bool>> predicate,
|
||||
Expression<Func<CoreCmsDistributionGrade, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false)
|
||||
{
|
||||
|
||||
@@ -34,182 +34,5 @@ namespace CoreCms.Net.Repository
|
||||
_unitOfWork = unitOfWork;
|
||||
}
|
||||
|
||||
#region 实现重写增删改查操作==========================================================
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步插入方法
|
||||
/// </summary>
|
||||
/// <param name="entity">实体数据</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> InsertAsync(CoreCmsDistributionOrderDetails 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 new async Task<AdminUiCallBack> UpdateAsync(CoreCmsDistributionOrderDetails entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var oldModel = await DbClient.Queryable<CoreCmsDistributionOrderDetails>().In(entity.id).SingleAsync();
|
||||
if (oldModel == null)
|
||||
{
|
||||
jm.msg = "不存在此信息";
|
||||
return jm;
|
||||
}
|
||||
//事物处理过程开始
|
||||
oldModel.id = entity.id;
|
||||
oldModel.distributionOrderId = entity.distributionOrderId;
|
||||
oldModel.orderId = entity.orderId;
|
||||
oldModel.productPrice = entity.productPrice;
|
||||
oldModel.amount = entity.amount;
|
||||
oldModel.goodId = entity.goodId;
|
||||
oldModel.name = entity.name;
|
||||
oldModel.addon = entity.addon;
|
||||
oldModel.productId = entity.productId;
|
||||
oldModel.productNums = entity.productNums;
|
||||
oldModel.promotionAmount = entity.promotionAmount;
|
||||
oldModel.imageUrl = entity.imageUrl;
|
||||
oldModel.remark = entity.remark;
|
||||
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 new async Task<AdminUiCallBack> UpdateAsync(List<CoreCmsDistributionOrderDetails> 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 new async Task<AdminUiCallBack> DeleteByIdAsync(object id)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Deleteable<CoreCmsDistributionOrderDetails>(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 new async Task<AdminUiCallBack> DeleteByIdsAsync(int[] ids)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Deleteable<CoreCmsDistributionOrderDetails>().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 new async Task<IPageList<CoreCmsDistributionOrderDetails>> QueryPageAsync(Expression<Func<CoreCmsDistributionOrderDetails, bool>> predicate,
|
||||
Expression<Func<CoreCmsDistributionOrderDetails, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false)
|
||||
{
|
||||
RefAsync<int> totalCount = 0;
|
||||
List<CoreCmsDistributionOrderDetails> page;
|
||||
if (blUseNoLock)
|
||||
{
|
||||
page = await DbClient.Queryable<CoreCmsDistributionOrderDetails>()
|
||||
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
|
||||
.WhereIF(predicate != null, predicate).Select(p => new CoreCmsDistributionOrderDetails
|
||||
{
|
||||
id = p.id,
|
||||
distributionOrderId = p.distributionOrderId,
|
||||
orderId = p.orderId,
|
||||
amount = p.amount,
|
||||
productPrice = p.productPrice,
|
||||
goodId = p.goodId,
|
||||
name = p.name,
|
||||
addon = p.addon,
|
||||
productId = p.productId,
|
||||
productNums = p.productNums,
|
||||
promotionAmount = p.promotionAmount,
|
||||
imageUrl = p.imageUrl,
|
||||
remark = p.remark,
|
||||
createTime = p.createTime,
|
||||
|
||||
}).With(SqlWith.NoLock).ToPageListAsync(pageIndex, pageSize, totalCount);
|
||||
}
|
||||
else
|
||||
{
|
||||
page = await DbClient.Queryable<CoreCmsDistributionOrderDetails>()
|
||||
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
|
||||
.WhereIF(predicate != null, predicate).Select(p => new CoreCmsDistributionOrderDetails
|
||||
{
|
||||
id = p.id,
|
||||
distributionOrderId = p.distributionOrderId,
|
||||
orderId = p.orderId,
|
||||
amount = p.amount,
|
||||
productPrice = p.productPrice,
|
||||
goodId = p.goodId,
|
||||
name = p.name,
|
||||
addon = p.addon,
|
||||
productId = p.productId,
|
||||
productNums = p.productNums,
|
||||
promotionAmount = p.promotionAmount,
|
||||
imageUrl = p.imageUrl,
|
||||
remark = p.remark,
|
||||
createTime = p.createTime,
|
||||
|
||||
}).ToPageListAsync(pageIndex, pageSize, totalCount);
|
||||
}
|
||||
var list = new PageList<CoreCmsDistributionOrderDetails>(page, pageIndex, pageSize, totalCount);
|
||||
return list;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace CoreCms.Net.Repository
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#region 重写根据条件查询分页数据
|
||||
/// <summary>
|
||||
@@ -46,7 +46,7 @@ namespace CoreCms.Net.Repository
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<IPageList<CoreCmsDistributionOrder>> QueryPageAsync(Expression<Func<CoreCmsDistributionOrder, bool>> predicate,
|
||||
public async Task<IPageList<CoreCmsDistributionOrder>> QueryPageAsync(Expression<Func<CoreCmsDistributionOrder, bool>> predicate,
|
||||
Expression<Func<CoreCmsDistributionOrder, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false)
|
||||
{
|
||||
|
||||
@@ -128,7 +128,7 @@ namespace CoreCms.Net.Repository
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<IPageList<CoreCmsDistribution>> QueryPageAsync(Expression<Func<CoreCmsDistribution, bool>> predicate,
|
||||
public async Task<IPageList<CoreCmsDistribution>> QueryPageAsync(Expression<Func<CoreCmsDistribution, bool>> predicate,
|
||||
Expression<Func<CoreCmsDistribution, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false)
|
||||
{
|
||||
|
||||
@@ -15,9 +15,9 @@ 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.Basics;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using SqlSugar;
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="entity">实体数据</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> InsertAsync(CoreCmsDistributionResult entity)
|
||||
public async Task<AdminUiCallBack> InsertAsync(CoreCmsDistributionResult entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
@@ -49,13 +49,9 @@ namespace CoreCms.Net.Repository
|
||||
return jm;
|
||||
}
|
||||
|
||||
var bl = await DbClient.Insertable(entity).ExecuteReturnIdentityAsync() > 0;
|
||||
var bl = await DbClient.Insertable(entity).RemoveDataCache().ExecuteReturnIdentityAsync() > 0;
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.CreateSuccess : GlobalConstVars.CreateFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
@@ -65,7 +61,7 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> UpdateAsync(CoreCmsDistributionResult entity)
|
||||
public async Task<AdminUiCallBack> UpdateAsync(CoreCmsDistributionResult entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
@@ -88,13 +84,9 @@ namespace CoreCms.Net.Repository
|
||||
oldModel.parameters = entity.parameters;
|
||||
|
||||
//事物处理过程结束
|
||||
var bl = await DbClient.Updateable(oldModel).ExecuteCommandHasChangeAsync();
|
||||
var bl = await DbClient.Updateable(oldModel).RemoveDataCache().ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
return jm;
|
||||
}
|
||||
|
||||
@@ -103,17 +95,13 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> UpdateAsync(List<CoreCmsDistributionResult> entity)
|
||||
public async Task<AdminUiCallBack> UpdateAsync(List<CoreCmsDistributionResult> entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Updateable(entity).ExecuteCommandHasChangeAsync();
|
||||
var bl = await DbClient.Updateable(entity).RemoveDataCache().ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
@@ -123,17 +111,13 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> DeleteByIdAsync(object id)
|
||||
public async Task<AdminUiCallBack> DeleteByIdAsync(object id)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Deleteable<CoreCmsDistributionResult>(id).ExecuteCommandHasChangeAsync();
|
||||
var bl = await DbClient.Deleteable<CoreCmsDistributionResult>(id).RemoveDataCache().ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
@@ -143,51 +127,19 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> DeleteByIdsAsync(int[] ids)
|
||||
public async Task<AdminUiCallBack> DeleteByIdsAsync(int[] ids)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Deleteable<CoreCmsDistributionResult>().In(ids).ExecuteCommandHasChangeAsync();
|
||||
var bl = await DbClient.Deleteable<CoreCmsDistributionResult>().In(ids).RemoveDataCache().ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 获取缓存的所有数据==========================================================
|
||||
|
||||
/// <summary>
|
||||
/// 获取缓存的所有数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<List<CoreCmsDistributionResult>> GetCaChe()
|
||||
{
|
||||
var cache = ManualDataCache.Instance.Get<List<CoreCmsDistributionResult>>(GlobalConstVars.CacheCoreCmsDistributionResult);
|
||||
if (cache != null)
|
||||
{
|
||||
return cache;
|
||||
}
|
||||
return await UpdateCaChe();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新cache
|
||||
/// </summary>
|
||||
public async Task<List<CoreCmsDistributionResult>> UpdateCaChe()
|
||||
{
|
||||
var list = await DbClient.Queryable<CoreCmsDistributionResult>().With(SqlWith.NoLock).ToListAsync();
|
||||
ManualDataCache.Instance.Set(GlobalConstVars.CacheCoreCmsDistributionResult, list);
|
||||
return list;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 重写根据条件查询分页数据
|
||||
/// <summary>
|
||||
/// 重写根据条件查询分页数据
|
||||
@@ -199,7 +151,7 @@ namespace CoreCms.Net.Repository
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<IPageList<CoreCmsDistributionResult>> QueryPageAsync(Expression<Func<CoreCmsDistributionResult, bool>> predicate,
|
||||
public async Task<IPageList<CoreCmsDistributionResult>> QueryPageAsync(Expression<Func<CoreCmsDistributionResult, bool>> predicate,
|
||||
Expression<Func<CoreCmsDistributionResult, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false)
|
||||
{
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace CoreCms.Net.Repository
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<IPageList<CoreCmsInvoice>> QueryPageAsync(
|
||||
public async Task<IPageList<CoreCmsInvoice>> QueryPageAsync(
|
||||
Expression<Func<CoreCmsInvoice, bool>> predicate,
|
||||
Expression<Func<CoreCmsInvoice, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false)
|
||||
|
||||
@@ -13,7 +13,6 @@ 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;
|
||||
@@ -37,16 +36,13 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="entity">实体数据</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> InsertAsync(CoreCmsGoodsCategory entity)
|
||||
public async Task<AdminUiCallBack> InsertAsync(CoreCmsGoodsCategory entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
var bl = await DbClient.Insertable(entity).ExecuteReturnIdentityAsync() > 0;
|
||||
var bl = await DbClient.Insertable(entity).RemoveDataCache().ExecuteReturnIdentityAsync() > 0;
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.CreateSuccess : GlobalConstVars.CreateFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
@@ -55,38 +51,14 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> UpdateAsync(CoreCmsGoodsCategory entity)
|
||||
public async Task<AdminUiCallBack> UpdateAsync(CoreCmsGoodsCategory entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
//事物处理过程结束
|
||||
var bl = await DbClient.Updateable(entity).ExecuteCommandHasChangeAsync();
|
||||
var bl = await DbClient.Updateable(entity).RemoveDataCache().ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步更新方法方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> UpdateAsync(List<CoreCmsGoodsCategory> entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Updateable(entity).ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
@@ -96,42 +68,17 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> DeleteByIdAsync(object id)
|
||||
public async Task<AdminUiCallBack> DeleteByIdAsync(object id)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Deleteable<CoreCmsGoodsCategory>(id).ExecuteCommandHasChangeAsync();
|
||||
var bl = await DbClient.Deleteable<CoreCmsGoodsCategory>(id).RemoveDataCache().ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写删除指定ID集合的数据(批量删除)
|
||||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> DeleteByIdsAsync(int[] ids)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Deleteable<CoreCmsGoodsCategory>().In(ids).ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
return jm;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region 获取缓存的所有数据==========================================================
|
||||
@@ -142,21 +89,7 @@ namespace CoreCms.Net.Repository
|
||||
/// <returns></returns>
|
||||
public async Task<List<CoreCmsGoodsCategory>> GetCaChe()
|
||||
{
|
||||
var cache = ManualDataCache.Instance.Get<List<CoreCmsGoodsCategory>>(GlobalConstVars.CacheCoreCmsGoodsCategory);
|
||||
if (cache != null)
|
||||
{
|
||||
return cache;
|
||||
}
|
||||
return await UpdateCaChe();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新cache
|
||||
/// </summary>
|
||||
private async Task<List<CoreCmsGoodsCategory>> UpdateCaChe()
|
||||
{
|
||||
var list = await DbClient.Queryable<CoreCmsGoodsCategory>().With(SqlWith.NoLock).ToListAsync();
|
||||
ManualDataCache.Instance.Set(GlobalConstVars.CacheCoreCmsGoodsCategory, list);
|
||||
var list = await DbClient.Queryable<CoreCmsGoodsCategory>().With(SqlWith.NoLock).WithCache().ToListAsync();
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,9 +15,9 @@ 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.Basics;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using SqlSugar;
|
||||
|
||||
@@ -34,28 +34,12 @@ namespace CoreCms.Net.Repository
|
||||
|
||||
#region 实现重写增删改查操作==========================================================
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步插入方法
|
||||
/// </summary>
|
||||
/// <param name="entity">实体数据</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> InsertAsync(CoreCmsGoodsComment 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 new async Task<AdminUiCallBack> UpdateAsync(CoreCmsGoodsComment entity)
|
||||
public async Task<AdminUiCallBack> UpdateAsync(CoreCmsGoodsComment entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
@@ -87,28 +71,12 @@ namespace CoreCms.Net.Repository
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步更新方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> UpdateAsync(List<CoreCmsGoodsComment> 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 new async Task<AdminUiCallBack> DeleteByIdAsync(object id)
|
||||
public async Task<AdminUiCallBack> DeleteByIdAsync(object id)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
@@ -119,22 +87,6 @@ namespace CoreCms.Net.Repository
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写删除指定ID集合的数据(批量删除)
|
||||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> DeleteByIdsAsync(int[] ids)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Deleteable<CoreCmsGoodsComment>().In(ids).ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -144,7 +96,7 @@ namespace CoreCms.Net.Repository
|
||||
/// <param name="id">序列</param>
|
||||
/// <param name="sellerContent">回复内容</param>
|
||||
/// <returns></returns>
|
||||
public async Task<AdminUiCallBack> Reply(int id,string sellerContent)
|
||||
public async Task<AdminUiCallBack> Reply(int id, string sellerContent)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
@@ -225,7 +177,7 @@ namespace CoreCms.Net.Repository
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<IPageList<CoreCmsGoodsComment>> QueryPageAsync(Expression<Func<CoreCmsGoodsComment, bool>> predicate,
|
||||
public async Task<IPageList<CoreCmsGoodsComment>> QueryPageAsync(Expression<Func<CoreCmsGoodsComment, bool>> predicate,
|
||||
Expression<Func<CoreCmsGoodsComment, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false)
|
||||
{
|
||||
|
||||
@@ -742,7 +742,7 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> DeleteByIdsAsync(int[] ids)
|
||||
public async Task<AdminUiCallBack> DeleteByIdsAsync(int[] ids)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
@@ -1144,7 +1144,7 @@ namespace CoreCms.Net.Repository
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<IPageList<CoreCmsGoods>> QueryPageAsync(Expression<Func<CoreCmsGoods, bool>> predicate,
|
||||
public async Task<IPageList<CoreCmsGoods>> QueryPageAsync(Expression<Func<CoreCmsGoods, bool>> predicate,
|
||||
Expression<Func<CoreCmsGoods, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false)
|
||||
{
|
||||
@@ -1274,7 +1274,7 @@ namespace CoreCms.Net.Repository
|
||||
/// <param name="orderByType">排序顺序</param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<List<CoreCmsGoods>> QueryListByClauseAsync(Expression<Func<CoreCmsGoods, bool>> predicate, int take,
|
||||
public async Task<List<CoreCmsGoods>> QueryListByClauseAsync(Expression<Func<CoreCmsGoods, bool>> predicate, int take,
|
||||
Expression<Func<CoreCmsGoods, object>> orderByPredicate, OrderByType orderByType, bool blUseNoLock = false)
|
||||
{
|
||||
List<CoreCmsGoods> page;
|
||||
@@ -1400,7 +1400,7 @@ namespace CoreCms.Net.Repository
|
||||
/// <param name="orderBy"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<List<CoreCmsGoods>> QueryListByClauseAsync(Expression<Func<CoreCmsGoods, bool>> predicate, string orderBy = "",
|
||||
public async Task<List<CoreCmsGoods>> QueryListByClauseAsync(Expression<Func<CoreCmsGoods, bool>> predicate, string orderBy = "",
|
||||
bool blUseNoLock = false)
|
||||
{
|
||||
List<CoreCmsGoods> page;
|
||||
@@ -1528,7 +1528,7 @@ namespace CoreCms.Net.Repository
|
||||
/// <param name="pageSize">分布大小</param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<IPageList<CoreCmsGoods>> QueryPageAsync(Expression<Func<CoreCmsGoods, bool>> predicate, string orderBy = "",
|
||||
public async Task<IPageList<CoreCmsGoods>> QueryPageAsync(Expression<Func<CoreCmsGoods, bool>> predicate, string orderBy = "",
|
||||
int pageIndex = 1, int pageSize = 20, bool blUseNoLock = false)
|
||||
{
|
||||
RefAsync<int> totalCount = 0;
|
||||
@@ -1781,7 +1781,6 @@ namespace CoreCms.Net.Repository
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region 根据条件查询商品及sku分页数据
|
||||
@@ -1840,11 +1839,11 @@ namespace CoreCms.Net.Repository
|
||||
isDel = good.isDel,
|
||||
initialSales = good.initialSales,
|
||||
})
|
||||
.Mapper(p => p.sku, p => p.sku.First().goodsId)
|
||||
.Mapper(it =>
|
||||
{
|
||||
it.sku = it.sku.Where(o => o.isDel == false).ToList();
|
||||
})
|
||||
//.Mapper(p => p.sku, p => p.sku.First().goodsId)
|
||||
//.Mapper(it =>
|
||||
//{
|
||||
// it.sku = it.sku.Where(o => o.isDel == false).ToList();
|
||||
//})
|
||||
.With(SqlWith.NoLock)
|
||||
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
|
||||
.WhereIF(predicate != null, predicate)
|
||||
@@ -1889,11 +1888,11 @@ namespace CoreCms.Net.Repository
|
||||
isDel = good.isDel,
|
||||
initialSales = good.initialSales,
|
||||
})
|
||||
.Mapper(p => p.sku, p => p.sku.First().goodsId)
|
||||
.Mapper(it =>
|
||||
{
|
||||
it.sku = it.sku.Where(o => o.isDel == false).ToList();
|
||||
})
|
||||
//.Mapper(p => p.sku, p => p.sku.First().goodsId)
|
||||
//.Mapper(it =>
|
||||
//{
|
||||
// it.sku = it.sku.Where(o => o.isDel == false).ToList();
|
||||
//})
|
||||
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
|
||||
.WhereIF(predicate != null, predicate)
|
||||
.ToPageListAsync(pageIndex, pageSize, totalCount);
|
||||
|
||||
@@ -64,24 +64,12 @@ namespace CoreCms.Net.Repository
|
||||
var goodsTypeSpec = new CoreCmsGoodsTypeSpec();
|
||||
goodsTypeSpec.name = entity.name;
|
||||
goodsTypeSpec.sort = entity.sort;
|
||||
var specId = await DbClient.Insertable(goodsTypeSpec).ExecuteReturnIdentityAsync();
|
||||
if (specId > 0 && entity.value != null && entity.value.Count > 0)
|
||||
{
|
||||
var list = new List<CoreCmsGoodsTypeSpecValue>();
|
||||
for (var index = 0; index < entity.value.Count; index++)
|
||||
{
|
||||
var item = entity.value[index];
|
||||
list.Add(new CoreCmsGoodsTypeSpecValue()
|
||||
{
|
||||
specId = specId,
|
||||
value = item,
|
||||
sort = index + 1
|
||||
});
|
||||
}
|
||||
var bl = await DbClient.Insertable(list).ExecuteCommandAsync() > 0;
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.CreateSuccess : GlobalConstVars.CreateFailure;
|
||||
}
|
||||
var specId = await DbClient.Insertable(goodsTypeSpec).RemoveDataCache().ExecuteReturnIdentityAsync();
|
||||
if (specId <= 0 || entity.value is not { Count: > 0 }) return jm;
|
||||
var list = entity.value.Select((item, index) => new CoreCmsGoodsTypeSpecValue() { specId = specId, value = item, sort = index + 1 }).ToList();
|
||||
var bl = await DbClient.Insertable(list).RemoveDataCache().ExecuteCommandAsync() > 0;
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.CreateSuccess : GlobalConstVars.CreateFailure;
|
||||
|
||||
|
||||
return jm;
|
||||
@@ -119,16 +107,15 @@ namespace CoreCms.Net.Repository
|
||||
}
|
||||
oldModel.name = entity.name;
|
||||
oldModel.sort = entity.sort;
|
||||
var bl = await DbClient.Updateable(oldModel).ExecuteCommandHasChangeAsync();
|
||||
var bl = await DbClient.Updateable(oldModel).RemoveDataCache().ExecuteCommandHasChangeAsync();
|
||||
if (bl)
|
||||
{
|
||||
var oldValues = await DbClient.Queryable<CoreCmsGoodsTypeSpecValue>().OrderBy(p => p.sort)
|
||||
.Where(p => p.specId == oldModel.id).ToListAsync();
|
||||
var oldValues = await DbClient.Queryable<CoreCmsGoodsTypeSpecValue>().OrderBy(p => p.sort).Where(p => p.specId == oldModel.id).ToListAsync();
|
||||
|
||||
//获取需要删除的数据库数据
|
||||
var deleteValues = oldValues.Where(p => !entity.value.Contains(p.value)).ToList();
|
||||
//删除旧数据
|
||||
if (deleteValues.Any()) bl = await DbClient.Deleteable<CoreCmsGoodsTypeSpecValue>(deleteValues).ExecuteCommandHasChangeAsync();
|
||||
if (deleteValues.Any()) bl = await DbClient.Deleteable<CoreCmsGoodsTypeSpecValue>(deleteValues).RemoveDataCache().ExecuteCommandHasChangeAsync();
|
||||
|
||||
//新数据
|
||||
var values = oldValues.Select(p => p.value).ToList();
|
||||
@@ -138,7 +125,7 @@ namespace CoreCms.Net.Repository
|
||||
if (newValues.Any())
|
||||
{
|
||||
var newList = newValues.Select((t, index) => new CoreCmsGoodsTypeSpecValue() { specId = oldModel.id, value = t, sort = oldValues.Count + index }).ToList();
|
||||
bl = await DbClient.Insertable<CoreCmsGoodsTypeSpecValue>(newList).ExecuteCommandAsync() > 0;
|
||||
bl = await DbClient.Insertable<CoreCmsGoodsTypeSpecValue>(newList).RemoveDataCache().ExecuteCommandAsync() > 0;
|
||||
}
|
||||
}
|
||||
jm.code = bl ? 0 : 1;
|
||||
@@ -153,16 +140,16 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> DeleteByIdAsync(object id)
|
||||
public async Task<AdminUiCallBack> DeleteByIdAsync(object id)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Deleteable<CoreCmsGoodsTypeSpec>(id).ExecuteCommandHasChangeAsync();
|
||||
var bl = await DbClient.Deleteable<CoreCmsGoodsTypeSpec>(id).RemoveDataCache().ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
|
||||
if (bl)
|
||||
{
|
||||
await DbClient.Deleteable<CoreCmsGoodsTypeSpecValue>(p => p.specId == (int)id).ExecuteCommandHasChangeAsync();
|
||||
await DbClient.Deleteable<CoreCmsGoodsTypeSpecValue>(p => p.specId == (int)id).RemoveDataCache().ExecuteCommandHasChangeAsync();
|
||||
}
|
||||
|
||||
return jm;
|
||||
|
||||
@@ -14,10 +14,8 @@ 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;
|
||||
|
||||
namespace CoreCms.Net.Repository
|
||||
{
|
||||
|
||||
@@ -35,7 +35,6 @@ namespace CoreCms.Net.Repository
|
||||
{
|
||||
}
|
||||
|
||||
#region 重写异步插入方法==========================================================
|
||||
/// <summary>
|
||||
/// 重写异步插入方法
|
||||
/// </summary>
|
||||
@@ -45,7 +44,6 @@ namespace CoreCms.Net.Repository
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
|
||||
var check = CheckItems(entity.items);
|
||||
if (check.code == 1)
|
||||
{
|
||||
@@ -65,15 +63,8 @@ namespace CoreCms.Net.Repository
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.CreateSuccess : GlobalConstVars.CreateFailure;
|
||||
|
||||
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步更新方法
|
||||
@@ -174,7 +165,6 @@ namespace CoreCms.Net.Repository
|
||||
});
|
||||
await DbClient.Insertable(newPostItems).ExecuteCommandAsync();
|
||||
}
|
||||
await UpdateCaChe();
|
||||
}
|
||||
return jm;
|
||||
}
|
||||
@@ -256,50 +246,6 @@ namespace CoreCms.Net.Repository
|
||||
return jm;
|
||||
}
|
||||
|
||||
|
||||
#region 实现重写增删改查操作==========================================================
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步插入方法
|
||||
/// </summary>
|
||||
/// <param name="entity">实体数据</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> InsertAsync(CoreCmsForm 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;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步更新方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> UpdateAsync(List<CoreCmsForm> entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Updateable(entity).ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写删除指定ID的数据
|
||||
/// </summary>
|
||||
@@ -323,64 +269,11 @@ namespace CoreCms.Net.Repository
|
||||
if (bl)
|
||||
{
|
||||
await DbClient.Deleteable<CoreCmsFormItem>().Where(p => p.formId == id).ExecuteCommandHasChangeAsync();
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写删除指定ID集合的数据(批量删除)
|
||||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> DeleteByIdsAsync(int[] ids)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Deleteable<CoreCmsForm>().In(ids).ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 获取缓存的所有数据==========================================================
|
||||
|
||||
/// <summary>
|
||||
/// 获取缓存的所有数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<List<CoreCmsForm>> GetCaChe()
|
||||
{
|
||||
var cache = ManualDataCache.Instance.Get<List<CoreCmsForm>>(GlobalConstVars.CacheCoreCmsForm);
|
||||
if (cache != null)
|
||||
{
|
||||
return cache;
|
||||
}
|
||||
return await UpdateCaChe();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新cache
|
||||
/// </summary>
|
||||
public async Task<List<CoreCmsForm>> UpdateCaChe()
|
||||
{
|
||||
var list = await DbClient.Queryable<CoreCmsForm>().With(SqlWith.NoLock).ToListAsync();
|
||||
ManualDataCache.Instance.Set(GlobalConstVars.CacheCoreCmsForm, list);
|
||||
return list;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 重写根据条件查询分页数据
|
||||
/// <summary>
|
||||
/// 重写根据条件查询分页数据
|
||||
/// </summary>
|
||||
@@ -391,7 +284,7 @@ namespace CoreCms.Net.Repository
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<IPageList<CoreCmsForm>> QueryPageAsync(Expression<Func<CoreCmsForm, bool>> predicate,
|
||||
public async Task<IPageList<CoreCmsForm>> QueryPageAsync(Expression<Func<CoreCmsForm, bool>> predicate,
|
||||
Expression<Func<CoreCmsForm, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false)
|
||||
{
|
||||
@@ -460,10 +353,5 @@ namespace CoreCms.Net.Repository
|
||||
return list;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,8 +18,8 @@ using CoreCms.Net.IRepository.UnitOfWork;
|
||||
using CoreCms.Net.Loging;
|
||||
using CoreCms.Net.Model.Entities;
|
||||
using CoreCms.Net.Model.ViewModels.Basics;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using CoreCms.Net.Model.ViewModels.DTO;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using SqlSugar;
|
||||
|
||||
namespace CoreCms.Net.Repository
|
||||
@@ -47,85 +47,12 @@ namespace CoreCms.Net.Repository
|
||||
return await DbClient.Insertable(entity).ExecuteReturnIdentityAsync();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步插入方法
|
||||
/// </summary>
|
||||
/// <param name="entity">实体数据</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> InsertAsync(CoreCmsFormSubmit entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var id = await DbClient.Insertable(entity).ExecuteReturnIdentityAsync();
|
||||
var bl = id > 0;
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.CreateSuccess : GlobalConstVars.CreateFailure;
|
||||
jm.count = id;
|
||||
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步更新方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> UpdateAsync(CoreCmsFormSubmit entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var oldModel = await DbClient.Queryable<CoreCmsFormSubmit>().In(entity.id).SingleAsync();
|
||||
if (oldModel == null)
|
||||
{
|
||||
jm.msg = "不存在此信息";
|
||||
return jm;
|
||||
}
|
||||
//事物处理过程开始
|
||||
oldModel.id = entity.id;
|
||||
oldModel.formId = entity.formId;
|
||||
oldModel.formName = entity.formName;
|
||||
oldModel.userId = entity.userId;
|
||||
oldModel.money = entity.money;
|
||||
oldModel.payStatus = entity.payStatus;
|
||||
oldModel.status = entity.status;
|
||||
oldModel.feedback = entity.feedback;
|
||||
oldModel.ip = entity.ip;
|
||||
oldModel.createTime = entity.createTime;
|
||||
oldModel.updateTime = entity.updateTime;
|
||||
|
||||
//事物处理过程结束
|
||||
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 new async Task<AdminUiCallBack> UpdateAsync(List<CoreCmsFormSubmit> 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 new async Task<AdminUiCallBack> DeleteByIdAsync(object id)
|
||||
public async Task<AdminUiCallBack> DeleteByIdAsync(object id)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
@@ -136,22 +63,6 @@ namespace CoreCms.Net.Repository
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写删除指定ID集合的数据(批量删除)
|
||||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> DeleteByIdsAsync(int[] ids)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Deleteable<CoreCmsFormSubmit>().In(ids).ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -166,7 +77,7 @@ namespace CoreCms.Net.Repository
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<IPageList<CoreCmsFormSubmit>> QueryPageAsync(Expression<Func<CoreCmsFormSubmit, bool>> predicate,
|
||||
public async Task<IPageList<CoreCmsFormSubmit>> QueryPageAsync(Expression<Func<CoreCmsFormSubmit, bool>> predicate,
|
||||
Expression<Func<CoreCmsFormSubmit, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false)
|
||||
{
|
||||
@@ -267,7 +178,7 @@ namespace CoreCms.Net.Repository
|
||||
/// <param name="formId">表单序列</param>
|
||||
/// <param name="day">多少天内的数据</param>
|
||||
/// <returns></returns>
|
||||
public async Task<FormStatisticsViewDto> GetStatisticsByFormid(int formId, int day)
|
||||
public async Task<FormStatisticsViewDto> GetStatisticsByFormId(int formId, int day)
|
||||
{
|
||||
var dt = DateTime.Now;
|
||||
var whereDt = dt.AddDays(-day);
|
||||
|
||||
@@ -13,7 +13,6 @@ using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using CoreCms.Net.Configuration;
|
||||
using CoreCms.Net.Model.Entities;
|
||||
using CoreCms.Net.Model.ViewModels.Basics;
|
||||
using CoreCms.Net.IRepository;
|
||||
using CoreCms.Net.IRepository.UnitOfWork;
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ using System.Text;
|
||||
using CoreCms.Net.IRepository;
|
||||
using CoreCms.Net.IRepository.UnitOfWork;
|
||||
using CoreCms.Net.Model.Entities;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
@@ -20,7 +20,6 @@ using CoreCms.Net.IRepository.UnitOfWork;
|
||||
using CoreCms.Net.Model.Entities;
|
||||
using CoreCms.Net.Model.Entities.Expression;
|
||||
using CoreCms.Net.Model.ViewModels.Basics;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using CoreCms.Net.Model.ViewModels.DTO;
|
||||
using CoreCms.Net.Utility.Helper;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
@@ -42,9 +41,9 @@ namespace CoreCms.Net.Repository
|
||||
}
|
||||
|
||||
|
||||
#region 查询团购秒杀下单数量
|
||||
#region 查询团购秒杀下单数量(获取货品的秒杀团购数据)
|
||||
/// <summary>
|
||||
/// 查询团购秒杀下单数量
|
||||
/// 查询团购秒杀下单数量(获取货品的秒杀团购数据)
|
||||
/// </summary>
|
||||
/// <param name="productId"></param>
|
||||
/// <param name="userId"></param>
|
||||
@@ -56,8 +55,7 @@ namespace CoreCms.Net.Repository
|
||||
{
|
||||
var dto = new FindLimitOrderDto();
|
||||
|
||||
var statusArr = new int[]{(int)GlobalEnumVars.OrderStatus.Normal,
|
||||
(int)GlobalEnumVars.OrderStatus.Complete};
|
||||
var statusArr = new int[] { (int)GlobalEnumVars.OrderStatus.Normal, (int)GlobalEnumVars.OrderStatus.Complete };
|
||||
|
||||
var payStatusArr = new int[] { (int)GlobalEnumVars.OrderPayStatus.No, (int)GlobalEnumVars.OrderPayStatus.Yes, (int)GlobalEnumVars.OrderPayStatus.PartialYes };
|
||||
var shipStatusArr = new int[] { (int)GlobalEnumVars.OrderShipStatus.No, (int)GlobalEnumVars.OrderShipStatus.Yes, (int)GlobalEnumVars.OrderShipStatus.PartialYes };
|
||||
@@ -78,6 +76,7 @@ namespace CoreCms.Net.Repository
|
||||
queryable.In((orderItem, orderModel) => orderModel.payStatus, payStatusArr);
|
||||
queryable.In((orderItem, orderModel) => orderModel.shipStatus, shipStatusArr);
|
||||
|
||||
|
||||
//订单类型
|
||||
if (orderType > 0)
|
||||
{
|
||||
@@ -96,6 +95,62 @@ namespace CoreCms.Net.Repository
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 查询团购秒杀下单数量(获取商品序号的秒杀团购数据)
|
||||
/// <summary>
|
||||
/// 查询团购秒杀下单数量(获取商品序号的秒杀团购数据)
|
||||
/// </summary>
|
||||
/// <param name="goodId"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="startTime"></param>
|
||||
/// <param name="endTime"></param>
|
||||
/// <param name="orderType"></param>
|
||||
/// <returns></returns>
|
||||
public FindLimitOrderDto FindLimitOrderByGoodId(int goodId, int userId, DateTime? startTime, DateTime? endTime, int orderType = 0)
|
||||
{
|
||||
var dto = new FindLimitOrderDto();
|
||||
|
||||
var statusArr = new int[] { (int)GlobalEnumVars.OrderStatus.Normal, (int)GlobalEnumVars.OrderStatus.Complete };
|
||||
|
||||
var payStatusArr = new int[] { (int)GlobalEnumVars.OrderPayStatus.No, (int)GlobalEnumVars.OrderPayStatus.Yes, (int)GlobalEnumVars.OrderPayStatus.PartialYes };
|
||||
var shipStatusArr = new int[] { (int)GlobalEnumVars.OrderShipStatus.No, (int)GlobalEnumVars.OrderShipStatus.Yes, (int)GlobalEnumVars.OrderShipStatus.PartialYes };
|
||||
|
||||
|
||||
var queryable = DbClient.Queryable<CoreCmsOrderItem, CoreCmsOrder>((orderItem, orderModel) => new object[]
|
||||
{
|
||||
JoinType.Inner, orderItem.orderId == orderModel.orderId
|
||||
});
|
||||
|
||||
//计算订单总量
|
||||
queryable.WhereIF(goodId > 0, (orderItem, orderModel) => orderItem.goodsId == goodId);
|
||||
queryable.In((orderItem, orderModel) => orderModel.status, statusArr);
|
||||
//在活动时间范围内
|
||||
queryable.WhereIF(startTime != null, (orderItem, orderModel) => orderModel.createTime >= startTime);
|
||||
queryable.WhereIF(endTime != null, (orderItem, orderModel) => orderModel.createTime < endTime);
|
||||
//已退款、已退货、部分退款的、部分退货的排除
|
||||
queryable.In((orderItem, orderModel) => orderModel.payStatus, payStatusArr);
|
||||
queryable.In((orderItem, orderModel) => orderModel.shipStatus, shipStatusArr);
|
||||
|
||||
|
||||
//订单类型
|
||||
if (orderType > 0)
|
||||
{
|
||||
queryable.Where((orderItem, orderModel) => orderModel.orderType == orderType);
|
||||
}
|
||||
|
||||
dto.TotalOrders = queryable.Clone().Select((orderItem, orderModel) => new { nums = orderItem.nums }).MergeTable().With(SqlWith.Null).Sum(p => p.nums);
|
||||
|
||||
if (userId <= 0) return dto;
|
||||
{
|
||||
queryable.Where((orderItem, orderModel) => orderModel.userId == userId);
|
||||
dto.TotalUserOrders = queryable.Clone().Select((orderItem, orderModel) => new { nums = orderItem.nums }).MergeTable().With(SqlWith.Null).Sum(p => p.nums);
|
||||
}
|
||||
return dto;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 根据用户id和商品id获取下了多少订单
|
||||
/// <summary>
|
||||
/// 根据用户id和商品id获取下了多少订单
|
||||
@@ -185,6 +240,7 @@ namespace CoreCms.Net.Repository
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 重写根据条件查询分页数据-带用户数据
|
||||
/// <summary>
|
||||
/// 重写根据条件查询分页数据-带用户数据
|
||||
@@ -196,7 +252,7 @@ namespace CoreCms.Net.Repository
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<IPageList<CoreCmsOrder>> QueryPageAsync(Expression<Func<CoreCmsOrder, bool>> predicate,
|
||||
public async Task<IPageList<CoreCmsOrder>> QueryPageAsync(Expression<Func<CoreCmsOrder, bool>> predicate,
|
||||
Expression<Func<CoreCmsOrder, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false)
|
||||
{
|
||||
@@ -249,6 +305,7 @@ namespace CoreCms.Net.Repository
|
||||
updateTime = sOrder.updateTime,
|
||||
userNickName = sUser.nickName
|
||||
})
|
||||
.With(SqlWith.NoLock)
|
||||
.MergeTable()
|
||||
.Mapper(sOrder => sOrder.aftersalesItem, sOrder => sOrder.aftersalesItem.First().orderId)
|
||||
.Mapper(sOrder => sOrder.items, sOrder => sOrder.items.First().orderId)
|
||||
|
||||
@@ -151,7 +151,7 @@ namespace CoreCms.Net.Repository
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<IPageList<CoreCmsPinTuanRecord>> QueryPageAsync(Expression<Func<CoreCmsPinTuanRecord, bool>> predicate,
|
||||
public async Task<IPageList<CoreCmsPinTuanRecord>> QueryPageAsync(Expression<Func<CoreCmsPinTuanRecord, bool>> predicate,
|
||||
Expression<Func<CoreCmsPinTuanRecord, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false)
|
||||
{
|
||||
|
||||
@@ -18,8 +18,8 @@ using CoreCms.Net.IRepository;
|
||||
using CoreCms.Net.IRepository.UnitOfWork;
|
||||
using CoreCms.Net.Model.Entities;
|
||||
using CoreCms.Net.Model.ViewModels.Basics;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using CoreCms.Net.Model.ViewModels.DTO;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using SqlSugar;
|
||||
|
||||
namespace CoreCms.Net.Repository
|
||||
|
||||
@@ -19,8 +19,8 @@ using CoreCms.Net.IRepository.UnitOfWork;
|
||||
using CoreCms.Net.Loging;
|
||||
using CoreCms.Net.Model.Entities;
|
||||
using CoreCms.Net.Model.ViewModels.Basics;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using CoreCms.Net.Model.ViewModels.DTO;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using CoreCms.Net.Utility.Helper;
|
||||
using SqlSugar;
|
||||
|
||||
@@ -37,7 +37,6 @@ namespace CoreCms.Net.Repository
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
#region 根据优惠券编码取优惠券的信息,并判断是否可用
|
||||
|
||||
/// <summary>
|
||||
@@ -52,7 +51,7 @@ namespace CoreCms.Net.Repository
|
||||
|
||||
foreach (var codeStr in code)
|
||||
{
|
||||
var model =await DbClient.Queryable<CoreCmsCoupon, CoreCmsPromotion>((coupon, prommotion) => new object[]
|
||||
var model = await DbClient.Queryable<CoreCmsCoupon, CoreCmsPromotion>((coupon, prommotion) => new object[]
|
||||
{
|
||||
JoinType.Inner, coupon.promotionId == prommotion.id
|
||||
}).Where((coupon, prommotion) => coupon.couponCode == codeStr)
|
||||
@@ -161,11 +160,13 @@ namespace CoreCms.Net.Repository
|
||||
startTime = coupon.startTime,
|
||||
endTime = coupon.endTime,
|
||||
|
||||
}).MergeTable()
|
||||
})
|
||||
.With(SqlWith.Null)
|
||||
.MergeTable()
|
||||
.Mapper(p => p.conditions, p => p.promotionId)
|
||||
.Mapper(p => p.results, p => p.promotionId)
|
||||
.OrderBy(p => p.createTime, OrderByType.Desc)
|
||||
.With(SqlWith.Null)
|
||||
|
||||
.ToPageListAsync(page, limit, totalCount);
|
||||
|
||||
var totalPages = totalCount.Value / limit;
|
||||
@@ -349,7 +350,7 @@ namespace CoreCms.Net.Repository
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<IPageList<CoreCmsCoupon>> QueryPageAsync(Expression<Func<CoreCmsCoupon, bool>> predicate,
|
||||
public async Task<IPageList<CoreCmsCoupon>> QueryPageAsync(Expression<Func<CoreCmsCoupon, bool>> predicate,
|
||||
Expression<Func<CoreCmsCoupon, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false)
|
||||
{
|
||||
|
||||
@@ -14,7 +14,6 @@ using CoreCms.Net.Configuration;
|
||||
using CoreCms.Net.IRepository;
|
||||
using CoreCms.Net.IRepository.UnitOfWork;
|
||||
using CoreCms.Net.Model.Entities;
|
||||
using CoreCms.Net.Model.ViewModels.DTO;
|
||||
using CoreCms.Net.Utility.Helper;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
@@ -15,10 +15,8 @@ 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
|
||||
|
||||
@@ -36,12 +36,13 @@ namespace CoreCms.Net.Repository
|
||||
|
||||
//判断商品是否参加团购
|
||||
/// <summary>
|
||||
/// 判断商品是否参加团购
|
||||
/// 判断商品是否参加团购/秒杀
|
||||
/// </summary>
|
||||
/// <param name="goodId">商品序列</param>
|
||||
/// <param name="promotionId">关联促销信息</param>
|
||||
/// <param name="type">类型</param>
|
||||
/// <returns></returns>
|
||||
public bool IsInGroup(int goodId, out int promotionId)
|
||||
public bool IsInGroup(int goodId, out int promotionId,int type)
|
||||
{
|
||||
promotionId = 0;
|
||||
if (goodId == 0)
|
||||
@@ -57,11 +58,8 @@ namespace CoreCms.Net.Repository
|
||||
}
|
||||
)
|
||||
.Where((pro, ccpc) => pro.isEnable == true && pro.isDel == false)
|
||||
//.Where((pro, ccpc) => pro.startTime < dt && pro.endTime > dt)
|
||||
//.Where((pro, ccpc) => ccpc.parameters.Contains("%\"" + goodId + "\"%"))
|
||||
.Where((pro, ccpc) => ccpc.parameters.Contains(goodIds))
|
||||
.Where((pro, ccpc) => pro.type == (int)GlobalEnumVars.PromotionType.Group ||
|
||||
pro.type == (int)GlobalEnumVars.PromotionType.Seckill)
|
||||
.Where((pro, ccpc) => pro.type == type)
|
||||
.Select((pro, ccpc) => ccpc)
|
||||
.First();
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ using CoreCms.Net.Configuration;
|
||||
using CoreCms.Net.IRepository;
|
||||
using CoreCms.Net.IRepository.UnitOfWork;
|
||||
using CoreCms.Net.Model.Entities;
|
||||
using CoreCms.Net.Model.ViewModels.DTO;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace CoreCms.Net.Repository
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<IPageList<CoreCmsUserServicesOrder>> QueryPageAsync(Expression<Func<CoreCmsUserServicesOrder, bool>> predicate,
|
||||
public async Task<IPageList<CoreCmsUserServicesOrder>> QueryPageAsync(Expression<Func<CoreCmsUserServicesOrder, bool>> predicate,
|
||||
Expression<Func<CoreCmsUserServicesOrder, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false)
|
||||
{
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace CoreCms.Net.Repository
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<IPageList<CoreCmsUserServicesTicket>> QueryPageAsync(Expression<Func<CoreCmsUserServicesTicket, bool>> predicate,
|
||||
public async Task<IPageList<CoreCmsUserServicesTicket>> QueryPageAsync(Expression<Func<CoreCmsUserServicesTicket, bool>> predicate,
|
||||
Expression<Func<CoreCmsUserServicesTicket, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false)
|
||||
{
|
||||
|
||||
@@ -15,7 +15,6 @@ 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;
|
||||
@@ -39,17 +38,13 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="entity">实体数据</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> InsertAsync(CoreCmsArea entity)
|
||||
public async Task<AdminUiCallBack> InsertAsync(CoreCmsArea entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Insertable(entity).ExecuteReturnIdentityAsync() > 0;
|
||||
var bl = await DbClient.Insertable(entity).RemoveDataCache().ExecuteReturnIdentityAsync() > 0;
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.CreateSuccess : GlobalConstVars.CreateFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
@@ -59,7 +54,7 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> UpdateAsync(CoreCmsArea entity)
|
||||
public async Task<AdminUiCallBack> UpdateAsync(CoreCmsArea entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
@@ -70,41 +65,14 @@ namespace CoreCms.Net.Repository
|
||||
return jm;
|
||||
}
|
||||
//事物处理过程开始
|
||||
//oldModel.id = entity.id;
|
||||
//oldModel.parentId = entity.parentId;
|
||||
//oldModel.depth = entity.depth;
|
||||
oldModel.name = entity.name;
|
||||
oldModel.postalCode = entity.postalCode;
|
||||
oldModel.sort = entity.sort;
|
||||
|
||||
//事物处理过程结束
|
||||
var bl = await DbClient.Updateable(oldModel).ExecuteCommandHasChangeAsync();
|
||||
var bl = await DbClient.Updateable(oldModel).RemoveDataCache().ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步更新方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> UpdateAsync(List<CoreCmsArea> entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Updateable(entity).ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
@@ -114,41 +82,16 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> DeleteByIdAsync(object id)
|
||||
public async Task<AdminUiCallBack> DeleteByIdAsync(object id)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Deleteable<CoreCmsArea>(id).ExecuteCommandHasChangeAsync();
|
||||
var bl = await DbClient.Deleteable<CoreCmsArea>(id).RemoveDataCache().ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写删除指定ID集合的数据(批量删除)
|
||||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> DeleteByIdsAsync(int[] ids)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Deleteable<CoreCmsArea>().In(ids).ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 获取缓存的所有数据==========================================================
|
||||
@@ -159,27 +102,10 @@ namespace CoreCms.Net.Repository
|
||||
/// <returns></returns>
|
||||
public async Task<List<CoreCmsArea>> GetCaChe()
|
||||
{
|
||||
var cache = ManualDataCache.Instance.Get<List<CoreCmsArea>>(GlobalConstVars.CacheCoreCmsArea);
|
||||
if (cache != null)
|
||||
{
|
||||
return cache;
|
||||
}
|
||||
return await UpdateCaChe();
|
||||
var cache = await DbClient.Queryable<CoreCmsArea>().OrderBy(p => p.sort).With(SqlWith.NoLock).WithCache().ToListAsync();
|
||||
return cache;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新cache
|
||||
/// </summary>
|
||||
public async Task<List<CoreCmsArea>> UpdateCaChe()
|
||||
{
|
||||
|
||||
var list = await DbClient.Queryable<CoreCmsArea>().OrderBy(p=>p.sort).With(SqlWith.NoLock).ToListAsync();
|
||||
ManualDataCache.Instance.Set(GlobalConstVars.CacheCoreCmsArea, list);
|
||||
return list;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ using CoreCms.Net.IRepository;
|
||||
using CoreCms.Net.IRepository.UnitOfWork;
|
||||
using CoreCms.Net.Model.Entities;
|
||||
using CoreCms.Net.Model.ViewModels.Basics;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using CoreCms.Net.Utility.Extensions;
|
||||
using SqlSugar;
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ using CoreCms.Net.Configuration;
|
||||
using CoreCms.Net.IRepository;
|
||||
using CoreCms.Net.IRepository.UnitOfWork;
|
||||
using CoreCms.Net.Model.Entities;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
|
||||
namespace CoreCms.Net.Repository
|
||||
{
|
||||
|
||||
@@ -41,17 +41,13 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="entity">实体数据</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> InsertAsync(CoreCmsOrderDistributionModel entity)
|
||||
public async Task<AdminUiCallBack> InsertAsync(CoreCmsOrderDistributionModel entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Insertable(entity).ExecuteReturnIdentityAsync() > 0;
|
||||
var bl = await DbClient.Insertable(entity).RemoveDataCache().ExecuteReturnIdentityAsync() > 0;
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.CreateSuccess : GlobalConstVars.CreateFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
@@ -61,7 +57,7 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> UpdateAsync(CoreCmsOrderDistributionModel entity)
|
||||
public async Task<AdminUiCallBack> UpdateAsync(CoreCmsOrderDistributionModel entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
@@ -80,33 +76,9 @@ namespace CoreCms.Net.Repository
|
||||
oldModel.isOpenSelfDelivery = entity.isOpenSelfDelivery;
|
||||
|
||||
//事物处理过程结束
|
||||
var bl = await DbClient.Updateable(oldModel).ExecuteCommandHasChangeAsync();
|
||||
var bl = await DbClient.Updateable(oldModel).RemoveDataCache().ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步更新方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> UpdateAsync(List<CoreCmsOrderDistributionModel> entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Updateable(entity).ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
@@ -116,37 +88,13 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> DeleteByIdAsync(object id)
|
||||
public async Task<AdminUiCallBack> DeleteByIdAsync(object id)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Deleteable<CoreCmsOrderDistributionModel>(id).ExecuteCommandHasChangeAsync();
|
||||
var bl = await DbClient.Deleteable<CoreCmsOrderDistributionModel>(id).RemoveDataCache().ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写删除指定ID集合的数据(批量删除)
|
||||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> DeleteByIdsAsync(int[] ids)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Deleteable<CoreCmsOrderDistributionModel>().In(ids).ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
@@ -161,24 +109,11 @@ namespace CoreCms.Net.Repository
|
||||
/// <returns></returns>
|
||||
public async Task<List<CoreCmsOrderDistributionModel>> GetCaChe()
|
||||
{
|
||||
var cache = ManualDataCache.Instance.Get<List<CoreCmsOrderDistributionModel>>(GlobalConstVars.CacheCoreCmsOrderDistributionModel);
|
||||
if (cache != null)
|
||||
{
|
||||
return cache;
|
||||
}
|
||||
return await UpdateCaChe();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新cache
|
||||
/// </summary>
|
||||
public async Task<List<CoreCmsOrderDistributionModel>> UpdateCaChe()
|
||||
{
|
||||
var list = await DbClient.Queryable<CoreCmsOrderDistributionModel>().With(SqlWith.NoLock).ToListAsync();
|
||||
ManualDataCache.Instance.Set(GlobalConstVars.CacheCoreCmsOrderDistributionModel, list);
|
||||
var list = await DbClient.Queryable<CoreCmsOrderDistributionModel>().With(SqlWith.NoLock).WithCache().ToListAsync();
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -193,7 +128,7 @@ namespace CoreCms.Net.Repository
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<IPageList<CoreCmsOrderDistributionModel>> QueryPageAsync(Expression<Func<CoreCmsOrderDistributionModel, bool>> predicate,
|
||||
public async Task<IPageList<CoreCmsOrderDistributionModel>> QueryPageAsync(Expression<Func<CoreCmsOrderDistributionModel, bool>> predicate,
|
||||
Expression<Func<CoreCmsOrderDistributionModel, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false)
|
||||
{
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="entity">实体数据</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> InsertAsync(CoreCmsPages entity)
|
||||
public async Task<AdminUiCallBack> InsertAsync(CoreCmsPages entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> UpdateAsync(CoreCmsPages entity)
|
||||
public async Task<AdminUiCallBack> UpdateAsync(CoreCmsPages entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
|
||||
@@ -15,9 +15,9 @@ 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.Basics;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using SqlSugar;
|
||||
|
||||
@@ -39,17 +39,13 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="entity">实体数据</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> InsertAsync(CoreCmsServiceDescription entity)
|
||||
public async Task<AdminUiCallBack> InsertAsync(CoreCmsServiceDescription entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Insertable(entity).ExecuteReturnIdentityAsync() > 0;
|
||||
var bl = await DbClient.Insertable(entity).RemoveDataCache().ExecuteReturnIdentityAsync() > 0;
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.CreateSuccess : GlobalConstVars.CreateFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
@@ -59,7 +55,7 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> UpdateAsync(CoreCmsServiceDescription entity)
|
||||
public async Task<AdminUiCallBack> UpdateAsync(CoreCmsServiceDescription entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
@@ -70,7 +66,6 @@ namespace CoreCms.Net.Repository
|
||||
return jm;
|
||||
}
|
||||
//事物处理过程开始
|
||||
oldModel.id = entity.id;
|
||||
oldModel.title = entity.title;
|
||||
oldModel.type = entity.type;
|
||||
oldModel.description = entity.description;
|
||||
@@ -78,33 +73,9 @@ namespace CoreCms.Net.Repository
|
||||
oldModel.sortId = entity.sortId;
|
||||
|
||||
//事物处理过程结束
|
||||
var bl = await DbClient.Updateable(oldModel).ExecuteCommandHasChangeAsync();
|
||||
var bl = await DbClient.Updateable(oldModel).RemoveDataCache().ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步更新方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> UpdateAsync(List<CoreCmsServiceDescription> entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Updateable(entity).ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
@@ -114,37 +85,13 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> DeleteByIdAsync(object id)
|
||||
public async Task<AdminUiCallBack> DeleteByIdAsync(object id)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Deleteable<CoreCmsServiceDescription>(id).ExecuteCommandHasChangeAsync();
|
||||
var bl = await DbClient.Deleteable<CoreCmsServiceDescription>(id).RemoveDataCache().ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写删除指定ID集合的数据(批量删除)
|
||||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> DeleteByIdsAsync(int[] ids)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Deleteable<CoreCmsServiceDescription>().In(ids).ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
@@ -159,21 +106,7 @@ namespace CoreCms.Net.Repository
|
||||
/// <returns></returns>
|
||||
public async Task<List<CoreCmsServiceDescription>> GetCaChe()
|
||||
{
|
||||
var cache = ManualDataCache.Instance.Get<List<CoreCmsServiceDescription>>(GlobalConstVars.CacheCoreCmsServiceDescription);
|
||||
if (cache != null)
|
||||
{
|
||||
return cache;
|
||||
}
|
||||
return await UpdateCaChe();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新cache
|
||||
/// </summary>
|
||||
public async Task<List<CoreCmsServiceDescription>> UpdateCaChe()
|
||||
{
|
||||
var list = await DbClient.Queryable<CoreCmsServiceDescription>().With(SqlWith.NoLock).ToListAsync();
|
||||
ManualDataCache.Instance.Set(GlobalConstVars.CacheCoreCmsServiceDescription, list);
|
||||
var list = await DbClient.Queryable<CoreCmsServiceDescription>().With(SqlWith.NoLock).WithCache().ToListAsync();
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -190,7 +123,7 @@ namespace CoreCms.Net.Repository
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<IPageList<CoreCmsServiceDescription>> QueryPageAsync(Expression<Func<CoreCmsServiceDescription, bool>> predicate,
|
||||
public async Task<IPageList<CoreCmsServiceDescription>> QueryPageAsync(Expression<Func<CoreCmsServiceDescription, bool>> predicate,
|
||||
Expression<Func<CoreCmsServiceDescription, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false)
|
||||
{
|
||||
|
||||
@@ -19,8 +19,6 @@ using CoreCms.Net.IRepository;
|
||||
using CoreCms.Net.IRepository.UnitOfWork;
|
||||
using CoreCms.Net.Model.Entities;
|
||||
using CoreCms.Net.Model.FromBody;
|
||||
using CoreCms.Net.Model.ViewModels.Basics;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="entity">实体数据</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> InsertAsync(CoreCmsShip entity)
|
||||
public async Task<AdminUiCallBack> InsertAsync(CoreCmsShip entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> UpdateAsync(CoreCmsShip entity)
|
||||
public async Task<AdminUiCallBack> UpdateAsync(CoreCmsShip entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
@@ -192,8 +192,6 @@ namespace CoreCms.Net.Repository
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#region 重写根据条件查询分页数据
|
||||
/// <summary>
|
||||
/// 重写根据条件查询分页数据
|
||||
@@ -205,7 +203,7 @@ namespace CoreCms.Net.Repository
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<IPageList<CoreCmsShip>> QueryPageAsync(Expression<Func<CoreCmsShip, bool>> predicate,
|
||||
public async Task<IPageList<CoreCmsShip>> QueryPageAsync(Expression<Func<CoreCmsShip, bool>> predicate,
|
||||
Expression<Func<CoreCmsShip, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false)
|
||||
{
|
||||
|
||||
@@ -40,11 +40,11 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="entity">实体数据</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> InsertAsync(CoreCmsStore entity)
|
||||
public async Task<AdminUiCallBack> InsertAsync(CoreCmsStore entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var isDefaultObj = DbClient.Queryable<CoreCmsStore>().Where(p => p.isDefault == true).Any();
|
||||
var isDefaultObj = await DbClient.Queryable<CoreCmsStore>().Where(p => p.isDefault == true).AnyAsync();
|
||||
if (isDefaultObj && entity.isDefault == true)
|
||||
{
|
||||
await DbClient.Updateable<CoreCmsStore>().SetColumns(it => it.isDefault == false).Where(p => p.id > 0).ExecuteCommandAsync(); ;
|
||||
@@ -56,7 +56,7 @@ namespace CoreCms.Net.Repository
|
||||
entity.createTime = DateTime.Now;
|
||||
entity.updateTime = DateTime.Now;
|
||||
entity.distance = 0;
|
||||
if (entity.coordinate.Contains(","))
|
||||
if (entity.coordinate.Contains($","))
|
||||
{
|
||||
var latlong = entity.coordinate.Split(",");
|
||||
entity.latitude = latlong[0];
|
||||
@@ -77,7 +77,7 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> UpdateAsync(CoreCmsStore entity)
|
||||
public async Task<AdminUiCallBack> UpdateAsync(CoreCmsStore entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
|
||||
@@ -39,17 +39,13 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="entity">实体数据</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> InsertAsync(CoreCmsSolitaireItems entity)
|
||||
public async Task<AdminUiCallBack> InsertAsync(CoreCmsSolitaireItems entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Insertable(entity).ExecuteReturnIdentityAsync() > 0;
|
||||
var bl = await DbClient.Insertable(entity).RemoveDataCache().ExecuteReturnIdentityAsync() > 0;
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.CreateSuccess : GlobalConstVars.CreateFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
@@ -59,7 +55,7 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> UpdateAsync(CoreCmsSolitaireItems entity)
|
||||
public async Task<AdminUiCallBack> UpdateAsync(CoreCmsSolitaireItems entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
@@ -80,33 +76,9 @@ namespace CoreCms.Net.Repository
|
||||
oldModel.isDelete = entity.isDelete;
|
||||
|
||||
//事物处理过程结束
|
||||
var bl = await DbClient.Updateable(oldModel).ExecuteCommandHasChangeAsync();
|
||||
var bl = await DbClient.Updateable(oldModel).RemoveDataCache().ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步更新方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> UpdateAsync(List<CoreCmsSolitaireItems> entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Updateable(entity).ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
@@ -116,17 +88,13 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> DeleteByIdAsync(object id)
|
||||
public async Task<AdminUiCallBack> DeleteByIdAsync(object id)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Deleteable<CoreCmsSolitaireItems>(id).ExecuteCommandHasChangeAsync();
|
||||
var bl = await DbClient.Deleteable<CoreCmsSolitaireItems>(id).RemoveDataCache().ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
@@ -136,17 +104,13 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> DeleteByIdsAsync(int[] ids)
|
||||
public async Task<AdminUiCallBack> DeleteByIdsAsync(int[] ids)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Deleteable<CoreCmsSolitaireItems>().In(ids).ExecuteCommandHasChangeAsync();
|
||||
var bl = await DbClient.Deleteable<CoreCmsSolitaireItems>().In(ids).RemoveDataCache().ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
@@ -161,21 +125,7 @@ namespace CoreCms.Net.Repository
|
||||
/// <returns></returns>
|
||||
public async Task<List<CoreCmsSolitaireItems>> GetCaChe()
|
||||
{
|
||||
var cache = ManualDataCache.Instance.Get<List<CoreCmsSolitaireItems>>(GlobalConstVars.CacheCoreCmsSolitaireItems);
|
||||
if (cache != null)
|
||||
{
|
||||
return cache;
|
||||
}
|
||||
return await UpdateCaChe();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新cache
|
||||
/// </summary>
|
||||
public async Task<List<CoreCmsSolitaireItems>> UpdateCaChe()
|
||||
{
|
||||
var list = await DbClient.Queryable<CoreCmsSolitaireItems>().With(SqlWith.NoLock).ToListAsync();
|
||||
ManualDataCache.Instance.Set(GlobalConstVars.CacheCoreCmsSolitaireItems, list);
|
||||
var list = await DbClient.Queryable<CoreCmsSolitaireItems>().With(SqlWith.NoLock).WithCache().ToListAsync();
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -191,12 +141,12 @@ namespace CoreCms.Net.Repository
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<List<CoreCmsSolitaireItems>> QueryListByClauseAsync(Expression<Func<CoreCmsSolitaireItems, bool>> predicate,
|
||||
public async Task<List<CoreCmsSolitaireItems>> QueryListByClauseAsync(Expression<Func<CoreCmsSolitaireItems, bool>> predicate,
|
||||
Expression<Func<CoreCmsSolitaireItems, object>> orderByExpression, OrderByType orderByType, bool blUseNoLock = false)
|
||||
{
|
||||
List<CoreCmsSolitaireItems> list;
|
||||
if (blUseNoLock)
|
||||
{
|
||||
{
|
||||
list = await DbClient.Queryable<CoreCmsSolitaireItems>()
|
||||
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
|
||||
.WhereIF(predicate != null, predicate).Select(p => new CoreCmsSolitaireItems
|
||||
@@ -244,7 +194,6 @@ namespace CoreCms.Net.Repository
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region 重写根据条件查询分页数据
|
||||
/// <summary>
|
||||
/// 重写根据条件查询分页数据
|
||||
@@ -256,7 +205,7 @@ namespace CoreCms.Net.Repository
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<IPageList<CoreCmsSolitaireItems>> QueryPageAsync(Expression<Func<CoreCmsSolitaireItems, bool>> predicate,
|
||||
public async Task<IPageList<CoreCmsSolitaireItems>> QueryPageAsync(Expression<Func<CoreCmsSolitaireItems, bool>> predicate,
|
||||
Expression<Func<CoreCmsSolitaireItems, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false)
|
||||
{
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="entity">实体数据</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> InsertAsync(CoreCmsSolitaire entity)
|
||||
public async Task<AdminUiCallBack> InsertAsync(CoreCmsSolitaire entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
@@ -93,10 +93,7 @@ namespace CoreCms.Net.Repository
|
||||
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.CreateSuccess : GlobalConstVars.CreateFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
@@ -105,7 +102,7 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> UpdateAsync(CoreCmsSolitaire entity)
|
||||
public async Task<AdminUiCallBack> UpdateAsync(CoreCmsSolitaire entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
@@ -217,105 +214,12 @@ namespace CoreCms.Net.Repository
|
||||
}
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步更新方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> UpdateAsync(List<CoreCmsSolitaire> entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Updateable(entity).ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写删除指定ID的数据
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> DeleteByIdAsync(object id)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Deleteable<CoreCmsSolitaire>(id).ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写删除指定ID集合的数据(批量删除)
|
||||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> DeleteByIdsAsync(int[] ids)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Deleteable<CoreCmsSolitaire>().In(ids).ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 获取缓存的所有数据==========================================================
|
||||
|
||||
/// <summary>
|
||||
/// 获取缓存的所有数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<List<CoreCmsSolitaire>> GetCaChe()
|
||||
{
|
||||
var cache = ManualDataCache.Instance.Get<List<CoreCmsSolitaire>>(GlobalConstVars.CacheCoreCmsSolitaire);
|
||||
if (cache != null)
|
||||
{
|
||||
return cache;
|
||||
}
|
||||
return await UpdateCaChe();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新cache
|
||||
/// </summary>
|
||||
public async Task<List<CoreCmsSolitaire>> UpdateCaChe()
|
||||
{
|
||||
var list = await DbClient.Queryable<CoreCmsSolitaire>().With(SqlWith.NoLock).ToListAsync();
|
||||
ManualDataCache.Instance.Set(GlobalConstVars.CacheCoreCmsSolitaire, list);
|
||||
return list;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 重写根据条件查询分页数据
|
||||
/// <summary>
|
||||
/// 重写根据条件查询分页数据
|
||||
@@ -327,7 +231,7 @@ namespace CoreCms.Net.Repository
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<IPageList<CoreCmsSolitaire>> QueryPageAsync(Expression<Func<CoreCmsSolitaire, bool>> predicate,
|
||||
public async Task<IPageList<CoreCmsSolitaire>> QueryPageAsync(Expression<Func<CoreCmsSolitaire, bool>> predicate,
|
||||
Expression<Func<CoreCmsSolitaire, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false)
|
||||
{
|
||||
@@ -480,8 +384,6 @@ namespace CoreCms.Net.Repository
|
||||
return jm;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
@@ -15,9 +15,9 @@ 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.Basics;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using SqlSugar;
|
||||
|
||||
@@ -32,107 +32,6 @@ namespace CoreCms.Net.Repository
|
||||
{
|
||||
}
|
||||
|
||||
#region 实现重写增删改查操作==========================================================
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步插入方法
|
||||
/// </summary>
|
||||
/// <param name="entity">实体数据</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> InsertAsync(CoreCmsStockLog 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 new async Task<AdminUiCallBack> UpdateAsync(CoreCmsStockLog entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var oldModel = await DbClient.Queryable<CoreCmsStockLog>().In(entity.id).SingleAsync();
|
||||
if (oldModel == null)
|
||||
{
|
||||
jm.msg = "不存在此信息";
|
||||
return jm;
|
||||
}
|
||||
//事物处理过程开始
|
||||
oldModel.id = entity.id;
|
||||
oldModel.stockId = entity.stockId;
|
||||
oldModel.productId = entity.productId;
|
||||
oldModel.goodsId = entity.goodsId;
|
||||
oldModel.nums = entity.nums;
|
||||
oldModel.sn = entity.sn;
|
||||
oldModel.bn = entity.bn;
|
||||
oldModel.goodsName = entity.goodsName;
|
||||
oldModel.spesDesc = entity.spesDesc;
|
||||
|
||||
//事物处理过程结束
|
||||
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 new async Task<AdminUiCallBack> UpdateAsync(List<CoreCmsStockLog> 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 new async Task<AdminUiCallBack> DeleteByIdAsync(object id)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Deleteable<CoreCmsStockLog>(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 new async Task<AdminUiCallBack> DeleteByIdsAsync(int[] ids)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Deleteable<CoreCmsStockLog>().In(ids).ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 重写根据条件查询分页数据
|
||||
/// <summary>
|
||||
/// 重写根据条件查询分页数据
|
||||
@@ -144,7 +43,7 @@ namespace CoreCms.Net.Repository
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<IPageList<CoreCmsStockLog>> QueryPageAsync(Expression<Func<CoreCmsStockLog, bool>> predicate,
|
||||
public async Task<IPageList<CoreCmsStockLog>> QueryPageAsync(Expression<Func<CoreCmsStockLog, bool>> predicate,
|
||||
Expression<Func<CoreCmsStockLog, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false)
|
||||
{
|
||||
|
||||
@@ -16,10 +16,10 @@ 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.FromBody;
|
||||
using CoreCms.Net.Model.ViewModels.Basics;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using CoreCms.Net.Utility.Helper;
|
||||
using SqlSugar;
|
||||
@@ -185,83 +185,6 @@ namespace CoreCms.Net.Repository
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步更新方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> UpdateAsync(CoreCmsStock entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var oldModel = await DbClient.Queryable<CoreCmsStock>().In(entity.id).SingleAsync();
|
||||
if (oldModel == null)
|
||||
{
|
||||
jm.msg = "不存在此信息";
|
||||
return jm;
|
||||
}
|
||||
//事物处理过程开始
|
||||
oldModel.id = entity.id;
|
||||
oldModel.type = entity.type;
|
||||
oldModel.manager = entity.manager;
|
||||
oldModel.memo = entity.memo;
|
||||
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 new async Task<AdminUiCallBack> UpdateAsync(List<CoreCmsStock> 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 new async Task<AdminUiCallBack> DeleteByIdAsync(object id)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Deleteable<CoreCmsStock>(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 new async Task<AdminUiCallBack> DeleteByIdsAsync(int[] ids)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Deleteable<CoreCmsStock>().In(ids).ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -277,7 +200,7 @@ namespace CoreCms.Net.Repository
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<IPageList<CoreCmsStock>> QueryPageAsync(Expression<Func<CoreCmsStock, bool>> predicate,
|
||||
public async Task<IPageList<CoreCmsStock>> QueryPageAsync(Expression<Func<CoreCmsStock, bool>> predicate,
|
||||
Expression<Func<CoreCmsStock, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false)
|
||||
{
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="entity">实体数据</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> InsertAsync(CoreCmsAppUpdateLog entity)
|
||||
public async Task<AdminUiCallBack> InsertAsync(CoreCmsAppUpdateLog entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> UpdateAsync(CoreCmsAppUpdateLog entity)
|
||||
public async Task<AdminUiCallBack> UpdateAsync(CoreCmsAppUpdateLog entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
@@ -84,28 +84,13 @@ namespace CoreCms.Net.Repository
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步更新方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> UpdateAsync(List<CoreCmsAppUpdateLog> 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 new async Task<AdminUiCallBack> DeleteByIdAsync(object id)
|
||||
public async Task<AdminUiCallBack> DeleteByIdAsync(object id)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
@@ -116,21 +101,6 @@ namespace CoreCms.Net.Repository
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写删除指定ID集合的数据(批量删除)
|
||||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> DeleteByIdsAsync(int[] ids)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Deleteable<CoreCmsAppUpdateLog>().In(ids).ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -147,7 +117,7 @@ namespace CoreCms.Net.Repository
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<IPageList<CoreCmsAppUpdateLog>> QueryPageAsync(Expression<Func<CoreCmsAppUpdateLog, bool>> predicate,
|
||||
public async Task<IPageList<CoreCmsAppUpdateLog>> QueryPageAsync(Expression<Func<CoreCmsAppUpdateLog, bool>> predicate,
|
||||
Expression<Func<CoreCmsAppUpdateLog, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false)
|
||||
{
|
||||
|
||||
@@ -14,7 +14,6 @@ using System.Threading.Tasks;
|
||||
using CoreCms.Net.Configuration;
|
||||
using CoreCms.Net.IRepository;
|
||||
using CoreCms.Net.Model.Entities;
|
||||
using CoreCms.Net.Model.ViewModels.Basics;
|
||||
using CoreCms.Net.IRepository.UnitOfWork;
|
||||
|
||||
namespace CoreCms.Net.Repository
|
||||
|
||||
@@ -15,7 +15,6 @@ 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;
|
||||
@@ -39,17 +38,13 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="entity">实体数据</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> InsertAsync(SysMenu entity)
|
||||
public async Task<AdminUiCallBack> InsertAsync(SysMenu entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Insertable(entity).ExecuteReturnIdentityAsync() > 0;
|
||||
var bl = await DbClient.Insertable(entity).RemoveDataCache().ExecuteReturnIdentityAsync() > 0;
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.CreateSuccess : GlobalConstVars.CreateFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
@@ -59,7 +54,7 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> UpdateAsync(SysMenu entity)
|
||||
public async Task<AdminUiCallBack> UpdateAsync(SysMenu entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
@@ -83,18 +78,14 @@ namespace CoreCms.Net.Repository
|
||||
oldModel.iconColor = entity.iconColor;
|
||||
oldModel.hide = entity.hide;
|
||||
//oldModel.deleted = entity.deleted;
|
||||
//oldModel.createTime = oldModel.createTime;
|
||||
//oldModel.createTime = entity.createTime;
|
||||
oldModel.updateTime = DateTime.Now;
|
||||
oldModel.identificationCode = entity.identificationCode;
|
||||
|
||||
//事物处理过程结束
|
||||
var bl = await DbClient.Updateable(oldModel).ExecuteCommandHasChangeAsync();
|
||||
var bl = await DbClient.Updateable(oldModel).RemoveDataCache().ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
@@ -104,17 +95,13 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> UpdateAsync(List<SysMenu> entity)
|
||||
public async Task<AdminUiCallBack> UpdateAsync(List<SysMenu> entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Updateable(entity).ExecuteCommandHasChangeAsync();
|
||||
var bl = await DbClient.Updateable(entity).RemoveDataCache().ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
@@ -128,7 +115,7 @@ namespace CoreCms.Net.Repository
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var all = await GetCaChe();
|
||||
var all = await DbClient.Queryable<SysMenu>().ToListAsync();
|
||||
var model = all.Find(p => p.id == id);
|
||||
if (model == null)
|
||||
{
|
||||
@@ -139,13 +126,9 @@ namespace CoreCms.Net.Repository
|
||||
var ids = new List<int>() { id };
|
||||
GetIds(all, id, ids);
|
||||
|
||||
var bl = await DbClient.Deleteable<SysMenu>().In(ids).ExecuteCommandHasChangeAsync();
|
||||
var bl = await DbClient.Deleteable<SysMenu>().In(ids).RemoveDataCache().ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
@@ -174,34 +157,5 @@ namespace CoreCms.Net.Repository
|
||||
return ids;
|
||||
}
|
||||
|
||||
#region 获取缓存的所有数据==========================================================
|
||||
|
||||
/// <summary>
|
||||
/// 获取缓存的所有数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<List<SysMenu>> GetCaChe()
|
||||
{
|
||||
var cache = ManualDataCache.Instance.Get<List<SysMenu>>(GlobalConstVars.CacheSysMenu);
|
||||
if (cache != null)
|
||||
{
|
||||
return cache;
|
||||
}
|
||||
return await UpdateCaChe();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新cache
|
||||
/// </summary>
|
||||
public async Task<List<SysMenu>> UpdateCaChe()
|
||||
{
|
||||
var list = await DbClient.Queryable<SysMenu>().ToListAsync();
|
||||
ManualDataCache.Instance.Set(GlobalConstVars.CacheSysMenu, list);
|
||||
return list;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace CoreCms.Net.Repository
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<IPageList<SysUserOperationLog>> QueryPageAsync(Expression<Func<SysUserOperationLog, bool>> predicate,
|
||||
public async Task<IPageList<SysUserOperationLog>> QueryPageAsync(Expression<Func<SysUserOperationLog, bool>> predicate,
|
||||
Expression<Func<SysUserOperationLog, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false)
|
||||
{
|
||||
|
||||
@@ -22,11 +22,6 @@ namespace CoreCms.Net.Repository.UnitOfWork
|
||||
{
|
||||
private readonly ISqlSugarClient _sqlSugarClient;
|
||||
|
||||
//public UnitOfWork(ISqlSugarClient sqlSugarClient)
|
||||
//{
|
||||
// _sqlSugarClient = sqlSugarClient;
|
||||
//}
|
||||
|
||||
public UnitOfWork()
|
||||
{
|
||||
_sqlSugarClient = DbScoped.SugarScope;
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace CoreCms.Net.Repository
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<IPageList<CoreCmsUserBalance>> QueryPageAsync(
|
||||
public async Task<IPageList<CoreCmsUserBalance>> QueryPageAsync(
|
||||
Expression<Func<CoreCmsUserBalance, bool>> predicate,
|
||||
Expression<Func<CoreCmsUserBalance, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false)
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="entity">实体数据</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<WebApiCallBack> InsertAsync(CoreCmsUserShip entity)
|
||||
public async Task<WebApiCallBack> InsertAsync(CoreCmsUserShip entity)
|
||||
{
|
||||
var jm = new WebApiCallBack();
|
||||
if (entity.isDefault == true)
|
||||
@@ -60,7 +60,7 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> UpdateAsync(CoreCmsUserShip entity)
|
||||
public async Task<AdminUiCallBack> UpdateAsync(CoreCmsUserShip entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace CoreCms.Net.Repository
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<IPageList<CoreCmsUserTocash>> QueryPageAsync(
|
||||
public async Task<IPageList<CoreCmsUserTocash>> QueryPageAsync(
|
||||
Expression<Func<CoreCmsUserTocash, bool>> predicate,
|
||||
Expression<Func<CoreCmsUserTocash, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false)
|
||||
|
||||
@@ -31,7 +31,6 @@ namespace CoreCms.Net.Repository
|
||||
}
|
||||
|
||||
|
||||
|
||||
#region 重写根据条件查询分页数据
|
||||
/// <summary>
|
||||
/// 重写根据条件查询分页数据
|
||||
@@ -43,7 +42,7 @@ namespace CoreCms.Net.Repository
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<IPageList<CoreCmsUserWeChatInfo>> QueryPageAsync(Expression<Func<CoreCmsUserWeChatInfo, bool>> predicate,
|
||||
public async Task<IPageList<CoreCmsUserWeChatInfo>> QueryPageAsync(Expression<Func<CoreCmsUserWeChatInfo, bool>> predicate,
|
||||
Expression<Func<CoreCmsUserWeChatInfo, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false)
|
||||
{
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> UpdateAsync(WeChatTransactionComponentAuditCategory entity)
|
||||
public async Task<AdminUiCallBack> UpdateAsync(WeChatTransactionComponentAuditCategory entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
@@ -76,28 +76,12 @@ namespace CoreCms.Net.Repository
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步更新方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> UpdateAsync(List<WeChatTransactionComponentAuditCategory> 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 new async Task<AdminUiCallBack> DeleteByIdAsync(object id)
|
||||
public async Task<AdminUiCallBack> DeleteByIdAsync(object id)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
@@ -109,22 +93,6 @@ namespace CoreCms.Net.Repository
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写删除指定ID集合的数据(批量删除)
|
||||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> DeleteByIdsAsync(int[] ids)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Deleteable<WeChatTransactionComponentAuditCategory>().In(ids).ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -139,7 +107,7 @@ namespace CoreCms.Net.Repository
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<IPageList<WeChatTransactionComponentAuditCategory>> QueryPageAsync(Expression<Func<WeChatTransactionComponentAuditCategory, bool>> predicate,
|
||||
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)
|
||||
{
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="entity">实体数据</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> InsertAsync(WeChatTransactionComponentBrandAudit entity)
|
||||
public async Task<AdminUiCallBack> InsertAsync(WeChatTransactionComponentBrandAudit entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
entity.createTime = DateTime.Now;
|
||||
@@ -59,7 +59,7 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> UpdateAsync(WeChatTransactionComponentBrandAudit entity)
|
||||
public async Task<AdminUiCallBack> UpdateAsync(WeChatTransactionComponentBrandAudit entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
@@ -97,28 +97,12 @@ namespace CoreCms.Net.Repository
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步更新方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> UpdateAsync(List<WeChatTransactionComponentBrandAudit> 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 new async Task<AdminUiCallBack> DeleteByIdAsync(object id)
|
||||
public async Task<AdminUiCallBack> DeleteByIdAsync(object id)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
@@ -129,22 +113,6 @@ namespace CoreCms.Net.Repository
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写删除指定ID集合的数据(批量删除)
|
||||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> DeleteByIdsAsync(int[] ids)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Deleteable<WeChatTransactionComponentBrandAudit>().In(ids).ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 重写根据条件查询分页数据
|
||||
@@ -158,7 +126,7 @@ namespace CoreCms.Net.Repository
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<IPageList<WeChatTransactionComponentBrandAudit>> QueryPageAsync(Expression<Func<WeChatTransactionComponentBrandAudit, bool>> predicate,
|
||||
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)
|
||||
{
|
||||
|
||||
@@ -42,21 +42,7 @@ namespace CoreCms.Net.Repository
|
||||
/// <returns></returns>
|
||||
public async Task<List<WeChatTransactionComponentDeliveryCompany>> GetCaChe()
|
||||
{
|
||||
var cache = ManualDataCache.Instance.Get<List<WeChatTransactionComponentDeliveryCompany>>(GlobalConstVars.CacheWeChatTransactionComponentDeliveryCompany);
|
||||
if (cache != null)
|
||||
{
|
||||
return cache;
|
||||
}
|
||||
return await UpdateCaChe();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新cache
|
||||
/// </summary>
|
||||
public async Task<List<WeChatTransactionComponentDeliveryCompany>> UpdateCaChe()
|
||||
{
|
||||
var list = await DbClient.Queryable<WeChatTransactionComponentDeliveryCompany>().With(SqlWith.NoLock).ToListAsync();
|
||||
ManualDataCache.Instance.Set(GlobalConstVars.CacheWeChatTransactionComponentDeliveryCompany, list);
|
||||
var list = await DbClient.Queryable<WeChatTransactionComponentDeliveryCompany>().With(SqlWith.NoLock).WithCache().ToListAsync();
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -74,7 +60,7 @@ namespace CoreCms.Net.Repository
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<IPageList<WeChatTransactionComponentDeliveryCompany>> QueryPageAsync(Expression<Func<WeChatTransactionComponentDeliveryCompany, bool>> predicate,
|
||||
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)
|
||||
{
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="entity">实体数据</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> InsertAsync(WeChatTransactionComponentGood entity)
|
||||
public async Task<AdminUiCallBack> InsertAsync(WeChatTransactionComponentGood entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
var isHave = await DbClient.Queryable<WeChatTransactionComponentGood>()
|
||||
@@ -108,7 +108,7 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> UpdateAsync(WeChatTransactionComponentGood entity)
|
||||
public async Task<AdminUiCallBack> UpdateAsync(WeChatTransactionComponentGood entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
@@ -173,25 +173,6 @@ namespace CoreCms.Net.Repository
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
|
||||
|
||||
|
||||
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步更新方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> UpdateAsync(List<WeChatTransactionComponentGood> 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;
|
||||
}
|
||||
|
||||
@@ -200,7 +181,7 @@ namespace CoreCms.Net.Repository
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> DeleteByIdAsync(object id)
|
||||
public async Task<AdminUiCallBack> DeleteByIdAsync(object id)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
@@ -210,22 +191,6 @@ namespace CoreCms.Net.Repository
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写删除指定ID集合的数据(批量删除)
|
||||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> DeleteByIdsAsync(int[] ids)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Deleteable<WeChatTransactionComponentGood>().In(ids).ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 重写根据条件查询分页数据
|
||||
@@ -239,7 +204,7 @@ namespace CoreCms.Net.Repository
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<IPageList<WeChatTransactionComponentGood>> QueryPageAsync(Expression<Func<WeChatTransactionComponentGood, bool>> predicate,
|
||||
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)
|
||||
{
|
||||
|
||||
@@ -34,68 +34,12 @@ namespace CoreCms.Net.Repository
|
||||
_unitOfWork = unitOfWork;
|
||||
}
|
||||
|
||||
#region 实现重写增删改查操作==========================================================
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步插入方法
|
||||
/// </summary>
|
||||
/// <param name="entity">实体数据</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> InsertAsync(WeChatTransactionComponentGoodSKU 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 new async Task<AdminUiCallBack> UpdateAsync(WeChatTransactionComponentGoodSKU entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var oldModel = await DbClient.Queryable<WeChatTransactionComponentGoodSKU>().In(entity.id).SingleAsync();
|
||||
if (oldModel == null)
|
||||
{
|
||||
jm.msg = "不存在此信息";
|
||||
return jm;
|
||||
}
|
||||
//事物处理过程开始
|
||||
oldModel.id = entity.id;
|
||||
oldModel.skuId = entity.skuId;
|
||||
oldModel.outProductId = entity.outProductId;
|
||||
oldModel.outSkuId = entity.outSkuId;
|
||||
oldModel.thumbImg = entity.thumbImg;
|
||||
oldModel.costprice = entity.costprice;
|
||||
oldModel.salePrice = entity.salePrice;
|
||||
oldModel.marketPrice = entity.marketPrice;
|
||||
oldModel.stockNum = entity.stockNum;
|
||||
oldModel.barCode = entity.barCode;
|
||||
oldModel.skuCode = entity.skuCode;
|
||||
oldModel.isSelect = entity.isSelect;
|
||||
|
||||
//事物处理过程结束
|
||||
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 new async Task<AdminUiCallBack> UpdateAsync(List<WeChatTransactionComponentGoodSKU> entity)
|
||||
public async Task<AdminUiCallBack> UpdateAsync(List<WeChatTransactionComponentGoodSKU> entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
@@ -106,105 +50,5 @@ namespace CoreCms.Net.Repository
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写删除指定ID的数据
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> DeleteByIdAsync(object id)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Deleteable<WeChatTransactionComponentGoodSKU>(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 new async Task<AdminUiCallBack> DeleteByIdsAsync(int[] ids)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Deleteable<WeChatTransactionComponentGoodSKU>().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 new async Task<IPageList<WeChatTransactionComponentGoodSKU>> QueryPageAsync(Expression<Func<WeChatTransactionComponentGoodSKU, bool>> predicate,
|
||||
Expression<Func<WeChatTransactionComponentGoodSKU, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false)
|
||||
{
|
||||
RefAsync<int> totalCount = 0;
|
||||
List<WeChatTransactionComponentGoodSKU> page;
|
||||
if (blUseNoLock)
|
||||
{
|
||||
page = await DbClient.Queryable<WeChatTransactionComponentGoodSKU>()
|
||||
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
|
||||
.WhereIF(predicate != null, predicate).Select(p => new WeChatTransactionComponentGoodSKU
|
||||
{
|
||||
id = p.id,
|
||||
skuId = p.skuId,
|
||||
outProductId = p.outProductId,
|
||||
outSkuId = p.outSkuId,
|
||||
thumbImg = p.thumbImg,
|
||||
costprice = p.costprice,
|
||||
salePrice = p.salePrice,
|
||||
marketPrice = p.marketPrice,
|
||||
stockNum = p.stockNum,
|
||||
barCode = p.barCode,
|
||||
skuCode = p.skuCode,
|
||||
isSelect = p.isSelect,
|
||||
|
||||
}).With(SqlWith.NoLock).ToPageListAsync(pageIndex, pageSize, totalCount);
|
||||
}
|
||||
else
|
||||
{
|
||||
page = await DbClient.Queryable<WeChatTransactionComponentGoodSKU>()
|
||||
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
|
||||
.WhereIF(predicate != null, predicate).Select(p => new WeChatTransactionComponentGoodSKU
|
||||
{
|
||||
id = p.id,
|
||||
skuId = p.skuId,
|
||||
outProductId = p.outProductId,
|
||||
outSkuId = p.outSkuId,
|
||||
thumbImg = p.thumbImg,
|
||||
costprice = p.costprice,
|
||||
salePrice = p.salePrice,
|
||||
marketPrice = p.marketPrice,
|
||||
stockNum = p.stockNum,
|
||||
barCode = p.barCode,
|
||||
skuCode = p.skuCode,
|
||||
isSelect = p.isSelect,
|
||||
|
||||
}).ToPageListAsync(pageIndex, pageSize, totalCount);
|
||||
}
|
||||
var list = new PageList<WeChatTransactionComponentGoodSKU>(page, pageIndex, pageSize, totalCount);
|
||||
return list;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,161 +32,6 @@ namespace CoreCms.Net.Repository
|
||||
{
|
||||
}
|
||||
|
||||
#region 实现重写增删改查操作==========================================================
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步插入方法
|
||||
/// </summary>
|
||||
/// <param name="entity">实体数据</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> InsertAsync(WeChatTransactionComponentThirdCategory 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;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步更新方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> UpdateAsync(WeChatTransactionComponentThirdCategory entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var oldModel = await DbClient.Queryable<WeChatTransactionComponentThirdCategory>().In(entity.id).SingleAsync();
|
||||
if (oldModel == null)
|
||||
{
|
||||
jm.msg = "不存在此信息";
|
||||
return jm;
|
||||
}
|
||||
//事物处理过程开始
|
||||
oldModel.id = entity.id;
|
||||
oldModel.third_cat_id = entity.third_cat_id;
|
||||
oldModel.third_cat_name = entity.third_cat_name;
|
||||
oldModel.qualification = entity.qualification;
|
||||
oldModel.qualification_type = entity.qualification_type;
|
||||
oldModel.product_qualification = entity.product_qualification;
|
||||
oldModel.product_qualification_type = entity.product_qualification_type;
|
||||
oldModel.second_cat_id = entity.second_cat_id;
|
||||
oldModel.second_cat_name = entity.second_cat_name;
|
||||
oldModel.first_cat_id = entity.first_cat_id;
|
||||
oldModel.first_cat_name = entity.first_cat_name;
|
||||
oldModel.createTime = entity.createTime;
|
||||
|
||||
//事物处理过程结束
|
||||
var bl = await DbClient.Updateable(oldModel).ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步更新方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> UpdateAsync(List<WeChatTransactionComponentThirdCategory> entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Updateable(entity).ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写删除指定ID的数据
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> DeleteByIdAsync(object id)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Deleteable<WeChatTransactionComponentThirdCategory>(id).ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写删除指定ID集合的数据(批量删除)
|
||||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> DeleteByIdsAsync(int[] ids)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Deleteable<WeChatTransactionComponentThirdCategory>().In(ids).ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 获取缓存的所有数据==========================================================
|
||||
|
||||
/// <summary>
|
||||
/// 获取缓存的所有数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<List<WeChatTransactionComponentThirdCategory>> GetCaChe()
|
||||
{
|
||||
var cache = ManualDataCache.Instance.Get<List<WeChatTransactionComponentThirdCategory>>(GlobalConstVars.CacheWeChatTCThirdCatList);
|
||||
if (cache != null)
|
||||
{
|
||||
return cache;
|
||||
}
|
||||
return await UpdateCaChe();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新cache
|
||||
/// </summary>
|
||||
public async Task<List<WeChatTransactionComponentThirdCategory>> UpdateCaChe()
|
||||
{
|
||||
var list = await DbClient.Queryable<WeChatTransactionComponentThirdCategory>().With(SqlWith.NoLock).ToListAsync();
|
||||
ManualDataCache.Instance.Set(GlobalConstVars.CacheWeChatTCThirdCatList, list);
|
||||
return list;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 重写根据条件查询分页数据
|
||||
/// <summary>
|
||||
/// 重写根据条件查询分页数据
|
||||
@@ -198,7 +43,7 @@ namespace CoreCms.Net.Repository
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<IPageList<WeChatTransactionComponentThirdCategory>> QueryPageAsync(Expression<Func<WeChatTransactionComponentThirdCategory, bool>> predicate,
|
||||
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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user