Learn extjs5 with me (34 -- Design of a single module [2 create a form table bean])

Source: Internet
Author: User
Tags table definition

Learn extjs5 with me (34 -- Design of a single module [2 create a form table bean])
Join me in extjs5 (34 -- Design of a single module [2 create a form table and bean]) to create a form scheme table:

CREATE TABLE [dbo].[_ModuleFormScheme]([tf_formSchemeId] [int] NOT NULL,[tf_moduleId] [nvarchar](10) COLLATE Chinese_PRC_CI_AS NOT NULL,[tf_schemeOrder] [int] NOT NULL,[tf_schemeName] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NOT NULL,[tf_isSystemScheme] [bit] NULL,[tf_windowHeight] [int] NULL,[tf_windowWidth] [int] NULL,[tf_numCols] [int] NULL,[tf_displayMode] [nvarchar](20) COLLATE Chinese_PRC_CI_AS NULL,[tf_otherSetting] [nvarchar](max) COLLATE Chinese_PRC_CI_AS NULL, CONSTRAINT [PK___ModuleFormSchem__30F848ED] PRIMARY KEY CLUSTERED ([tf_formSchemeId] ASC)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY], CONSTRAINT [_ModuleFormScheme_ix1] UNIQUE NONCLUSTERED ([tf_moduleId] ASC,[tf_schemeOrder] ASC)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]) ON [PRIMARY]GOALTER TABLE [dbo].[_ModuleFormScheme]  WITH CHECK ADD  CONSTRAINT [_ModuleFormScheme_fk1] FOREIGN KEY([tf_moduleId])REFERENCES [dbo].[_Module] ([tf_moduleId])ON UPDATE CASCADEON DELETE CASCADE
Java bean of the form scheme table:
Package com. jfok. server. hibernate. system; import java. io. serializable; import java. util. list; import javax. persistence. cascadeType; import javax. persistence. column; import javax. persistence. entity; import javax. persistence. fetchType; import javax. persistence. generatedValue; import javax. persistence. id; import javax. persistence. joinColumn; import javax. persistence. manyToOne; import javax. persistence. onetoworkflow; Import javax. persistence. orderBy; import org. codehaus. jackson. annotate. jsonIgnore; import org. hibernate. annotations. genericGenerator; import com. jfok. server. common. annotation. fieldDefine; import com. jfok. server. common. annotation. tableDefine; @ SuppressWarnings ("serial") @ Entity@org.hibernate.annotations.Entity (dynamicUpdate = true) @ TableDefine (group = "system module", id = 9907, title = "module FZ modules? Http://www.bkjia.com/kf/ware/vc/ "target =" _ blank "class =" keylink "> vcm23vbC4", shortname = "Form solution") public class _ ModuleFormScheme implements _ IModuleControlInterface, serializable {@ Id @ GeneratedValue (generator = "increment") @ GenericGenerator (name = "increment", strategy = "increment") @ FieldDefine (title = "Id ", number = 10) private Integer tf_formSchemeId; @ JsonIgnore @ ManyToOne (cascade = CascadeType. REFRESH, fetch = FetchType. EAGER) @ JoinColumn (name = "tf_moduleId", nullable = false) @ FieldDefine (title = "Module", number = 20) private _ Module tf_Module; @ FieldDefine (title = "sequence number", number = 30) @ Column (nullable = false) private Integer tf_schemeOrder; @ FieldDefine (title = "solution name", nameField = true, number = 40) @ Column (nullable = false, length = 50) private String tf_schemeName; @ FieldDefine (title = "system solution", number = 50) private Boolean tf_isSystemScheme; @ FieldDefine (title = "window height", number = 60) private Integer tf_windowHeight; @ FieldDefine (title = "window width", number = 70) private Integer tf_1_wwidth; @ FieldDefine (title = "number of columns", number = 80) private Integer tf_numCols; @ FieldDefine (title = "Form Type", number = 90) private String tf_displayMode; @ FieldDefine (title = "Additional Settings", number = 100) private String tf_otherSetting; @ onetoworkflow (targetEntity = _ ModuleFormSchemeGroup. class, fetch = FetchType. LAZY, cascade = CascadeType. ALL) @ JoinColumn (name = "tf_formSchemeId") @ OrderBy ("tf_formGroupOrder") private List <_ tables> moduleFormSchemeGroups; public _ ModuleFormScheme () {}// getter and setter}


Table definition and bean of form group:
CREATE TABLE [dbo].[_ModuleFormSchemeGroup]([tf_formGroupId] [int] NOT NULL,[tf_formSchemeId] [int] NOT NULL,[tf_formGroupOrder] [int] NOT NULL,[tf_formGroupName] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NOT NULL,[tf_displayMode] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL,[tf_collapsible] [bit] NULL,[tf_collapsed] [bit] NULL,[tf_numCols] [int] NULL,[tf_auditingGroup] [bit] NULL,[tf_approveGroup] [bit] NULL,[tf_subModuleName] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL,[tf_otherSetting] [nvarchar](max) COLLATE Chinese_PRC_CI_AS NULL, CONSTRAINT [PK___ModuleFormSchem__5070F446] PRIMARY KEY CLUSTERED ([tf_formGroupId] ASC)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]) ON [PRIMARY]GOALTER TABLE [dbo].[_ModuleFormSchemeGroup]  WITH CHECK ADD  CONSTRAINT [_ModuleFormSchemeGroup_fk1] FOREIGN KEY([tf_formSchemeId])REFERENCES [dbo].[_ModuleFormScheme] ([tf_formSchemeId])ON DELETE CASCADE

Package com. jfok. server. hibernate. system; import java. io. serializable; import java. util. list; import javax. persistence. cascadeType; import javax. persistence. column; import javax. persistence. entity; import javax. persistence. fetchType; import javax. persistence. generatedValue; import javax. persistence. id; import javax. persistence. joinColumn; import javax. persistence. manyToOne; import javax. persistence. onetovel; import javax. persistence. orderBy; import org. codehaus. jackson. annotate. jsonIgnore; import org. hibernate. annotations. genericGenerator; import com. jfok. server. common. annotation. fieldDefine; import com. jfok. server. common. annotation. tableDefine; @ SuppressWarnings ("serial") @ Entity@org.hibernate.annotations.Entity (dynamicUpdate = true) @ TableDefine (group = "system module", id = 9908, title = "module Form field group ", shortname = "Form field group") public class _ incluimplements _ IModuleControlInterface, Serializable {public static final String FORMGROUPID = "tf_formGroupId"; @ Id @ GeneratedValue (generator = "increment ") @ GenericGenerator (name = "increment", strategy = "increment") @ FieldDefine (title = "ID", number = 10) private Integer tf_formGroupId; @ JsonIgnore @ ManyToOne (cascade = CascadeType. REFRESH, fetch = FetchType. EAGER) @ JoinColumn (name = "tf_formSchemeId", nullable = false) @ FieldDefine (title = "module Form solution", number = 20) private _ ModuleFormScheme tf_ModuleFormScheme; @ FieldDefine (title = "sequence number", number = 30) @ Column (nullable = false) private Integer tf_formGroupOrder; @ FieldDefine (title = "group name", nameField = true, number = 40) @ Column (nullable = false, length = 50) private String tf_formGroupName; @ FieldDefine (title = "display mode", number = 50) @ Column (length = 50) private String tf_displayMode; @ FieldDefine (title = "number of columns", number = 60) private Integer tf_numCols; @ FieldDefine (title = "Review Group", number = 70) private Boolean tf_auditingGroup; @ FieldDefine (title = "Approval Group", number = 80) private Boolean tf_approveGroup; @ FieldDefine (title = "foldable", number = 90) private Boolean tf_collapsible; @ FieldDefine (title = "Default fold", number = 100) private Boolean tf_collapsed; @ FieldDefine (title = "submodule name", remark = "set this item, this sub-module is displayed in this group ", number = 110) @ Column (length = 50) private String tf_subModuleName; @ FieldDefine (title =" other settings ", number = 120) private String tf_otherSetting; @ onetoworkflow (targetEntity = _ ModuleFormSchemeGroupField. class, fetch = FetchType. LAZY, cascade = CascadeType. ALL) @ JoinColumn (name = "tf_formGroupId") @ OrderBy ("tf_formFieldOrder") private List <_ ModuleFormSchemeGroupField> groups; public _ ModuleFormSchemeGroup () {}// getter and setter}

Form field definition and bean:
CREATE TABLE [dbo].[_ModuleFormSchemeGroupField]([tf_formFieldId] [int] NOT NULL,[tf_formGroupId] [int] NOT NULL,[tf_formFieldOrder] [int] NOT NULL,[tf_fieldId] [int] NOT NULL,[tf_width] [int] NULL,[tf_height] [int] NULL,[tf_colspan] [int] NULL,[tf_isAllowApprove] [bit] NULL,[tf_isStartRow] [bit] NULL,[tf_isEndrow] [bit] NULL,[tf_otherSetting] [nvarchar](max) COLLATE Chinese_PRC_CI_AS NULL, CONSTRAINT [PK___ModuleFormSchem__6FE99F9F] PRIMARY KEY CLUSTERED ([tf_formFieldId] ASC)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY], CONSTRAINT [_ModuleFormSchemeGroupField_ix1] UNIQUE NONCLUSTERED ([tf_formGroupId] ASC,[tf_fieldId] ASC)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]) ON [PRIMARY]GOALTER TABLE [dbo].[_ModuleFormSchemeGroupField]  WITH CHECK ADD  CONSTRAINT [_ModuleFormSchemeGroupField_fk1] FOREIGN KEY([tf_formGroupId])REFERENCES [dbo].[_ModuleFormSchemeGroup] ([tf_formGroupId])ON UPDATE CASCADEON DELETE CASCADEGOALTER TABLE [dbo].[_ModuleFormSchemeGroupField]  WITH CHECK ADD  CONSTRAINT [_ModuleFormSchemeGroupField_fk2] FOREIGN KEY([tf_fieldId])REFERENCES [dbo].[_ModuleField] ([tf_fieldId])ON UPDATE CASCADEON DELETE CASCADE

Package com. jfok. server. hibernate. system; import java. io. serializable; import javax. persistence. cascadeType; import javax. persistence. column; import javax. persistence. entity; import javax. persistence. fetchType; import javax. persistence. generatedValue; import javax. persistence. id; import javax. persistence. joinColumn; import javax. persistence. manyToOne; import org. codehaus. jackson. annotate. jsonIgnore; import org. hibernate. annotations. genericGenerator; import com. jfok. server. common. annotation. fieldDefine; import com. jfok. server. common. annotation. tableDefine; @ SuppressWarnings ("serial") @ Entity@org.hibernate.annotations.Entity (dynamicUpdate = true) @ TableDefine (group = "system module", id = 9909, title = "module Form field ", shortname = "Form field") public class _ ModuleFormSchemeGroupField implements _ IModuleControlInterface, Serializable {@ Id @ GeneratedValue (generator = "increment") @ GenericGenerator (name = "increment ", strategy = "increment") @ FieldDefine (title = "ID", hidden = true, number = 10) private Integer tf_formFieldId; @ JsonIgnore @ ManyToOne (cascade = CascadeType. REFRESH, fetch = FetchType. LAZY) @ JoinColumn (name = "tf_formGroupId", nullable = false) @ FieldDefine (title = "module Form field group", number = 20) private _ ModuleFormSchemeGroup tf_ModuleFormSchemeGroup; @ FieldDefine (title = "sequence number", number = 30) @ Column (nullable = false) private Integer tf_formFieldOrder; @ JsonIgnore @ ManyToOne (cascade = CascadeType. REFRESH, fetch = FetchType. EAGER) @ JoinColumn (name = "tf_fieldId", nullable = false) @ FieldDefine (title = "module field", nameField = true, number = 40) private _ ModuleField tf_ModuleField; // This field is used to convert the data to json and add the moduleField id @ Column (insertable = false, updatable = false) private Integer tf_fieldId when it is passed to the foreground; @ FieldDefine (title = "width", number = 50) private Integer tf_width; @ FieldDefine (title = "number of columns", number = 60) private Integer tf_colspan; @ FieldDefine (title = "end line", number = 70) private Boolean tf_isEndRow; @ FieldDefine (title = "Additional Settings", number = 80) private String tf_otherSetting; public _ ModuleFormSchemeGroupField () {}// getter and setter}

In this way, the fields, lists, tables, and beans are added, and the following statements must be added to _ Module. java:
@OneToMany(targetEntity = _MenuModule.class, fetch = FetchType.LAZY, cascade = CascadeType.ALL)@JoinColumn(name = "tf_moduleId")@OrderBy("tf_fieldOrder")private List<_ModuleField> moduleFields;@OneToMany(targetEntity = _ModuleFormScheme.class, fetch = FetchType.LAZY, cascade = CascadeType.ALL)@JoinColumn(name = "tf_moduleId")@OrderBy("tf_schemeOrder")private List<_ModuleFormScheme> moduleFormSchemes;@OneToMany(targetEntity = _ModuleGridScheme.class, fetch = FetchType.LAZY, cascade = CascadeType.ALL)@JoinColumn(name = "tf_moduleId")@OrderBy("tf_schemeOrder")private List<_ModuleGridScheme> moduleGridSchemes;//getter and setter

Add the data of the three modules to the bean of the "module". When the module data is transferred to the foreground, the field, list, and form information are transmitted to the foreground.




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.