| | |
| | | public String username; |
| | | public String password; |
| | | public String table; |
| | | public String tableName; |
| | | public String packagePath; |
| | | public boolean controller = true; |
| | | public boolean service = true; |
| | |
| | | private String systemPackage; |
| | | private String itemName; |
| | | private String tableColumns; |
| | | private String formEditColumns; |
| | | |
| | | public void build() throws Exception { |
| | | init(); |
| | |
| | | } |
| | | itemName = packagePathSplit[packagePathSplit.length - 1]; |
| | | tableColumns = createTableColumns(); |
| | | formEditColumns = createFormEditColumns(); |
| | | } |
| | | |
| | | private String readFile(String template){ |
| | |
| | | if(!writerFile.exists()){ |
| | | content=content. |
| | | replaceAll("@\\{TABLENAME}", table) |
| | | .replaceAll("@\\{TABLEDESC}", tableName) |
| | | .replaceAll("@\\{ENTITYIMPORT}", entityImport) |
| | | .replaceAll("@\\{ENTITYCONTENT}", entityContent) |
| | | .replaceAll("@\\{ENTITYNAME}", fullEntityName) |
| | |
| | | .replaceAll("@\\{UPCASEMARJORCOLUMN}", GeneratorUtils.firstCharConvert(primaryKeyColumn, false)) |
| | | .replaceAll("@\\{SYSTEMPACKAGE}",systemPackage) |
| | | .replaceAll("@\\{TABLECOLUMNS}", tableColumns) |
| | | .replaceAll("@\\{FORMEDITCOLUMNS}", formEditColumns) |
| | | ; |
| | | writerFile.createNewFile(); |
| | | BufferedWriter writer=new BufferedWriter(new FileWriter(writerFile)); |
| | |
| | | private void gainDbInfo() throws Exception { |
| | | Connection conn; |
| | | if (null == this.sqlOsType) { |
| | | throw new RuntimeException("请指定数据库类型!"); |
| | | throw new RuntimeException("请选择sqlOsType!"); |
| | | } |
| | | if (null == this.table) { |
| | | throw new RuntimeException("请输入table!"); |
| | | } |
| | | if (null == this.tableName) { |
| | | throw new RuntimeException("请输入tableName!"); |
| | | } |
| | | switch (this.sqlOsType) { |
| | | case MYSQL: |
| | |
| | | /************************************** Edit动态字段 ********************************************/ |
| | | /**********************************************************************************************/ |
| | | |
| | | private String createFormEditColumns() { |
| | | StringBuilder sb = new StringBuilder(); |
| | | int times = 0; |
| | | for (Column column : columns) { |
| | | if (column.isPrimaryKey() |
| | | || column.getHumpName().equals("deleted") |
| | | || column.getHumpName().equals("hostId") |
| | | ) { |
| | | continue; |
| | | } |
| | | |
| | | if (times%2 == 0) { |
| | | |
| | | } |
| | | |
| | | times++; |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | |
| | | |
| | | |
| | |
| | | disabled |
| | | hidden={true} |
| | | /> |
| | | <ProForm.Group> |
| | | <ProFormText |
| | | name="name" |
| | | label="角色名称" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | placeholder="请输入" |
| | | rules={[{ required: true, message: "请输入角色名称!" }]} |
| | | /> |
| | | <ProFormText |
| | | name="code" |
| | | label="角色标识" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | placeholder="请输入" |
| | | rules={[{ required: true, message: "请输入角色标识!" }]} |
| | | /> |
| | | </ProForm.Group> |
| | | <ProForm.Group> |
| | | <ProFormSelect |
| | | name="status" |
| | | label="状态" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | options={[ |
| | | { label: '正常', value: 1 }, |
| | | { label: '禁用', value: 0 }, |
| | | ]} |
| | | rules={[{ required: true, message: "请选择状态!" }]} |
| | | /> |
| | | <ProFormDateTimePicker |
| | | name="updateTime" |
| | | label="修改时间" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | transform={(value) => { |
| | | return moment(value).toISOString(); |
| | | }} |
| | | /> |
| | | </ProForm.Group> |
| | | <ProFormSelect |
| | | name="hostId" |
| | | label="机构" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | showSearch |
| | | debounceTime={300} |
| | | request={async ({ keyWords }) => { |
| | | const resp = await Http.doPostForm('api/hostId/query', { condition: keyWords }); |
| | | return resp.data; |
| | | }} |
| | | /> |
| | | @{FORMEDITCOLUMNS} |
| | | </ProForm> |
| | | </Modal> |
| | | </> |
| | |
| | | -- save @{SIMPLEENTITYNAME} record |
| | | -- mysql |
| | | insert into `sys_menu` ( `name`, `parent_id`, `route`, `type`, `sort`, `host_id`, `status`) values ( '@{SIMPLEENTITYNAME}管理', '0', '/@{ITEMNAME}/@{SIMPLEENTITYNAME}', '0' , '0', '1' , '1'); |
| | | insert into `sys_menu` ( `name`, `parent_id`, `route`, `type`, `sort`, `host_id`, `status`) values ( '@{SIMPLEENTITYNAME}管理', '0', '/@{TABLEDESC}/@{SIMPLEENTITYNAME}', '0' , '0', '1' , '1'); |
| | | |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '查询@{SIMPLEENTITYNAME}', '', '1', '@{ITEMNAME}:@{SIMPLEENTITYNAME}:list', '0', '1', '1'); |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '添加@{SIMPLEENTITYNAME}', '', '1', '@{ITEMNAME}:@{SIMPLEENTITYNAME}:save', '1', '1', '1'); |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '修改@{SIMPLEENTITYNAME}', '', '1', '@{ITEMNAME}:@{SIMPLEENTITYNAME}:update', '2', '1', '1'); |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '删除@{SIMPLEENTITYNAME}', '', '1', '@{ITEMNAME}:@{SIMPLEENTITYNAME}:remove', '3', '1', '1'); |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '查询@{TABLEDESC}', '', '1', '@{ITEMNAME}:@{SIMPLEENTITYNAME}:list', '0', '1', '1'); |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '添加@{TABLEDESC}', '', '1', '@{ITEMNAME}:@{SIMPLEENTITYNAME}:save', '1', '1', '1'); |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '修改@{TABLEDESC}', '', '1', '@{ITEMNAME}:@{SIMPLEENTITYNAME}:update', '2', '1', '1'); |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '删除@{TABLEDESC}', '', '1', '@{ITEMNAME}:@{SIMPLEENTITYNAME}:remove', '3', '1', '1'); |
| | | |
| | |
| | | // generator.password="Zoneyung@zy56$"; |
| | | |
| | | generator.table="sys_dept"; |
| | | generator.tableName="部门"; |
| | | generator.packagePath="com.zy.asrs.wcs.system"; |
| | | |
| | | generator.build(); |