修改BUG:站内消息字段转换异常,更改数据库结构,增加数据默认值
This commit is contained in:
parent
270d70b538
commit
d191da612c
|
@ -1,62 +1,64 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Bootstrap.DataAccess
|
||||
{
|
||||
/// <summary>
|
||||
/// 消息表实体
|
||||
/// author:liuchun
|
||||
/// date:2016.11.12
|
||||
/// </summary>
|
||||
public class Message
|
||||
{
|
||||
/// <summary>
|
||||
/// 消息主键 数据库自增
|
||||
/// </summary>
|
||||
public int ID { get; set; }
|
||||
/// <summary>
|
||||
/// 标题
|
||||
/// </summary>
|
||||
public string Title { get; set; }
|
||||
/// <summary>
|
||||
/// 内容
|
||||
/// </summary>
|
||||
public string Content { get; set; }
|
||||
/// <summary>
|
||||
/// 发消息人
|
||||
/// </summary>
|
||||
public string From { get; set; }
|
||||
/// <summary>
|
||||
/// 收消息人
|
||||
/// </summary>
|
||||
public string To { get; set; }
|
||||
/// <summary>
|
||||
/// 消息发送时间
|
||||
/// </summary>
|
||||
public DateTime SendTime { get; set; }
|
||||
/// <summary>
|
||||
/// 消息状态:0-未读,1-已读
|
||||
/// 和Dict表的通知消息关联
|
||||
/// </summary>
|
||||
public string Status { get; set; }
|
||||
/// <summary>
|
||||
/// 标旗状态:0-未标旗,1-已标旗
|
||||
/// </summary>
|
||||
public int Mark { get; set; }
|
||||
/// <summary>
|
||||
/// 删除状态:0-未删除,1-已删除
|
||||
/// </summary>
|
||||
public int IsDelete { get; set; }
|
||||
/// <summary>
|
||||
/// 消息标签:0-一般,1-紧要
|
||||
/// 和Dict表的消息标签关联
|
||||
/// </summary>
|
||||
public string Label { get; set; }
|
||||
/// <summary>
|
||||
/// 获得/设置 时间描述 2分钟内为刚刚
|
||||
/// </summary>
|
||||
public string Period { get; set; }
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Bootstrap.DataAccess
|
||||
{
|
||||
/// <summary>
|
||||
/// 消息表实体
|
||||
/// author:liuchun
|
||||
/// date:2016.11.12
|
||||
/// </summary>
|
||||
public class Message
|
||||
{
|
||||
/// <summary>
|
||||
/// 消息主键 数据库自增
|
||||
/// </summary>
|
||||
public int ID { get; set; }
|
||||
/// <summary>
|
||||
/// 标题
|
||||
/// </summary>
|
||||
public string Title { get; set; }
|
||||
/// <summary>
|
||||
/// 内容
|
||||
/// </summary>
|
||||
public string Content { get; set; }
|
||||
/// <summary>
|
||||
/// 发消息人
|
||||
/// </summary>
|
||||
public string From { get; set; }
|
||||
/// <summary>
|
||||
/// 收消息人
|
||||
/// </summary>
|
||||
public string To { get; set; }
|
||||
/// <summary>
|
||||
/// 消息发送时间
|
||||
/// </summary>
|
||||
public DateTime SendTime { get; set; }
|
||||
/// <summary>
|
||||
/// 消息状态:0-未读,1-已读 和Dict表的通知消息关联
|
||||
/// </summary>
|
||||
public string Status { get; set; }
|
||||
/// <summary>
|
||||
/// 标旗状态:0-未标旗,1-已标旗
|
||||
/// </summary>
|
||||
public int Mark { get; set; }
|
||||
/// <summary>
|
||||
/// 删除状态:0-未删除,1-已删除
|
||||
/// </summary>
|
||||
public int IsDelete { get; set; }
|
||||
/// <summary>
|
||||
/// 消息标签:0-一般,1-紧要 和Dict表的消息标签关联
|
||||
/// </summary>
|
||||
public string Label { get; set; }
|
||||
/// <summary>
|
||||
/// 获得/设置 标签名称
|
||||
/// </summary>
|
||||
public string LabelName { get; set; }
|
||||
/// <summary>
|
||||
/// 获得/设置 时间描述 2分钟内为刚刚
|
||||
/// </summary>
|
||||
public string Period { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace Bootstrap.DataAccess
|
|||
{
|
||||
var messageRet = CacheManager.GetOrAdd(RetrieveMessageDataKey, CacheSection.RetrieveIntervalByKey(RetrieveMessageDataKey), key =>
|
||||
{
|
||||
string sql = "select * from [Messages] where [To]=@UserName or [From]=@UserName";
|
||||
string sql = "select m.*, d.Name from [Messages] m left join Dicts d on m.Label = d.Code and d.Category = N'消息状态' and d.Define = 0 where[To] = @UserName or [From] = @UserName";
|
||||
List<Message> messages = new List<Message>();
|
||||
DbCommand cmd = DBAccessManager.SqlDBAccess.CreateCommand(CommandType.Text, sql);
|
||||
try
|
||||
|
@ -46,10 +46,10 @@ namespace Bootstrap.DataAccess
|
|||
To = (string)reader[4],
|
||||
SendTime = LgbConvert.ReadValue(reader[5], DateTime.MinValue),
|
||||
Status = (string)reader[6],
|
||||
Mark=(int)reader[7],
|
||||
IsDelete=(int)reader[8],
|
||||
Label=(string)reader[9]
|
||||
|
||||
Mark = (int)reader[7],
|
||||
IsDelete = (int)reader[8],
|
||||
Label = (string)reader[9],
|
||||
LabelName = LgbConvert.ReadValue(reader[10], string.Empty)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ namespace Bootstrap.DataAccess
|
|||
/// 收件箱
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
|
||||
|
||||
public static IEnumerable<Message> Inbox(string userName)
|
||||
{
|
||||
var messageRet = RetrieveMessages(userName);
|
||||
|
@ -88,7 +88,7 @@ namespace Bootstrap.DataAccess
|
|||
public static IEnumerable<Message> Trash(string userName)
|
||||
{
|
||||
var messageRet = RetrieveMessages(userName);
|
||||
return messageRet.Where(n => n.IsDelete==1).Select(n => n);
|
||||
return messageRet.Where(n => n.IsDelete == 1).Select(n => n);
|
||||
}
|
||||
/// <summary>
|
||||
/// 标旗
|
||||
|
@ -98,7 +98,7 @@ namespace Bootstrap.DataAccess
|
|||
public static IEnumerable<Message> Mark(string userName)
|
||||
{
|
||||
var messageRet = RetrieveMessages(userName);
|
||||
return messageRet.Where(n => n.Mark==1).Select(n => n);
|
||||
return messageRet.Where(n => n.Mark == 1).Select(n => n);
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取Header处显示的消息列表
|
||||
|
|
|
@ -331,7 +331,7 @@ CREATE TABLE [dbo].[Messages](
|
|||
[To] [varchar](50) NOT NULL,
|
||||
[SendTime] [datetime] NOT NULL,
|
||||
[Status] [nvarchar](50) NOT NULL,
|
||||
[Mark] [nvarchar](50) NOT NULL,
|
||||
[Flag] [int] NOT NULL,
|
||||
[IsDelete] [int] NOT NULL,
|
||||
[Label] [nvarchar](50) NOT NULL,
|
||||
CONSTRAINT [PK_Messages] PRIMARY KEY CLUSTERED
|
||||
|
@ -343,4 +343,13 @@ CREATE TABLE [dbo].[Messages](
|
|||
GO
|
||||
|
||||
SET ANSI_PADDING OFF
|
||||
GO
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[Messages] ADD CONSTRAINT [DF_Messages_Mark] DEFAULT ((0)) FOR [Flag]
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[Messages] ADD CONSTRAINT [DF_Messages_IsDelete] DEFAULT ((0)) FOR [IsDelete]
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[Messages] ADD CONSTRAINT [DF_Messages_Label] DEFAULT ((0)) FOR [Label]
|
||||
GO
|
||||
|
|
Loading…
Reference in New Issue