重构系统日志架构,稍后完善

This commit is contained in:
Argo-Lenovo 2016-11-05 15:26:42 +08:00
parent aa4bf3c989
commit 3a2c89f289
12 changed files with 284 additions and 384 deletions

View File

@ -129,7 +129,6 @@
<Content Include="Content\fonts\glyphicons-halflings-regular.svg" /> <Content Include="Content\fonts\glyphicons-halflings-regular.svg" />
<Content Include="Content\images\success.png" /> <Content Include="Content\images\success.png" />
<Content Include="Content\js\common-scripts.js" /> <Content Include="Content\js\common-scripts.js" />
<Content Include="Content\js\jQuery.cookie.js" />
<Content Include="Content\js\jquery.dcjqaccordion.2.7.js" /> <Content Include="Content\js\jquery.dcjqaccordion.2.7.js" />
<Content Include="Content\js\jquery.nicescroll.min.js" /> <Content Include="Content\js\jquery.nicescroll.min.js" />
<Content Include="Content\js\jquery.scrollTo.js" /> <Content Include="Content\js\jquery.scrollTo.js" />

View File

@ -1,7 +1,8 @@
(function ($) { (function ($) {
BootstrapAdmin = function (options) { BootstrapAdmin = function (options) {
var that = this; var that = this;
if (options.click !== undefined && options.click.constructor === Object) { options.click = $.extend({}, BootstrapAdmin.settings.click, options.click); } options = options || {};
options.click = $.extend({}, BootstrapAdmin.settings.click, options.click);
this.options = $.extend({}, BootstrapAdmin.settings, options); this.options = $.extend({}, BootstrapAdmin.settings, options);
this.dataEntity = options.dataEntity; this.dataEntity = options.dataEntity;
@ -144,7 +145,7 @@
type: 'DELETE', type: 'DELETE',
success: function (result) { success: function (result) {
if ($.isFunction(options.success)) options.success('del', options); if ($.isFunction(options.success)) options.success('del', options);
if (result) setTimeout(function () { swal("成功!", "删除数据", "success"); $(options.bootstrapTable).bootstrapTable('refresh'); saveLog(options, "DELETE"); }, 100); if (result) setTimeout(function () { swal("成功!", "删除数据", "success"); $(options.bootstrapTable).bootstrapTable('refresh'); }, 100);
else setTimeout(function () { swal("失败", "删除数据", "error"); }, 200); else setTimeout(function () { swal("失败", "删除数据", "error"); }, 200);
}, },
error: function (XMLHttpRequest, textStatus, errorThrown) { error: function (XMLHttpRequest, textStatus, errorThrown) {
@ -183,7 +184,6 @@
} }
} }
if (options.modal.constructor === String) $('#' + options.modal).modal("hide"); if (options.modal.constructor === String) $('#' + options.modal).modal("hide");
saveLog(options, "POST");
swal("成功", "保存数据", "success"); swal("成功", "保存数据", "success");
} }
else { else {

View File

@ -1,89 +0,0 @@
/*jslint browser: true */ /*global jQuery: true */
/**
* jQuery Cookie plugin
*
* Copyright (c) 2010 Klaus Hartl (stilbuero.de)
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
*/
// TODO JsDoc
/**
* Create a cookie with the given key and value and other optional parameters.
*
* @example $.cookie('the_cookie', 'the_value');
* @desc Set the value of a cookie.
* @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
* @desc Create a cookie with all available options.
* @example $.cookie('the_cookie', 'the_value');
* @desc Create a session cookie.
* @example $.cookie('the_cookie', null);
* @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
* used when the cookie was set.
*
* @param String key The key of the cookie.
* @param String value The value of the cookie.
* @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
* @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
* If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
* If set to null or omitted, the cookie will be a session cookie and will not be retained
* when the the browser exits.
* @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
* @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
* @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
* require a secure protocol (like HTTPS).
* @type undefined
*
* @name $.cookie
* @cat Plugins/Cookie
* @author Klaus Hartl/klaus.hartl@stilbuero.de
*/
/**
* Get the value of a cookie with the given key.
*
* @example $.cookie('the_cookie');
* @desc Get the value of a cookie.
*
* @param String key The key of the cookie.
* @return The value of the cookie.
* @type String
*
* @name $.cookie
* @cat Plugins/Cookie
* @author Klaus Hartl/klaus.hartl@stilbuero.de
*/
jQuery.cookie = function (key, value, options) {
// key and value given, set cookie...
if (arguments.length > 1 && (value === null || typeof value !== "object")) {
options = jQuery.extend({}, options);
if (value === null) {
options.expires = -1;
}
if (typeof options.expires === 'number') {
var days = options.expires, t = options.expires = new Date();
t.setDate(t.getDate() + days);
}
return (document.cookie = [
encodeURIComponent(key), '=',
options.raw ? String(value) : encodeURIComponent(String(value)),
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
options.path ? '; path=' + options.path : '',
options.domain ? '; domain=' + options.domain : '',
options.secure ? '; secure' : ''
].join(''));
}
// key and possibly options given, get cookie...
options = value || {};
var result, decode = options.raw ? function (s) { return s; } : decodeURIComponent;
return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null;
};

View File

@ -1,30 +1,38 @@
var saveLog = function (options,otype) { (function ($) {
$.ajax({ LogPlugin = function (options) {
url: "../api/Logs", var that = this;
type: "POST", this.options = $.extend({}, LogPlugin.settings, options);
data: CreateOperationData(options,otype),
success: function (result) { // handler click event
if (result) { for (name in this.options.click) {
} var cId = this.options.click[name];
} var source = $("#" + cId);
}); source.data('click', name);
} source.click(function () {
var method = $(this).data('click');
function CreateOperationData(options,otype) { LogPlugin.prototype[method].call(that, this);
var nameStr = $.cookie("lgb____bd____cp"); });
nameStr = nameStr.substring("realUserName=".length, nameStr.indexOf("&")); }
var operationType; }
if (otype == "POST") {
//0表示新增1表示修改 LogPlugin.settings = {
operationType = options.data.ID == 0 ? 0 : 1; url: '../api/Logs',
} else if (otype == "DELETE") { click: {
//2表示删除 query: 'btn_query',
operationType = 2; del: 'btn_delete',
} save: 'btnSubmit'
//operationModule表示修改的模块 }
var operationModule = options.url.substring(options.url.lastIndexOf("/") + 1, options.url.length); }
var postdata = { OperationType: operationType, UserName: nameStr, Remark: "", OperationModule: operationModule }; LogPlugin.prototype = {
return postdata; constructor: LogPlugin,
} query: function (element) {
log(this.options.url, { crud: 'Query' });
}
}
var log = function (url, data) {
$.post(url, data);
}
})(jQuery);

View File

@ -1,40 +1,43 @@
using Bootstrap.Admin.Models; using Bootstrap.Admin.Models;
using Bootstrap.DataAccess; using Bootstrap.DataAccess;
using System.Linq; using System.Linq;
using System.Web.Http; using System.Web;
using System.Web.Http;
namespace Bootstrap.Admin.Controllers
{ namespace Bootstrap.Admin.Controllers
public class LogsController : ApiController {
{ public class LogsController : ApiController
/// <summary> {
/// /// <summary>
/// </summary> ///
/// <param name="value"></param> /// </summary>
/// <returns></returns> /// <param name="value"></param>
[HttpGet] /// <returns></returns>
public QueryData<Log> Get([FromUri]QueryLogOption value) [HttpGet]
{ public QueryData<Log> Get([FromUri]QueryLogOption value)
return value.RetrieveData(); {
} return value.RetrieveData();
/// <summary> }
/// /// <summary>
/// </summary> ///
/// <param name="id"></param> /// </summary>
/// <returns></returns> /// <param name="id"></param>
[HttpGet] /// <returns></returns>
public Log Get(int id) [HttpGet]
{ public Log Get(int id)
return LogHelper.RetrieveLogs().FirstOrDefault(t => t.ID == id); {
} return LogHelper.RetrieveLogs().FirstOrDefault(t => t.ID == id);
}
[HttpPost]
public bool Post([FromBody]Log value) [HttpPost]
{ public bool Post([FromBody]Log value)
{
value.OperationIp = LogHelper.GetClientIp(); var request = HttpContext.Current.Request;
value.OperationTime = System.DateTime.Now; value.ClientAgent = request.UserAgent;
return LogHelper.SaveLog(value); value.RequestUrl = request.Url.AbsolutePath;
} value.ClientIp = request.UserHostAddress;
} value.UserName = HttpContext.Current.User.Identity.Name;
return LogHelper.SaveLog(value);
}
}
} }

View File

@ -1,72 +1,71 @@
using Bootstrap.DataAccess; using Bootstrap.DataAccess;
using Longbow.Web.Mvc; using Longbow.Web.Mvc;
using System; using System;
using System.Globalization; using System.Globalization;
using System.Linq; using System.Linq;
namespace Bootstrap.Admin.Models namespace Bootstrap.Admin.Models
{ {
public class QueryLogOption : PaginationOption public class QueryLogOption : PaginationOption
{ {
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public string OperateType { get; set; } public string OperateType { get; set; }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public string OperateTimeStart { get; set; } public string OperateTimeStart { get; set; }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public string OperateTimeEnd { get; set; } public string OperateTimeEnd { get; set; }
public QueryData<Log> RetrieveData() public QueryData<Log> RetrieveData()
{ {
var data = LogHelper.RetrieveLogs(string.Empty); var data = LogHelper.RetrieveLogs(string.Empty);
if (!string.IsNullOrEmpty(OperateType)) if (!string.IsNullOrEmpty(OperateType))
{ {
data = data.Where(t => t.OperationType.ToString().Contains(OperateType)); data = data.Where(t => t.CRUD.ToString().Contains(OperateType));
} }
if (!string.IsNullOrEmpty(OperateTimeStart)) if (!string.IsNullOrEmpty(OperateTimeStart))
{ {
DateTime opTimeStart = StringToDateTime(OperateTimeStart); DateTime opTimeStart = StringToDateTime(OperateTimeStart);
if (opTimeStart != null) if (opTimeStart != null)
data = data.Where(t => IsSmallThen(opTimeStart, t.OperationTime)); data = data.Where(t => IsSmallThen(opTimeStart, t.LogTime));
} }
if (!string.IsNullOrEmpty(OperateTimeEnd)) if (!string.IsNullOrEmpty(OperateTimeEnd))
{ {
DateTime opTimeEnd = StringToDateTime(OperateTimeEnd); DateTime opTimeEnd = StringToDateTime(OperateTimeEnd);
if (opTimeEnd != null) if (opTimeEnd != null)
data = data.Where(t => IsSmallThen(t.OperationTime, opTimeEnd)); data = data.Where(t => IsSmallThen(t.LogTime, opTimeEnd));
} }
var ret = new QueryData<Log>(); var ret = new QueryData<Log>();
ret.total = data.Count(); ret.total = data.Count();
// TODO: 通过option.Sort属性判断对那列进行排序现在统一对名称列排序 data = Order == "asc" ? data.OrderBy(t => t.CRUD) : data.OrderByDescending(t => t.CRUD);
data = Order == "asc" ? data.OrderBy(t => t.OperationType) : data.OrderByDescending(t => t.OperationType); ret.rows = data.Skip(Offset).Take(Limit);
ret.rows = data.Skip(Offset).Take(Limit); return ret;
return ret; }
} private static DateTime StringToDateTime(string dt_str)
private static DateTime StringToDateTime(string dt_str) {
{ DateTime dt;
DateTime dt ; DateTimeFormatInfo dtFormat = new DateTimeFormatInfo();
DateTimeFormatInfo dtFormat = new DateTimeFormatInfo(); dtFormat.ShortDatePattern = "yyyy-MM-dd HH:mm:ss";
dtFormat.ShortDatePattern = "yyyy-MM-dd HH:mm:ss"; dt = Convert.ToDateTime(dt_str, dtFormat);
dt = Convert.ToDateTime(dt_str, dtFormat); return dt;
return dt; }
} /// <summary>
/// <summary> /// 比较两个DateTime
/// 比较两个DateTime /// (去掉了毫秒)
/// (去掉了毫秒) /// </summary>
/// </summary> /// <param name="d1"></param>
/// <param name="d1"></param> /// <param name="d2"></param>
/// <param name="d2"></param> /// <returns></returns>
/// <returns></returns> private static bool IsSmallThen(DateTime d1, DateTime d2)
private static bool IsSmallThen(DateTime d1, DateTime d2) {
{ return new DateTime(d1.Year, d1.Month, d1.Day, d1.Hour, d1.Minute, d1.Second) <=
return new DateTime(d1.Year, d1.Month, d1.Day, d1.Hour, d1.Minute, d1.Second) <= new DateTime(d2.Year, d2.Month, d2.Day, d2.Hour, d2.Minute, d2.Second);
new DateTime(d2.Year, d2.Month, d2.Day, d2.Hour, d2.Minute, d2.Second); }
} }
}
} }

View File

@ -1,37 +1,21 @@
$(function () { $(function () {
//隐藏掉操作按钮 $('table').smartTable({
$("#toolbar").hide(); url: '../api/Logs', //请求后台的URL*
sortName: 'OperationType',
var bsa = new BootstrapAdmin({ queryParams: function (params) { return $.extend(params, { operateType: $("#txt_operate_type").val(), OperateTimeStart: $("#txt_operate_start").val(), OperateTimeEnd: $("#txt_operate_end").val() }); }, //传递参数(*
url: '../api/Logs', columns: [{ checkbox: true },
dataEntity: new DataEntity({ { title: "操作类型", field: "CRUD", sortable: true },
map: { { title: "用户名称", field: "UserName", sortable: false },
ID: "logID", {
OperationType: "operateType", title: "操作时间", field: "LogTime", sortable: false,
UserID: "userId", formatter: function (value, row, index) {
OperationTime: "operateTime", return value.substring(0, 19).replace("T", " ");
OperateIp: "operationIp", }
OperationModule: "operationModule", },
} { title: "操作IP", field: "ClientIp", sortable: false },
}) { title: "备注", field: "ClientAgent", sortable: false },
}); { title: "操作模块", field: "RequestUrl", sortable: false }
$('table').smartTable({ ]
url: '../api/Logs', //请求后台的URL* });
sortName: 'OperationType', var log = new LogPlugin();
queryParams: function (params) { return $.extend(params, { operateType: $("#txt_operate_type").val(), OperateTimeStart: $("#txt_operate_start").val(), OperateTimeEnd: $("#txt_operate_end").val() }); }, //传递参数(*
columns: [{ checkbox: true },
{ title: "Id", field: "ID", events: bsa.idEvents(), formatter: BootstrapAdmin.idFormatter, },
{ title: "操作类型", field: "OperationType", sortable: true },
{ title: "用户名称", field: "UserName", sortable: false },
{
title: "操作时间", field: "OperationTime", sortable: false,
formatter: function (value, row, index) {
return value.substring(0,19).replace("T", " ");
}
},
{ title: "操作IP", field: "OperationIp", sortable: false },
{ title: "备注", field: "Remark", sortable: false },
{ title: "操作模块", field: "OperationModule", sortable: false }
]
});
}); });

View File

@ -1,34 +1,46 @@
@model NavigatorBarModel @model NavigatorBarModel
@{ @{
ViewBag.Title = "系统日志"; ViewBag.Title = "系统日志";
Layout = "~/Views/Shared/_Default.cshtml"; Layout = "~/Views/Shared/_Admin.cshtml";
} }
@section Javascript { @section Javascript {
<script src="~/scripts/Logs.js"></script> <script src="~/content/js/bootstrap-table.js"></script>
} <script src="~/content/js/bootstrap-table-zh-CN.js"></script>
@section header { <script src="~/scripts/Logs.js"></script>
@Html.Partial("Header", Model) }
} @section header {
@section navigator { @Html.Partial("Header", Model)
@Html.Partial("Navigator", Model) }
} @section navigator {
@section query { @Html.Partial("Navigator", Model)
<form class="form-inline" role="form"> }
<div class="form-group col-lg-5"> <div class="panel panel-default">
<label class="control-label" for="txt_operate_type">操作类型</label> <div class="panel-heading">查询条件</div>
<input type="text" class="form-control" id="txt_operate_type" /> <div class="panel-body">
</div> <form class="form-inline" role="form">
<div class="form-group col-lg-5"> <div class="form-group col-lg-5">
<label class="control-label" for="txt_operate_start">起始时间</label> <label class="control-label" for="txt_operate_type">操作类型</label>
<input type="datetime" class="form-control" id="txt_operate_start" /> <input type="text" class="form-control" id="txt_operate_type" />
</div> </div>
<div class="form-group col-lg-5"> <div class="form-group col-lg-5">
<label class="control-label" for="txt_operate_end">终止时间</label> <label class="control-label" for="txt_operate_start">起始时间</label>
<input type="datetime" class="form-control" id="txt_operate_end" /> <input type="datetime" class="form-control" id="txt_operate_start" />
</div> </div>
<div class="form-group col-lg-5">
<div class="form-group col-lg-2"> <label class="control-label" for="txt_operate_end">终止时间</label>
<button type="button" id="btn_query" class="btn btn-primary"><span class="glyphicon glyphicon-search" aria-hidden="true"></span>查询</button> <input type="datetime" class="form-control" id="txt_operate_end" />
</div> </div>
</form> <div class="form-group col-lg-2">
} <button type="button" id="btn_query" class="btn btn-primary"><span class="glyphicon glyphicon-search" aria-hidden="true"></span>查询</button>
</div>
</form>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
查询结果
</div>
<div class="panel-body">
<table></table>
</div>
</div>

View File

@ -1,41 +1,41 @@
using System; using System;
namespace Bootstrap.DataAccess namespace Bootstrap.DataAccess
{ {
public class Log public class Log
{ {
/// <summary> /// <summary>
/// 获得/设置 操作日志主键ID /// 获得/设置 操作日志主键ID
/// </summary> /// </summary>
public int ID { get; set; } public int ID { get; set; }
/// <summary> /// <summary>
/// 获得/设置 操作类型 /// 获得/设置 操作类型
/// </summary> /// </summary>
public int OperationType { get; set; } public string CRUD { get; set; }
/// <summary> /// <summary>
/// 获得/设置 用户名称 /// 获得/设置 用户名称
/// </summary> /// </summary>
public string UserName { get; set; } public string UserName { get; set; }
/// <summary> /// <summary>
/// 获得/设置 操作时间 /// 获得/设置 操作时间
/// </summary> /// </summary>
public DateTime OperationTime { get; set; } public DateTime LogTime { get; set; }
/// <summary> /// <summary>
/// 获得/设置 操作者Ip /// 获得/设置 客户端IP
/// </summary> /// </summary>
public string OperationIp { get; set; } public string ClientIp { get; set; }
/// <summary> /// <summary>
/// 获取/设置 备注 /// 获取/设置 客户端信息
/// </summary> /// </summary>
public string Remark { get; set; } public string ClientAgent { get; set; }
/// <summary> /// <summary>
/// 获取/设置 操作模块 /// 获取/设置 请求网址
/// </summary> /// </summary>
public string OperationModule { get; set; } public string RequestUrl { get; set; }
} }
} }

View File

@ -35,12 +35,12 @@ namespace Bootstrap.DataAccess
Logs.Add(new Log() Logs.Add(new Log()
{ {
ID = (int)reader[0], ID = (int)reader[0],
OperationType = (int)reader[1], CRUD = (string)reader[1],
UserName = (string)reader[2], UserName = (string)reader[2],
OperationTime = (DateTime)reader[3], LogTime = (DateTime)reader[3],
OperationIp = (string)reader[4], ClientIp = (string)reader[4],
Remark = (string)reader[5], ClientAgent = (string)reader[5],
OperationModule = (string)reader[6] RequestUrl = (string)reader[6]
}); });
} }
} }
@ -84,17 +84,16 @@ namespace Bootstrap.DataAccess
{ {
if (p == null) throw new ArgumentNullException("p"); if (p == null) throw new ArgumentNullException("p");
bool ret = false; bool ret = false;
string sql = "Insert Into Logs (OperationType, UserName,OperationTime,OperationIp,Remark,OperationModule) Values (@OperationType, @UserName,@OperationTime,@OperationIp,@Remark,@OperationModule)"; string sql = "Insert Into Logs (CRUD, UserName, LogTime, ClientIp, ClientAgent, RequestUrl) Values (@CRUD, @UserName, GetDate(), @ClientIp, @ClientAgent, @RequestUrl)";
try try
{ {
using (DbCommand cmd = DBAccessManager.SqlDBAccess.CreateCommand(CommandType.Text, sql)) using (DbCommand cmd = DBAccessManager.SqlDBAccess.CreateCommand(CommandType.Text, sql))
{ {
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@OperationType", p.OperationType, ParameterDirection.Input)); cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@CRUD", p.CRUD, ParameterDirection.Input));
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@UserName", p.UserName, ParameterDirection.Input)); cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@UserName", p.UserName, ParameterDirection.Input));
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@OperationTime", p.OperationTime, ParameterDirection.Input)); cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@ClientIp", p.ClientIp, ParameterDirection.Input));
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@OperationIp", p.OperationIp == null ? "" : p.OperationIp, ParameterDirection.Input)); cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@ClientAgent", p.ClientAgent, ParameterDirection.Input));
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@Remark", p.Remark == null ? "" : p.Remark, ParameterDirection.Input)); cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@RequestUrl", p.RequestUrl, ParameterDirection.Input));
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@OperationModule", p.OperationModule == null ? "" : p.OperationModule, ParameterDirection.Input));
DBAccessManager.SqlDBAccess.ExecuteNonQuery(cmd); DBAccessManager.SqlDBAccess.ExecuteNonQuery(cmd);
} }
CacheCleanUtility.ClearCache(logIds: p.ID == 0 ? "" : p.ID.ToString()); CacheCleanUtility.ClearCache(logIds: p.ID == 0 ? "" : p.ID.ToString());
@ -106,21 +105,5 @@ namespace Bootstrap.DataAccess
} }
return ret; return ret;
} }
/// <summary>
/// 获取客户端IP地址
/// </summary>
/// <returns></returns>
public static string GetClientIp()
{
HttpRequest request = HttpContext.Current.Request;
string result = request.ServerVariables["HTTP_X_FORWARDED_FOR"];
if (string.IsNullOrEmpty(result))
result = request.ServerVariables["REMOTE_ADDR"];
if (string.IsNullOrEmpty(result))
result = request.UserHostAddress;
if (string.IsNullOrEmpty(result))
result = "0.0.0.0";
return result;
}
} }
} }

View File

@ -36,11 +36,6 @@ EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'密码盐' , @
GO GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'显示名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Users', @level2type=N'COLUMN',@level2name=N'DisplayName' EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'显示名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Users', @level2type=N'COLUMN',@level2name=N'DisplayName'
GO GO
/* added by argo the default password is 123789 */
insert into Users (UserName, Password, PassSalt, DisplayName) values ('Admin', 'Es7WVgNsJuELwWK8daCqufUBknCsSC0IYDphQZAiGOo=', 'W5vpBEOYRGHkQXatN0t+ECM/U8cHDuEgrq56+zZBk4J481xH', 'Administrator')
GO
/****** Object: Table [dbo].[Groups] Script Date: 10/22/2016 09:44:03 ******/ /****** Object: Table [dbo].[Groups] Script Date: 10/22/2016 09:44:03 ******/
SET ANSI_NULLS ON SET ANSI_NULLS ON
GO GO
@ -180,33 +175,39 @@ EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'字典代码'
GO GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'0表示系统使用1表示自定义' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Dicts', @level2type=N'COLUMN',@level2name=N'Define' EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'0表示系统使用1表示自定义' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Dicts', @level2type=N'COLUMN',@level2name=N'Define'
GO GO
/****** Object: Table [dbo].[Logs] Script Date: 11/05/2016 14:17:40 ******/
/****** Object: Table [dbo].[Logs] Script Date: 11/04/2016 15:13:04 ******/
SET ANSI_NULLS ON SET ANSI_NULLS ON
GO GO
SET QUOTED_IDENTIFIER ON SET QUOTED_IDENTIFIER ON
GO GO
SET ANSI_PADDING ON SET ANSI_PADDING ON
GO GO
CREATE TABLE [dbo].[Logs]( CREATE TABLE [dbo].[Logs](
[ID] [int] IDENTITY(1,1) NOT NULL, [ID] [int] IDENTITY(1,1) NOT NULL,
[OperationType] [int] NOT NULL, [CRUD] [varchar](50) NOT NULL,
[UserName] [varchar](50) NOT NULL, [UserName] [varchar](50) NOT NULL,
[OperationTime] [datetime] NOT NULL, [LogTime] [datetime] NOT NULL,
[OperationIp] [nvarchar](50) NULL, [ClientIp] [varchar](15) NOT NULL,
[Remark] [nvarchar](500) NULL, [ClientAgent] [nvarchar](500) NOT NULL,
[OperationModule] [varchar](50) NULL, [RequestUrl] [nvarchar](500) NOT NULL,
CONSTRAINT [PK_Logs] PRIMARY KEY CLUSTERED CONSTRAINT [PK_Logs] PRIMARY KEY CLUSTERED
( (
[ID] ASC [ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] ) ON [PRIMARY]
GO GO
SET ANSI_PADDING OFF SET ANSI_PADDING OFF
GO GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Logs', @level2type=N'COLUMN',@level2name=N'ID' EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Logs', @level2type=N'COLUMN',@level2name=N'ID'
GO GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Logs', @level2type=N'COLUMN',@level2name=N'OperationType'
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Logs', @level2type=N'COLUMN',@level2name=N'CURD'
GO GO
/****** Object: Table [dbo].[Navigations] ******/ /****** Object: Table [dbo].[Navigations] ******/
CREATE TABLE [dbo].[Navigations]( CREATE TABLE [dbo].[Navigations](