作者:管理员  历史版本:1  最后编辑:龚清  更新时间:2025-10-14 18:31
根据Id查询代码模板数据
简述:
- 根据Id查询代码模板数据
 
请求URL:
- http://ip:port/ibps/platform/v3/codegen/template/get
 - URL中的ip需要替换为自己网关ip
 - URL中的port需要替换为自己网关端口
 
请求方式:
- GET
 
请求参数:
- Headers:
 
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 | 
|---|---|---|---|---|---|
| X-Authorization-access_token | String | 是 | 系统令牌 | 
- Query:
 
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 | 
|---|---|---|---|---|---|
| id | string | 是 | 代码模板id | 
- Body:
 
暂无
请求参数示例:
http://192.168.3.230:15100/ibps/business/v3/codegen/template/get?id=657590755065331712返回示例:
{
    "state": 200,
    "request": null,
    "message": "",
    "cause": "",
    "variables": {},
    "data": {
        "pk": "",
        "name": "function",
        "ip": null,
        "createBy": null,
        "createTime": 1576823453000,
        "updateBy": null,
        "updateTime": null,
        "tenantId": "-999",
        "dataStatus": null,
        "dbtype": null,
        "id": "657590755065331712",
        "typeId": null,
        "key": "function",
        "filename": "-",
        "dir": "-",
        "sub": "true",
        "override": "true",
        "path": "/template/codegen/function.ftl",
        "content": "<#--获取查询数据类型-->\n<#function getDataType colType start>\n<#if (colType==\"Long\") > <#return \"L\">\n<#elseif (colType==\"Integer\")><#return \"N\">\n<#elseif (colType==\"Double\"&& start==\"2\")><#return \"DB\">\n<#elseif (colType==\"Double\" && start==\"1\")><#return \"DBL\">\n<#elseif (colType==\"Double\" && start==\"0\")><#return \"DBG\">\n<#elseif (colType==\"Short\")><#return \"SN\">\n<#elseif (colType==\"Date\" && start==\"1\")><#return \"DL\">\n<#elseif (colType==\"Date\" && start==\"0\")><#return \"DG\">\n<#else><#return \"SL\"></#if>\n</#function>\n\n<#---\n********************************************\nlist 转string\n********************************************\n-->\n<#function listToString object>\n <#if object??>\n        <#if object?is_enumerable>\n            <#local json = '['>\n            <#list object as item>\n                <#if item?is_number >\n                    <#if item_index > 0 && json != \"[\" >\n                        <#local json = json +',' >\n                    </#if>\n                    <#local json = json + '${item}'>\n                <#elseif item?is_string>\n                    <#if item_index > 0 && json != \"[\" >\n                        <#local json = json +',' >\n                    </#if>\n                    <#local json = json + '\"${item?html!\"\"?js_string}\"'>\n                <#elseif item?is_boolean  >\n                    <#if item_index > 0 && json != \"[\" >\n                        <#local json = json +',' >\n                    </#if>\n                    <#local json = json + '${item?string(\"true\", \"false\")}'>\n                <#elseif item?is_enumerable && !(item?is_method) >\n                    <#if item_index > 0 && json != \"[\" >\n                        <#local json = json +',' >\n                    </#if>\n                    <#local json = json + listToString(item)>\n                <#elseif item?is_hash>\n                    <#if item_index > 0 && json != \"[\" >\n                        <#local json = json +',' >\n                    </#if>\n                    <#local json = json + listToString(item)>\n                </#if>\n            </#list>\n            <#return json + ']'>\n        <#elseif object?is_hash>\n            <#local json = \"{\">\n            <#assign keys = object?keys>\n            <#list keys as key>\n                <#if object[key]?? && !(object[key]?is_method) && key != \"class\">\n                    <#if object[key]?is_number>\n                        <#if key_index > 0 && json != \"{\" >\n                            <#local json = json +',' >\n                        </#if>\n                        <#local json = json + \"'${key}': ${object[key]}\">\n                    <#elseif object[key]?is_string>\n                        <#if key_index > 0 && json != \"{\" >\n                            <#local json = json +',' >\n                        </#if>\n                        <#local json = json + \"'${key}': '${object[key]?html!''?js_string}'\">\n                    <#elseif object[key]?is_boolean >\n                        <#if key_index > 0 && json != \"{\" >\n                            <#local json = json +',' >\n                        </#if>\n                        <#local json = json + \"'${key}': ${object[key]?string('true', 'false')}\">\n\n                    <#elseif object[key]?is_enumerable >\n                        <#if key_index > 0 && json != \"{\" >\n                            <#local json = json +',' >\n                        </#if>\n                        <#local json = json + '\"${key}\":'+ listToString(object[key])>\n\n                    <#elseif object[key]?is_hash>\n                        <#if key_index > 0 && json != \"{\" >\n                            <#local json = json +',' >\n                        </#if>\n                        <#local json = json + \"'${key}':\"+ listToString(object[key])>\n                    </#if>\n                </#if>\n            </#list>\n            <#return json +\"}\">\n        </#if>\n    <#else>\n        <#return \"[]\">\n    </#if>\n</#function>\n\n<#--将字符串 user_id 转换为 类似userId-->\n<#function convertUnderLine field>\n<#assign rtn><#list field?split(\"_\") as x><#if (x_index==0)><#if x?length==1>${x?upper_case}<#else>${x?lower_case}</#if><#else>${x?lower_case?cap_first}</#if></#list></#assign>\n <#return rtn>\n</#function>\n\n<#--将字符串 user_id 转换为 类似userId-->\n<#function getFkName model>\n<#assign rtn><#assign fk=model.foreignKey><#list model.columnList as col><#if (fk==col.columnName)>${col.colName}</#if></#list></#assign>\n <#return rtn>\n</#function>\n\n<#--将字符串 user_id 转换为 类似userId-->\n<#function getFromKeyName model pmodel>\n<#assign rtn><#assign fromKey=model.fromKey><#list pmodel.columnList as col><#if (fromKey==col.columnName)>${col.colName}</#if></#list></#assign>\n <#return rtn>\n</#function>\n\n<#function getPk model>\n<#assign rtn><#if (model.pkModel??) >${model.pkModel.columnName}<#else>\"id\"</#if></#assign>\n <#return rtn>\n</#function>\n\n<#--获取主键类型-->\n<#function getPkType model>\n<#list model.columnList as col>\n<#if col.isPK>\n<#if (col.colType==\"Integer\")><#assign rtn>\"Long\"</#assign><#return rtn>\n<#else><#assign pkType=col.colType ></#if>\n</#if>\n</#list>\n<#assign rtn>${pkType}</#assign>\n<#return rtn>\n</#function>\n\n<#--获取外键类型 没有则返回Long-->\n<#function getFkType model>\n<#assign fk=model.foreignKey>\n<#list model.columnList as col>\n<#if (col.columnName?lower_case)==(fk?lower_case)>\n\t<#if (col.colType==\"Integer\")><#assign rtn>Long</#assign><#return rtn><#else><#assign rtn>${col.colType}</#assign><#return rtn></#if>\n</#if>\n</#list>\n<#assign rtn>Long</#assign><#return rtn>\n</#function>\n\n<#function getPkVar model>\n<#assign pkModel=model.pkModel>\n<#assign rtn><#if (model.pkModel??) ><#noparse>${</#noparse>${model.pkModel.colName}<#noparse>}</#noparse><#else>\"id\"</#if></#assign>\n <#return rtn>\n</#function>\n\n<#function getJdbcType dataType>\n<#assign dbtype=dataType?lower_case>\n<#assign rtn>\n<#if  dbtype?ends_with(\"int\") || (dbtype==\"double\") || (dbtype==\"float\") || (dbtype==\"decimal\") || dbtype?ends_with(\"number\")||dbtype?starts_with(\"numeric\") >\nNUMERIC\n<#elseif (dbtype?index_of(\"char\")>-1)  >\nVARCHAR\n<#elseif (dbtype==\"date\") || (dbtype?index_of(\"timestamp\")>-1)  || (dbtype==\"datetime\") >\nTIMESTAMP\n<#elseif (dbtype?ends_with(\"text\") || dbtype?ends_with(\"clob\")) >\nCLOB\n<#elseif (dbtype?ends_with(\"blob\")) >\nBLOB\n</#if></#assign>\n <#return rtn?trim>\n</#function>\n\n<#function getJdbcType2 dataType>\n<#assign dbtype=dataType?lower_case>\n<#assign rtn>\n<#if  dbtype?ends_with(\"int\") || (dbtype==\"double\") || (dbtype==\"float\") || (dbtype==\"decimal\") || dbtype?ends_with(\"number\")||dbtype?starts_with(\"numeric\") >\nNUMERIC\n<#elseif (dbtype?index_of(\"char\")>-1)  >\nVARCHAR\n<#--<#elseif (dbtype==\"date\")>DATE-->\n<#elseif (dbtype?index_of(\"timestamp\")>-1)  || (dbtype==\"datetime\") || (dbtype==\"date\")>\nTIMESTAMP\n<#elseif (dbtype?ends_with(\"text\") || dbtype?ends_with(\"clob\") || dbtype?ends_with(\"blob\")) >\nBLOB\n</#if></#assign>\n <#return rtn?trim>\n</#function>\n",
        "comment": null,
        "isDef": "Y",
        "creator": "654755459927900160",
        "typeName": null,
        "creatorName": "黄春艳"
    }
}返回参数说明:
| 名称 | 类型 | 备注 | 
|---|---|---|
| data | TemplatePo | 代码模板 | 
初始化代码模板
简述:
- 初始化代码模板
 
请求URL:
- http://ip:port/ibps/platform/v3/codegen/template/init
 - URL中的ip需要替换为自己网关ip
 - URL中的port需要替换为自己网关端口
 
请求方式:
- POST
 
请求参数:
- Headers:
 
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 | 
|---|---|---|---|---|---|
| X-Authorization-access_token | String | 是 | 系统令牌 | 
- Query:
 
暂无
- Body:
 
暂无
请求参数示例:
无返回示例:
{
    "state": 200,
    "request": null,
    "message": "",
    "cause": "",
    "variables": {},
    "data": null
}返回参数说明:
| 名称 | 类型 | 备注 | 
|---|---|---|
| data | Void | 
查询代码模板列表(分页条件查询)数据
简述:
- 查询代码模板列表(分页条件查询)数据
 
请求URL:
- http://ip:port/ibps/platform/v3/codegen/template/query
 - URL中的ip需要替换为自己网关ip
 - URL中的port需要替换为自己网关端口
 
请求方式:
- POST
 
请求参数:
- Headers:
 
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 | 
|---|---|---|---|---|---|
| X-Authorization-access_token | String | 是 | 系统令牌 | 
- Query:
 
暂无
- Body:
 
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 | 
|---|---|---|---|---|---|
| request | APIRequest[1] | 是 | 动态查询请求对象 | 
请求参数示例:
{
    "parameters": [],
    "requestPage": {
        "pageNo": 1,
        "limit": 20
    },
    "sorts": []
}返回示例:
{
    "state": 200,
    "request": null,
    "message": "",
    "cause": "",
    "variables": {},
    "data": {
        "dataResult": [
            {
                "pk": "",
                "name": "treeEdit",
                "ip": null,
                "createBy": null,
                "createTime": 1581406043000,
                "updateBy": null,
                "updateTime": null,
                "tenantId": null,
                "dataStatus": null,
                "dbtype": null,
                "id": "676811527046561792",
                "typeId": null,
                "key": "treeEdit",
                "filename": "tree-edit.vue",
                "dir": "src/views/{sys}/{module}/{classVar}",
                "sub": "false",
                "override": "true",
                "path": "/template/codegen/view/treeEdit.ftl",
                "content": "<template>\n  <div>\n    <div v-if=\"readonly\">\n      <el-form :label-width=\"formLabelWidth\">\n\t<#list commonList as col>\n\t<#assign colName=col.colName>\n        <el-form-item label=\"${col.comment}:\" prop=\"${colName}\">\n          <span>{{ form.${colName} }}</span>\n        </el-form-item>\n\t</#list>  \n      </el-form>\n    </div>\n    <ibps-container v-else type=\"full\" header-background-color class=\"page\">\n      <template slot=\"header\">\n        <el-button type=\"primary\" icon=\"ibps-icon-save\" @click=\"handleSave()\">保存</el-button>\n      </template>\n      <el-form ref=\"${classVar}Form\" :model=\"form\" :rules=\"rules\" :label-width=\"formLabelWidth\">\n\t<#list commonList as col>\n\t<#assign colName=col.colName>\n        <el-form-item label=\"${col.comment}:\" prop=\"${colName}\">\n          <el-input v-model=\"form.${colName}\"/>\n        </el-form-item>\n\t</#list>  \n      </el-form>\n    </ibps-container>\n  </div>\n</template>\n<script>\nimport { save, get } from '@/api/${sys}/${module}/${classVar}'\nimport ActionUtils from '@/utils/action'\n// import { validateKey, validateEmpty } from '@/utils/validate'\n\nexport default {\n  props: {\n    id: [String, Number],\n    parentId: [String, Number],\n    readonly: {\n      type: Boolean,\n      default: false\n    }\n  },\n  data() {\n    return {\n      formName: '${classVar}Form',\n      formLoading: false,\n      formLabelWidth: '120px',\n      formId: '',\n      clientHeight: '',\n      optionsWidth: '',\n      defaultForm: {},\n      form: {\n\t\t<#list colList as col>\n        ${col.colName}: ''<#if (col_has_next)>,</#if>\n\t\t</#list>\n      },\n      rules: {\n      \t<#assign tmp=0>\n      \t<#list commonList as col>\n      \t<#assign index=col_index?if_exists>\n\t      <#if col.isNotNull>\n          <#if (tmp>0)>,</#if>${col.colName}: [{ required: true, message: this.$t('validate.required') }]\n          <#assign tmp=tmp+1>\n\t      </#if>\n      \t</#list>\n      }\n    }\n  },\n  // 监听\n  watch: {\n    id: {\n      handler: function(val, oldVal) {\n        this.formId = this.id\n\n        this.getFormData()\n      },\n      immediate: true\n    }\n  },\n  created() {\n    this.defaultForm = JSON.parse(JSON.stringify(this.form))\n  },\n  methods: {\n    getWidth(even) {\n      this.optionsWidth = even.srcElement.clientWidth + 'px'\n    },\n    // 保存数据\n    handleSave() {\n      this.$refs[this.formName].validate(valid => {\n        if (valid) {\n          this.saveData()\n        } else {\n          ActionUtils.saveErrorMessage()\n        }\n      })\n    },\n    // 提交保存数据\n    saveData() {\n      const data = this.form\n      save(data).then(response => {\n        this.$emit('callback', this)\n        ActionUtils.saveSuccessMessage(response.message, (rtn) => {\n          if (this.$utils.isEmpty(this.formId)) {\n            this.$refs[this.formName].resetFields()\n          }\n          this.$emit('success', rtn)\n        })\n      }).catch((err) => {\n        console.info(err)\n      })\n    },\n    // 获取编辑数据\n    getFormData() {\n      if (this.$utils.isEmpty(this.formId)) {\n        // 页面渲染完后初始化表单\n        this.$nextTick(() => {\n          // 重置表单\n          this.form = JSON.parse(JSON.stringify(this.defaultForm))\n          this.form.${convertUnderLine(model.variables.pidKey)} = this.parentId\n          this.formValidate()\n        })\n      } else {\n        this.formLoading = true\n        get({ id: this.formId }).then(response => {\n          this.form = response.data\n          if (!this.readonly) {\n            this.formValidate()\n          }\n          this.formLoading = false\n        }).catch(() => {\n          this.formLoading = false\n        })\n      }\n    },\n    /**\n     * 表单验证\n     */\n    formValidate() {\n      this.$nextTick(() => {\n        this.$refs[this.formName].validate(() => {})\n      })\n    }\n  }\n}\n</script>\n\n",
                "comment": null,
                "isDef": "Y",
                "creator": "654384477392338944",
                "typeName": null,
                "creatorName": "tom"
            },
            {
                "pk": "",
                "name": "tree",
                "ip": null,
                "createBy": null,
                "createTime": 1581406043000,
                "updateBy": null,
                "updateTime": null,
                "tenantId": null,
                "dataStatus": null,
                "dbtype": null,
                "id": "676811526987841536",
                "typeId": null,
                "key": "tree",
                "filename": "manage.vue",
                "dir": "src/views/{sys}/{module}/{classVar}",
                "sub": "false",
                "override": "true",
                "path": "/template/codegen/view/tree.ftl",
                "content": "<template>\n  <ibps-layout ref=\"layout\">\n    <div slot=\"west\">\n      <ibps-tree\n        ref=\"tree\"\n        :width=\"width\"\n        :height=\"height\"\n        :data=\"${classVar}TreeData\"\n        :options=\"${classVar}Treeoptions\"\n        :contextmenus=\"${classVar}TreeContextmenus\"\n        title=\"${comment}管理\"\n        @action-event=\"handleTreeAction\"\n        @node-click=\"handleNodeClick\"\n        @expand-collapse=\"handleExpandCollapse\"\n      />\n      <ibps-container\n        :margin-left=\"width+'px'\"\n        class=\"page\"\n      >\n        <edit\n          v-if=\"show==='edit'\"\n          :id=\"${classVar}Pk\"\n          :parent-id=\"parentId\"\n          :readonly=\"readonly\"\n          @callback=\"loadTreeData\"\n        />\n\n        <el-alert\n          v-else\n          :closable=\"false\"\n          title=\"尚未指定一个${comment}\"\n          type=\"warning\"\n          show-icon\n          style=\"height:50px;\"\n        />\n      </ibps-container>\n\n    </div>\n  </ibps-layout>\n</template>\n<script>\nimport { remove, getTreeData } from '@/api/${sys}/${module}/${classVar}'\nimport ActionUtils from '@/utils/action'\nimport FixHeight from '@/mixins/height'\nimport Edit from './tree-edit'\n\nexport default {\n  components: {\n    Edit\n  },\n  mixins: [FixHeight],\n  data() {\n    return {\n      show: '',\n      width: 230,\n      height: document.clientHeight,\n      readonly: false,\n      ${classVar}Pk: '',\n\n      // ${comment}树配置\n      ${classVar}Treeoptions: {\n        nodeKey: '${convertUnderLine(model.variables.idKey)}',\n        pidKey: '${convertUnderLine(model.variables.pidKey)}',\n        props: {\n          label: '${convertUnderLine(model.variables.key)}'\n        }\n      },\n      ${classVar}TreeContextmenus: [\n        { icon: 'add', label: '添加', value: 'add' },\n        { icon: 'edit', label: '编辑', value: 'edit', rights: ['node'] },\n        { icon: 'remove', label: '删除', value: 'remove', rights: ['node'] }\n      ],\n      ${classVar}TreeData: []\n    }\n  },\n  created() {\n    this.loadTreeData()\n  },\n  methods: {\n    handleTreeAction(command, position, selection, data) {\n      if (position === 'toolbar') {\n        if (command === 'refresh') {\n          this.loadTreeData()\n        }\n      } else {\n        const id = data.${convertUnderLine(model.variables.idKey)}\n        switch (command) {\n          case 'add':// 添加\n            this.handleEdit('', id)\n            break\n          case 'edit':// 编辑\n            this.handleEdit(id)\n            break\n          case 'remove':// 删除\n            ActionUtils.removeRecord(id).then((ids) => {\n              this.handleRemove(ids)\n            }).catch(() => { })\n            break\n          default:\n            break\n        }\n      }\n    },\n    // 添加 编辑\n    handleEdit(id = '', parentId) {\n      this.show = 'edit'\n      this.readonly = false\n      this.${classVar}Pk = id\n      this.parentId = parentId\n    },\n    // 处理删除\n    handleRemove(ids) {\n      remove({ ids: ids }).then(response => {\n        ActionUtils.removeSuccessMessage()\n        this.loadTreeData()\n      }).catch(() => {})\n    },\n    // 树点击\n    handleNodeClick(data) {\n      if (data.${convertUnderLine(model.variables.idKey)} === 0 || data.${convertUnderLine(model.variables.idKey)} === '0') {\n        this.show = 'empty'\n        return\n      }\n      this.readonly = true\n      this.${classVar}Pk = data.${convertUnderLine(model.variables.idKey)} + ''\n      this.parentId = data.${convertUnderLine(model.variables.pidKey)} + ''\n      this.show = 'edit'\n    },\n    handleExpandCollapse(isExpand) {\n      this.width = isExpand ? 230 : 30\n    },\n    loadTreeData() {\n      getTreeData({\n        parameters: [],\n        requestPage: {},\n        sorts: []\n      }).then(response => {\n        const data = response.data\n        this.${classVar}TreeData = data\n      }).catch(() => {\n      })\n    },\n    // 查询\n    search() {\n      this.loadTreeData()\n    }\n  }\n}\n</script>\n\n\n",
                "comment": null,
                "isDef": "Y",
                "creator": "654384477392338944",
                "typeName": null,
                "creatorName": "tom"
            },
            {
                "pk": "",
                "name": "edit",
                "ip": null,
                "createBy": null,
                "createTime": 1581406043000,
                "updateBy": null,
                "updateTime": null,
                "tenantId": null,
                "dataStatus": null,
                "dbtype": null,
                "id": "676811526908149760",
                "typeId": null,
                "key": "edit",
                "filename": "edit.vue",
                "dir": "src/views/{sys}/{module}/{classVar}",
                "sub": "false",
                "override": "true",
                "path": "/template/codegen/view/edit.ftl",
                "content": "<template>\n  <el-dialog\n    :title=\"title\"\n    :visible.sync=\"dialogVisible\"\n    :close-on-click-modal=\"false\"\n    class=\"dialog\"\n    @open=\"getFormData\"\n    @close=\"closeDialog\"\n  >\n    <el-form\n      ref=\"form\"\n      v-loading=\"dialogLoading\"\n      :rules=\"rules\"\n      :element-loading-text=\"$t('common.loading')\"\n      :model=\"form\"\n      :label-width=\"formLabelWidth\"\n    >\n\t<#list commonList as col>\n\t<#assign colName=col.colName>\n      <el-form-item label=\"${col.comment}:\" prop=\"${colName}\">\n        <el-input v-if=\"!readonly\" v-model=\"form.${colName}\" />\n        <span v-else>{{ form.${colName} }}</span>\n      </el-form-item>\n\t</#list>  \n    </el-form>\n    <div slot=\"footer\" class=\"el-dialog--center\">\n      <ibps-toolbar\n        :actions=\"toolbars\"\n        @action-event=\"handleActionEvent\"\n      />\n    </div>\n  </el-dialog>\n</template>\n\n<script>\nimport { save, get } from '@/api/${sys}/${module}/${classVar}'\nimport ActionUtils from '@/utils/action'\n// import { validateKey } from '@/utils/validate'\n\nexport default {\n  props: {\n    visible: {\n      type: Boolean,\n      default: false\n    },\n    readonly: {\n      type: Boolean,\n      default: false\n    },\n    id: String,\n    title: String\n  },\n  data() {\n    return {\n      formName: 'form',\n      formLabelWidth: '120px',\n      dialogVisible: this.visible,\n      dialogLoading: false,\n      defaultForm: {},\n      defaulRules: {},\n      form: {\n\t\t<#list colList as col>\n        ${col.colName}: ''<#if (col_has_next)>,</#if>\n\t\t</#list>\n      },\n      rules: {\n      \t<#assign index=0>\n      \t<#list commonList as col>\n\t      <#if col.isNotNull>\n          <#if (index>0)>,</#if>${col.colName}: [{ required: true, message: this.$t('validate.required') }]\n          <#assign index=index+1>\n\t      </#if>\n      \t</#list>\n        // id: [{ required: true, message: this.$t('validate.required') }, { validator: validateKey, trigger: 'blur' }],\n      },\n      toolbars: [\n        { key: 'save', hidden: () => { return this.readonly } },\n        { key: 'cancel' }\n      ]\n    }\n  },\n  computed: {\n    formId() {\n      return this.id\n    }\n  },\n  watch: {\n    visible: {\n      handler: function(val, oldVal) {\n        this.dialogVisible = this.visible\n      },\n      immediate: true\n    }\n  },\n  created() {\n    this.defaultForm = JSON.parse(JSON.stringify(this.form))\n    this.defaulRules = JSON.parse(JSON.stringify(this.rules))\n  },\n  methods: {\n    handleActionEvent({ key }) {\n      switch (key) {\n        case 'save':\n          this.handleSave()\n          break\n        case 'cancel':\n          this.closeDialog()\n          break\n        default:\n          break\n      }\n    },\n    /**\n     * 表单验证\n     */\n    formValidate() {\n      if (this.readonly) return\n      this.$nextTick(() => {\n        this.$refs[this.formName].validate(() => {})\n      })\n    },\n    // 保存数据\n    handleSave() {\n      this.$refs[this.formName].validate(valid => {\n        if (valid) {\n          this.saveData()\n        } else {\n          ActionUtils.saveErrorMessage()\n        }\n      })\n    },\n    // 提交保存数据\n    saveData() {\n      console.info(this.form)\n      save(this.form).then(response => {\n        this.$emit('callback', this)\n        ActionUtils.saveSuccessMessage(response.message, (rtn) => {\n          if (this.$utils.isEmpty(this.formId)) {\n            this.$refs[this.formName].resetFields()\n          }\n          if (rtn) {\n            this.closeDialog()\n          }\n        })\n      }).catch((err) => {\n        console.info(err)\n      })\n    },\n    // 关闭当前窗口\n    closeDialog() {\n      this.$emit('close', false)\n      this.$refs[this.formName].resetFields()\n    },\n    /**\n     * 获取表单数据\n     */\n    getFormData() {\n      if (this.readonly) {\n        this.rules = {}\n      } else {\n        this.rules = this.defaulRules\n      }\n      if (this.$utils.isEmpty(this.formId)) {\n        // 重置表单\n        this.form = JSON.parse(JSON.stringify(this.defaultForm))\n        this.formValidate()\n        return\n      }\n      this.dialogLoading = true\n      get({\n        id: this.formId\n      }).then(response => {\n        this.form = response.data\n        this.dialogLoading = false\n      }).catch(() => {\n        this.dialogLoading = false\n      })\n    }\n  }\n\n}\n</script>\n\n",
                "comment": null,
                "isDef": "Y",
                "creator": "654384477392338944",
                "typeName": null,
                "creatorName": "tom"
            }
        ],
        "pageResult": {
            "limit": 3,
            "page": 1,
            "totalCount": 23,
            "totalPages": 8
        }
    }
}返回参数说明:
| 名称 | 类型 | 备注 | 
|---|---|---|
| data | APIPageList< TemplatePo > | 代码模板 | 
删除代码模板数据
简述:
- 删除代码模板数据
 
请求URL:
- http://ip:port/ibps/platform/v3/codegen/template/remove
 - URL中的ip需要替换为自己网关ip
 - URL中的port需要替换为自己网关端口
 
请求方式:
- POST
 
请求参数:
- Headers:
 
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 | 
|---|---|---|---|---|---|
| X-Authorization-access_token | String | 是 | 系统令牌 | 
- Query:
 
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 | 
|---|---|---|---|---|---|
| ids | string[] | 是 | 代码模板id | 
- Body:
 
暂无
请求参数示例:
http://192.168.3.230:15100/ibps/business/v3/codegen/template/remove?ids=676813672173010944返回示例:
{
    "state": 200,
    "request": null,
    "message": "",
    "cause": "",
    "variables": {},
    "data": null
}返回参数说明:
| 名称 | 类型 | 备注 | 
|---|---|---|
| data | Void | 
保存模板
简述:
- 保存模板
 
请求URL:
- http://ip:port/ibps/platform/v3/codegen/template/save
 - URL中的ip需要替换为自己网关ip
 - URL中的port需要替换为自己网关端口
 
请求方式:
- POST
 
请求参数:
- Headers:
 
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 | 
|---|---|---|---|---|---|
| X-Authorization-access_token | String | 是 | 系统令牌 | 
- Query:
 
暂无
- Body:
 
TemplatePo 对象信息
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 
|---|---|---|---|---|
| id | String | 否 | 主键 | |
| typeId | String | 否 | 分类 | |
| key | String | 是 | 模板key | |
| name | String | 是 | 模板名称 | |
| filename | String | 是 | 文件名 | |
| dir | String | 是 | 代码目录 | |
| sub | String | 是 | 是否子表 | |
| override | String | 是 | 是否覆盖 | |
| path | String | 否 | 模板路径 | |
| content | String | 否 | 模板内容 | |
| comment | String | 否 | 描述 | |
| isDef | String | 是 | 是否默认 | |
| creator | String | 是 | 创建人 | |
| createTime | Date | 否 | 创建时间 | |
| typeName | String | 否 | 分类名称 | |
| creatorName | String | 否 | 创建人 | 
请求参数示例:
{
    "key": "test",
    "name": "test",
    "filename": "test",
    "dir": "test",
    "sub": "true",
    "override": "true",
    "path": "",
    "content": "test",
    "comment": "",
    "id": "",
    "isDef": "N",
    "creator": "654384477392338944",
    "createTime": null
}返回示例:
{
    "state": 200,
    "request": null,
    "message": "保存模板成功!",
    "cause": "",
    "variables": {},
    "data": null
}返回参数说明:
| 名称 | 类型 | 备注 | 
|---|---|---|
| data | Void | 
设置分类
简述:
- 设置分类
 
请求URL:
- http://ip:port/ibps/platform/v3/codegen/template/setCategory
 - URL中的ip需要替换为自己网关ip
 - URL中的port需要替换为自己网关端口
 
请求方式:
- POST
 
请求参数:
- Headers:
 
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 | 
|---|---|---|---|---|---|
| X-Authorization-access_token | String | 是 | 系统令牌 | 
- Query:
 
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 | 
|---|---|---|---|---|---|
| templateIds | string | 是 | 代码模板id | ||
| typeId | string | 是 | 分类id | 
- Body:
 
暂无
请求参数示例:
http://192.168.3.230:15100/ibps/business/v3/codegen/template/setCategory?templateIds=676815159099916288&typeId=386814138233389054返回示例:
{
    "state": 200,
    "request": null,
    "message": "",
    "cause": "",
    "variables": {},
    "data": null
}返回参数说明:
| 名称 | 类型 | 备注 | 
|---|---|---|
| data | Void | 
获取模板列表
简述:
- 获取模板列表
 
请求URL:
- http://ip:port/ibps/platform/v3/codegen/template/templateByTypeListJson
 - URL中的ip需要替换为自己网关ip
 - URL中的port需要替换为自己网关端口
 
请求方式:
- GET
 
请求参数:
- Headers:
 
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 | 
|---|---|---|---|---|---|
| X-Authorization-access_token | String | 是 | 系统令牌 | 
- Query:
 
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 | 
|---|---|---|---|---|---|
| typeId | string | 是 | 代码模板id | 
- Body:
 
暂无
请求参数示例:
http://192.168.3.230:15100/ibps/business/v3/codegen/template/templateByTypeListJson?typeId=386814138233389054返回示例:
{
    "state": 200,
    "request": null,
    "message": "",
    "cause": "",
    "variables": {},
    "data": [
        {
            "pk": "",
            "name": "test",
            "ip": null,
            "createBy": null,
            "createTime": 1581406909000,
            "updateBy": null,
            "updateTime": null,
            "tenantId": null,
            "dataStatus": null,
            "dbtype": null,
            "id": "676815159099916288",
            "typeId": "386814138233389054",
            "key": "test",
            "filename": "test",
            "dir": "test",
            "sub": "true",
            "override": "true",
            "path": "",
            "content": "test",
            "comment": "",
            "isDef": "N",
            "creator": "654384477392338944",
            "typeName": null,
            "creatorName": "tom"
        }
    ]
}返回参数说明:
| 名称 | 类型 | 备注 | 
|---|---|---|
| data | List< TemplatePo > | 代码模板 | 
获取模板列表
简述:
- 获取模板列表
 
请求URL:
- http://ip:port/ibps/platform/v3/codegen/template/templateList
 - URL中的ip需要替换为自己网关ip
 - URL中的port需要替换为自己网关端口
 
请求方式:
- POST
 
请求参数:
- Headers:
 
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 | 
|---|---|---|---|---|---|
| X-Authorization-access_token | String | 是 | 系统令牌 | 
- Query:
 
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 | 
|---|---|---|---|---|---|
| key | string | 是 | 代码模板KEY | ||
| keys | string | 是 | 代码模板id | 
- Body:
 
暂无
请求参数示例:
http://192.168.3.230:15100/ibps/business/v3/codegen/template/templateList?key=test&keys=676815159099916288返回示例:
{
    "state": 200,
    "request": null,
    "message": "",
    "cause": "",
    "variables": {},
    "data": [
        {
            "id": "test",
            "text": "test"
        }
    ]
}返回参数说明:
| 名称 | 类型 | 备注 | 
|---|---|---|
| data | List<Map<String, String>> | 
备注
- [1] : APIRequest为动态查询请求对象,详情请移步全局请求格式