From 38e2628b15d7f388550cfc2bc19911b87bdf6f8a Mon Sep 17 00:00:00 2001 From: yubaolee Date: Fri, 1 Apr 2016 17:12:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0mysql=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OpenAuth.Domain/Interface/IRepository.cs | 15 +- OpenAuth.Mvc/OpenAuth.Mvc.csproj | 8 + OpenAuth.Mvc/Web.config | 11 +- OpenAuth.Mvc/packages.config | 4 +- OpenAuth.Repository/BaseRepository.cs | 181 ++++++---- mysql建表&初始化数据.txt | 425 +++++++++++++++++++++++ 6 files changed, 562 insertions(+), 82 deletions(-) create mode 100644 mysql建表&初始化数据.txt diff --git a/OpenAuth.Domain/Interface/IRepository.cs b/OpenAuth.Domain/Interface/IRepository.cs index b4dd76fd..957128c9 100644 --- a/OpenAuth.Domain/Interface/IRepository.cs +++ b/OpenAuth.Domain/Interface/IRepository.cs @@ -21,7 +21,7 @@ namespace OpenAuth.Domain.Interface public interface IRepository where T : class { T FindSingle(Expression> exp = null); - + bool IsExist(Expression> exp); IQueryable Find(Expression> exp = null); IQueryable Find(int pageindex = 1, int pagesize = 10, string orderby = "", @@ -31,6 +31,8 @@ namespace OpenAuth.Domain.Interface void Add(T entity); + void BatchAdd(T[] entities); + /// /// 更新一个实体的所有属性 /// @@ -39,10 +41,17 @@ namespace OpenAuth.Domain.Interface void Delete(T entity); /// - /// 批量更新 + /// 按指定的ID进行批量更新 /// - void Update(Expression> exp, T entity); + void Update(Expression> identityExp, T entity); + /// + /// 实现按需要只更新部分更新 + /// 如:Update(u =>u.Id==1,u =>new User{Name="ok"}); + /// + /// 更新条件 + /// 更新后的实体 + void Update(Expression> where, Expression> entity); /// /// 批量删除 /// diff --git a/OpenAuth.Mvc/OpenAuth.Mvc.csproj b/OpenAuth.Mvc/OpenAuth.Mvc.csproj index feba44c9..aaaae519 100644 --- a/OpenAuth.Mvc/OpenAuth.Mvc.csproj +++ b/OpenAuth.Mvc/OpenAuth.Mvc.csproj @@ -60,6 +60,14 @@ ..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll + + ..\packages\MySql.Data.6.9.8\lib\net45\MySql.Data.dll + True + + + ..\packages\MySql.Data.Entity.6.9.8\lib\net45\MySql.Data.Entity.EF6.dll + True + False ..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll diff --git a/OpenAuth.Mvc/Web.config b/OpenAuth.Mvc/Web.config index 4484e6ee..6fa7d0a3 100644 --- a/OpenAuth.Mvc/Web.config +++ b/OpenAuth.Mvc/Web.config @@ -15,6 +15,7 @@ + @@ -102,6 +103,12 @@ - + + - \ No newline at end of file + + + + + + \ No newline at end of file diff --git a/OpenAuth.Mvc/packages.config b/OpenAuth.Mvc/packages.config index c606f08c..2f69a9a4 100644 --- a/OpenAuth.Mvc/packages.config +++ b/OpenAuth.Mvc/packages.config @@ -17,9 +17,9 @@ - + + - \ No newline at end of file diff --git a/OpenAuth.Repository/BaseRepository.cs b/OpenAuth.Repository/BaseRepository.cs index efa65def..397d64b3 100644 --- a/OpenAuth.Repository/BaseRepository.cs +++ b/OpenAuth.Repository/BaseRepository.cs @@ -14,91 +14,122 @@ namespace OpenAuth.Repository { protected OpenAuthDBContext Context = new OpenAuthDBContext(); - /// - /// 根据过滤条件,获取记录 - /// - /// The exp. - public IQueryable Find(Expression> exp = null) - { - return Filter(exp); - } /// - /// 查找单个 - /// - public T FindSingle(Expression> exp) - { - return Context.Set().AsNoTracking().FirstOrDefault(exp); - } + /// 根据过滤条件,获取记录 + /// + /// The exp. + public IQueryable Find(Expression> exp = null) + { + return Filter(exp); + } - /// - /// 得到分页记录 - /// - /// The pageindex. - /// The pagesize. - /// 排序,格式如:"Id"/"Id descending" - public IQueryable Find(int pageindex, int pagesize, string orderby = "", Expression> exp = null) - { - if (pageindex < 1) pageindex = 1; - if (string.IsNullOrEmpty(orderby)) - orderby = "Id descending"; + public bool IsExist(Expression> exp) + { + return Context.Set().Any(exp); + } - return Filter(exp).OrderBy(orderby).Skip(pagesize * (pageindex - 1)).Take(pagesize); - } + /// + /// 查找单个 + /// + public T FindSingle(Expression> exp) + { + return Context.Set().AsNoTracking().FirstOrDefault(exp); + } - /// - /// 根据过滤条件获取记录数 - /// - public int GetCount(Expression> exp = null) - { - return Filter(exp).Count(); - } + /// + /// 得到分页记录 + /// + /// The pageindex. + /// The pagesize. + /// 排序,格式如:"Id"/"Id descending" + public IQueryable Find(int pageindex, int pagesize, string orderby = "", Expression> exp = null) + { + if (pageindex < 1) pageindex = 1; + if (string.IsNullOrEmpty(orderby)) + orderby = "Id descending"; - public void Add(T entity) - { - Context.Set().Add(entity); - Save(); - } + return Filter(exp).OrderBy(orderby).Skip(pagesize * (pageindex - 1)).Take(pagesize); + } - public void Update(T entity) - { - var entry = this.Context.Entry(entity); - //todo:如果状态没有任何更改,会报错 - entry.State = EntityState.Modified; + /// + /// 根据过滤条件获取记录数 + /// + public int GetCount(Expression> exp = null) + { + return Filter(exp).Count(); + } - Save(); - } - - public void Delete(T entity) - { - Context.Set().Remove(entity); - Save(); - } - - public void Update(Expression> identityExp, T entity) - { - //TODO: 暂时有问题,EntityFramework.Extension的Update必须有new操作 - // Context.Set().Where(exp).Update(u => entity); - Context.Set().AddOrUpdate(identityExp, entity); + public void Add(T entity) + { + Context.Set().Add(entity); Save(); - } + } - public void Delete(Expression> exp) - { - Context.Set().Where(exp).Delete(); - } + /// + /// 批量添加 + /// + /// The entities. + public void BatchAdd(T[] entities) + { + Context.Set().AddRange(entities); + Save(); + } - public void Save() - { - Context.SaveChanges(); - } + public void Update(T entity) + { + var entry = this.Context.Entry(entity); + //todo:如果状态没有任何更改,会报错 + entry.State = EntityState.Modified; - private IQueryable Filter(Expression> exp) - { - var dbSet = Context.Set().AsQueryable(); - if (exp != null) - dbSet = dbSet.Where(exp); - return dbSet; - } - } + Save(); + } + + public void Delete(T entity) + { + Context.Set().Remove(entity); + Save(); + } + + /// + /// 按指定id更新实体,会更新整个实体 + /// + /// The identity exp. + /// The entity. + public void Update(Expression> identityExp, T entity) + { + Context.Set().AddOrUpdate(identityExp, entity); + Save(); + } + + /// + /// 实现按需要只更新部分更新 + /// 如:Update(u =>u.Id==1,u =>new User{Name="ok"}); + /// + /// The where. + /// The entity. + public void Update(Expression> where, Expression> entity) + { + Context.Set().Where(where).Update(entity); + } + + public virtual void Delete(Expression> exp) + { + Context.Set().Where(exp).Delete(); + } + + public void Save() + { + Context.SaveChanges(); + } + + private IQueryable Filter(Expression> exp) + { + var dbSet = Context.Set().AsQueryable(); + if (exp != null) + dbSet = dbSet.Where(exp); + return dbSet; + } + + } } diff --git a/mysql建表&初始化数据.txt b/mysql建表&初始化数据.txt new file mode 100644 index 00000000..9256392b --- /dev/null +++ b/mysql建表&初始化数据.txt @@ -0,0 +1,425 @@ +/*==============================================================*/ +/* DBMS name: MySQL 5.0 */ +/* Created on: 2016-04-01 15:24:06 */ +/*==============================================================*/ + + +drop table if exists Category; + +drop table if exists DicDetail; + +drop table if exists DicIndex; + +drop table if exists Module; + +drop table if exists ModuleElement; + +drop table if exists Org; + +drop table if exists Param; + +drop table if exists Relevance; + +drop table if exists Resource; + +drop table if exists Role; + +drop table if exists Stock; + +drop table if exists User; + +drop table if exists UserCfg; + +drop table if exists UserExt; + +/*==============================================================*/ +/* Table: Category */ +/*==============================================================*/ +create table Category +( + Id int not null auto_increment comment '分类表ID', + CascadeId varchar(255) not null default ' ' comment '节点语义ID', + Name varchar(255) not null default ' ' comment '名称', + ParentId int not null default 0 comment '父节点流水号', + Status int not null default 1 comment '当前状态', + SortNo int not null default 0 comment '排序号', + RootKey varchar(100) not null default ' ' comment '分类所属科目', + RootName varchar(200) not null default ' ' comment '分类所属科目名称', + primary key (Id) +) DEFAULT CHARSET=utf8; + +alter table Category comment '分类表'; + +/*==============================================================*/ +/* Table: DicDetail */ +/*==============================================================*/ +create table DicDetail +( + Id int not null auto_increment comment 'ID', + Value varchar(100) not null default ' ' comment '值', + Text varchar(100) not null default '0' comment '文本描述', + DicId int not null default 0 comment '所属字典ID', + SortNo int not null default 0 comment '排序号', + Status int not null default 0 comment '状态', + Description varchar(100) not null default ' ' comment '描述', + primary key (Id) +) DEFAULT CHARSET=utf8; + +alter table DicDetail comment '数据字典详情'; + +/*==============================================================*/ +/* Table: DicIndex */ +/*==============================================================*/ +create table DicIndex +( + Id int not null auto_increment comment '数据字典ID', + Name varchar(255) not null default ' ' comment '名称', + `Key` varchar(100) not null default ' ' comment '英文标识', + SortNo int not null default 0 comment '排序号', + CategoryId int not null default 0 comment '所属分类', + Description varchar(200) not null default '0' comment '描述', + primary key (Id) +) DEFAULT CHARSET=utf8; + +alter table DicIndex comment '数据字典'; + +/*==============================================================*/ +/* Table: Module */ +/*==============================================================*/ +create table Module +( + Id int not null auto_increment comment '功能模块流水号', + CascadeId varchar(255) not null default ' ' comment '节点语义ID', + Name varchar(255) not null default ' ' comment '功能模块名称', + Url varchar(255) not null default ' ' comment '主页面URL', + HotKey varchar(255) not null default ' ' comment '热键', + ParentId int not null default 0 comment '父节点流水号', + IsLeaf bool not null default 1 comment '是否叶子节点', + IsAutoExpand bool not null default 0 comment '是否自动展开', + IconName varchar(255) not null default ' ' comment '节点图标文件名称', + Status int not null default 1 comment '当前状态', + ParentName varchar(255) not null default ' ' comment '父节点名称', + Vector varchar(255) not null default ' ' comment '矢量图标', + SortNo int not null default 0 comment '排序号', + primary key (Id) +) DEFAULT CHARSET=utf8; + +alter table Module comment '功能模块表'; + +/*==============================================================*/ +/* Table: ModuleElement */ +/*==============================================================*/ +create table ModuleElement +( + Id int not null auto_increment comment '流水号', + DomId varchar(255) not null default ' ' comment 'DOM ID', + Name varchar(255) not null default ' ' comment '名称', + Type varchar(50) not null default ' ' comment '类型', + ModuleId int not null default 0 comment '功能模块Id', + Attr varchar(500) not null default ' ' comment '元素附加属性', + Script varchar(500) not null default ' ' comment '元素调用脚本', + Icon varchar(255) not null default ' ' comment '元素图标', + Class varchar(255) not null default ' ' comment '元素样式', + Remark varchar(200) not null default ' ' comment '备注', + Sort int not null default 0 comment '排序字段', + primary key (Id) +) DEFAULT CHARSET=utf8; + +alter table ModuleElement comment '模块元素表(需要权限控制的按钮)'; + +/*==============================================================*/ +/* Table: Org */ +/*==============================================================*/ +create table Org +( + Id int not null auto_increment comment '流水号', + CascadeId varchar(255) not null default ' ' comment '节点语义ID', + Name varchar(255) not null default ' ' comment '组织名称', + HotKey varchar(255) not null default ' ' comment '热键', + ParentId int not null default 0 comment '父节点流水号', + ParentName varchar(255) not null default ' ' comment '父节点名称', + IsLeaf bool not null default 1 comment '是否叶子节点', + IsAutoExpand bool not null default 0 comment '是否自动展开', + IconName varchar(255) not null default ' ' comment '节点图标文件名称', + Status int not null default 1 comment '当前状态', + Type int not null default 0 comment '组织类型', + BizCode varchar(255) not null default ' ' comment '业务对照码', + CustomCode varchar(4000) not null default ' ' comment '自定义扩展码', + CreateTime datetime not null default '2016-4-1' comment '创建时间', + CreateId int not null default 0 comment '创建人ID', + SortNo int not null default 0 comment '排序号', + primary key (Id) +) DEFAULT CHARSET=utf8; + +alter table Org comment '组织表'; + +/*==============================================================*/ +/* Table: Param */ +/*==============================================================*/ +create table Param +( + Id int not null auto_increment comment 'ID', + Value varchar(100) not null default ' ' comment '值', + `Key` varchar(100) not null default ' ' comment '键', + CategoryId int not null default 0 comment '所属分类', + SortNo int not null default 0 comment '排序号', + Status int not null default 0 comment '状态', + Description varchar(100) not null default ' ' comment '描述', + primary key (Id) +) DEFAULT CHARSET=utf8; + +alter table Param comment '键值参数'; + +/*==============================================================*/ +/* Table: Relevance */ +/*==============================================================*/ +create table Relevance +( + Id int not null auto_increment comment '流水号', + FirstId int not null default 0 comment '第一个表主键ID', + SecondId int not null default 0 comment '第二个表主键ID', + Description varchar(100) not null default ' ' comment '描述', + `Key` varchar(100) not null default ' ' comment '映射标识', + Status int not null default 0 comment '状态', + OperateTime datetime not null default '2016-4-1' comment '授权时间', + OperatorId int not null default 0 comment '授权人', + primary key (Id) +) DEFAULT CHARSET=utf8; + +alter table Relevance comment '多对多关系集中映射'; + +/*==============================================================*/ +/* Table: Resource */ +/*==============================================================*/ +create table Resource +( + Id int not null auto_increment comment '资源表ID', + CascadeId varchar(255) not null default ' ' comment '节点语义ID', + `Key` varchar(200) not null default ' ' comment '资源英文唯一标识', + Name varchar(255) not null default ' ' comment '名称', + ParentId int not null default 0 comment '父节点流水号', + Status int not null default 1 comment '当前状态', + SortNo int not null default 0 comment '排序号', + CategoryId int not null default 0 comment '资源分类', + Description varchar(500) not null default ' ' comment '描述', + primary key (Id) +) DEFAULT CHARSET=utf8; + +alter table Resource comment '资源表'; + +/*==============================================================*/ +/* Table: Role */ +/*==============================================================*/ +create table Role +( + Id int not null auto_increment comment '流水号', + Name varchar(255) not null default ' ' comment '角色名称', + Status int not null default 1 comment '当前状态', + Type int not null default 0 comment '角色类型', + CreateTime datetime not null default '2016-4-1' comment '创建时间', + CreateId varchar(64) not null default ' ' comment '创建人ID', + OrgId int not null default 0 comment '所属部门流水号', + OrgCascadeId varchar(255) not null default ' ' comment '所属部门节点语义ID', + OrgName varchar(255) not null default ' ' comment '所属部门名称', + primary key (Id) +) DEFAULT CHARSET=utf8; + +alter table Role comment '角色表'; + +/*==============================================================*/ +/* Table: Stock */ +/*==============================================================*/ +create table Stock +( + Id int not null auto_increment comment '数据ID', + Name varchar(500) not null default ' ' comment '产品名称', + Number int not null default 0 comment '产品数量', + Price decimal(10,1) not null default 0 comment '产品单价', + Status int not null default 0 comment '出库/入库', + User varchar(50) not null default ' ' comment '操作人', + Time datetime not null default '2016-4-1' comment '操作时间', + OrgId int not null default 0 comment '组织ID', + primary key (Id) +) DEFAULT CHARSET=utf8; + +alter table Stock comment '出入库信息表'; + +/*==============================================================*/ +/* Table: User */ +/*==============================================================*/ +create table User +( + Id int not null auto_increment comment '流水号', + Account varchar(255) not null default ' ' comment '用户登录帐号', + Password varchar(255) not null default ' ' comment '密码', + Name varchar(255) not null default ' ' comment '用户姓名', + Sex int not null default 0 comment '性别', + Status int not null default 0 comment '用户状态', + Type int not null default 0 comment '用户类型', + BizCode varchar(255) not null default ' ' comment '业务对照码', + CreateTime datetime not null default '2016-4-1' comment '经办时间', + CreateId int not null default 0 comment '经办人流水号', + primary key (Id) +) DEFAULT CHARSET=utf8; + +alter table User comment '用户基本信息表'; + +/*==============================================================*/ +/* Table: UserCfg */ +/*==============================================================*/ +create table UserCfg +( + Id int not null default 0 comment '用户ID', + Theme varchar(255) not null default ' ' comment '用户界面主题', + Skin varchar(255) not null default ' ' comment '用户界面皮肤', + NavBarStyle varchar(255) not null default ' ' comment '导航条按钮风格', + TabFocusColor varchar(255) not null default ' ' comment 'Tab高亮颜色', + NavTabIndex int not null default 0 comment '导航缺省活动页', + primary key (Id) +) DEFAULT CHARSET=utf8; + +alter table UserCfg comment '用户配置表'; + +/*==============================================================*/ +/* Table: UserExt */ +/*==============================================================*/ +create table UserExt +( + Id int not null comment '用户ID', + Email varchar(255) not null default ' ' comment '电子邮件', + Phone_ varchar(255) not null default ' ' comment '固定电话', + Mobile varchar(255) not null default ' ' comment '移动电话', + Address varchar(255) not null default ' ' comment '联系地址', + Zip varchar(255) not null default ' ' comment '邮编', + Birthday varchar(255) not null default ' ' comment '生日', + IdCard varchar(255) not null default ' ' comment '身份证号', + QQ varchar(255) not null default ' ' comment 'QQ', + DynamicField varchar(4000) not null default ' ' comment '动态扩展字段', + ByteArrayId int not null default 0 comment '用户头像流文件ID', + Remark varchar(4000) not null default ' ' comment '备注', + Field1 varchar(255) not null default ' ' comment '静态扩展字段1', + Field2 varchar(255) not null default ' ' comment '静态扩展字段2', + Field3 varchar(255) not null default ' ' comment '静态扩展字段3', + primary key (Id) +) DEFAULT CHARSET=utf8; + +alter table UserExt comment '用户扩展信息表'; + +INSERT INTO `module` VALUES ('1', '0.1.1', '模块管理', 'ModuleManager/Index', ' ', '2', '1', '0', ' ', '1', ' ', ' ', '0'); +INSERT INTO `module` VALUES ('2', '0.1', '基础配置', ' ', ' ', '0', '1', '0', ' ', '1', ' ', ' ', '0'); +INSERT INTO `module` VALUES ('4', '0.1.3', '部门管理', 'OrgManager/Index', '', '2', '0', '0', '', '0', '基础配置', '', '0'); +INSERT INTO `module` VALUES ('5', '0.1.4', '角色管理', 'RoleManager/Index', '', '2', '0', '0', '', '0', '基础配置', '', '0'); +INSERT INTO `module` VALUES ('6', '0.2', '应用功能', '/', '', '0', '0', '0', '', '0', '根节点', '', '0'); +INSERT INTO `module` VALUES ('7', '0.2.1', '进出库管理', 'StockManager/Index', '', '6', '0', '0', '', '0', '应用功能', '', '0'); +INSERT INTO `module` VALUES ('8', '0.1.5', '分类管理', 'CategoryManager/Index', '', '2', '0', '0', '', '0', '基础配置', '', '0'); +INSERT INTO `module` VALUES ('9', '0.1.2', '用户管理', 'UserManager/Index', '', '2', '0', '0', '', '0', '基础配置', '', '0'); +INSERT INTO `module` VALUES ('10', '0.1.6', '资源管理', 'ResourceManager/Index', '', '2', '0', '0', '', '0', '基础配置', '', '0'); + +INSERT INTO `moduleelement` VALUES ('2', 'btnAdd', '添加', 'a', '3', 'href=\'/UserManager/Add/\' data-toggle=\'dialog\' data-id=\'dialog-mask\' data-mask=\'true\' data-on-close=\'refreshGrid\'', 'javascript:;', 'plus', 'btn btn-green ', '', '0'); +INSERT INTO `moduleelement` VALUES ('3', 'btnEdit', '编辑', 'button', '3', '', 'editUser()', 'pencil', 'btn-green', '', '0'); +INSERT INTO `moduleelement` VALUES ('4', 'btnAccessModule', '为用户分配模块', 'button', '3', '', 'openUserModuleAccess(this)', 'pencil', 'btn-green', '', '0'); +INSERT INTO `moduleelement` VALUES ('5', 'btnAccessRole', '为用户分配角色', 'button', '3', '', 'openUserRoleAccess(this)', 'pencil', 'btn-green ', '', '0'); +INSERT INTO `moduleelement` VALUES ('6', 'btnRefresh', '刷新', 'button', '3', '', 'refreshUserGrid()', 'refresh', 'btn-green', '', '0'); +INSERT INTO `moduleelement` VALUES ('7', 'btnDel', '删除', 'button', '3', '', 'delUser()', 'pencil', 'btn-red ', '', '0'); +INSERT INTO `moduleelement` VALUES ('10', 'btnRefresh', '刷新', 'button', '4', '', 'refreshOrgGrid()', 'refresh', 'btn-green', '', '0'); +INSERT INTO `moduleelement` VALUES ('11', 'btnAdd', '添加', 'a', '4', 'href=\'/OrgManager/AddOrg/\' data-toggle=\'dialog\' data-id=\'dialog-mask\' data-mask=\'true\' data-on-close=\'refreshGrid\'', 'javascript:;', 'plus', 'btn btn-green', '', '0'); +INSERT INTO `moduleelement` VALUES ('12', 'btnDel', '删除', 'button', '4', '', 'delOrg()', 'del', 'btn-red', '', '0'); +INSERT INTO `moduleelement` VALUES ('19', 'btnAdd', '添加', 'a', '5', 'href=\'/RoleManager/Add/\' data-toggle=\'dialog\' data-id=\'dialog-mask\' data-mask=\'true\' data-on-close=\'refreshGrid\'', 'javascript:;', 'plus', 'btn btn-green ', '', '0'); +INSERT INTO `moduleelement` VALUES ('20', 'btnEdit', '编辑', 'button', '5', '', 'editRole()', 'pencil', 'btn-green', '', '0'); +INSERT INTO `moduleelement` VALUES ('21', 'btnAccessModule', '为角色分配模块', 'button', '5', '', 'assignRoleModule(this)', 'pencil', 'btn-green', '', '0'); +INSERT INTO `moduleelement` VALUES ('23', 'btnRefresh', '刷新', 'button', '5', '', 'refreshRoleGrid()', 'refresh', 'btn-green', '', '0'); +INSERT INTO `moduleelement` VALUES ('24', 'btnDel', '删除', 'button', '5', '', 'delRole()', 'pencil', 'btn-red ', '', '0'); +INSERT INTO `moduleelement` VALUES ('25', 'btnAdd', '添加', 'a', '1', 'href=\'/ModuleManager/Add/\' data-toggle=\'dialog\' data-id=\'dialog-mask\' data-mask=\'true\' data-on-close=\'refreshGrid\'', 'javascript:;', 'plus', 'btn btn-green ', '', '0'); +INSERT INTO `moduleelement` VALUES ('26', 'btnEdit', '编辑', 'button', '1', '', 'editModule()', 'pencil', 'btn-green', '', '0'); +INSERT INTO `moduleelement` VALUES ('27', 'btnAssign', '为模块分配按钮', 'button', '1', '', 'assignButton()', 'pencil', 'btn-green', '', '0'); +INSERT INTO `moduleelement` VALUES ('28', 'btnRefresh', '刷新', 'button', '1', '', 'refreshModuleGrid()', 'refresh', 'btn-green', '', '0'); +INSERT INTO `moduleelement` VALUES ('29', 'btnDel', '删除', 'button', '1', '', 'delModule()', 'pencil', 'btn-red ', '', '0'); +INSERT INTO `moduleelement` VALUES ('30', 'btnAssignElement', '为用户分配菜单', 'button', '3', '', 'openAssignUserElement(this)', 'pencil', 'btn-green', '', '0'); +INSERT INTO `moduleelement` VALUES ('31', 'btnAssignElement', '为角色分配菜单', 'button', '5', '', 'assignRoleElement(this)', 'pencil', 'btn-green', '', '0'); +INSERT INTO `moduleelement` VALUES ('32', 'btnAdd', '添加', 'a', '8', 'href=\'/CategoryManager/Add/\' data-toggle=\'dialog\' data-id=\'dialog-mask\' data-mask=\'true\' data-on-close=\'refreshGrid\'', '', 'plus', 'btn btn-green', '', '0'); +INSERT INTO `moduleelement` VALUES ('33', 'btnDel', '删除', 'button', '8', ' ', 'delCategory()', 'pencil', 'btn-red', '', '0'); +INSERT INTO `moduleelement` VALUES ('34', 'btnEdit', '编辑', 'button', '8', ' ', 'editCategory()', 'pencil', 'btn-green', '', '0'); +INSERT INTO `moduleelement` VALUES ('35', 'btnAdd', '添加', 'a', '9', 'href=\'/UserManager/Add/\' data-toggle=\'dialog\' data-id=\'dialog-mask\' data-mask=\'true\' data-on-close=\'refreshGrid\'', 'javascript:;', 'plus', 'btn btn-green ', '', '0'); +INSERT INTO `moduleelement` VALUES ('36', 'btnEdit', '编辑', 'button', '9', ' ', 'editUser()', 'pencil', 'btn-green', '', '0'); +INSERT INTO `moduleelement` VALUES ('37', 'btnAccessModule', '为用户分配模块', 'button', '9', ' ', 'openUserModuleAccess(this)', 'pencil', 'btn-green', '', '0'); +INSERT INTO `moduleelement` VALUES ('38', 'btnAccessRole', '为用户分配角色', 'button', '9', ' ', 'openUserRoleAccess(this)', 'pencil', 'btn-green ', '', '0'); +INSERT INTO `moduleelement` VALUES ('39', 'btnRefresh', '刷新', 'button', '9', ' ', 'refreshUserGrid()', 'refresh', 'btn-green', '', '0'); +INSERT INTO `moduleelement` VALUES ('40', 'btnDel', '删除', 'button', '9', ' ', 'delUser()', 'pencil', 'btn-red ', '', '0'); +INSERT INTO `moduleelement` VALUES ('41', 'btnAssignElement', '为用户分配菜单', 'button', '9', ' ', 'openAssignUserElement(this)', 'pencil', 'btn-green', '', '0'); +INSERT INTO `moduleelement` VALUES ('43', 'btnAdd', '添加', 'a', '10', 'href=\'/ResourceManager/Add/\' data-toggle=\'dialog\' data-id=\'dialog-mask\' data-mask=\'true\' data-on-close=\'refreshGrid\'', 'javascript:;', 'pencil', 'btn btn-green', '', '0'); +INSERT INTO `moduleelement` VALUES ('44', 'btnEdit', '编辑', 'button', '10', ' ', 'editResource()', 'pencil', 'btn-green', '', '0'); +INSERT INTO `moduleelement` VALUES ('45', 'btnDel', '删除', 'button', '10', ' ', 'delResource()', 'plus', 'btn-red', '', '0'); +INSERT INTO `moduleelement` VALUES ('46', 'btnAssignReource', '为用户分配资源', 'button', '9', ' ', 'openUserReourceAccess(this)', 'pencil', 'btn-green', '', '0'); +INSERT INTO `moduleelement` VALUES ('47', 'btnAssignRes', '为角色分配资源', 'button', '5', ' ', 'openRoleReourceAccess(this)', 'pencil', 'btn-green', '', '0'); +INSERT INTO `moduleelement` VALUES ('48', 'btnAddStock', '添加', 'a', '7', 'href=\'/StockManager/Add/\' data-toggle=\'dialog\' data-id=\'dialog-mask\' data-mask=\'true\' data-on-close=\'refreshGrid\'', 'javascript:;', 'pencil', 'btn btn-green', '', '0'); +INSERT INTO `moduleelement` VALUES ('50', 'btnDelStock', '删除', 'button', '7', ' ', 'delStock()', 'plus', 'btn-red', '', '0'); +INSERT INTO `moduleelement` VALUES ('51', 'btnEditStock', '编辑', 'button', '7', ' ', 'editStock()', 'pencil', 'btn-green', '', '0'); +INSERT INTO `moduleelement` VALUES ('52', 'btnAccessOrg', '为角色分配部门', 'button', '5', ' ', 'assignRoleOrg(this)', 'pencil', 'btn-green', '', '0'); +INSERT INTO `moduleelement` VALUES ('53', 'btnOpenUserOrgAccess', '为用户分配部门权限', 'button', '9', ' ', 'openUserOrgAccess(this)', 'pencil', 'btn-green', '', '0'); + + +INSERT INTO `org` VALUES ('1', '0.1', '集团总部', '', '0', '根节点', '0', '0', '', '0', '0', '', '', '2015-12-05 21:51:36', '0', '0'); +INSERT INTO `org` VALUES ('2', '0.1.1', '研发部', '', '1', '集团总部', '0', '0', '', '0', '0', '', '', '2015-12-29 17:03:45', '0', '0'); +INSERT INTO `org` VALUES ('3', '0.1.2', '生产部', '', '1', '集团总部', '0', '0', '', '0', '0', '', '', '2015-12-29 17:03:57', '0', '0'); +INSERT INTO `org` VALUES ('4', '0.1.2.1', '生产1组', '', '3', '生产部', '0', '0', '', '0', '0', '', '', '2015-12-29 17:04:44', '0', '0'); + +INSERT INTO `relevance` VALUES ('50', '21', '10', '', 'UserElement', '0', '2015-12-08 00:20:55', '0'); +INSERT INTO `relevance` VALUES ('51', '21', '11', '', 'UserElement', '0', '2015-12-08 00:20:55', '0'); +INSERT INTO `relevance` VALUES ('52', '1', '1', '', 'UserOrg', '0', '2015-12-19 16:46:25', '0'); +INSERT INTO `relevance` VALUES ('64', '1', '1', '', 'UserRole', '0', '2015-12-22 11:34:12', '0'); +INSERT INTO `relevance` VALUES ('65', '1', '2', '', 'UserRole', '0', '2015-12-22 11:34:12', '0'); +INSERT INTO `relevance` VALUES ('66', '1', '2', '', 'UserResource', '0', '2015-12-22 14:59:46', '0'); +INSERT INTO `relevance` VALUES ('67', '1', '3', '', 'UserResource', '0', '2015-12-22 14:59:49', '0'); +INSERT INTO `relevance` VALUES ('68', '1', '4', '', 'RoleResource', '0', '2015-12-22 15:00:17', '0'); +INSERT INTO `relevance` VALUES ('69', '2', '6', '', 'RoleModule', '0', '2015-12-29 17:06:32', '0'); +INSERT INTO `relevance` VALUES ('70', '2', '7', '', 'RoleModule', '0', '2015-12-29 17:06:32', '0'); +INSERT INTO `relevance` VALUES ('84', '1', '10', '', 'RoleElement', '0', '2015-12-29 17:11:30', '0'); +INSERT INTO `relevance` VALUES ('85', '1', '11', '', 'RoleElement', '0', '2015-12-29 17:11:30', '0'); +INSERT INTO `relevance` VALUES ('86', '1', '12', '', 'RoleElement', '0', '2015-12-29 17:11:30', '0'); +INSERT INTO `relevance` VALUES ('92', '2', '1', '', 'UserAccessedOrg', '0', '2016-01-07 11:19:46', '0'); +INSERT INTO `relevance` VALUES ('93', '2', '3', '', 'UserAccessedOrg', '0', '2016-01-07 11:19:46', '0'); +INSERT INTO `relevance` VALUES ('94', '2', '4', '', 'UserAccessedOrg', '0', '2016-01-07 11:19:46', '0'); +INSERT INTO `relevance` VALUES ('95', '1', '25', '', 'RoleElement', '0', '2016-01-07 16:14:00', '0'); +INSERT INTO `relevance` VALUES ('96', '1', '26', '', 'RoleElement', '0', '2016-01-07 16:14:00', '0'); +INSERT INTO `relevance` VALUES ('97', '1', '27', '', 'RoleElement', '0', '2016-01-07 16:14:00', '0'); +INSERT INTO `relevance` VALUES ('98', '1', '28', '', 'RoleElement', '0', '2016-01-07 16:14:00', '0'); +INSERT INTO `relevance` VALUES ('99', '1', '21', '', 'RoleElement', '0', '2016-01-07 16:14:09', '0'); +INSERT INTO `relevance` VALUES ('100', '1', '23', '', 'RoleElement', '0', '2016-01-07 16:14:09', '0'); +INSERT INTO `relevance` VALUES ('101', '1', '24', '', 'RoleElement', '0', '2016-01-07 16:14:09', '0'); +INSERT INTO `relevance` VALUES ('102', '2', '48', '', 'RoleElement', '0', '2016-01-08 10:27:59', '0'); +INSERT INTO `relevance` VALUES ('103', '2', '50', '', 'RoleElement', '0', '2016-01-08 10:27:59', '0'); +INSERT INTO `relevance` VALUES ('104', '2', '51', '', 'RoleElement', '0', '2016-01-08 10:27:59', '0'); +INSERT INTO `relevance` VALUES ('105', '2', '1', '', 'RoleAccessedOrg', '0', '2016-01-08 10:28:10', '0'); +INSERT INTO `relevance` VALUES ('106', '2', '3', '', 'RoleAccessedOrg', '0', '2016-01-08 10:28:10', '0'); +INSERT INTO `relevance` VALUES ('107', '2', '4', '', 'RoleAccessedOrg', '0', '2016-01-08 10:28:10', '0'); +INSERT INTO `relevance` VALUES ('109', '5', '3', '', 'UserOrg', '0', '2016-01-08 10:30:50', '0'); +INSERT INTO `relevance` VALUES ('110', '5', '2', '', 'UserRole', '0', '2016-01-08 10:31:06', '0'); +INSERT INTO `relevance` VALUES ('111', '1', '6', '', 'UserModule', '0', '2016-03-17 15:27:08', '0'); +INSERT INTO `relevance` VALUES ('112', '1', '7', '', 'UserModule', '0', '2016-03-17 15:27:09', '0'); +INSERT INTO `relevance` VALUES ('114', '5', '48', '', 'UserElement', '0', '2016-03-17 15:28:03', '0'); +INSERT INTO `relevance` VALUES ('121', '5', '2', '', 'UserModule', '0', '2016-03-17 15:29:22', '0'); +INSERT INTO `relevance` VALUES ('122', '5', '10', '', 'UserModule', '0', '2016-03-17 15:29:22', '0'); +INSERT INTO `relevance` VALUES ('125', '1', '2', '', 'RoleModule', '0', '2016-03-17 16:17:09', '0'); +INSERT INTO `relevance` VALUES ('126', '1', '1', '', 'RoleModule', '0', '2016-03-17 16:17:09', '0'); +INSERT INTO `relevance` VALUES ('127', '1', '4', '', 'RoleModule', '0', '2016-03-17 16:17:09', '0'); +INSERT INTO `relevance` VALUES ('128', '1', '5', '', 'RoleModule', '0', '2016-03-17 16:17:09', '0'); +INSERT INTO `relevance` VALUES ('129', '1', '8', '', 'RoleModule', '0', '2016-03-17 16:17:09', '0'); +INSERT INTO `relevance` VALUES ('130', '1', '9', '', 'RoleModule', '0', '2016-03-17 16:17:09', '0'); +INSERT INTO `relevance` VALUES ('131', '1', '10', '', 'RoleModule', '0', '2016-03-17 16:17:09', '0'); +INSERT INTO `relevance` VALUES ('132', '1', '6', '', 'RoleModule', '0', '2016-03-17 16:17:09', '0'); +INSERT INTO `relevance` VALUES ('133', '1', '7', '', 'RoleModule', '0', '2016-03-17 16:17:09', '0'); + + +INSERT INTO `resource` VALUES ('2', '', 'REPORT_NAME', '报表名称', '0', '0', '0', '7', '报表名称'); +INSERT INTO `resource` VALUES ('3', '', 'REPORT_1', '报表1月数据', '0', '0', '0', '7', '报表1月数据'); +INSERT INTO `resource` VALUES ('4', '', 'REPORT_2', '报表2月数据', '0', '0', '0', '7', '报表1月数据'); + + +INSERT INTO `role` VALUES ('1', '管理员', '0', '0', '2015-12-05 22:26:57', '', '1', '0.1', '集团总部'); +INSERT INTO `role` VALUES ('2', '测试主管', '0', '1', '2015-12-19 23:00:26', '', '4', '0.1.2.1', '生产1组'); + +INSERT INTO `stock` VALUES ('2', '权限管理软件一套', '1', '10000.0', '0', 'System', '2016-01-08 09:15:24', '2'); +INSERT INTO `stock` VALUES ('3', '高级权限管理', '1', '100000.0', '0', 'System', '2016-01-08 09:15:49', '4'); + +INSERT INTO `user` VALUES ('1', 'admin', 'admin', '管理员', '0', '0', '0', '', '2015-12-19 16:46:25', '0'); +INSERT INTO `user` VALUES ('5', 'test', 'test', 'test', '0', '0', '0', '', '2016-01-08 10:30:50', '0'); \ No newline at end of file