pdman模板

pdman模板pdman模板{“modules”:[],”dataTypeDomains”:{“datatype”:[{“name”:”string11″,”code”:”string11″,”apply”:{“JAVA”:{“type”:”String…

pdman 模板


{ 
   
  "modules": [],
  "dataTypeDomains": { 
   
    "datatype": [
      { 
   
        "name": "string11",
        "code": "string11",
        "apply": { 
   
          "JAVA": { 
   
            "type": "String"
          },
          "ORACLE": { 
   
            "type": "VARCHAR2(11)"
          },
          "MYSQL": { 
   
            "type": "VARCHAR(11) CHARACTER SET 'UTF8'"
          },
          "SQLServer": { 
   
            "type": "VARCHAR(11)"
          },
          "PostgreSQL": { 
   
            "type": "VARCHAR(11)"
          }
        }
      },
      { 
   
        "name": "string15",
        "code": "string15",
        "apply": { 
   
          "MYSQL": { 
   
            "type": "VARCHAR(15) CHARACTER SET 'UTF8'"
          },
          "ORACLE": { 
   
            "type": "VARCHAR2(15)"
          },
          "JAVA": { 
   
            "type": "String"
          },
          "SQLServer": { 
   
            "type": "VARCHAR(15)"
          },
          "PostgreSQL": { 
   
            "type": "VARCHAR(15)"
          }
        }
      },
      { 
   
        "name": "string30",
        "code": "string30",
        "apply": { 
   
          "JAVA": { 
   
            "type": "String"
          },
          "MYSQL": { 
   
            "type": "VARCHAR(30) CHARACTER SET 'UTF8'"
          },
          "ORACLE": { 
   
            "type": "NVARCHAR2(30)"
          },
          "SQLServer": { 
   
            "type": "NVARCHAR(30)"
          },
          "PostgreSQL": { 
   
            "type": "VARCHAR(30)"
          }
        }
      },
      { 
   
        "name": "string32",
        "code": "string32",
        "apply": { 
   
          "JAVA": { 
   
            "type": "String"
          },
          "MYSQL": { 
   
            "type": "VARCHAR(32) CHARACTER SET 'UTF8'"
          },
          "ORACLE": { 
   
            "type": "NVARCHAR2(32)"
          },
          "SQLServer": { 
   
            "type": "NVARCHAR(32)"
          },
          "PostgreSQL": { 
   
            "type": "VARCHAR(32)"
          }
        }
      },
      { 
   
        "name": "string64",
        "code": "string64",
        "apply": { 
   
          "JAVA": { 
   
            "type": "String"
          },
          "MYSQL": { 
   
            "type": "VARCHAR(64) CHARACTER SET 'UTF8'"
          },
          "ORACLE": { 
   
            "type": "NVARCHAR2(64)"
          },
          "SQLServer": { 
   
            "type": "NVARCHAR(64)"
          },
          "PostgreSQL": { 
   
            "type": "VARCHAR(64)"
          }
        }
      },
      { 
   
        "name": "string128",
        "code": "string128",
        "apply": { 
   
          "JAVA": { 
   
            "type": "String"
          },
          "MYSQL": { 
   
            "type": "VARCHAR(128) CHARACTER SET 'UTF8'"
          },
          "ORACLE": { 
   
            "type": "NVARCHAR2(128)"
          },
          "SQLServer": { 
   
            "type": "NVARCHAR(128)"
          },
          "PostgreSQL": { 
   
            "type": "VARCHAR(128)"
          }
        }
      },
      { 
   
        "name": "string255",
        "code": "string255",
        "apply": { 
   
          "JAVA": { 
   
            "type": "String"
          },
          "MYSQL": { 
   
            "type": "VARCHAR(255) CHARACTER SET 'UTF8'"
          },
          "ORACLE": { 
   
            "type": "NVARCHAR2(255)"
          },
          "SQLServer": { 
   
            "type": "NVARCHAR(255)"
          },
          "PostgreSQL": { 
   
            "type": "VARCHAR(255)"
          }
        }
      },
      { 
   
        "name": "string512",
        "code": "string512",
        "apply": { 
   
          "JAVA": { 
   
            "type": "String"
          },
          "ORACLE": { 
   
            "type": "NVARCHAR2(512)"
          },
          "MYSQL": { 
   
            "type": "VARCHAR(512) CHARACTER SET 'UTF8'"
          },
          "SQLServer": { 
   
            "type": "NVARCHAR(512)"
          },
          "PostgreSQL": { 
   
            "type": "VARCHAR(512)"
          }
        }
      },
      { 
   
        "name": "text65535",
        "code": "text",
        "apply": { 
   
          "JAVA": { 
   
            "type": "String"
          },
          "MYSQL": { 
   
            "type": "TEXT CHARACTER SET 'UTF8'"
          },
          "ORACLE": { 
   
            "type": "CLOB"
          },
          "SQLServer": { 
   
            "type": "NTEXT"
          },
          "PostgreSQL": { 
   
            "type": "TEXT"
          }
        }
      },
      { 
   
        "name": "tinyint128-127",
        "code": "tinyint-128-127",
        "apply": { 
   
          "MYSQL": { 
   
            "type": "TINYINT"
          },
          "JAVA": { 
   
            "type": "Integer"
          },
          "ORACLE": { 
   
            "type": ""
          },
          "SQLServer": { 
   
            "type": ""
          },
          "PostgreSQL": { 
   
            "type": ""
          }
        }
      },
      { 
   
        "name": "tinyint0-255",
        "code": "tinyint0-255",
        "apply": { 
   
          "JAVA": { 
   
            "type": "Integer"
          },
          "MYSQL": { 
   
            "type": "TINYINT UNSIGNED"
          },
          "ORACLE": { 
   
            "type": ""
          },
          "SQLServer": { 
   
            "type": ""
          },
          "PostgreSQL": { 
   
            "type": ""
          }
        }
      },
      { 
   
        "name": "int",
        "code": "int",
        "apply": { 
   
          "JAVA": { 
   
            "type": "Integer"
          },
          "MYSQL": { 
   
            "type": "INT"
          },
          "ORACLE": { 
   
            "type": ""
          },
          "SQLServer": { 
   
            "type": ""
          },
          "PostgreSQL": { 
   
            "type": ""
          }
        }
      },
      { 
   
        "name": "int unsigned",
        "code": "int unsigned",
        "apply": { 
   
          "MYSQL": { 
   
            "type": "INT UNSIGNED"
          },
          "JAVA": { 
   
            "type": "Integer"
          }
        }
      },
      { 
   
        "name": "bigint",
        "code": "bigint",
        "apply": { 
   
          "MYSQL": { 
   
            "type": "BIGINT"
          },
          "JAVA": { 
   
            "type": "Long"
          }
        }
      },
      { 
   
        "name": "bigint unsigned",
        "code": "bigint unsigned",
        "apply": { 
   
          "MYSQL": { 
   
            "type": "BIGINT UNSIGNED"
          },
          "JAVA": { 
   
            "type": "Long"
          }
        }
      },
      { 
   
        "name": "Date",
        "code": "Date",
        "apply": { 
   
          "JAVA": { 
   
            "type": "Date"
          },
          "MYSQL": { 
   
            "type": "DATE"
          },
          "ORACLE": { 
   
            "type": "DATE"
          },
          "SQLServer": { 
   
            "type": "DATE"
          },
          "PostgreSQL": { 
   
            "type": "DATE"
          }
        }
      },
      { 
   
        "name": "DateTime",
        "code": "DateTime",
        "apply": { 
   
          "JAVA": { 
   
            "type": "Date"
          },
          "MYSQL": { 
   
            "type": "DATETIME"
          },
          "ORACLE": { 
   
            "type": "DATE"
          },
          "SQLServer": { 
   
            "type": "DATE"
          },
          "PostgreSQL": { 
   
            "type": "DATE"
          }
        }
      },
      { 
   
        "name": "DECIMAL(4,2)",
        "code": "DECIMAL(4,2)",
        "apply": { 
   
          "MYSQL": { 
   
            "type": "DECIMAL(4,2)"
          },
          "JAVA": { 
   
            "type": "Double"
          },
          "ORACLE": { 
   
            "type": "NUMBER(4,2)"
          },
          "SQLServer": { 
   
            "type": "DECIMAL(4,2)"
          },
          "PostgreSQL": { 
   
            "type": "DECIMAL(4,2)"
          }
        }
      },
      { 
   
        "name": "DECIMAL(11,4)",
        "code": "DECIMAL(11,4)",
        "apply": { 
   
          "MYSQL": { 
   
            "type": "DECIMAL(11,4)"
          },
          "JAVA": { 
   
            "type": "Double"
          }
        }
      },
      { 
   
        "name": "DECIMAL(32,10)",
        "code": "DECIMAL(32,10)",
        "apply": { 
   
          "JAVA": { 
   
            "type": "Double"
          },
          "MYSQL": { 
   
            "type": "DECIMAL(32,10)"
          },
          "ORACLE": { 
   
            "type": "NUMBER(32,10)"
          },
          "SQLServer": { 
   
            "type": "DECIMAL(32,10)"
          },
          "PostgreSQL": { 
   
            "type": "DECIMAL(32,10)"
          }
        }
      }
    ],
    "database": [
      { 
   
        "code": "MYSQL",
        "template": "DROP TABLE { 
   {=it.entity.title}};\n$blankline\nCREATE TABLE { 
   {=it.entity.title}}(\n{ 
   { pkList = [] ; }}\n{ 
   {~it.entity.fields:field:index}}\n { 
   {? field.pk }}{ 
   { pkList.push(field.name) }}{ 
   {?}}\n { 
   {=field.name}} { 
   {=field.type}} { 
   {= field.pk ? 'NOT NULL' : '' }} COMMENT '{ 
   {=it.func.join(field.chnname,field.remark,';')}}' { 
   {= index < it.entity.fields.length-1 ? ',' : ( pkList.length>0 ? ',' :'' ) }}\n{ 
   {~}}\n{ 
   {? pkList.length >0 }}\n PRIMARY KEY ({ 
   {~pkList:pkName:i}}{ 
   {= pkName }}{ 
   {= i<pkList.length-1 ? ',' : '' }}{ 
   {~}})\n{ 
   {?}}\n) COMMENT = '{ 
   {=it.func.join(it.entity.chnname,it.entity.remark,';') }}'",
        "fileShow": true,
        "defaultDatabase": true,
        "createTableTemplate": "CREATE TABLE { 
   {=it.entity.title}}(\n{ 
   { pkList = [] ; }}\n{ 
   {~it.entity.fields:field:index}}\n { 
   {? field.pk }}{ 
   { pkList.push(field.name) }}{ 
   {?}}\n { 
   {=field.name}} { 
   {=field.type}} { 
   {= field.notNull ? 'NOT NULL' : '' }} { 
   {= field.autoIncrement ? 'AUTO_INCREMENT' : '' }} { 
   {= field.defaultValue ? it.func.join('DEFAULT',field.defaultValue,' ') : '' }} COMMENT '{ 
   {=it.func.join(field.chnname,field.remark,' ')}}' { 
   {= index < it.entity.fields.length-1 ? ',' : ( pkList.length>0 ? ',' :'' ) }}\n{ 
   {~}}\n{ 
   {? pkList.length >0 }}\n PRIMARY KEY ({ 
   {~pkList:pkName:i}}{ 
   {= pkName }}{ 
   {= i<pkList.length-1 ? ',' : '' }}{ 
   {~}})\n{ 
   {?}}\n) COMMENT = '{ 
   {=it.func.join(it.entity.chnname,it.entity.remark,' ') }}';{ 
   {=it.separator}}\n$blankline\n",
        "deleteTableTemplate": "",
        "rebuildTableTemplate": "create table PDMAN_UP_{ 
   {=it.oldEntity.title}}\nas select * from { 
   {=it.oldEntity.title}};{ 
   {=it.separator}}\n$blankline\n\ndrop table { 
   {=it.oldEntity.title}};{ 
   {=it.separator}}\n$blankline\n\nCREATE TABLE { 
   {=it.newEntity.title}}(\n{ 
   { pkList = [] ; }}\n{ 
   {~it.newEntity.fields:field:index}}\n { 
   {? field.pk }}{ 
   { pkList.push(field.name) }}{ 
   {?}}\n { 
   {=field.name}} { 
   {=field.type}} { 
   {= field.notNull ? 'NOT NULL' : '' }} COMMENT '{ 
   {=it.func.join(field.chnname,field.remark,';')}}' { 
   {= index < it.newEntity.fields.length-1 ? ',' : ( pkList.length>0 ? ',' :'' ) }}\n{ 
   {~}}\n{ 
   {? pkList.length >0 }}\n PRIMARY KEY ({ 
   {~pkList:pkName:i}}{ 
   {= pkName }}{ 
   {= i<pkList.length-1 ? ',' : '' }}{ 
   {~}})\n{ 
   {?}}\n) COMMENT = '{ 
   {=it.func.join(it.newEntity.chnname,it.newEntity.remark,';') }}';{ 
   {=it.separator}}\n$blankline\n\n{ 
   { sameCols = it.func.intersect(it.newEntity.fields,it.oldEntity.fields) ;}}\ninsert into { 
   {=it.newEntity.title}}(\n{ 
   {~sameCols:field:index}}\n { 
   {=field.name}}{ 
   {? index<sameCols.length-1}},{ 
   {?}}\n{ 
   {~}}\n) \nselect \n{ 
   {~sameCols:field:index}}\n { 
   {=field.name}}{ 
   {? index<sameCols.length-1}},{ 
   {?}}\n{ 
   {~}}\nfrom PDMAN_UP_{ 
   {=it.oldEntity.title}};{ 
   {=it.separator}}\n$blankline\n\ndrop table PDMAN_UP_{ 
   {=it.oldEntity.title}};{ 
   {=it.separator}}\n$blankline\n{ 
   {~it.newEntity.indexs:index}}\nALTER TABLE { 
   {=it.newEntity.title}} ADD { 
   {? index.isUnique}}UNIQUE{ 
   {??}}INDEX{ 
   {?}} { 
   {=index.name}}({ 
   {=it.func.join(...index.fields,',')}});{ 
   {=it.separator}}\n{ 
   {~}}",
        "createFieldTemplate": "ALTER TABLE { 
   {=it.entity.title}} ADD COLUMN { 
   {=it.field.name}} { 
   {=it.field.type}} { 
   {? it.field.notNull}}NOT NULL{ 
   {?}} { 
   {? it.field.defaultValue}}DEFAULT { 
   {? null==it.field.defaultValue}}NULL{ 
   {??}}'{ 
   {=it.field.defaultValue}}'{ 
   {?}}{ 
   {?}} { 
   {? it.field.autoIncrement}}AUTO_INCREMENT{ 
   {?}} { 
   {? it.field.pk}}PRIMARY KEY{ 
   {?}} { 
   {? it.field.chnname}}COMMENT '{ 
   {=it.field.chnname}}'{ 
   {?}} { 
   {? it.field.addAfter}}AFTER { 
   {=it.field.addAfter}}{ 
   {?}};{ 
   {=it.separator}}",
        "updateFieldTemplate": "ALTER TABLE { 
   {=it.entity.title}} MODIFY COLUMN { 
   {=it.field.name}} { 
   {=it.field.type}} { 
   {? it.field.notNull}}NOT NULL{ 
   {?}} { 
   {? it.field.defaultValue}}DEFAULT { 
   {? null==it.field.defaultValue}}NULL{ 
   {??}}'{ 
   {=it.field.defaultValue}}'{ 
   {?}}{ 
   {?}} { 
   {? it.field.autoIncrement}}AUTO_INCREMENT{ 
   {?}} { 
   {? it.field.chnname}}COMMENT '{ 
   {=it.field.chnname}}'{ 
   {?}};{ 
   {=it.separator}}",
        "deleteFieldTemplate": "ALTER TABLE { 
   {=it.entity.title}} DROP { 
   {=it.field.name}};{ 
   {=it.separator}}",
        "deleteIndexTemplate": "ALTER TABLE { 
   {=it.entity.title}} DROP INDEX { 
   {=it.index.name}};{ 
   {=it.separator}}",
        "createIndexTemplate": "ALTER TABLE { 
   {=it.entity.title}} ADD { 
   {? it.index.isUnique}}UNIQUE{ 
   {??}}INDEX{ 
   {?}} { 
   {=it.index.name}}({ 
   {=it.func.join(...it.index.fields,',')}});{ 
   {=it.separator}}",
        "updateTableComment": "ALTER TABLE { 
   {=it.entity.title}} COMMENT '{ 
   {=it.entity.chnname}}';{ 
   {=it.separator}}"
      },
      { 
   
        "code": "ORACLE",
        "template": "DROP TABLE { 
   {=it.entity.title}};{ 
   {=it.separator}}\n$blankline\nCREATE TABLE { 
   {=it.entity.title}}(\n{ 
   { pkList = [] ; }}\n{ 
   {~it.entity.fields:field:index}}\n { 
   {? field.pk }}{ 
   { pkList.push(field.name) }}{ 
   {?}}\n { 
   {=field.name}} { 
   {=field.type}} { 
   {= field.pk ? 'NOT NULL' : '' }} { 
   {= index < it.entity.fields.length-1 ? ',' : ( pkList.length>0 ? ',' :'' ) }}\n{ 
   {~}}\n{ 
   {? pkList.length >0 }}\n PRIMARY KEY ({ 
   {~pkList:pkName:i}}{ 
   {= pkName }}{ 
   {= i<pkList.length-1 ? ',' : '' }}{ 
   {~}})\n{ 
   {?}}\n);{ 
   {=it.separator}}\n$blankline\nCOMMENT ON TABLE { 
   {=it.entity.title}} IS '{ 
   {=it.func.join(it.entity.chnname,it.entity.remark,';') }}';{ 
   {=it.separator}}\n{ 
   {~it.entity.fields:field:index}}\nCOMMENT ON COLUMN { 
   {=it.entity.title}}.{ 
   {=field.name}} IS '{ 
   {=it.func.join(field.chnname,field.remark,';')}}';{ 
   {=it.separator}}\n{ 
   {~}}",
        "createTableTemplate": "CREATE TABLE { 
   {=it.entity.title}}(\n{ 
   { pkList = [] ; }}\n{ 
   {~it.entity.fields:field:index}}\n { 
   {? field.pk }}{ 
   { pkList.push(field.name) }}{ 
   {?}}\n { 
   {=field.name}} { 
   {=field.type}}{ 
   {? field.defaultValue}} DEFAULT { 
   {=field.defaultValue}}{ 
   {?}}{ 
   {= field.notNull ? ' NOT NULL' : '' }}{ 
   {= index < it.entity.fields.length-1 ? ',' : ( pkList.length>0 ? ',' :'' ) }}\n{ 
   {~}}\n{ 
   {? pkList.length >0 }}\n PRIMARY KEY ({ 
   {~pkList:pkName:i}}{ 
   {= pkName }}{ 
   {= i<pkList.length-1 ? ',' : '' }}{ 
   {~}})\n{ 
   {?}}\n);{ 
   {=it.separator}}\n$blankline\n{ 
   {? it.entity.chnname || it.entity.remark}}COMMENT ON TABLE { 
   {=it.entity.title}} IS { 
   {? it.entity.remark}}'{ 
   {=it.entity.remark}}'{ 
   {??}}'{ 
   {=it.entity.chnname}}'{ 
   {?}};{ 
   {=it.separator}}{ 
   {?}}\n{ 
   {~it.entity.fields:field:index}}\n{ 
   {? field.chnname || field.remark}}COMMENT ON COLUMN { 
   {=it.entity.title}}.{ 
   {=field.name}} IS { 
   {? field.remark}}'{ 
   {=field.remark}}'{ 
   {??}}'{ 
   {=field.chnname}}'{ 
   {?}};{ 
   {=it.separator}}{ 
   {?}}\n{ 
   {~}}",
        "deleteTableTemplate": "DROP TABLE { 
   {=it.entity.title}};{ 
   {=it.separator}}/*SkipError*/\r\n$blankline",
        "rebuildTableTemplate": "CREATE TABLE PDMAN_UP_{ 
   {=it.oldEntity.title}}\nAS SELECT * FROM { 
   {=it.oldEntity.title}};{ 
   {=it.separator}}\n$blankline\nDROP TABLE { 
   {=it.oldEntity.title}};{ 
   {=it.separator}}\n$blankline\nCREATE TABLE { 
   {=it.newEntity.title}}(\n{ 
   { pkList = [] ; }}{ 
   {~it.newEntity.fields:field:index}}{ 
   {? field.pk }}{ 
   { pkList.push(field.name) }}{ 
   {?}} { 
   {=field.name}} { 
   {=field.type}}{ 
   {? field.defaultValue}} DEFAULT { 
   {=field.defaultValue}}{ 
   {?}}{ 
   {= field.notNull ? ' NOT NULL' : '' }}{ 
   {= index < it.newEntity.fields.length-1 ? ',' : ( pkList.length>0 ? ',' :'' ) }}\n{ 
   {~}}{ 
   {? pkList.length >0 }} PRIMARY KEY ({ 
   {~pkList:pkName:i}}{ 
   {= pkName }}{ 
   {= i<pkList.length-1 ? ',' : '' }}{ 
   {~}}){ 
   {?}}\n);{ 
   {=it.separator}}\n$blankline\n{ 
   {? it.newEntity.chnname || it.newEntity.remark}}COMMENT ON TABLE { 
   {=it.newEntity.title}} IS { 
   {? it.newEntity.remark}}'{ 
   {=it.entity.remark}}'{ 
   {??}}'{ 
   {=it.newEntity.chnname}}'{ 
   {?}};{ 
   {?}}{ 
   {=it.separator}}\n{ 
   {~it.newEntity.fields:field:index}}\n{ 
   {? field.chnname || field.remark}}COMMENT ON COLUMN { 
   {=it.newEntity.title}}.{ 
   {=field.name}} IS { 
   {? field.remark}}'{ 
   {=field.remark}}'{ 
   {??}}'{ 
   {=field.chnname}}'{ 
   {?}};{ 
   {?}}{ 
   {=it.separator}}\n{ 
   {~}}\n{ 
   { sameCols = it.func.intersect(it.newEntity.fields,it.oldEntity.fields) ;}}\n$blankline\nINSERT INTO { 
   {=it.newEntity.title}}(\n{ 
   {~sameCols:field:index}} { 
   {=field.name}}{ 
   {? index<sameCols.length-1}},{ 
   {?}}\n{ 
   {~}}) \nSELECT\n{ 
   {~sameCols:field:index}} { 
   {=field.name}}{ 
   {? index<sameCols.length-1}},{ 
   {?}}\n{ 
   {~}}FROM PDMAN_UP_{ 
   {=it.oldEntity.title}};{ 
   {=it.separator}}\n\nDROP TABLE PDMAN_UP_{ 
   {=it.oldEntity.title}};{ 
   {=it.separator}}\n{ 
   {~it.newEntity.indexs:index}}\nCREATE{ 
   {? index.isUnique}} UNIQUE{ 
   {?}} INDEX { 
   {=index.name}} ON { 
   {=it.newEntity.title}}({ 
   {=it.func.join(index.fields,',')}});{ 
   {=it.separator}}\n{ 
   {~}}",
        "createFieldTemplate": "ALTER TABLE { 
   {=it.entity.title}} ADD({ 
   {=it.field.name}} { 
   {=it.field.type}}{ 
   {? it.field.defaultValue}} DEFAULT { 
   {=it.field.defaultValue}}{ 
   {?}}{ 
   {? it.field.notNull}} NOT NULL{ 
   {?}});{ 
   {=it.separator}}\r\n{ 
   {? it.field.chnname || it.field.remark}}COMMENT ON COLUMN { 
   {=it.entity.title}}.{ 
   {=it.field.name}} IS { 
   {? it.field.remark}}'{ 
   {=it.field.remark}}'{ 
   {??}}'{ 
   {=it.field.chnname}}'{ 
   {?}};{ 
   {=it.separator}}{ 
   {?}}\r\n$blankline",
        "updateFieldTemplate": "ALTER TABLE { 
   {=it.entity.title}} MODIFY({ 
   {=it.field.name}} { 
   {=it.field.type}}{ 
   {? it.field.defaultValue}} DEFAULT { 
   {=it.field.defaultValue}}{ 
   {?}}{ 
   {? it.field.notNull}} NOT NULL{ 
   {?}});{ 
   {=it.separator}}\r\n{ 
   {? it.field.chnname || it.field.remark}}COMMENT ON COLUMN { 
   {=it.entity.title}}.{ 
   {=it.field.name}} IS { 
   {? it.field.remark}}'{ 
   {=it.field.remark}}'{ 
   {??}}'{ 
   {=it.field.chnname}}'{ 
   {?}};{ 
   {=it.separator}}{ 
   {=it.separator}}{ 
   {?}}\r\n$blankline",
        "deleteFieldTemplate": "ALTER TABLE { 
   {=it.entity.title}} DROP({ 
   {=it.field.name}});{ 
   {=it.separator}}\r\n$blankline",
        "deleteIndexTemplate": "DROP INDEX { 
   {=it.entity.title}}.{ 
   {=it.index.name}};{ 
   {=it.separator}}\r\n$blankline",
        "createIndexTemplate": "CREATE{ 
   {? it.index.isUnique}} UNIQUE{ 
   {?}} INDEX { 
   {=it.index.name}} ON { 
   {=it.entity.title}}({ 
   {=it.func.join(it.index.fields,',')}});{ 
   {=it.separator}}\r\n$blankline",
        "updateTableComment": "{ 
   {? it.entity.chnname || it.entity.remark}}COMMENT ON TABLE { 
   {=it.entity.title}} IS { 
   {? it.entity.remark}}'{ 
   {=it.entity.remark}}'{ 
   {??}}'{ 
   {=it.entity.chnname}}'{ 
   {?}};{ 
   {=it.separator}}{ 
   {?}}\r\n$blankline"
      },
      { 
   
        "code": "SQLServer",
        "createTableTemplate": "CREATE TABLE { 
   {=it.entity.title}}(\n{ 
   { pkList = [] ; }}\n{ 
   {~it.entity.fields:field:index}}\n { 
   {? field.pk }}{ 
   { pkList.push(field.name) }}{ 
   {?}}\n { 
   {=field.name}} { 
   {=field.type}} { 
   {= field.notNull ? 'NOT NULL' : '' }} { 
   {= field.autoIncrement ? 'IDENTITY(1,1)' : '' }} { 
   {= field.defaultValue ? it.func.join('DEFAULT',field.defaultValue,' ') : '' }} { 
   {= index < it.entity.fields.length-1 ? ',' : ( pkList.length>0 ? ',' :'' ) }}\n{ 
   {~}}\n{ 
   {? pkList.length >0 }}\n CONSTRAINT PK_{ 
   {=it.entity.title}} PRIMARY KEY CLUSTERED ({ 
   {~pkList:pkName:i}}{ 
   {= pkName }} ASC { 
   {= i<pkList.length-1 ? ',' : '' }}{ 
   {~}}) ON [PRIMARY] \n{ 
   {?}}\n) ;{ 
   {=it.separator}}\n\n$blankline\nEXECUTE sp_addextendedproperty N'MS_Description', '{ 
   {= it.entity.chnname || it.entity.remark}}', N'user', N'dbo', N'table', N'{ 
   {=it.entity.title}}', NULL, NULL;{ 
   {=it.separator}}\n{ 
   {~it.entity.fields:field:index}}\n{ 
   {? field.chnname || field.remark}}EXECUTE sp_addextendedproperty N'MS_Description', { 
   {? field.remark}}'{ 
   {=field.remark}}'{ 
   {??}}'{ 
   {=field.chnname}}'{ 
   {?}}, N'user', N'dbo', N'table', N'{ 
   {=it.entity.title}}', N'column', N'{ 
   {=field.name}}';{ 
   {=it.separator}}{ 
   {?}}\n{ 
   {~}}\n",
        "deleteTableTemplate": "",
        "rebuildTableTemplate": "",
        "createFieldTemplate": "",
        "updateFieldTemplate": "",
        "deleteFieldTemplate": "",
        "deleteIndexTemplate": "",
        "createIndexTemplate": "",
        "updateTableComment": ""
      },
      { 
   
        "code": "PostgreSQL",
        "template": "DROP TABLE { 
   {=it.entity.title}};\n$blankline\nCREATE TABLE { 
   {=it.entity.title}}(\n{ 
   { pkList = [] ; }}\n{ 
   {~it.entity.fields:field:index}}\n { 
   {? field.pk }}{ 
   { pkList.push(field.name) }}{ 
   {?}}\n { 
   {=field.name}} { 
   {=field.type}} { 
   {= field.pk ? 'NOT NULL' : '' }} COMMENT '{ 
   {=it.func.join(field.chnname,field.remark,';')}}' { 
   {= index < it.entity.fields.length-1 ? ',' : ( pkList.length>0 ? ',' :'' ) }}\n{ 
   {~}}\n{ 
   {? pkList.length >0 }}\n PRIMARY KEY ({ 
   {~pkList:pkName:i}}{ 
   {= pkName }}{ 
   {= i<pkList.length-1 ? ',' : '' }}{ 
   {~}})\n{ 
   {?}}\n) COMMENT = '{ 
   {=it.func.join(it.entity.chnname,it.entity.remark,';') }}'",
        "createTableTemplate": "CREATE TABLE { 
   {=it.entity.title}}(\n{ 
   { pkList = [] ; }}\n{ 
   {~it.entity.fields:field:index}}\n { 
   {? field.pk }}{ 
   { pkList.push(field.name) }}{ 
   {?}}\n { 
   {=field.name}} { 
   {=field.type}}{ 
   {? field.defaultValue}} DEFAULT { 
   {=field.defaultValue}}{ 
   {?}}{ 
   {= field.notNull ? ' NOT NULL' : '' }}{ 
   {= index < it.entity.fields.length-1 ? ',' : ( pkList.length>0 ? ',' :'' ) }}\n{ 
   {~}}\n{ 
   {? pkList.length >0 }}\n PRIMARY KEY ({ 
   {~pkList:pkName:i}}{ 
   {= pkName }}{ 
   {= i<pkList.length-1 ? ',' : '' }}{ 
   {~}})\n{ 
   {?}}\n);{ 
   {=it.separator}}\n$blankline\n{ 
   {? it.entity.chnname || it.entity.remark}}COMMENT ON TABLE { 
   {=it.entity.title}} IS { 
   {? it.entity.remark}}'{ 
   {=it.entity.remark}}'{ 
   {??}}'{ 
   {=it.entity.chnname}}'{ 
   {?}};{ 
   {=it.separator}}{ 
   {?}}\n{ 
   {~it.entity.fields:field:index}}\n{ 
   {? field.chnname || field.remark}}COMMENT ON COLUMN { 
   {=it.entity.title}}.{ 
   {=field.name}} IS { 
   {? field.remark}}'{ 
   {=field.remark}}'{ 
   {??}}'{ 
   {=field.chnname}}'{ 
   {?}};{ 
   {=it.separator}}{ 
   {?}}\n{ 
   {~}}",
        "deleteTableTemplate": "DROP TABLE { 
   {=it.entity.title}};{ 
   {=it.separator}}/*SkipError*/",
        "rebuildTableTemplate": "create table PDMAN_UP_{ 
   {=it.oldEntity.title}}\nas select * from { 
   {=it.oldEntity.title}};{ 
   {=it.separator}}\n$blankline\n\ndrop table { 
   {=it.oldEntity.title}};{ 
   {=it.separator}}\n$blankline\n\nCREATE TABLE { 
   {=it.newEntity.title}}(\n{ 
   { pkList = [] ; }}\n{ 
   {~it.newEntity.fields:field:index}}\n { 
   {? field.pk }}{ 
   { pkList.push(field.name) }}{ 
   {?}}\n { 
   {=field.name}} { 
   {=field.type}} { 
   {= field.notNull ? 'NOT NULL' : '' }} COMMENT '{ 
   {=it.func.join(field.chnname,field.remark,';')}}' { 
   {= index < it.newEntity.fields.length-1 ? ',' : ( pkList.length>0 ? ',' :'' ) }}\n{ 
   {~}}\n{ 
   {? pkList.length >0 }}\n PRIMARY KEY ({ 
   {~pkList:pkName:i}}{ 
   {= pkName }}{ 
   {= i<pkList.length-1 ? ',' : '' }}{ 
   {~}})\n{ 
   {?}}\n) COMMENT = '{ 
   {=it.func.join(it.newEntity.chnname,it.newEntity.remark,';') }}';{ 
   {=it.separator}}\n$blankline\n\n{ 
   { sameCols = it.func.intersect(it.newEntity.fields,it.oldEntity.fields) ;}}\ninsert into { 
   {=it.newEntity.title}}(\n{ 
   {~sameCols:field:index}}\n { 
   {=field.name}}{ 
   {? index<sameCols.length-1}},{ 
   {?}}\n{ 
   {~}}\n) \nselect \n{ 
   {~sameCols:field:index}}\n { 
   {=field.name}}{ 
   {? index<sameCols.length-1}},{ 
   {?}}\n{ 
   {~}}\nfrom PDMAN_UP_{ 
   {=it.oldEntity.title}};{ 
   {=it.separator}}\n$blankline\n\ndrop table PDMAN_UP_{ 
   {=it.oldEntity.title}};{ 
   {=it.separator}}",
        "createFieldTemplate": "ALTER TABLE { 
   {=it.entity.title}} ADD COLUMN { 
   {=it.field.name}} { 
   {=it.field.type}} { 
   {? it.field.notNull}}NOT NULL{ 
   {?}} { 
   {? it.field.defaultValue}}DEFAULT { 
   {? null==it.field.defaultValue}}NULL{ 
   {??}}'{ 
   {=it.field.defaultValue}}'{ 
   {?}}{ 
   {?}} { 
   {? it.field.autoIncrement}}AUTO_INCREMENT{ 
   {?}} { 
   {? it.field.pk}}PRIMARY KEY{ 
   {?}} { 
   {? it.field.chnname}}COMMENT '{ 
   {=it.field.chnname}}'{ 
   {?}} { 
   {? it.field.addAfter}}AFTER { 
   {=it.field.addAfter}}{ 
   {?}};{ 
   {=it.separator}}",
        "updateFieldTemplate": "ALTER TABLE { 
   {=it.entity.title}} MODIFY COLUMN { 
   {=it.field.name}} { 
   {=it.field.type}} { 
   {? it.field.notNull}}NOT NULL{ 
   {?}} { 
   {? it.field.defaultValue}}DEFAULT { 
   {? null==it.field.defaultValue}}NULL{ 
   {??}}'{ 
   {=it.field.defaultValue}}'{ 
   {?}}{ 
   {?}} { 
   {? it.field.autoIncrement}}AUTO_INCREMENT{ 
   {?}} { 
   {? it.field.chnname}}COMMENT '{ 
   {=it.field.chnname}}'{ 
   {?}};{ 
   {=it.separator}}",
        "deleteFieldTemplate": "ALTER TABLE { 
   {=it.entity.title}} DROP { 
   {=it.field.name}};{ 
   {=it.separator}}",
        "deleteIndexTemplate": "ALTER TABLE { 
   {=it.entity.title}} DROP INDEX { 
   {=it.index.name}};{ 
   {=it.separator}}",
        "createIndexTemplate": "ALTER TABLE { 
   {=it.entity.title}} ADD { 
   {? it.index.isUnique}}UNIQUE{ 
   {??}}INDEX{ 
   {?}} { 
   {=it.index.name}}({ 
   {=it.func.join(...it.index.fields,',')}});{ 
   {=it.separator}}",
        "updateTableComment": "ALTER TABLE { 
   {=it.entity.title}} COMMENT '{ 
   {=it.entity.chnname}}';{ 
   {=it.separator}}"
      },
      { 
   
        "code": "JAVA",
        "template": "package group.rober.pdman.{ 
   {=it.module.name}}.entity;\n$blankline\nimport javax.persistence.*;\nimport java.io.Serializable;\nimport java.util.Date;\n$blankline\n$blankline\n\n/** { 
   {=it.entity.chnname}} */\n@Table(name=\"{ 
   {=it.entity.title}}\")\npublic class { 
   {=it.func.camel(it.entity.title,true) }} implements Serializable,Cloneable{\n{ 
   {~it.entity.fields:field:index}}\n /** { 
   {=it.func.join(field.chnname,field.remark,';')}} */\n { 
   {? field.pk }}\n @Id\n @GeneratedValue\n { 
   {?}}\n private { 
   {=field.type}} { 
   {=it.func.camel(field.name,false)}} ;\n{ 
   {~}}\n$blankline\n{ 
   {~it.entity.fields:field:index}}\n /** { 
   {=it.func.join(field.chnname,field.remark,';')}} */\n public { 
   {=field.type}} get{ 
   {=it.func.camel(field.name,true)}}(){\n return this.{ 
   {=it.func.camel(field.name,false)}};\n }\n /** { 
   {=it.func.join(field.chnname,field.remark,';')}} */\n public void set{ 
   {=it.func.camel(field.name,true)}}({ 
   {=field.type}} { 
   {= it.func.camel(field.name,false) }}){\n this.{ 
   {=it.func.camel(field.name,false)}} = { 
   {= it.func.camel(field.name,false) }};\n }\n{ 
   {~}}\n}",
        "createTableTemplate": "package group.rober.pdman.{ 
   {=it.module.name}}.entity;\n$blankline\nimport javax.persistence.*;\nimport java.io.Serializable;\nimport java.util.Date;\n$blankline\n$blankline\n@Table(name=\"{ 
   {=it.entity.title}}\")\npublic class { 
   {=it.func.camel(it.entity.title,true) }} implements Serializable,Cloneable{\n{ 
   {~it.entity.fields:field:index}}\n /** { 
   {=it.func.join(field.chnname,field.remark,';')}} */\n { 
   {? field.pk }}\n @Id\n @GeneratedValue\n { 
   {?}}\n private { 
   {=field.type}} { 
   {=it.func.camel(field.name,false)}} ;\n{ 
   {~}}\n$blankline\n{ 
   {~it.entity.fields:field:index}}\n /** { 
   {=it.func.join(field.chnname,field.remark,';')}} */\n public { 
   {=field.type}} get{ 
   {=it.func.camel(field.name,true)}}(){\n return this.{ 
   {=it.func.camel(field.name,false)}};\n }\n /** { 
   {=it.func.join(field.chnname,field.remark,';')}} */\n public void set{ 
   {=it.func.camel(field.name,true)}}({ 
   {=field.type}} { 
   {= it.func.camel(field.name,false) }}){\n this.{ 
   {=it.func.camel(field.name,false)}} = { 
   {= it.func.camel(field.name,false) }};\n }\n{ 
   {~}}\n}",
        "deleteTableTemplate": "",
        "rebuildTableTemplate": "",
        "createFieldTemplate": "",
        "updateFieldTemplate": "",
        "deleteFieldTemplate": "",
        "deleteIndexTemplate": "",
        "createIndexTemplate": "",
        "updateTableComment": ""
      }
    ]
  },
  "profile": { 
   
    "defaultFields": [
      { 
   
        "name": "id",
        "type": "bigint unsigned",
        "remark": "",
        "chnname": "id",
        "pk": true,
        "notNull": true,
        "autoIncrement": true
      },
      { 
   
        "name": "revision",
        "type": "int unsigned",
        "remark": "",
        "chnname": "乐观锁"
      },
      { 
   
        "name": "created_key",
        "type": "string32",
        "remark": "建议使用uuid标识,去掉中间“-”分割符号,也可以是id标识,但需要注意不同用户类型id重复的情况",
        "chnname": "创建人标识",
        "notNull": true
      },
      { 
   
        "name": "created_name",
        "type": "string32",
        "remark": "更新人名称,冗余字段,查询时可直接取出,不需要使用created_key进行关联查询",
        "chnname": "创建人名称",
        "notNull": true
      },
      { 
   
        "name": "created_time",
        "type": "DateTime",
        "remark": "",
        "chnname": "创建时间",
        "notNull": true
      },
      { 
   
        "name": "updated_key",
        "type": "string32",
        "remark": "建议使用uuid标识,去掉中间“-”分割符号,也可以是id标识,但需要注意不同用户类型id重复的情况",
        "chnname": "更新人标识",
        "notNull": true
      },
      { 
   
        "name": "updated_name",
        "type": "string32",
        "remark": "更新人名称,冗余字段,查询时可直接取出,不需要使用updated_key进行关联查询",
        "chnname": "更新人名称",
        "notNull": true
      },
      { 
   
        "name": "updated_time",
        "type": "DateTime",
        "remark": "首次存入时,可存入创建时间",
        "chnname": "更新时间",
        "notNull": true
      }
    ],
    "defaultFieldsType": "2",
    "javaConfig": { 
   },
    "sqlConfig": ";",
    "dbs": [],
    "wordTemplateConfig": ""
  }
}

今天的文章pdman模板分享到此就结束了,感谢您的阅读。

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/4572.html

(0)
编程小号编程小号

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注