Commit b7da5b1b authored by 黄奎's avatar 黄奎

新增活动评论

parent 8ef51466
using Mall.Common.Enum;
using Mall.Common.Enum.Goods;
using Mall.Common.Enum.User;
using System;
using VT.FW.DB;
namespace Mall.Model.Entity.TradePavilion
{
/// <summary>
/// 商会活动评论表实体类
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Commerce_Comment
{
/// <summary>
/// 主键编号
/// </summary>
public int Id { get; set; }
/// <summary>
/// 活动编号
/// </summary>
public int ActivityId { get; set; }
/// <summary>
/// 用户编号
/// </summary>
public int UserId { get; set; }
/// <summary>
/// 客人名称
/// </summary>
public string UserName { get; set; }
/// <summary>
/// 用户头像
/// </summary>
public string UserPhoto { get; set; }
/// <summary>
/// 评分 1-5分
/// </summary>
public int CommentScore { get; set; }
/// <summary>
/// 评论类型 1 好评 2中评 3差评
/// </summary>
public GoodsCommentTypeEnum CommentGrade { get; set; }
/// <summary>
/// 评论内容
/// </summary>
public string Content { get; set; }
/// <summary>
/// 评论图片
/// </summary>
public string CommentImage { get; set; }
/// <summary>
/// 回复
/// </summary>
public string Reply { get; set; }
/// <summary>
/// 来源
/// </summary>
public UserSourceEnum PlatformSource { get; set; }
/// <summary>
/// 是否置顶 1是 2否
/// </summary>
public int Is_Top { get; set; }
/// <summary>
/// 是否显示 1是 2否
/// </summary>
public int Is_Show { get; set; }
/// <summary>
/// 是否匿名 1是 2否
/// </summary>
public int Is_Anonymity { get; set; }
/// <summary>
/// 删除状态
/// </summary>
public DateStateEnum Status { get; set; }
/// <summary>
/// 商户号
/// </summary>
public int TenantId { get; set; }
/// <summary>
/// 小程序id
/// </summary>
public int MallBaseId { get; set; }
/// <summary>
/// CreateDate
/// </summary>
public DateTime CreateDate { get; set; }
/// <summary>
/// UpdateDate
/// </summary>
public DateTime UpdateDate { get; set; }
}
}
using Mall.Model.Entity.TradePavilion;
using System;
using System.Collections.Generic;
using System.Text;
namespace Mall.Model.Extend.TradePavilion
{
/// <summary>
/// 商会活动评论表扩展实体类
/// </summary>
public class RB_Commerce_Comment_Extend : RB_Commerce_Comment
{
}
}
using Mall.Common.Enum;
using Mall.Model.Extend.TradePavilion;
using Mall.Repository.TradePavilion;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VT.FW.DB;
namespace Mall.Module.TradePavilion
{
/// <summary>
/// 活动评论处理类
/// </summary>
public class CommerceCommentModule
{
/// <summary>
/// 商会活动评论表仓储层对象
/// </summary>
private readonly RB_Commerce_CommentRepository commerce_CommentRepository = new RB_Commerce_CommentRepository();
/// <summary>
/// 获取活动评论分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Commerce_Comment_Extend> GetCommerceCommentPageModule(int pageIndex, int pageSize, out long rowsCount, RB_Commerce_Comment_Extend query)
{
return commerce_CommentRepository.GetCommerceCommentPageRepository(pageIndex, pageSize, out rowsCount, query).ToList();
}
/// <summary>
/// 新增活动评论
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool SetCommerceCommentModule(RB_Commerce_Comment_Extend model)
{
var newId = commerce_CommentRepository.Insert(model);
model.Id = newId;
bool flag = newId > 0;
return flag;
}
/// <summary>
/// 删除活动评论
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public bool RemoveCommerceCommentModule(int Id)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Commerce_Comment_Extend.Id),(int)DateStateEnum.Delete }
};
return commerce_CommentRepository.Update(fileds, new WhereHelper(nameof(RB_Commerce_Comment_Extend.Id), Id));
}
}
}
using Mall.Common.Enum;
using Mall.Model.Entity.TradePavilion;
using Mall.Model.Extend.TradePavilion;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VT.FW.DB.Dapper;
namespace Mall.Repository.TradePavilion
{
/// <summary>
/// 商会活动评论表仓储层
/// </summary>
public class RB_Commerce_CommentRepository:BaseRepository<RB_Commerce_Comment>
{
/// <summary>
/// 获取活动评论分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Commerce_Comment_Extend> GetCommerceCommentPageRepository(int pageIndex, int pageSize, out long rowsCount, RB_Commerce_Comment_Extend query)
{
rowsCount = 0;
DynamicParameters parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT *
FROM rb_commerce_comment
WHERE 1=1
");
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Commerce_Comment_Extend.Status), (int)DateStateEnum.Normal);
if (query == null)
{
return new List<RB_Commerce_Comment_Extend>();
}
else
{
if (query.TenantId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Commerce_Comment_Extend.TenantId), query.TenantId);
}
if (query.MallBaseId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Commerce_Comment_Extend.MallBaseId), query.MallBaseId);
}
if (!string.IsNullOrEmpty(query.Content))
{
builder.AppendFormat(" AND {0} LIKE @Name ", nameof(RB_Commerce_Comment_Extend.Content));
parameters.Add("Name", "%" + query.Content.Trim() + "%");
}
if (query.ActivityId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Commerce_Comment_Extend.ActivityId), query.ActivityId);
}
}
return GetPage<RB_Commerce_Comment_Extend>(pageIndex, pageSize, out rowsCount, builder.ToString(), parameters).ToList();
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment