#
luxiaotao1123
2024-02-17 c05fa8a85061355577aba11107932bb85df3517c
#
4个文件已修改
90 ■■■■■ 已修改文件
zy-asrs-framework/src/main/java/com/zy/asrs/framework/generators/BetterGenerator.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-framework/src/main/resources/templates/react/Edit.txt 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-framework/src/main/resources/templates/react/Sql.txt 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/utils/CodeBuilder.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-framework/src/main/java/com/zy/asrs/framework/generators/BetterGenerator.java
@@ -41,6 +41,7 @@
    public String username;
    public String password;
    public String table;
    public String tableName;
    public String packagePath;
    public boolean controller = true;
    public boolean service = true;
@@ -71,6 +72,7 @@
    private String systemPackage;
    private String itemName;
    private String tableColumns;
    private String formEditColumns;
    public void build() throws Exception {
        init();
@@ -163,6 +165,7 @@
        }
        itemName = packagePathSplit[packagePathSplit.length - 1];
        tableColumns = createTableColumns();
        formEditColumns = createFormEditColumns();
    }
    private String readFile(String template){
@@ -190,6 +193,7 @@
        if(!writerFile.exists()){
            content=content.
                    replaceAll("@\\{TABLENAME}", table)
                    .replaceAll("@\\{TABLEDESC}", tableName)
                    .replaceAll("@\\{ENTITYIMPORT}", entityImport)
                    .replaceAll("@\\{ENTITYCONTENT}", entityContent)
                    .replaceAll("@\\{ENTITYNAME}", fullEntityName)
@@ -212,6 +216,7 @@
                    .replaceAll("@\\{UPCASEMARJORCOLUMN}", GeneratorUtils.firstCharConvert(primaryKeyColumn, false))
                    .replaceAll("@\\{SYSTEMPACKAGE}",systemPackage)
                    .replaceAll("@\\{TABLECOLUMNS}", tableColumns)
                    .replaceAll("@\\{FORMEDITCOLUMNS}", formEditColumns)
            ;
            writerFile.createNewFile();
            BufferedWriter writer=new BufferedWriter(new FileWriter(writerFile));
@@ -227,7 +232,13 @@
    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:
@@ -840,7 +851,25 @@
    /************************************** 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();
    }
zy-asrs-framework/src/main/resources/templates/react/Edit.txt
@@ -56,53 +56,7 @@
                        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>
        </>
zy-asrs-framework/src/main/resources/templates/react/Sql.txt
@@ -1,9 +1,9 @@
-- 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');
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/utils/CodeBuilder.java
@@ -23,6 +23,7 @@
//        generator.password="Zoneyung@zy56$";
        generator.table="sys_dept";
        generator.tableName="部门";
        generator.packagePath="com.zy.asrs.wcs.system";
        generator.build();