Learn Extjs5 with me. (34--design of individual modules [2 create form table and Bean]) Create a form scheme table:
create TABLE [dbo]. [_moduleformscheme] ([Tf_formschemeid] [int] not null,[tf_moduleid] [nvarchar] (Ten) COLLATE chinese_prc_ci_as not null,[tf_schemeorder] [int ] not null,[tf_schemename] [nvarchar] (a) 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] (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], Constra INT [_moduleformscheme_ix1] UNIQUE nonclustered ([Tf_moduleid] asc,[tf_schemeorder] ASC) with (Ignore_dup_key = OFF) on [P Rimary]) 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 for form proposal 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.onetomany;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 Form scheme", ShortName = "form scheme") public class _moduleformscheme implements _imodulecontrolinterface, Serializable {@ Id@generatedvalue (generator = "increment") @GenericGenerator (name = "Increment", strategy = "increment") @FieldDefine (title = "id", Number = ten) private Integer Tf_formschemeid; @JsonIgnore @manytoone (cascade = Cascadetype.refresh, Fetch = Fetchtype.eager) @JoinColumn (name = "Tf_moduleid", nullable = False) @FieldDefine (title = "Module", number =) Private _module Tf_module; @FieldDefine (title = "Ordinal", Number =) @Column (nullable = False) Private Integer tf_schemeorder;@ Fielddefine (title = "scheme name", NameField = true, number = All) @Column (nullable = false, length =) Private String Tf_schemena Me; @FieldDefine (title = "System Scheme", Number =) private Boolean tf_issystemscheme; @FieldDefine (title = "Window High", number =) Priv Ate Integer tf_windowheight; @FieldDefine (title = "Window width", number =) private Integer tf_windowwidth; @FieldDefine (title = " Columns ", Number = +) private Integer tf_numcols; @FieldDefine (title =" Form Type ", Number = +) private String tf_displaymode; @Fie Lddefine (title = "Additional Settings", Number = +) private String tf_othersetting; @OneToMany (targetentity = _ Moduleformschemegroup.class, fetch = Fetchtype.lazy, cascade= Cascadetype.all) @JoinColumn (name = "Tf_formschemeid") @OrderBy ("Tf_formgrouporder") Private list<_ Moduleformschemegroup> moduleformschemegroups;public _moduleformscheme () {}//getter and Setter}
The definition of a table grouped by form and the bean:
CREATE TABLE [dbo]. [_moduleformschemegroup] ([tf_formgroupid] [int] not Null,[tf_formschemeid] [int.] NOT Null,[tf_formgrouporder] [int.] not Null,[tf_formgroupname] [nvarchar] (COLLATE chinese_prc_ci_as not null,[tf_displaymode] [nvarchar] (a) 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] (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 the 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.onetomany;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 grouping ", ShortName =" form field grouping ") public class _moduleformschemegroup implements _imodulecontrolinterface, Serializable {public Static final String formgroupid = "Tf_formgroupid"; @Id @generatedvalue (generator = "increment")@GenericGenerator (name = "Increment", strategy = "increment") @FieldDefine (title = "id", Number = ten) private Integer TF_FO Rmgroupid; @JsonIgnore @manytoone (cascade = cascadetype.refresh, fetch = Fetchtype.eager) @JoinColumn (name = "Tf_ Formschemeid ", nullable = False) @FieldDefine (title =" Module Form scheme ", number =) Private _moduleformscheme tf_ Moduleformscheme; @FieldDefine (title = "Ordinal", Number =) @Column (nullable = False) Private Integer tf_formgrouporder;@ Fielddefine (title = "Group name", NameField = true, Number = +) @Column (nullable = false, length =) Private String Tf_formgrou PName; @FieldDefine (title = "Display Mode", Number = @Column (length =) private String tf_displaymode; @FieldDefine (title = "Column "Number =" Private Integer tf_numcols; @FieldDefine (title = "Audit Group", and "# =") private Boolean Tf_auditinggroup; @Field Define (title = "Approval Group", Number = +) Private Boolean tf_approvegroup; @FieldDefine (title = "Collapsible", Number = +) Private Boolean tf_collapsible; @FieldDefine (title = "Default Collapse", Number = +) pRivate Boolean tf_collapsed; @FieldDefine (title = "Submodule Name", Remark = "Set this to show the submodule in this group, number = +) @Column (length =) pr Ivate string tf_submodulename; @FieldDefine (title = "Other Settings", Number = +) private String tf_othersetting; @OneToMany ( Targetentity = _moduleformschemegroupfield.class, fetch = fetchtype.lazy, cascade = Cascadetype.all) @JoinColumn (name = " Tf_formgroupid ") @OrderBy (" Tf_formfieldorder ") Private list<_moduleformschemegroupfield> Moduleformschemegroupfields;public _moduleformschemegroup () {}//getter and setter}
form field definitions and beans:
CREATE TABLE [dbo]. [_moduleformschemegroupfield] ([tf_formfieldid] [int] not NULL,[TF_FORMGROUPID] [int.] NOT Null,[tf_formfieldorder] [int.] not NULL,[TF_FIELDID] [int] NO T 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 [P Rimary], 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 Number", hidden = true, Number = ten) private Integer tf_formfieldid;@JsonIgnore @manytoone (cascade = cascadetype.refresh, fetch = Fetchtype.lazy) @JoinColumn (name = "Tf_formgroupid", Nullable = False) @FieldDefine (title = "Module form field grouping", number =) Private _moduleformschemegroup Tf_moduleformschemegroup ; @FieldDefine (title = "Ordinal", Number =) @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 = +) Private _modulefield tf_modulefield;//This field is used to transfer data to JSON At the front desk, add Modulefield id@column (insertable = false, updatable = false) private Integer Tf_fieldid; @FieldDefine (title = "width") , number =) private integer tf_width; @FieldDefine (title = "Column Count", numbers =) private integer tf_colspan; @FieldDefine (titl E = "End Line", number = All) private Boolean Tf_isendrow; @FieldDefine (title = "Additional Settings", Number = +) Private String tf_othersetting ;p ublic _moduleformschemegroupfield () {}//getter and setter}
This adds the fields, lists, form tables, and beans, and then adds the following statement to the _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
The data of the three modules is added to the "module" bean, and the information of the fields, lists and forms is transmitted to the foreground when the module data is passed to the foreground.
Learn Extjs5 with me. (34--design of a single module [2 Creating a Form table bean])