Learn extjs5 with me (28 -- add module and menu Definition [1 create database and table]), extjs528 --

Source: Internet
Author: User

Learn extjs5 with me (28 -- add module and menu Definition [1 create database and table]), extjs528 --
Join me to learn about extjs5 (28 -- add module and menu Definition [1 create database and table]). Next we start to design the custom system and build various components. First, create a database in SQL server. Here, the data name is defined as extjs5, and then the module definition table needs to be created, which stores the definition information of all modules in the system. In order to have an intuitive interaction between the frontend and backend, add the module and menu to organize the menu data and send it to the foreground for display.
Because many modules in the system need to be classified, we need to design a "module grouping" table first. For menus, we also need a "menu grouping" table.

  • Module grouping table: _ ModuleGroup
  • Module table: _ Module
  • Menu group table: _ MenuGroup
  • Module menu definition table: _ MenuModule
I. Table creation in Databases
Shows the relationship between the four tables:
The following statements are used to create a table:
CREATE TABLE [dbo].[_ModuleGroup]([tf_moduleGroupId] [nvarchar](10) COLLATE Chinese_PRC_CI_AS NOT NULL,[tf_title] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NOT NULL,[tf_description] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL,[tf_iconURL] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL,[tf_remark] [nvarchar](max) COLLATE Chinese_PRC_CI_AS NULL, CONSTRAINT [PK___ModuleGroup__08EA5793] PRIMARY KEY CLUSTERED ([tf_moduleGroupId] ASC)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY], CONSTRAINT [_ModuleGroup_ix1] UNIQUE NONCLUSTERED ([tf_title] ASC)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]) ON [PRIMARY]

CREATE TABLE [dbo].[_Module]([tf_moduleId] [nvarchar](10) COLLATE Chinese_PRC_CI_AS NOT NULL,[tf_moduleGroupId] [nvarchar](10) COLLATE Chinese_PRC_CI_AS NOT NULL,[tf_moduleName] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NOT NULL,[tf_title] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NOT NULL,[tf_description] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL,[tf_requestMapping] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NOT NULL,[tf_iconURL] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL,[tf_shortname] [nvarchar](20) COLLATE Chinese_PRC_CI_AS NULL,[tf_englishname] [nvarchar](20) COLLATE Chinese_PRC_CI_AS NULL,[tf_tableName] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL,[tf_primaryKey] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NOT NULL,[tf_nameFields] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NOT NULL,[tf_titleTpl] [nvarchar](200) COLLATE Chinese_PRC_CI_AS NULL,[tf_codeField] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL,[tf_orderField] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL,[tf_dateField] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL,[tf_yearField] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL,[tf_monthField] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL,[tf_seasonField] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL,[tf_fileField] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL,[tf_homepageTag] [int] NULL,[tf_isEnable] [bit] NOT NULL,[tf_hasBrowse] [bit] NOT NULL,[tf_hasInsert] [bit] NOT NULL,[tf_hasEdit] [bit] NOT NULL,[tf_hasDelete] [bit] NOT NULL,[tf_hasExec] [bit] NOT NULL,[tf_hasAuditing] [bit] NOT NULL,[tf_hasApprove] [bit] NOT NULL,[tf_hasPayment] [bit] NOT NULL,[tf_hasAddition] [bit] NOT NULL,[tf_isInlineOper] [bit] NULL CONSTRAINT [DF___Module__tf_isIn__1ED998B2]  DEFAULT ((0)),[tf_allowInsertExcel] [bit] NOT NULL,[tf_allowEditExcel] [bit] NOT NULL,[tf_defaultOrderField] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL,[tf_codeLevel] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL,[tf_linkedModule] [nvarchar](200) COLLATE Chinese_PRC_CI_AS NULL,[tf_hasChart] [bit] NOT NULL,[tf_canLimit] [bit] NOT NULL,[tf_isSystem] [bit] NOT NULL,[tf_searchCondOrder] [int] NULL,[tf_remark] [nvarchar](max) COLLATE Chinese_PRC_CI_AS NULL, CONSTRAINT [PK___Module__1BFD2C07] PRIMARY KEY CLUSTERED ([tf_moduleId] ASC)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY], CONSTRAINT [_Module_ix1] UNIQUE NONCLUSTERED ([tf_moduleName] ASC)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY], CONSTRAINT [_Module_ix2] UNIQUE NONCLUSTERED ([tf_title] ASC)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]) ON [PRIMARY]GOUSE [extjs5]GOALTER TABLE [dbo].[_Module]  WITH CHECK ADD  CONSTRAINT [_Module_fk1] FOREIGN KEY([tf_moduleGroupId])REFERENCES [dbo].[_ModuleGroup] ([tf_moduleGroupId])ON UPDATE CASCADE



CREATE TABLE [dbo].[_MenuGroup]([tf_menuGroupId] [nvarchar](10) COLLATE Chinese_PRC_CI_AS NOT NULL,[tf_title] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NOT NULL,[tf_description] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL,[tf_glyph] [nvarchar](10) COLLATE Chinese_PRC_CI_AS NULL,[tf_iconURL] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL,[tf_remark] [nvarchar](max) COLLATE Chinese_PRC_CI_AS NULL,[tf_expand] [bit] NULL, CONSTRAINT [PK___MenuGroup__1920BF5C] PRIMARY KEY CLUSTERED ([tf_menuGroupId] ASC)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY], CONSTRAINT [_MenuGroup_ix1] UNIQUE NONCLUSTERED ([tf_title] ASC)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]) ON [PRIMARY]

CREATE TABLE [dbo].[_MenuModule]([tf_menuModuleId] [int] NOT NULL,[tf_menuGroupId] [nvarchar](10) COLLATE Chinese_PRC_CI_AS NOT NULL,[tf_moduleId] [nvarchar](10) COLLATE Chinese_PRC_CI_AS NOT NULL,[tf_orderId] [int] NULL,[tf_addSeparator] [bit] NULL,[tf_parentMenu] [nvarchar](20) COLLATE Chinese_PRC_CI_AS NULL,[tf_title] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL,[tf_parentFilter] [nvarchar](max) COLLATE Chinese_PRC_CI_AS NULL, CONSTRAINT [PK___MenuModule__2C3393D0] PRIMARY KEY CLUSTERED ([tf_menuModuleId] ASC)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]) ON [PRIMARY]GOUSE [extjs5]GOALTER TABLE [dbo].[_MenuModule]  WITH CHECK ADD  CONSTRAINT [_MenuModule_fk1] FOREIGN KEY([tf_menuGroupId])REFERENCES [dbo].[_MenuGroup] ([tf_menuGroupId])ON UPDATE CASCADEGOALTER TABLE [dbo].[_MenuModule]  WITH CHECK ADD  CONSTRAINT [_MenuModule_fk2] FOREIGN KEY([tf_moduleId])REFERENCES [dbo].[_Module] ([tf_moduleId])ON UPDATE CASCADE

Add some data after creating the table:









The database and source code will be downloaded at the end of a stage.


1. Use SQL to create a database and create three tables. The entity integrity and reference integrity of the table must be indicated.

No code is required. Set it directly in the database.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.