using System.Data; using System.Threading.Tasks; using Wicture.DbRESTFul; using Wicture.DbRESTFul.Infrastructure.Repository; using System.Collections.Generic; using JiaZhiQuan.Common.Models.MallGoodsModel; namespace JiaZhiQuan.Common { public static partial class RepositoryExtension { /// /// 新增商品变更事件 /// /// /// /// 商品id /// 操作人id /// 操作人类型:0 平台 1 买家 2 卖家 3 运营人员 MallGoodsChangeOperatorType 枚举 /// 事件类型 /// 事件描述 /// 操作类型(1,创建、编辑2,审核,3,刊登, 4,删除, 5,启用禁用, 6,销售) 枚举MallGoodsChangeEventType /// /// public static async Task AddGoodsChangeEvent(this DbRESTFulRepository repository, List chages, IDbConnection conn = null, IDbTransaction trans = null) { int count = await repository.QuerySingleOrDefaultAsync(@" insert into mall_goods_change_events( goodsId, eventName, eventDesc, operatorId, operatorType, eventType, createAt) values( @goodsId, @eventName, @eventDesc, @operatorId, @operatorType, @eventType, @createAt);select row_count() as count;", chages, conn, trans); if (count > 0) return; throw new LogicalException("新增商品变更事件失败"); } } }