update codegen js
This commit is contained in:
parent
8831529251
commit
5f7c00d4e4
45
pom.xml
45
pom.xml
@ -21,13 +21,15 @@
|
|||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>1.6</maven.compiler.source>
|
<maven.compiler.source>1.6</maven.compiler.source>
|
||||||
<maven.compiler.target>1.6</maven.compiler.target>
|
<maven.compiler.target>1.6</maven.compiler.target>
|
||||||
<spring.version>4.3.6.RELEASE</spring.version>
|
<spring.version>4.3.7.RELEASE</spring.version>
|
||||||
<spring-boot.version>1.5.2.RELEASE</spring-boot.version>
|
<spring-boot.version>1.5.2.RELEASE</spring-boot.version>
|
||||||
<slf4j.version>1.7.23</slf4j.version>
|
<slf4j.version>1.7.23</slf4j.version>
|
||||||
<log4j.version>2.7</log4j.version>
|
<log4j.version>2.7</log4j.version>
|
||||||
<shiro.version>1.3.2</shiro.version>
|
<shiro.version>1.3.2</shiro.version>
|
||||||
<aspectj.version>1.8.10</aspectj.version>
|
<aspectj.version>1.8.10</aspectj.version>
|
||||||
<main.class>Main</main.class>
|
<main.class>Main</main.class>
|
||||||
|
<maven.tomcat.port>8080</maven.tomcat.port>
|
||||||
|
<maven.tomcat.path>/</maven.tomcat.path>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<scm>
|
<scm>
|
||||||
@ -364,6 +366,18 @@
|
|||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-clean-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>com.coderplus.maven.plugins</groupId>
|
||||||
|
<artifactId>copy-rename-maven-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-resources-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
@ -589,13 +603,38 @@
|
|||||||
<artifactId>tomcat7-maven-plugin</artifactId>
|
<artifactId>tomcat7-maven-plugin</artifactId>
|
||||||
<version>2.2</version>
|
<version>2.2</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<port>8080</port>
|
<port>${maven.tomcat.port}</port>
|
||||||
<path>/</path>
|
<path>${maven.tomcat.path}</path>
|
||||||
<charset>utf-8</charset>
|
<charset>utf-8</charset>
|
||||||
<uriEncoding>utf-8</uriEncoding>
|
<uriEncoding>utf-8</uriEncoding>
|
||||||
<contextReloadable>false</contextReloadable>
|
<contextReloadable>false</contextReloadable>
|
||||||
|
<systemProperties>
|
||||||
|
<http.port>${maven.tomcat.port}</http.port>
|
||||||
|
<project.basedir>${project.basedir}</project.basedir>
|
||||||
|
</systemProperties>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<version>${spring-boot.version}</version>
|
||||||
|
<configuration>
|
||||||
|
<addResources>true</addResources>
|
||||||
|
<mainClass>${start-class}</mainClass>
|
||||||
|
<layout>ZIP</layout>
|
||||||
|
<jvmArguments>
|
||||||
|
-Xdebug
|
||||||
|
-Dproject.basedir=${project.basedir}
|
||||||
|
</jvmArguments>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>repackage</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-help-plugin</artifactId>
|
<artifactId>maven-help-plugin</artifactId>
|
||||||
|
@ -30,6 +30,10 @@
|
|||||||
<groupId>me.chyxion.tigon</groupId>
|
<groupId>me.chyxion.tigon</groupId>
|
||||||
<artifactId>tigon-webmvc-core</artifactId>
|
<artifactId>tigon-webmvc-core</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>me.chyxion.tigon</groupId>
|
||||||
|
<artifactId>tigon-service-support</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>spring-jdbc</artifactId>
|
<artifactId>spring-jdbc</artifactId>
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
package me.chyxion.tigon.codegen.service.support;
|
package me.chyxion.tigon.codegen.service.support;
|
||||||
|
|
||||||
import me.chyxion.tigon.mybatis.Table;
|
import me.chyxion.tigon.mybatis.Table;
|
||||||
|
import me.chyxion.tigon.service.BaseCrudService;
|
||||||
|
import me.chyxion.tigon.service.BaseService;
|
||||||
|
import me.chyxion.tigon.service.support.BaseCrudServiceSupport;
|
||||||
import me.chyxion.tigon.util.WordUtils;
|
import me.chyxion.tigon.util.WordUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -26,12 +29,6 @@ import me.chyxion.tigon.model.M0;
|
|||||||
import me.chyxion.tigon.model.M1;
|
import me.chyxion.tigon.model.M1;
|
||||||
import me.chyxion.tigon.model.M2;
|
import me.chyxion.tigon.model.M2;
|
||||||
import me.chyxion.tigon.model.M3;
|
import me.chyxion.tigon.model.M3;
|
||||||
/*
|
|
||||||
import me.chyxion.tigon.webmvc.annotations.Mock;
|
|
||||||
import me.chyxion.tigon.webmvc.controller.BaseController;
|
|
||||||
import me.chyxion.tigon.webmvc.service.BaseService;
|
|
||||||
import me.chyxion.tigon.webmvc.service.support.BaseServiceSupport;
|
|
||||||
*/
|
|
||||||
import me.chyxion.tigon.webmvc.test.ControllerTestTool;
|
import me.chyxion.tigon.webmvc.test.ControllerTestTool;
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@ -114,17 +111,18 @@ public class CodeGenServiceSupport implements CodeGenService {
|
|||||||
String baseModelFullName = null;
|
String baseModelFullName = null;
|
||||||
Collection<String> baseCols = null;
|
Collection<String> baseCols = null;
|
||||||
if (colNames.containsAll(new M3<String, String>().cols())) {
|
if (colNames.containsAll(new M3<String, String>().cols())) {
|
||||||
baseModelName = M3.class.getSimpleName();
|
baseModelName = M3.class.getSimpleName() +
|
||||||
|
"<" + idType + ", " + idType + ">";
|
||||||
baseModelFullName = M3.class.getName();
|
baseModelFullName = M3.class.getName();
|
||||||
baseCols = new M3<String, String>().cols();
|
baseCols = new M3<String, String>().cols();
|
||||||
}
|
}
|
||||||
else if (colNames.containsAll(new M2<String>().cols())) {
|
else if (colNames.containsAll(new M2<String>().cols())) {
|
||||||
baseModelName = M2.class.getSimpleName();
|
baseModelName = M2.class.getSimpleName() + "<" + idType + ">";
|
||||||
baseModelFullName = M2.class.getName();
|
baseModelFullName = M2.class.getName();
|
||||||
baseCols = new M2<String>().cols();
|
baseCols = new M2<String>().cols();
|
||||||
}
|
}
|
||||||
else if (colNames.containsAll(new M1<String>().cols())) {
|
else if (colNames.containsAll(new M1<String>().cols())) {
|
||||||
baseModelName = M1.class.getSimpleName();
|
baseModelName = M1.class.getSimpleName() + "<" + idType + ">";
|
||||||
baseModelFullName = M1.class.getName();
|
baseModelFullName = M1.class.getName();
|
||||||
baseCols = new M1<String>().cols();
|
baseCols = new M1<String>().cols();
|
||||||
}
|
}
|
||||||
@ -143,8 +141,7 @@ public class CodeGenServiceSupport implements CodeGenService {
|
|||||||
baseTool.getConfig("super.base.model.full.name");
|
baseTool.getConfig("super.base.model.full.name");
|
||||||
|
|
||||||
fmDataModel.put("baseModelName",
|
fmDataModel.put("baseModelName",
|
||||||
baseTool.getConfig("super.base.model.name",
|
baseTool.getConfig("super.base.model.name", baseModelName));
|
||||||
baseModelName + "<" + idType + ">"));
|
|
||||||
|
|
||||||
fmDataModel.put("baseModelFullName",
|
fmDataModel.put("baseModelFullName",
|
||||||
"NONE".equalsIgnoreCase(cfgBaseModelFullName) ? null :
|
"NONE".equalsIgnoreCase(cfgBaseModelFullName) ? null :
|
||||||
@ -204,14 +201,15 @@ public class CodeGenServiceSupport implements CodeGenService {
|
|||||||
// super classes name
|
// super classes name
|
||||||
fmDataModel.put("baseControllerName", BaseController.class.getSimpleName());
|
fmDataModel.put("baseControllerName", BaseController.class.getSimpleName());
|
||||||
fmDataModel.put("baseControllerFullName", BaseController.class.getName());
|
fmDataModel.put("baseControllerFullName", BaseController.class.getName());
|
||||||
// service interface
|
|
||||||
fmDataModel.put("baseServiceName", BaseService.class.getSimpleName());
|
|
||||||
fmDataModel.put("baseServiceFullName", BaseService.class.getName());
|
|
||||||
// server support
|
|
||||||
fmDataModel.put("baseServiceSupportName", BaseServiceSupport.class.getSimpleName());
|
|
||||||
fmDataModel.put("baseServiceSupportFullName", BaseServiceSupport.class.getName());
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// service interface
|
||||||
|
fmDataModel.put("baseServiceName", BaseCrudService.class.getSimpleName());
|
||||||
|
fmDataModel.put("baseServiceFullName", BaseService.class.getName());
|
||||||
|
// server support
|
||||||
|
fmDataModel.put("baseServiceSupportName", BaseCrudServiceSupport.class.getSimpleName());
|
||||||
|
fmDataModel.put("baseServiceSupportFullName", BaseCrudServiceSupport.class.getName());
|
||||||
|
|
||||||
// model
|
// model
|
||||||
//
|
//
|
||||||
// mapper
|
// mapper
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @version 0.0.1
|
* @version 0.0.1
|
||||||
* @since 0.0.1
|
|
||||||
* @author Auto Generated <br>
|
* @author Auto Generated <br>
|
||||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||||
* ${now}
|
* ${now}
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
package ${pkg}.services.support;
|
package ${pkg}.service.support;
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import ${baseServiceSupportFullName};
|
import ${baseServiceSupportFullName};
|
||||||
import ${pkg}.mappers.${ModelName}Mapper;
|
import ${pkg}.mapper.${ModelName}Mapper;
|
||||||
import ${pkg}.models.${ModelName};
|
import ${pkg}.model.${ModelName};
|
||||||
import ${pkg}.services.${ModelName}Service;
|
import ${pkg}.service.${ModelName}Service;
|
||||||
|
|
||||||
${objDoc}
|
${objDoc}
|
||||||
@Service
|
@Service
|
||||||
public class ${ModelName}ServiceSupport
|
public class ${ModelName}ServiceSupport
|
||||||
extends ${baseServiceSupportName}<${ModelName}, ${ModelName}Mapper>
|
extends ${baseServiceSupportName}<${idType}, ${ModelName}, ${ModelName}Mapper>
|
||||||
implements ${ModelName}Service {
|
implements ${ModelName}Service {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package ${pkg}.services;
|
package ${pkg}.service;
|
||||||
|
|
||||||
import ${baseServiceFullName};
|
import ${baseServiceFullName};
|
||||||
import ${pkg}.models.${ModelName};
|
import ${pkg}.model.${ModelName};
|
||||||
|
|
||||||
${objDoc}
|
${objDoc}
|
||||||
public interface ${ModelName}Service extends ${baseServiceName}<${ModelName}> {
|
public interface ${ModelName}Service extends ${baseServiceName}<${idType}, ${ModelName}> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
Ext.define ('Tigon.views.CodeGen', {
|
Ext.define ('Tigon.views.CodeGen', {
|
||||||
extend: 'Ext.container.Container',
|
extend: 'Ext.container.Container',
|
||||||
alternateClassName: ['SpringExt.views.CodeGen'],
|
title: 'Tigon Code Gen',
|
||||||
title: 'Auto Code',
|
|
||||||
layout: 'border',
|
layout: 'border',
|
||||||
items: [{
|
items: [{
|
||||||
xtype: 'container',
|
xtype: 'container',
|
||||||
@ -32,8 +31,8 @@ Ext.define ('Tigon.views.CodeGen', {
|
|||||||
handler: function () {
|
handler: function () {
|
||||||
var t = this.up('treepanel');
|
var t = this.up('treepanel');
|
||||||
Ext.MessageBox.show({
|
Ext.MessageBox.show({
|
||||||
title: 'Are You Sure?',
|
title: 'Are you sure?',
|
||||||
msg: 'Are You Sure To Remove Model(s) Selected Without Drop Tables?',
|
msg: 'Are you sure to remove model(s) selected without drop tables?',
|
||||||
buttons: Ext.MessageBox.YESNOCANCEL,
|
buttons: Ext.MessageBox.YESNOCANCEL,
|
||||||
fn: function(btn) {
|
fn: function(btn) {
|
||||||
if (btn != 'cancel') {
|
if (btn != 'cancel') {
|
||||||
@ -62,7 +61,7 @@ Ext.define ('Tigon.views.CodeGen', {
|
|||||||
form.getForm().reset();
|
form.getForm().reset();
|
||||||
form.down('grid').getStore().removeAll();
|
form.down('grid').getStore().removeAll();
|
||||||
// remove demo grid
|
// remove demo grid
|
||||||
rc.down('container[name=demo_grid]').removeAll();
|
// rc.down('container[name=demo_grid]').removeAll();
|
||||||
Message.alert('Remove Success.');
|
Message.alert('Remove Success.');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -88,12 +87,12 @@ Ext.define ('Tigon.views.CodeGen', {
|
|||||||
form.getForm().setValues(rec.getData());
|
form.getForm().setValues(rec.getData());
|
||||||
form.down('grid').getStore().loadData(rec.get('cols'));
|
form.down('grid').getStore().loadData(rec.get('cols'));
|
||||||
// show demo grid
|
// show demo grid
|
||||||
var dg = rc.down('container[name=demo_grid]');
|
// var dg = rc.down('container[name=demo_grid]');
|
||||||
dg.removeAll();
|
// dg.removeAll();
|
||||||
// load view
|
// load view
|
||||||
dg.add(Ext.create('App.views.' +
|
// dg.add(Ext.create('App.views.' +
|
||||||
(rec.get('module') ? rec.get('module') + '.' : '') +
|
// (rec.get('module') ? rec.get('module') + '.' : '') +
|
||||||
rec.get('model') + '.List'));
|
// rec.get('model') + '.List'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -101,6 +100,13 @@ Ext.define ('Tigon.views.CodeGen', {
|
|||||||
title: 'Tables',
|
title: 'Tables',
|
||||||
split: true,
|
split: true,
|
||||||
region: 'center',
|
region: 'center',
|
||||||
|
tbar: [{
|
||||||
|
text: 'Reload',
|
||||||
|
iconCls: 'refresh',
|
||||||
|
handler: function () {
|
||||||
|
this.up('treepanel').getStore().reload();
|
||||||
|
}
|
||||||
|
}],
|
||||||
store: Store.tree({
|
store: Store.tree({
|
||||||
url: 'codegen/tables',
|
url: 'codegen/tables',
|
||||||
fields: ['id', 'text', 'module', 'model', 'cols', 'table'],
|
fields: ['id', 'text', 'module', 'model', 'cols', 'table'],
|
||||||
@ -110,328 +116,317 @@ Ext.define ('Tigon.views.CodeGen', {
|
|||||||
select: function(rm, rec) {
|
select: function(rm, rec) {
|
||||||
if (rec.isLeaf()) {
|
if (rec.isLeaf()) {
|
||||||
// right container
|
// right container
|
||||||
var rc = this.up().next('container');
|
var form = this.up().next('form');
|
||||||
form = rc.down('form');
|
form.getForm().setValues(Ext.merge(rec.getData(), {
|
||||||
form.getForm().setValues(Ext.merge(rec.getData(), {
|
createTable: false
|
||||||
createTable: false
|
}));
|
||||||
}));
|
|
||||||
form.down('grid').getStore().loadData(rec.get('cols'));
|
form.down('grid').getStore().loadData(rec.get('cols'));
|
||||||
// show demo grid
|
// show demo grid
|
||||||
var dg = rc.down('container[name=demo_grid]');
|
// var dg = rc.down('container[name=demo_grid]');
|
||||||
dg.removeAll();
|
// dg.removeAll();
|
||||||
// load view
|
// load view
|
||||||
dg.add(Ext.create('App.views.' +
|
// dg.add(Ext.create('App.views.' +
|
||||||
(rec.get('module') ? rec.get('module') + '.' : '') +
|
// (rec.get('module') ? rec.get('module') + '.' : '') +
|
||||||
rec.get('model') + '.List'));
|
// rec.get('model') + '.List'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
}, {
|
}, {
|
||||||
xtype: 'container',
|
xtype: 'form',
|
||||||
region: 'center',
|
region: 'center',
|
||||||
layout: 'border',
|
split: true,
|
||||||
items: [{
|
height: 312,
|
||||||
xtype: 'form',
|
autoScroll: true,
|
||||||
region: 'north',
|
bodyPadding: 12,
|
||||||
split: true,
|
layout: 'vbox',
|
||||||
height: 312,
|
defaults: {
|
||||||
autoScroll: true,
|
width: '96%',
|
||||||
bodyPadding: 12,
|
labelWidth: 86
|
||||||
layout: 'vbox',
|
},
|
||||||
defaults: {
|
tbar: [{
|
||||||
width: '96%',
|
text: 'New model',
|
||||||
labelWidth: 86
|
iconCls: 'add',
|
||||||
},
|
handler: function(btn) {
|
||||||
tbar: [{
|
var form = btn.up('form'),
|
||||||
text: 'New Model',
|
s = form.down('grid').getStore();
|
||||||
iconCls: 'add',
|
s.removeAll();
|
||||||
handler: function(btn) {
|
s.add({
|
||||||
var form = btn.up('form'),
|
name: 'id',
|
||||||
s = form.down('grid').getStore();
|
javaType: 'String',
|
||||||
s.removeAll();
|
col: 'id',
|
||||||
s.add({
|
sqlType: 'varchar(36)'
|
||||||
name: 'id',
|
}, {
|
||||||
javaType: 'String',
|
name: 'dateCreated',
|
||||||
col: 'id',
|
javaType: 'Date',
|
||||||
sqlType: 'varchar(36)'
|
col: 'date_created',
|
||||||
}, {
|
sqlType: 'datetime'
|
||||||
name: 'dateCreated',
|
}, {
|
||||||
javaType: 'Date',
|
name: 'dateUpdated',
|
||||||
col: 'date_created',
|
javaType: 'Date',
|
||||||
sqlType: 'datetime'
|
col: 'date_updated',
|
||||||
}, {
|
sqlType: 'datetime'
|
||||||
name: 'dateUpdated',
|
});
|
||||||
javaType: 'Date',
|
}
|
||||||
col: 'date_updated',
|
}, {
|
||||||
sqlType: 'datetime'
|
text: 'Generate!',
|
||||||
});
|
iconCls: 'save',
|
||||||
}
|
handler: function(btn) {
|
||||||
}, {
|
var form = btn.up('form');
|
||||||
text: 'Generate!',
|
if (form.isValid()) {
|
||||||
iconCls: 'save',
|
var s = form.down('grid').getStore();
|
||||||
handler: function(btn) {
|
if (s.getCount()) {
|
||||||
var form = btn.up('form');
|
var params = form.getForm().getValues(),
|
||||||
if (form.isValid()) {
|
columns = [];
|
||||||
var s = form.down('grid').getStore();
|
s.each(function(rec) {
|
||||||
if (s.getCount()) {
|
columns.push(rec.getData());
|
||||||
var params = form.getForm().getValues(),
|
});
|
||||||
columns = [];
|
params.columns = columns;
|
||||||
s.each(function(rec) {
|
Dialog.confirm(s.collect('isKey').length > 1 ?
|
||||||
columns.push(rec.getData());
|
'Are you sure to submit?' :
|
||||||
|
'No primary key, are you sure to submit?', function() {
|
||||||
|
Ajax.post('codegen', params, function() {
|
||||||
|
form.previousNode('treepanel')
|
||||||
|
.previousNode('treepanel')
|
||||||
|
.getStore()
|
||||||
|
.reload();
|
||||||
|
Message.alert('Generate successfully.');
|
||||||
});
|
});
|
||||||
params.columns = columns;
|
});
|
||||||
Dialog.confirm(s.collect('isKey').length > 1 ?
|
}
|
||||||
'Are You Sure To Submit?' :
|
else {
|
||||||
'No Primary Key, Are You Sure To Submit?', function() {
|
Message.warn('No Columns.');
|
||||||
Ajax.post('codegen', params, function() {
|
}
|
||||||
form.up().previousNode('treepanel')
|
}
|
||||||
.previousNode('treepanel')
|
}
|
||||||
.getStore()
|
}],
|
||||||
.reload();
|
items: [{
|
||||||
Message.alert('Generate Success.');
|
xtype: 'box',
|
||||||
});
|
html: [
|
||||||
|
'<span style="color: #333;">Note: </span>',
|
||||||
|
'Welcome.'
|
||||||
|
].join(''),
|
||||||
|
padding: '0 0 12 0',
|
||||||
|
style: {
|
||||||
|
fontSize: '12pt',
|
||||||
|
color: '#00F'
|
||||||
|
},
|
||||||
|
}, {
|
||||||
|
fieldLabel: 'Options',
|
||||||
|
xtype: 'checkboxgroup',
|
||||||
|
defaults: {
|
||||||
|
checked: true,
|
||||||
|
xtype: 'checkbox',
|
||||||
|
inputValue: true
|
||||||
|
},
|
||||||
|
columns: 3,
|
||||||
|
items: [{
|
||||||
|
boxLabel: 'Gen controller',
|
||||||
|
name: 'genController'
|
||||||
|
}, {
|
||||||
|
boxLabel: 'Gen service',
|
||||||
|
name: 'genService'
|
||||||
|
}, {
|
||||||
|
boxLabel: 'Gen mapper',
|
||||||
|
name: 'genMapper'
|
||||||
|
}, {
|
||||||
|
boxLabel: 'Gen model',
|
||||||
|
name: 'genModel'
|
||||||
|
}, {
|
||||||
|
boxLabel: 'Gen table',
|
||||||
|
name: 'genTable'
|
||||||
|
}, {
|
||||||
|
boxLabel: 'Gen form',
|
||||||
|
checked: false,
|
||||||
|
name: 'genView'
|
||||||
|
}, {
|
||||||
|
boxLabel: 'Create table',
|
||||||
|
checked: false,
|
||||||
|
name: 'createTable'
|
||||||
|
}]
|
||||||
|
}, {
|
||||||
|
xtype: 'fieldcontainer',
|
||||||
|
fieldLabel: 'Columns',
|
||||||
|
items: {
|
||||||
|
xtype: 'grid',
|
||||||
|
minHeight: 128,
|
||||||
|
plugins: [Ext.create('Ext.grid.plugin.CellEditing', {
|
||||||
|
clicksToEdit: 1
|
||||||
|
})],
|
||||||
|
store: {
|
||||||
|
store: 'json',
|
||||||
|
fields: ['name', 'javaType', 'col', 'sqlType',
|
||||||
|
{name: 'notNull', type: 'boolean', defaultValue: true},
|
||||||
|
{name: 'isKey', type: 'boolean', defaultValue: false},
|
||||||
|
{name: 'isIndex', type: 'boolean', defaultValue: false}]
|
||||||
|
},
|
||||||
|
columns: [{
|
||||||
|
xtype: 'rownumberer'
|
||||||
|
}, {
|
||||||
|
dataIndex: 'name',
|
||||||
|
text: 'Property name',
|
||||||
|
width: 128,
|
||||||
|
editor: {
|
||||||
|
xtype: 'textfield',
|
||||||
|
allowBlank: false,
|
||||||
|
listeners: {
|
||||||
|
change: function(t, nv, ov) {
|
||||||
|
t.up().up()
|
||||||
|
.getSelectionModel()
|
||||||
|
.getLastSelected()
|
||||||
|
.set('col',
|
||||||
|
nv.split(/(?=[A-Z])(?=[A-Z][a-z])|(?=[^A-Z])(?=[A-Z])|(?=[^a-zA-Z])(?=[a-z])|(?=[A-Za-z])(?=[^A-Za-z])/)
|
||||||
|
.join('_').
|
||||||
|
toLowerCase());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
dataIndex: 'javaType',
|
||||||
|
text: 'Java Type',
|
||||||
|
flex: 1,
|
||||||
|
editor: {
|
||||||
|
xtype: 'combo',
|
||||||
|
typeAhead: true,
|
||||||
|
editable: false,
|
||||||
|
triggerAction: 'all',
|
||||||
|
store: [
|
||||||
|
['String', 'String'],
|
||||||
|
['int', 'int'],
|
||||||
|
['Integer', 'Integer'],
|
||||||
|
['long', 'long'],
|
||||||
|
['Long', 'Long'],
|
||||||
|
['double', 'double'],
|
||||||
|
['Double', 'Double'],
|
||||||
|
['Date', 'Date'],
|
||||||
|
['boolean', 'boolean'],
|
||||||
|
['Boolean', 'Boolean'],
|
||||||
|
['byte', 'byte'],
|
||||||
|
['Byte', 'Byte'],
|
||||||
|
['byte[]', 'byte[]'],
|
||||||
|
['Byte[]', 'Byte[]']
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
dataIndex: 'col',
|
||||||
|
text: 'Column name',
|
||||||
|
width: 128,
|
||||||
|
editor: {
|
||||||
|
xtype: 'textfield'
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
dataIndex: 'sqlType',
|
||||||
|
text: 'SQL type',
|
||||||
|
flex: 1,
|
||||||
|
editor: {
|
||||||
|
allowBlank: false,
|
||||||
|
xtype: 'combo',
|
||||||
|
typeAhead: true,
|
||||||
|
editable: true,
|
||||||
|
triggerAction: 'all',
|
||||||
|
store: [
|
||||||
|
['date', 'date'],
|
||||||
|
['datetime', 'datetime'],
|
||||||
|
['char(36)', 'char(36)'],
|
||||||
|
['varchar(36)', 'varchar(36)'],
|
||||||
|
['bit', 'bit'],
|
||||||
|
['bigint', 'bigint'],
|
||||||
|
['int', 'int'],
|
||||||
|
['float', 'float']
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
dataIndex: 'notNull',
|
||||||
|
text: 'Not Null',
|
||||||
|
width: 76,
|
||||||
|
renderer: function(v) {
|
||||||
|
return v || '';
|
||||||
|
},
|
||||||
|
editor: {
|
||||||
|
xtype: 'checkbox',
|
||||||
|
inputValue: true
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
dataIndex: 'isKey',
|
||||||
|
text: 'Primary key',
|
||||||
|
width: 76,
|
||||||
|
renderer: function(v) {
|
||||||
|
return v || '';
|
||||||
|
},
|
||||||
|
editor: {
|
||||||
|
xtype: 'checkbox',
|
||||||
|
inputValue: true
|
||||||
|
}
|
||||||
|
}],
|
||||||
|
tbar: [{
|
||||||
|
text: 'Add column',
|
||||||
|
iconCls: 'add',
|
||||||
|
handler: function () {
|
||||||
|
var s = this.up('grid').getStore(),
|
||||||
|
name = 0;
|
||||||
|
Ext.each(s.collect('name'), function(col) {
|
||||||
|
var m = col.match(/^name(\d*)$/);
|
||||||
|
if (m) {
|
||||||
|
var num = parseInt(m[1]);
|
||||||
|
if (isNaN(num)) {
|
||||||
|
name = 1;
|
||||||
|
}
|
||||||
|
else if (num + 1 > name) {
|
||||||
|
name = num + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
name = 'name' + (name ? name : '');
|
||||||
|
s.add({
|
||||||
|
name: name,
|
||||||
|
javaType: 'String',
|
||||||
|
col: name,
|
||||||
|
sqlType: 'varchar(36)',
|
||||||
|
notNull: true,
|
||||||
|
isKey: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
text: 'Remove column',
|
||||||
|
iconCls: 'remove',
|
||||||
|
handler: function (btn) {
|
||||||
|
var g = btn.up('grid'),
|
||||||
|
ss = g.getSelectionModel().getSelection();
|
||||||
|
if (ss.length) {
|
||||||
|
Dialog.confirm(
|
||||||
|
'Are you sure to remove the column selected?',
|
||||||
|
function() {
|
||||||
|
g.getStore().remove(ss);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Message.warn('No Columns.');
|
Message.warn('Please Select Column To Remove.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}],
|
|
||||||
items: [{
|
|
||||||
xtype: 'box',
|
|
||||||
html: [
|
|
||||||
'<span style="color: #333;">Note: </span>',
|
|
||||||
'Welcome.'
|
|
||||||
].join(''),
|
|
||||||
padding: '0 0 12 0',
|
|
||||||
style: {
|
|
||||||
fontSize: '12pt',
|
|
||||||
color: '#00F'
|
|
||||||
},
|
|
||||||
}, {
|
|
||||||
fieldLabel: 'Options',
|
|
||||||
xtype: 'checkboxgroup',
|
|
||||||
defaults: {
|
|
||||||
checked: true,
|
|
||||||
xtype: 'checkbox',
|
|
||||||
inputValue: true
|
|
||||||
},
|
|
||||||
columns: 3,
|
|
||||||
items: [{
|
|
||||||
boxLabel: 'Gen Controller',
|
|
||||||
name: 'genController'
|
|
||||||
}, {
|
|
||||||
boxLabel: 'Gen Service',
|
|
||||||
name: 'genService'
|
|
||||||
}, {
|
|
||||||
boxLabel: 'Gen Mapper',
|
|
||||||
name: 'genMapper'
|
|
||||||
}, {
|
|
||||||
boxLabel: 'Gen Model',
|
|
||||||
name: 'genModel'
|
|
||||||
}, {
|
|
||||||
boxLabel: 'Gen Table',
|
|
||||||
name: 'genTable'
|
|
||||||
}, {
|
|
||||||
boxLabel: 'Gen View',
|
|
||||||
checked: false,
|
|
||||||
name: 'genView'
|
|
||||||
}, {
|
|
||||||
boxLabel: 'Create Table',
|
|
||||||
checked: false,
|
|
||||||
name: 'createTable'
|
|
||||||
}]
|
}]
|
||||||
}, {
|
}
|
||||||
xtype: 'fieldcontainer',
|
|
||||||
fieldLabel: 'Columns',
|
|
||||||
items: {
|
|
||||||
xtype: 'grid',
|
|
||||||
minHeight: 128,
|
|
||||||
plugins: [Ext.create('Ext.grid.plugin.CellEditing', {
|
|
||||||
clicksToEdit: 1
|
|
||||||
})],
|
|
||||||
store: {
|
|
||||||
store: 'json',
|
|
||||||
fields: ['name', 'javaType', 'col', 'sqlType',
|
|
||||||
{name: 'notNull', type: 'boolean', defaultValue: true},
|
|
||||||
{name: 'isKey', type: 'boolean', defaultValue: false},
|
|
||||||
{name: 'isIndex', type: 'boolean', defaultValue: false}]
|
|
||||||
},
|
|
||||||
columns: [{
|
|
||||||
xtype: 'rownumberer'
|
|
||||||
}, {
|
|
||||||
dataIndex: 'name',
|
|
||||||
text: 'Property Name',
|
|
||||||
width: 128,
|
|
||||||
editor: {
|
|
||||||
xtype: 'textfield',
|
|
||||||
allowBlank: false,
|
|
||||||
listeners: {
|
|
||||||
change: function(t, nv, ov) {
|
|
||||||
t.up().up()
|
|
||||||
.getSelectionModel()
|
|
||||||
.getLastSelected()
|
|
||||||
.set('col',
|
|
||||||
nv.split(/(?=[A-Z])(?=[A-Z][a-z])|(?=[^A-Z])(?=[A-Z])|(?=[^a-zA-Z])(?=[a-z])|(?=[A-Za-z])(?=[^A-Za-z])/)
|
|
||||||
.join('_').
|
|
||||||
toLowerCase());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
dataIndex: 'javaType',
|
|
||||||
text: 'Java Type',
|
|
||||||
flex: 1,
|
|
||||||
editor: {
|
|
||||||
xtype: 'combo',
|
|
||||||
typeAhead: true,
|
|
||||||
editable: false,
|
|
||||||
triggerAction: 'all',
|
|
||||||
store: [
|
|
||||||
['String', 'String'],
|
|
||||||
['int', 'int'],
|
|
||||||
['Integer', 'Integer'],
|
|
||||||
['long', 'long'],
|
|
||||||
['Long', 'Long'],
|
|
||||||
['double', 'double'],
|
|
||||||
['Double', 'Double'],
|
|
||||||
['Date', 'Date'],
|
|
||||||
['boolean', 'boolean'],
|
|
||||||
['Boolean', 'Boolean'],
|
|
||||||
['byte', 'byte'],
|
|
||||||
['Byte', 'Byte'],
|
|
||||||
['byte[]', 'byte[]'],
|
|
||||||
['Byte[]', 'Byte[]']
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
dataIndex: 'col',
|
|
||||||
text: 'Column Name',
|
|
||||||
width: 128,
|
|
||||||
editor: {
|
|
||||||
xtype: 'textfield'
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
dataIndex: 'sqlType',
|
|
||||||
text: 'SQL Type',
|
|
||||||
flex: 1,
|
|
||||||
editor: {
|
|
||||||
allowBlank: false,
|
|
||||||
xtype: 'combo',
|
|
||||||
typeAhead: true,
|
|
||||||
editable: true,
|
|
||||||
triggerAction: 'all',
|
|
||||||
store: [
|
|
||||||
['date', 'date'],
|
|
||||||
['datetime', 'datetime'],
|
|
||||||
['char(36)', 'char(36)'],
|
|
||||||
['varchar(36)', 'varchar(36)'],
|
|
||||||
['bit', 'bit'],
|
|
||||||
['bigint', 'bigint'],
|
|
||||||
['int', 'int'],
|
|
||||||
['float', 'float']
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
dataIndex: 'notNull',
|
|
||||||
text: 'Not Null',
|
|
||||||
width: 76,
|
|
||||||
renderer: function(v) {
|
|
||||||
return v || '';
|
|
||||||
},
|
|
||||||
editor: {
|
|
||||||
xtype: 'checkbox',
|
|
||||||
inputValue: true
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
dataIndex: 'isKey',
|
|
||||||
text: 'Primary Key',
|
|
||||||
width: 76,
|
|
||||||
renderer: function(v) {
|
|
||||||
return v || '';
|
|
||||||
},
|
|
||||||
editor: {
|
|
||||||
xtype: 'checkbox',
|
|
||||||
inputValue: true
|
|
||||||
}
|
|
||||||
}],
|
|
||||||
tbar: [{
|
|
||||||
text: 'Add Column',
|
|
||||||
iconCls: 'add',
|
|
||||||
handler: function () {
|
|
||||||
var s = this.up('grid').getStore(),
|
|
||||||
name = 0;
|
|
||||||
Ext.each(s.collect('name'), function(col) {
|
|
||||||
var m = col.match(/^name(\d*)$/);
|
|
||||||
if (m) {
|
|
||||||
var num = parseInt(m[1]);
|
|
||||||
if (isNaN(num)) {
|
|
||||||
name = 1;
|
|
||||||
}
|
|
||||||
else if (num + 1 > name) {
|
|
||||||
name = num + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
name = 'name' + (name ? name : '');
|
|
||||||
s.add({
|
|
||||||
name: name,
|
|
||||||
javaType: 'String',
|
|
||||||
col: name,
|
|
||||||
sqlType: 'varchar(36)',
|
|
||||||
notNull: true,
|
|
||||||
isKey: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
text: 'Remove Column',
|
|
||||||
iconCls: 'remove',
|
|
||||||
handler: function (btn) {
|
|
||||||
var g = btn.up('grid'),
|
|
||||||
ss = g.getSelectionModel().getSelection();
|
|
||||||
if (ss.length) {
|
|
||||||
Dialog.confirm(
|
|
||||||
'Are You Sure To Remove The Column Selected.',
|
|
||||||
function() {
|
|
||||||
g.getStore().remove(ss);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Message.warn('Please Select Column To Remove.');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
xtype: 'textfield',
|
|
||||||
name: 'pkg',
|
|
||||||
fieldLabel: 'Base Package',
|
|
||||||
allowBlank: true,
|
|
||||||
emptyText: 'Default Base Package (' + pkg + ').'
|
|
||||||
}, {
|
|
||||||
xtype: 'textfield',
|
|
||||||
name: 'module',
|
|
||||||
fieldLabel: 'Module',
|
|
||||||
emptyText: 'Subpackage Of Base Package.'
|
|
||||||
}, {
|
|
||||||
xtype: 'textfield',
|
|
||||||
name: 'model',
|
|
||||||
fieldLabel: 'Model Name',
|
|
||||||
value: 'ModelName',
|
|
||||||
allowBlank: false
|
|
||||||
}, {
|
|
||||||
xtype: 'textfield',
|
|
||||||
name: 'table',
|
|
||||||
fieldLabel: 'Table Name',
|
|
||||||
allowBlank: false
|
|
||||||
}]
|
|
||||||
}, {
|
}, {
|
||||||
xtype: 'container',
|
xtype: 'textfield',
|
||||||
region: 'center',
|
name: 'pkg',
|
||||||
name: 'demo_grid',
|
fieldLabel: 'Base package',
|
||||||
layout: 'fit'
|
allowBlank: true,
|
||||||
|
emptyText: 'Default base package (' + pkg + ').'
|
||||||
|
}, {
|
||||||
|
xtype: 'textfield',
|
||||||
|
name: 'module',
|
||||||
|
fieldLabel: 'Module',
|
||||||
|
emptyText: 'Subpackage of base package.'
|
||||||
|
}, {
|
||||||
|
xtype: 'textfield',
|
||||||
|
name: 'model',
|
||||||
|
fieldLabel: 'Model name',
|
||||||
|
value: 'ModelName',
|
||||||
|
allowBlank: false
|
||||||
|
}, {
|
||||||
|
xtype: 'textfield',
|
||||||
|
name: 'table',
|
||||||
|
fieldLabel: 'Table name',
|
||||||
|
allowBlank: false
|
||||||
}]
|
}]
|
||||||
}]
|
}]
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user