作者:管理员 历史版本:1 最后编辑:龚清 更新时间:2024-11-20 15:41
获取生成类型列表
简述:
- 获取生成类型列表
请求URL:
- http://ip:port/ibps/platform/v3/codegen/do/type/doTypeGroupList
- URL中的ip需要替换为自己网关ip
- URL中的port需要替换为自己网关端口
请求方式:
- GET
请求参数:
- Headers:
名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
---|---|---|---|---|---|
X-Authorization-access_token | String | 是 | 系统令牌 |
- Query:
名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
---|---|---|---|---|---|
key | String | 是 | 模板key | ||
keys | String | 是 | 传入查询请求json字符串 |
- Body:
暂无
请求参数示例:
http://192.168.3.230:15100/ibps/business/v3/codegen/do/type/doTypeGroupList?key=dao&keys=treeView
返回示例:
{
"state": 200,
"request": null,
"message": "",
"cause": "",
"variables": {},
"data": [
{
"children": [],
"text": "DoTypeKeys"
},
{
"children": [
{
"id": "dao",
"text": "dao"
}
],
"text": "DoType"
}
]
}
返回参数说明:
名称 | 类型 | 备注 |
---|---|---|
data | List<Map<String, Object>> |
获取生成类型列表
简述:
- 获取生成类型列表
请求URL:
- http://ip:port/ibps/platform/v3/codegen/do/type/doTypeList
- URL中的ip需要替换为自己网关ip
- URL中的port需要替换为自己网关端口
请求方式:
- GET
请求参数:
- Headers:
名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
---|---|---|---|---|---|
X-Authorization-access_token | String | 是 | 系统令牌 |
- Query:
名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
---|---|---|---|---|---|
key | String | 是 | 模板key | ||
keys | String | 是 | 传入查询请求json字符串 | ||
subType | String | 否 | 子分类 |
- Body:
暂无
请求参数示例:
http://192.168.3.230:15100/ibps/business/v3/codegen/do/type/doTypeList?key=dao&keys=treeView&subType=
返回示例:
{
"state": 200,
"request": null,
"message": "",
"cause": "",
"variables": {},
"data": [
{
"id": "dao",
"text": "dao"
}
]
}
返回参数说明:
名称 | 类型 | 备注 |
---|---|---|
data | List<Map<String, String>> |
获取生成类型列表json
简述:
- 获取生成类型列表json
请求URL:
- http://ip:port/ibps/platform/v3/codegen/do/type/doTypeListJson
- URL中的ip需要替换为自己网关ip
- URL中的port需要替换为自己网关端口
请求方式:
- GET
请求参数:
- Headers:
名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
---|---|---|---|---|---|
X-Authorization-access_token | String | 是 | 系统令牌 |
- Query:
名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
---|---|---|---|---|---|
subType | String | 否 | 子分类 | ||
typeId | String | 否 | 分类id |
- Body:
暂无
请求参数示例:
http://192.168.3.230:15100/ibps/business/v3/codegen/do/type/doTypeListJson?subType=template&typeId=
返回示例:
{
"state": 200,
"request": null,
"message": "",
"cause": "",
"variables": {},
"data": [
{
"pk": "",
"name": "数据操作层",
"ip": null,
"createBy": null,
"createTime": 1488704737000,
"updateBy": null,
"updateTime": null,
"tenantId": "-999",
"dataStatus": null,
"dbtype": null,
"id": "386814138233389054",
"typeId": null,
"key": "dao",
"subType": "template",
"subKeys": "daoTest,queryDaoImpl,queryDao,daoImpl,dao,baseTest",
"isDef": "false",
"comment": null,
"creator": "1",
"typeName": null,
"creatorName": "管理员"
},
{
"pk": "",
"name": "树型视图",
"ip": null,
"createBy": null,
"createTime": 1512265220000,
"updateBy": null,
"updateTime": null,
"tenantId": "-999",
"dataStatus": null,
"dbtype": null,
"id": "386814138233389056",
"typeId": null,
"key": "treeView",
"subType": "template",
"subKeys": "web,tree,edit,flowEdit,get",
"isDef": "false",
"comment": null,
"creator": "1",
"typeName": null,
"creatorName": "管理员"
},
{
"pk": "",
"name": "领域层",
"ip": null,
"createBy": null,
"createTime": 1488704866000,
"updateBy": null,
"updateTime": null,
"tenantId": "-999",
"dataStatus": null,
"dbtype": null,
"id": "386814138233389057",
"typeId": null,
"key": "domain",
"subType": "template",
"subKeys": "repositoryImpl,repository,domain,domainTest",
"isDef": "false",
"comment": null,
"creator": "1",
"typeName": null,
"creatorName": "管理员"
},
{
"pk": "",
"name": "服务层",
"ip": null,
"createBy": null,
"createTime": 1489743454000,
"updateBy": null,
"updateTime": null,
"tenantId": "-999",
"dataStatus": null,
"dbtype": null,
"id": "386814138233389058",
"typeId": null,
"key": "service",
"subType": "template",
"subKeys": "serviceImpl,serviceXml,queryServiceImpl,queryServiceXml",
"isDef": "false",
"comment": null,
"creator": "1",
"typeName": null,
"creatorName": "管理员"
},
{
"pk": "",
"name": "视图层",
"ip": null,
"createBy": null,
"createTime": 1488683494000,
"updateBy": null,
"updateTime": null,
"tenantId": "-999",
"dataStatus": null,
"dbtype": null,
"id": "386814138233389060",
"typeId": null,
"key": "view",
"subType": "template",
"subKeys": "web,list,edit,flowEdit,get",
"isDef": "false",
"comment": null,
"creator": "1",
"typeName": null,
"creatorName": "管理员"
},
{
"pk": "",
"name": "控制层",
"ip": null,
"createBy": null,
"createTime": 1488704627000,
"updateBy": null,
"updateTime": null,
"tenantId": "-999",
"dataStatus": null,
"dbtype": null,
"id": "386814138233389062",
"typeId": null,
"key": "controller",
"subType": "template",
"subKeys": "controller",
"isDef": "false",
"comment": null,
"creator": "1",
"typeName": null,
"creatorName": "管理员"
},
{
"pk": "",
"name": "模型层",
"ip": null,
"createBy": null,
"createTime": 1488704712000,
"updateBy": null,
"updateTime": null,
"tenantId": "-999",
"dataStatus": null,
"dbtype": null,
"id": "386814138233389063",
"typeId": null,
"key": "db",
"subType": "template",
"subKeys": "mapping,tbl,po",
"isDef": "false",
"comment": null,
"creator": "1",
"typeName": null,
"creatorName": "管理员"
},
{
"pk": "",
"name": "接口层",
"ip": null,
"createBy": null,
"createTime": 1512983487000,
"updateBy": null,
"updateTime": null,
"tenantId": "-999",
"dataStatus": null,
"dbtype": null,
"id": "389826701045006336",
"typeId": null,
"key": "api",
"subType": "template",
"subKeys": "service,queryService",
"isDef": "false",
"comment": null,
"creator": "1",
"typeName": null,
"creatorName": "管理员"
},
{
"pk": "",
"name": "服务层",
"ip": null,
"createBy": null,
"createTime": 1512983487000,
"updateBy": null,
"updateTime": null,
"tenantId": "-999",
"dataStatus": null,
"dbtype": null,
"id": "389826701045006337",
"typeId": null,
"key": "provider",
"subType": "template",
"subKeys": "provider,queryProvider",
"isDef": "false",
"comment": null,
"creator": "1",
"typeName": null,
"creatorName": "管理员"
},
{
"pk": "",
"name": "消费层",
"ip": null,
"createBy": null,
"createTime": 1512983487000,
"updateBy": null,
"updateTime": null,
"tenantId": "-999",
"dataStatus": null,
"dbtype": null,
"id": "389826701045006338",
"typeId": null,
"key": "consumer",
"subType": "template",
"subKeys": "consumer,consumerXml,queryConsumer,queryConsumerXml",
"isDef": "false",
"comment": null,
"creator": "1",
"typeName": null,
"creatorName": "管理员"
}
]
}
返回参数说明:
名称 | 类型 | 备注 |
---|---|---|
data | List< DoTypePo > | 代码生成器-生成类型 |
获取生成类型/模板列表
简述:
- 获取生成类型/模板列表
请求URL:
- http://ip:port/ibps/platform/v3/codegen/do/type/doTypeOrTemplateListJson
- URL中的ip需要替换为自己网关ip
- URL中的port需要替换为自己网关端口
请求方式:
- GET
请求参数:
- Headers:
名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
---|---|---|---|---|---|
X-Authorization-access_token | String | 是 | 系统令牌 |
- Query:
名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
---|---|---|---|---|---|
doTypeId | String | 否 | 生成类型id | ||
subType | String | 是 | 生成类型id | ||
typeId | String | 否 | 分类id |
- Body:
暂无
请求参数示例:
http://192.168.3.230:15100/ibps/business/v3/codegen/do/type/doTypeOrTemplateListJson?doTypeId=&subType=template&typeId=
返回示例:
{
"state": 200,
"request": null,
"message": "",
"cause": "",
"variables": {},
"data": [
{
"name": "function",
"key": "function"
},
{
"name": "variable",
"key": "variable"
},
{
"name": "baseTest",
"key": "baseTest"
},
{
"name": "mapping",
"key": "mapping"
},
{
"name": "tbl",
"key": "tbl"
},
{
"name": "po",
"key": "po"
},
{
"name": "dao",
"key": "dao"
},
{
"name": "daoImpl",
"key": "daoImpl"
},
{
"name": "queryDao",
"key": "queryDao"
},
{
"name": "queryDaoImpl",
"key": "queryDaoImpl"
},
{
"name": "daoTest",
"key": "daoTest"
},
{
"name": "domain",
"key": "domain"
},
{
"name": "domainTest",
"key": "domainTest"
},
{
"name": "repository",
"key": "repository"
},
{
"name": "repositoryImpl",
"key": "repositoryImpl"
},
{
"name": "api",
"key": "api"
},
{
"name": "client",
"key": "client"
},
{
"name": "provider",
"key": "provider"
},
{
"name": "web",
"key": "web"
},
{
"name": "list",
"key": "list"
},
{
"name": "edit",
"key": "edit"
},
{
"name": "tree",
"key": "tree"
},
{
"name": "treeEdit",
"key": "treeEdit"
}
]
}
返回参数说明:
名称 | 类型 | 备注 |
---|---|---|
data | List<Map<String, Object>> |
获取生成类型信息
简述:
- 获取生成类型信息
请求URL:
- http://ip:port/ibps/platform/v3/codegen/do/type/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/do/type/get?id=386814138233389054
返回示例:
{
"state": 200,
"request": null,
"message": "",
"cause": "",
"variables": {
"doTypeList": null,
"templateList": [
{
"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": "黄春艳"
},
{
"pk": "",
"name": "variable",
"ip": null,
"createBy": null,
"createTime": 1576823453000,
"updateBy": null,
"updateTime": null,
"tenantId": "-999",
"dataStatus": null,
"dbtype": null,
"id": "657590755233103872",
"typeId": null,
"key": "variable",
"filename": "-",
"dir": "-",
"sub": "false",
"override": "true",
"path": "/template/codegen/variable.ftl",
"content": "<#-- 获取配置文件变量,使用include包含到各模板中,include之前必须import函数模板(function.ftl) -->\n<#-- common -->\n<#assign class=model.variables.class>\n<#assign classVar=model.variables.classVar>\n<#assign sys=model.variables.sys>\n<#assign scAlias=vars.scAlias>\n<#assign scPlatform=vars.scPlatform>\n<#assign cAlias=vars.cAlias>\n<#assign cPlatform=vars.cPlatform>\n<#assign app=model.variables.app>\n<#assign module=model.variables.module>\n<#assign comment=model.tabComment>\n<#assign sub=model.sub>\n<#assign subTableList=model.subTableList>\n<#assign hasSub=model.hasSub>\n<#assign pkModel=model.pkModel>\n<#assign pk=getPk(model) >\n<#assign pkVar=getPkVar(model) >\n<#assign pkType=getPkType(model)>\n<#assign isBaseModule=model.variables.isBaseModule>\n<#assign isGenSub=model.variables.isGenSub>\n<#assign dsAlias=model.variables.dsAlias>\n<#assign layer=model.layerTemplate>\n<#assign gatewayMapping=model.variables.gatewayMapping>\n\n<#-- db -->\n<#assign po=class + \"Po\">\n<#assign tableName=model.tableName>\n<#assign boId=model.boId>\n\n<#if isBaseModule = 'true'>\n<#assign namespace=\"com.\"+cAlias+\".\"+cPlatform+\".\"+sys + \".persistence.entity.\" +po>\n<#else>\n<#assign namespace=\"com.\"+cAlias+\".\"+cPlatform+\".\"+sys+\".\" + module + \".persistence.entity.\" +po>\n</#if>\n<#assign colList=model.columnList><#-- 含PK列 -->\n<#assign commonList=model.commonList><#-- 不含PK列 -->\n\n<#-- test -->\n<#assign baseClass=model.variables.baseClass>\n<#assign poVar=classVar + \"Po\">\n",
"comment": null,
"isDef": "Y",
"creator": "654755459927900160",
"typeName": null,
"creatorName": "黄春艳"
},
{
"pk": "",
"name": "baseTest",
"ip": null,
"createBy": null,
"createTime": 1576823454000,
"updateBy": null,
"updateTime": null,
"tenantId": "-999",
"dataStatus": null,
"dbtype": null,
"id": "657590755337961472",
"typeId": null,
"key": "baseTest",
"filename": "{baseClass}BaseTest.java",
"dir": "src/test/java/com/{cAlias}/{cPlatform}/{sys}",
"sub": "false",
"override": "true",
"path": "/template/codegen/test/baseTest.ftl",
"content": "package com.${cAlias}.${cPlatform}.${sys};\n\nimport javax.annotation.Resource;\n\nimport org.springframework.test.context.ContextConfiguration;\n\nimport com.${scAlias}.${scPlatform}.base.framework.test.BaseTestCase;\nimport com.${scAlias}.${scPlatform}.api.base.id.IdGenerator;\n\n/**\n * 测试基类。</br>\n * 模块其下的测试类均继承该子类\n *\n *<pre> \n <#if vars.company?exists>\n * 开发公司:${vars.company}\n </#if>\n <#if vars.developer?exists>\n * 开发人员:${vars.developer}\n </#if>\n <#if vars.email?exists>\n * 邮箱地址:${vars.email}\n </#if>\n * 创建时间:${date?string(\"yyyy-MM-dd HH:mm:ss\")}\n *</pre>\n */\n@ContextConfiguration({\"classpath:conf/${sys}-test.xml\"})\npublic class ${baseClass}BaseTest extends BaseTestCase{\n\t\n\t@Resource\n protected IdGenerator idGenerator;\n}\n",
"comment": null,
"isDef": "Y",
"creator": "654755459927900160",
"typeName": null,
"creatorName": "黄春艳"
},
{
"pk": "",
"name": "mapping",
"ip": null,
"createBy": null,
"createTime": 1576823454000,
"updateBy": null,
"updateTime": null,
"tenantId": "-999",
"dataStatus": null,
"dbtype": null,
"id": "657590755442819072",
"typeId": null,
"key": "mapping",
"filename": "{class}.map.xml",
"dir": "src/main/resources/com/{cAlias}/{cPlatform}/{module}/persistence/mapping",
"sub": "true",
"override": "true",
"path": "/template/codegen/mapping/mapping.ftl",
"content": "<#assign foreignKey=model.foreignKey>\n<#-- 模板开始 -->\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE mapper PUBLIC \"-//mybatis.org//DTD Mapper 3.0//EN\" \"http://mybatis.org/dtd/mybatis-3-mapper.dtd\">\n<mapper namespace=\"${namespace}\">\n\t<!--<cache type=\"net.oschina.j2cache.mybatis.J2CacheAdapter\"/>-->\n\t<resultMap id=\"${po}\" type=\"${namespace}\">\n\t\t<id property=\"${model.pkModel.colName}\" column=\"${model.pkModel.columnName?upper_case}\" jdbcType=\"${getJdbcType2(model.pkModel.colDbType)}\"/>\n\t\t<#list colList as col>\n\t\t<#if (!col.isPK)>\n\t\t<result property=\"${col.colName}\" column=\"${col.columnName?upper_case}\" jdbcType=\"${getJdbcType2(col.colDbType)}\"/>\n\t\t</#if>\n\t\t</#list>\n\t</resultMap>\n\t\n\t<sql id=\"columns\">\n\t\t<#list colList as col>${col.columnName?upper_case}<#if col_has_next>,</#if></#list>\n\t</sql>\n\t\n\t<insert id=\"create\" parameterType=\"${namespace}\">\n\t\tINSERT INTO ${tableName?upper_case}\n\t\t(<include refid=\"columns\"/>)\n\t\tVALUES \n\t\t(<#list colList as col><#noparse>#{</#noparse>${col.colName},jdbcType=${getJdbcType2(col.colDbType)}<#noparse>}</#noparse><#if col_has_next>, </#if></#list>)\n\t</insert>\n\t\n\t<select id=\"get\" parameterType=\"java.lang.String\" resultMap=\"${po}\">\n\t\tSELECT <include refid=\"columns\"/> FROM ${tableName?upper_case} \n\t\tWHERE \n\t\t${pk?upper_case}=<#noparse>#{</#noparse>${model.pkModel.colName}}\n\t</select>\n\t\n\t<#--\n\t<select id=\"getLast\" resultMap=\"${po}\">\n \tselect <include refid=\"columns\"/> from ${tableName} where ${pk} = (select max(${pk}) from ${tableName})\n </select>\n\t-->\n\t\n\t<select id=\"query\" parameterType=\"java.util.Map\" resultMap=\"${po}\">\n\t\tSELECT <include refid=\"columns\"/> FROM ${tableName?upper_case}\n\t\t<where>\n\t\t\t<if test=\"@o.Ognl@isNotEmpty(whereSql)\">\n\t\t\t\t<#noparse>${</#noparse>whereSql}\n\t\t\t</if>\n\t\t</where>\n\t\t<if test=\"@o.Ognl@isNotEmpty(orderBySql)\">\n\t\t\tORDER BY <#noparse>${</#noparse>orderBySql}\n\t\t</if>\n\t\t<if test=\"@o.Ognl@isEmpty(orderBySql)\">\n\t\t\tORDER BY ${pk?upper_case} DESC\n\t\t</if>\n\t</select>\n\t\n\t<select id=\"findByIds\" resultMap=\"${po}\">\n\t\tSELECT <include refid=\"columns\"/> FROM ${tableName?upper_case}\n\t\t\tWHERE ${pk?upper_case} in \n\t\t\t<foreach item=\"id\" index=\"index\" collection=\"ids\" open=\"(\" separator=\",\" close=\")\"> \n\t\t\t\t<#noparse>#{id} </#noparse>\n\t\t\t</foreach> \t\t\n\t\t\tORDER BY ${pk?upper_case} DESC\t\t\t\n\t</select>\t\n\t\n\t<update id=\"update\" parameterType=\"${namespace}\">\n\t\tUPDATE ${tableName?upper_case} SET\n\t\t<#list commonList as col>\n\t\t<#if col.columnName?upper_case!=\"CREATE_BY_\" && col.columnName?upper_case!=\"CREATE_TIME_\">\n\t\t${col.columnName?upper_case}=<#noparse>#{</#noparse>${col.colName},jdbcType=${getJdbcType2(col.colDbType)}<#noparse>}</#noparse><#if col_has_next>,</#if>\n\t\t</#if>\n\t\t</#list>\n\t\tWHERE\n\t\t${pk?upper_case}=<#noparse>#{</#noparse>${model.pkModel.colName}}\n\t</update>\n\t\n\t<delete id=\"remove\" parameterType=\"java.lang.String\">\n\t\tDELETE FROM ${tableName?upper_case} \n\t\tWHERE\n\t\t${pk?upper_case}=<#noparse>#{</#noparse>${model.pkModel.colName}}\n\t</delete>\n\t\n\t<#if sub?exists && sub==true>\n\t<delete id=\"deleteByMainId\">\n\t DELETE FROM ${tableName?upper_case}\n\t WHERE\n\t ${foreignKey?upper_case}=<#noparse>#{</#noparse>mainId}\n\t</delete> \n\t\n\t<select id=\"findByMainId\" resultMap=\"${po}\">\n\t SELECT <include refid=\"columns\"/>\n\t FROM ${tableName?upper_case} \n\t WHERE ${foreignKey?upper_case}=<#noparse>#{</#noparse>mainId}\n\t</select>\n\t</#if>\n\t\n</mapper>\n",
"comment": null,
"isDef": "Y",
"creator": "654755459927900160",
"typeName": null,
"creatorName": "黄春艳"
},
{
"pk": "",
"name": "tbl",
"ip": null,
"createBy": null,
"createTime": 1576823454000,
"updateBy": null,
"updateTime": null,
"tenantId": "-999",
"dataStatus": null,
"dbtype": null,
"id": "657590755547676672",
"typeId": null,
"key": "tbl",
"filename": "{class}Tbl.java",
"dir": "src/main/java/com/{cAlias}/{cPlatform}/{sys}/{module}/persistence/entity",
"sub": "true",
"override": "true",
"path": "/template/codegen/entity/tbl.ftl",
"content": "<#if isBaseModule = 'true'>\npackage com.${cAlias}.${cPlatform}.${sys}.persistence.entity;\n<#else>\npackage com.${cAlias}.${cPlatform}.${sys}.${module}.persistence.entity;\n</#if>\n\nimport java.util.Date;\n<#if subtables?exists && subtables?size!=0>\nimport java.util.ArrayList;\nimport java.util.List;\n</#if>\n\nimport com.${scAlias}.${scPlatform}.base.framework.persistence.entity.AbstractPo;\nimport io.swagger.annotations.ApiModel;\nimport io.swagger.annotations.ApiModelProperty;\n\n/**\n * ${model.tabComment} 表对象\n * \n *<pre> \n <#if vars.company?exists>\n * 开发公司:${vars.company}\n </#if>\n <#if vars.developer?exists>\n * 开发人员:${vars.developer}\n </#if>\n <#if vars.email?exists>\n * 邮箱地址:${vars.email}\n </#if>\n * 创建时间:${date?string(\"yyyy-MM-dd HH:mm:ss\")}\n *</pre>\n */\n@SuppressWarnings(\"serial\")\n@ApiModel(value = \"${model.tabComment}对象\")\npublic class ${class}Tbl extends AbstractPo<String>{\n\t<#list model.columnList as col>\n\t<#if (col.colName!=\"createTime\" && col.colName!=\"updateTime\" && col.colName!=\"createBy\" && col.colName!=\"updateBy\")>\n\t<#if (col.colType==\"java.util.Date\") ||(col.colType==\"Date\")>\n\t<#if (col.paramsMap.datefmt?exists)>\n\t@com.fasterxml.jackson.annotation.JsonFormat(pattern = \"${col.paramsMap.datefmt}\")\n\t<#else>\n\t@com.fasterxml.jackson.annotation.JsonFormat(pattern = com.lc.ibps.base.core.constants.StringPool.DATE_FORMAT_DATETIME)\n\t</#if>\n\t</#if>\n\t@ApiModelProperty(value = \"${col.comment}\")\n\tprotected ${col.colType} ${col.colName}; \t\t/*${col.comment}*/\n\t</#if>\n\t</#list>\n\n<#if (model.pkModel??) && (pkModel.colName!=\"id\")>\n\t@Override\n\tpublic void setId(String ${pkModel.colName}) {\n\t\tthis.${pkModel.colName} = ${pkModel.colName};\n\t}\n\t@Override\n\tpublic String getId() {\n\t\treturn ${pkModel.colName};\n\t}\t\n</#if>\n<#list model.columnList as col>\n\t<#if (col.colName!=\"createTime\" && col.colName!=\"updateTime\" && col.colName!=\"createBy\" && col.colName!=\"updateBy\")>\n\tpublic void set${col.colName?cap_first}(${col.colType} ${col.colName}) \n\t{\n\t\tthis.${col.colName} = ${col.colName};\n\t}\n\t/**\n\t * 返回 ${col.comment}\n\t * @return\n\t */\n\tpublic ${col.colType} get${col.colName?cap_first}() \n\t{\n\t\treturn this.${col.colName};\n\t}\n\t</#if>\n</#list>\n\t\n}\n",
"comment": null,
"isDef": "Y",
"creator": "654755459927900160",
"typeName": null,
"creatorName": "黄春艳"
},
{
"pk": "",
"name": "po",
"ip": null,
"createBy": null,
"createTime": 1576823454000,
"updateBy": null,
"updateTime": null,
"tenantId": "-999",
"dataStatus": null,
"dbtype": null,
"id": "657590755652534272",
"typeId": null,
"key": "po",
"filename": "{class}Po.java",
"dir": "src/main/java/com/{cAlias}/{cPlatform}/{sys}/{module}/persistence/entity",
"sub": "true",
"override": "true",
"path": "/template/codegen/entity/po.ftl",
"content": "<#if isBaseModule = 'true'>\npackage com.${cAlias}.${cPlatform}.${sys}.persistence.entity;\n<#else>\npackage com.${cAlias}.${cPlatform}.${sys}.${module}.persistence.entity;\n</#if>\n\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.List;\n<#if isGenSub = 'true' && hasSub?exists && hasSub==true>\nimport java.util.ArrayList;\n</#if>\nimport com.${scAlias}.${scPlatform}.base.core.util.JacksonUtil;\nimport io.swagger.annotations.ApiModel;\n\n/**\n * ${model.tabComment} 实体对象\n *\n *<pre> \n <#if vars.company?exists>\n * 开发公司:${vars.company}\n </#if>\n <#if vars.developer?exists>\n * 开发人员:${vars.developer}\n </#if>\n <#if vars.email?exists>\n * 邮箱地址:${vars.email}\n </#if>\n * 创建时间:${date?string(\"yyyy-MM-dd HH:mm:ss\")}\n *</pre>\n */\n@SuppressWarnings(\"serial\")\n@ApiModel(value = \"${model.tabComment}对象\")\npublic class ${class}Po extends ${class}Tbl{\n\t<#if isGenSub = 'true' && hasSub?exists && hasSub==true>\n\tprivate boolean delBeforeSave = true;\n\tpublic boolean isDelBeforeSave() {\n\t\treturn delBeforeSave;\n\t}\n\tpublic void setDelBeforeSave(boolean delBeforeSave) {\n\t\tthis.delBeforeSave = delBeforeSave;\n\t}\t\n\t<#list model.subTableList as subTable>\n\t\n\t<#if subTable.relation = 'one2one'>\n\tprivate ${subTable.variables.class}Po ${subTable.variables.classVar} = null;\n\tpublic ${subTable.variables.class}Po get${subTable.variables.class}() {\n\t\treturn ${subTable.variables.classVar};\n\t}\n\tpublic void set${subTable.variables.class}(${subTable.variables.class}Po ${subTable.variables.classVar}) {\n\t\tthis.${subTable.variables.classVar} = ${subTable.variables.classVar};\n\t}\n\t<#else>\n\tprivate List<${subTable.variables.class}Po> ${subTable.variables.classVar}PoList = new ArrayList<${subTable.variables.class}Po>();\n\tpublic List<${subTable.variables.class}Po> get${subTable.variables.class}PoList() {\n\t\treturn ${subTable.variables.classVar}PoList;\n\t}\n\tpublic void set${subTable.variables.class}PoList(List<${subTable.variables.class}Po> ${subTable.variables.classVar}PoList) {\n\t\tthis.${subTable.variables.classVar}PoList = ${subTable.variables.classVar}PoList;\n\t}\n\t</#if>\n\t</#list>\n\t</#if>\n\n\tpublic static ${class}Po fromJsonString(String data){\n\t\tif(JacksonUtil.isNotJsonObject(data)){\n\t\t\treturn null;\n\t\t}\n\t\treturn JacksonUtil.getDTO(data, ${class}Po.class);\n\t}\n\t\n\tpublic static List<${class}Po> fromJsonArrayString(String listData){\n\t\tif(JacksonUtil.isNotJsonArray(listData)){\n\t\t\treturn Collections.emptyList();\n\t\t}\n\t\treturn JacksonUtil.getDTOList(listData, ${class}Po.class);\n\t}\n}\n",
"comment": null,
"isDef": "Y",
"creator": "654755459927900160",
"typeName": null,
"creatorName": "黄春艳"
},
{
"pk": "",
"name": "dao",
"ip": null,
"createBy": null,
"createTime": 1576823454000,
"updateBy": null,
"updateTime": null,
"tenantId": "-999",
"dataStatus": null,
"dbtype": null,
"id": "657590755757391872",
"typeId": null,
"key": "dao",
"filename": "{class}Dao.java",
"dir": "src/main/java/com/{cAlias}/{cPlatform}/{sys}/{module}/persistence/dao",
"sub": "true",
"override": "true",
"path": "/template/codegen/dao/dao.ftl",
"content": "<#if isBaseModule = 'true'>\npackage com.${cAlias}.${cPlatform}.${sys}.persistence.dao;\n<#else>\npackage com.${cAlias}.${cPlatform}.${sys}.${module}.persistence.dao;\n</#if>\n\nimport com.${scAlias}.${scPlatform}.base.framework.persistence.dao.IDao;\n<#if isBaseModule = 'true'>\nimport com.${cAlias}.${cPlatform}.${sys}.persistence.entity.${class}Po;\n<#else>\nimport com.${cAlias}.${cPlatform}.${sys}.${module}.persistence.entity.${class}Po;\n</#if>\n\n/**\n * ${model.tabComment} Dao接口\n *\n *<pre> \n <#if vars.company?exists>\n * 开发公司:${vars.company}\n </#if>\n <#if vars.developer?exists>\n * 开发人员:${vars.developer}\n </#if>\n <#if vars.email?exists>\n * 邮箱地址:${vars.email}\n </#if>\n * 创建时间:${date?string(\"yyyy-MM-dd HH:mm:ss\")}\n *</pre>\n */\npublic interface ${class}Dao extends IDao<String, ${class}Po> {\n\t<#if sub?exists && sub>\n\t/**\n\t * 根据主表id删除 ${model.tabComment} 记录\n\t * @param mainId \n\t * void\n\t */\n\tpublic void deleteByMainId(String mainId);\n\t</#if>\n}\n",
"comment": null,
"isDef": "Y",
"creator": "654755459927900160",
"typeName": null,
"creatorName": "黄春艳"
},
{
"pk": "",
"name": "daoImpl",
"ip": null,
"createBy": null,
"createTime": 1576823454000,
"updateBy": null,
"updateTime": null,
"tenantId": "-999",
"dataStatus": null,
"dbtype": null,
"id": "657590755824500736",
"typeId": null,
"key": "daoImpl",
"filename": "{class}DaoImpl.java",
"dir": "src/main/java/com/{cAlias}/{cPlatform}/{sys}/{module}/persistence/dao/impl",
"sub": "true",
"override": "true",
"path": "/template/codegen/dao/impl/daoImpl.ftl",
"content": "<#if isBaseModule = 'true'>\npackage com.${cAlias}.${cPlatform}.${sys}.persistence.dao.impl;\n<#else>\npackage com.${cAlias}.${cPlatform}.${sys}.${module}.persistence.dao.impl;\n</#if>\n\nimport org.springframework.stereotype.Repository;\n\nimport com.${scAlias}.${scPlatform}.base.db.ddd.dao.MyBatisDaoImpl;\n<#if isBaseModule = 'true'>\nimport com.${cAlias}.${cPlatform}.${sys}.persistence.dao.${class}Dao;\nimport com.${cAlias}.${cPlatform}.${sys}.persistence.entity.${class}Po;\n<#else>\nimport com.${cAlias}.${cPlatform}.${sys}.${module}.persistence.dao.${class}Dao;\nimport com.${cAlias}.${cPlatform}.${sys}.${module}.persistence.entity.${class}Po;\n</#if>\n\n/**\n * ${model.tabComment} Dao接口的实现类\n *\n *<pre> \n <#if vars.company?exists>\n * 开发公司:${vars.company}\n </#if>\n <#if vars.developer?exists>\n * 开发人员:${vars.developer}\n </#if>\n <#if vars.email?exists>\n * 邮箱地址:${vars.email}\n </#if>\n * 创建时间:${date?string(\"yyyy-MM-dd HH:mm:ss\")}\n *</pre>\n */\n@SuppressWarnings(\"serial\")\n@Repository\npublic class ${class}DaoImpl extends MyBatisDaoImpl<String, ${class}Po> implements ${class}Dao{\n\n @Override\n public String getNamespace() {\n return ${class}Po.class.getName();\n }\n\t<#if sub?exists && sub>\n\tpublic void deleteByMainId(String mainId) {\n\t\tdeleteByKey(\"deleteByMainId\", b().a(\"mainId\", mainId).p());\t\t\n\t}\n\t</#if>\n}\n",
"comment": null,
"isDef": "Y",
"creator": "654755459927900160",
"typeName": null,
"creatorName": "黄春艳"
},
{
"pk": "",
"name": "queryDao",
"ip": null,
"createBy": null,
"createTime": 1576823454000,
"updateBy": null,
"updateTime": null,
"tenantId": "-999",
"dataStatus": null,
"dbtype": null,
"id": "657590755929358336",
"typeId": null,
"key": "queryDao",
"filename": "{class}QueryDao.java",
"dir": "src/main/java/com/{cAlias}/{cPlatform}/{sys}/{module}/persistence/dao",
"sub": "true",
"override": "true",
"path": "/template/codegen/dao/queryDao.ftl",
"content": "<#if isBaseModule = 'true'>\npackage com.${cAlias}.${cPlatform}.${sys}.persistence.dao;\n<#else>\npackage com.${cAlias}.${cPlatform}.${sys}.${module}.persistence.dao;\n</#if>\n\n<#if sub?exists && sub>\nimport java.util.List;\n</#if>\nimport com.${scAlias}.${scPlatform}.base.framework.persistence.dao.IQueryDao;\n<#if isBaseModule = 'true'>\nimport com.${cAlias}.${cPlatform}.${sys}.persistence.entity.${class}Po;\n<#else>\nimport com.${cAlias}.${cPlatform}.${sys}.${module}.persistence.entity.${class}Po;\n</#if>\n\n/**\n * ${model.tabComment} 查询Dao接口\n *\n *<pre> \n <#if vars.company?exists>\n * 开发公司:${vars.company}\n </#if>\n <#if vars.developer?exists>\n * 开发人员:${vars.developer}\n </#if>\n <#if vars.email?exists>\n * 邮箱地址:${vars.email}\n </#if>\n * 创建时间:${date?string(\"yyyy-MM-dd HH:mm:ss\")}\n *</pre>\n */\npublic interface ${class}QueryDao extends IQueryDao<String, ${class}Po> {\n\t<#if sub?exists && sub>\n\t/**\n\t * 根据主表ID查询 ${model.tabComment} 列表\n\t * @param mainId\n\t * @return \n\t * List<${class}Po>\n\t */\n\tpublic List<${class}Po> findByMainId(String mainId);\n\t</#if>\n}\n",
"comment": null,
"isDef": "Y",
"creator": "654755459927900160",
"typeName": null,
"creatorName": "黄春艳"
},
{
"pk": "",
"name": "queryDaoImpl",
"ip": null,
"createBy": null,
"createTime": 1576823454000,
"updateBy": null,
"updateTime": null,
"tenantId": "-999",
"dataStatus": null,
"dbtype": null,
"id": "657590756034215936",
"typeId": null,
"key": "queryDaoImpl",
"filename": "{class}QueryDaoImpl.java",
"dir": "src/main/java/com/{cAlias}/{cPlatform}/{sys}/{module}/persistence/dao/impl",
"sub": "true",
"override": "true",
"path": "/template/codegen/dao/impl/queryDaoImpl.ftl",
"content": "<#assign foreignKey=convertUnderLine(model.foreignKey)>\n\n<#if isBaseModule = 'true'>\npackage com.${cAlias}.${cPlatform}.${sys}.persistence.dao.impl;\n<#else>\npackage com.${cAlias}.${cPlatform}.${sys}.${module}.persistence.dao.impl;\n</#if>\n\n<#if sub?exists && sub>\nimport java.util.List;\n</#if>\n\nimport org.springframework.stereotype.Repository;\n\nimport com.${scAlias}.${scPlatform}.base.db.ddd.dao.MyBatisQueryDaoImpl;\n<#if isBaseModule = 'true'>\nimport com.${cAlias}.${cPlatform}.${sys}.persistence.dao.${class}QueryDao;\nimport com.${cAlias}.${cPlatform}.${sys}.persistence.entity.${class}Po;\n<#else>\nimport com.${cAlias}.${cPlatform}.${sys}.${module}.persistence.dao.${class}QueryDao;\nimport com.${cAlias}.${cPlatform}.${sys}.${module}.persistence.entity.${class}Po;\n</#if>\n\n/**\n *${model.tabComment} 查询Dao的实现类\n *\n *<pre> \n <#if vars.company?exists>\n * 开发公司:${vars.company}\n </#if>\n <#if vars.developer?exists>\n * 开发人员:${vars.developer}\n </#if>\n <#if vars.email?exists>\n * 邮箱地址:${vars.email}\n </#if>\n * 创建时间:${date?string(\"yyyy-MM-dd HH:mm:ss\")}\n *</pre>\n */\n @SuppressWarnings(\"serial\")\n@Repository\npublic class ${class}QueryDaoImpl extends MyBatisQueryDaoImpl<String, ${class}Po> implements ${class}QueryDao{\n\n @Override\n public String getNamespace() {\n return ${class}Po.class.getName();\n }\n <#if sub?exists && sub>\n\tpublic List<${class}Po> findByMainId(String mainId) {\n\t\treturn findByKey(\"findByMainId\", b().a(\"mainId\", mainId).p());\n\t}\n\t</#if>\n}\n",
"comment": null,
"isDef": "Y",
"creator": "654755459927900160",
"typeName": null,
"creatorName": "黄春艳"
},
{
"pk": "",
"name": "daoTest",
"ip": null,
"createBy": null,
"createTime": 1576823454000,
"updateBy": null,
"updateTime": null,
"tenantId": "-999",
"dataStatus": null,
"dbtype": null,
"id": "657590756139073536",
"typeId": null,
"key": "daoTest",
"filename": "{class}DaoTest.java",
"dir": "src/test/java/com/{cAlias}/{cPlatform}/{sys}/{module}/persistence/dao",
"sub": "true",
"override": "true",
"path": "/template/codegen/test/daoTest.ftl",
"content": "<#if isBaseModule = 'true'>\npackage com.${cAlias}.${cPlatform}.${sys}.persistence.dao;\n<#else>\npackage com.${cAlias}.${cPlatform}.${sys}.${module}.persistence.dao;\n</#if>\n\nimport javax.annotation.Resource;\n\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.springframework.test.annotation.Rollback;\n\n<#if isBaseModule = 'true'>\nimport com.${cAlias}.${cPlatform}.${sys}.persistence.dao.${class}Dao;\nimport com.${cAlias}.${cPlatform}.${sys}.persistence.dao.${class}QueryDao;\nimport com.${cAlias}.${cPlatform}.${sys}.persistence.entity.${po};\n<#else>\nimport com.${cAlias}.${cPlatform}.${sys}.${module}.persistence.dao.${class}Dao;\nimport com.${cAlias}.${cPlatform}.${sys}.${module}.persistence.dao.${class}QueryDao;\nimport com.${cAlias}.${cPlatform}.${sys}.${module}.persistence.entity.${po};\n</#if>\nimport com.${cAlias}.${cPlatform}.${sys}.${baseClass}BaseTest;\n\n/**\n * ${model.tabComment} dao单元测试类\n *\n *<pre> \n <#if vars.company?exists>\n * 开发公司:${vars.company}\n </#if>\n <#if vars.developer?exists>\n * 开发人员:${vars.developer}\n </#if>\n <#if vars.email?exists>\n * 邮箱地址:${vars.email}\n </#if>\n * 创建时间:${date?string(\"yyyy-MM-dd HH:mm:ss\")}\n *</pre>\n */\npublic class ${class}DaoTest extends ${baseClass}BaseTest{\n\n\t@Resource\n\tprivate ${class}Dao ${classVar}Dao;\n\t\n\t@Resource\n\tprivate ${class}QueryDao ${classVar}QueryDao;\n\t\t\n\t@Test\n\t@Rollback(true)\n\tpublic void testCrud(){\n\t\t${po} ${poVar}=new ${po}();\n\t\t<#list model.columnList as col>\n\t\t\t<#assign columnName=convertUnderLine(col.columnName)>\n\t\t<#if col.isPK>\n\t\t${poVar}.setId(idGenerator.getId());\n\t\t<#else>\n\t\t<#if col.isNotNull>\n\t\t<#if col.colType=\"java.util.Date\">\n\t\t${poVar}.set${col.colName?cap_first}(new Date());\n\t\t<#elseif col.colType=\"Float\">\n\t\tInteger randId=new Double(100000*Math.random()).intValue();\n\t\t${poVar}.set${col.colName?cap_first}(Float.parseFloat(randId+\"\"));\n\t\t<#elseif col.colType=\"Short\">\n\t\t${poVar}.set${col.colName?cap_first}(new Short(\"1\"));\n\t\t<#elseif col.colType=\"Integer\">\n\t\tInteger randId=new Double(100000*Math.random()).intValue();\n\t\t${poVar}.set${col.colName?cap_first}(randId);\n\t\t<#elseif col.colType=\"Long\">\n\t\tInteger randId=new Double(100000*Math.random()).intValue();\n\t\t${poVar}.set${col.colName?cap_first}(Long.parseLong(randId+\"\"));\n\t\t<#elseif col.colType=\"String\">\n\t\tInteger randId=new Double(100000*Math.random()).intValue();\n\t\t${poVar}.set${col.colName?cap_first}(\"${poVar}\" + randId);\n\t\t</#if>\n\t\t</#if>\n\t\t</#if>\n\t\t</#list>\n\t\t\n\t\t//创建一实体\n\t\t${classVar}Dao.create(${poVar});\n Assert.assertNotNull(${poVar}.getId());\n logger.debug(\"${poVar}1:\"+ ${poVar}.getId());\n\t\t//获取一实体\n\t\t${po} ${poVar}2=${classVar}QueryDao.get(${poVar}.getId());\n\t\tAssert.assertNotNull(${poVar}2);\n\t\tlogger.debug(\"${poVar}2:\" + ${poVar}2.toString());\n\t\t<#list model.columnList as col>\n\t\t\t<#assign columnName=convertUnderLine(col.columnName)>\n\t\t\t<#if !col.isPK>\n\t\t<#if col.isNotNull>\n\t\t<#if col.colType=\"java.util.Date\">\n\t\t${poVar}2.set${col.colName?cap_first}(new Date());\n\t\t<#elseif col.colType=\"Float\">\n\t\tInteger randId2=new Double(100000*Math.random()).intValue();\n\t\t${poVar}2.set${col.colName?cap_first}(Float.parseFloat(randId2+\"\"));\n\t\t<#elseif col.colType=\"Short\">\n\t\t${poVar}2.set${col.colName?cap_first}(new Short(\"1\"));\n\t\t<#elseif col.colType=\"Integer\">\n\t\tInteger randId2=new Double(100000*Math.random()).intValue();\n\t\t${poVar}2.set${col.colName?cap_first}(randId2);\n\t\t<#elseif col.colType=\"Long\">\n\t\tInteger randId2=new Double(100000*Math.random()).intValue();\n\t\t${poVar}2.set${col.colName?cap_first}(Long.parseLong(randId2+\"\"));\n\t\t<#elseif col.colType=\"String\">\n\t\tInteger randId2=new Double(100000*Math.random()).intValue();\n\t\t${poVar}2.set${col.colName?cap_first}(\"${poVar}\" + randId2);\n\t\t</#if>\n\t\t</#if>\n\t\t\t</#if>\n\t\t</#list>\n\t\t//更新一实体\n\t\t${classVar}Dao.update(${poVar}2);\n\t\t\n\t\t${po} ${poVar}3=${classVar}QueryDao.get(${poVar}.getId());\n\t\tAssert.assertNotNull(${poVar}3);\n\t\tlogger.debug(\"${poVar}3:\"+${poVar}3.toString());\n\t\t//删除一实体\n\t\t//${classVar}Dao.remove(${poVar}.getId());\n\t}\n\t\n}\n",
"comment": null,
"isDef": "Y",
"creator": "654755459927900160",
"typeName": null,
"creatorName": "黄春艳"
},
{
"pk": "",
"name": "domain",
"ip": null,
"createBy": null,
"createTime": 1576823454000,
"updateBy": null,
"updateTime": null,
"tenantId": "-999",
"dataStatus": null,
"dbtype": null,
"id": "657590756248125440",
"typeId": null,
"key": "domain",
"filename": "{class}.java",
"dir": "src/main/java/com/{cAlias}/{cPlatform}/{sys}/{module}/domain",
"sub": "true",
"override": "true",
"path": "/template/codegen/domain/domain.ftl",
"content": "<#if isBaseModule = 'true'>\npackage com.${cAlias}.${cPlatform}.${sys}.domain;\n<#else>\npackage com.${cAlias}.${cPlatform}.${sys}.${module}.domain;\n</#if>\n\nimport javax.annotation.Resource;\n\nimport org.springframework.context.annotation.Scope;\nimport org.springframework.transaction.annotation.Transactional;\nimport org.springframework.stereotype.Service;\n\nimport com.${scAlias}.${scPlatform}.base.core.util.BeanUtils;\n<#if isGenSub = 'true' && hasSub?exists && hasSub==true>\nimport com.${scAlias}.${scPlatform}.base.core.util.string.StringUtil;\n</#if>\nimport com.${scAlias}.${scPlatform}.base.core.util.AppUtil;\nimport com.${scAlias}.${scPlatform}.base.framework.domain.AbstractDomain;\nimport com.${scAlias}.${scPlatform}.base.framework.persistence.dao.IDao;\nimport com.${scAlias}.${scPlatform}.base.framework.persistence.dao.IQueryDao;\n<#if isBaseModule = 'true'>\nimport com.${cAlias}.${cPlatform}.${sys}.persistence.dao.${class}Dao;\nimport com.${cAlias}.${cPlatform}.${sys}.persistence.dao.${class}QueryDao;\nimport com.${cAlias}.${cPlatform}.${sys}.persistence.entity.${class}Po;\n<#if isGenSub = 'true' && hasSub?exists && hasSub==true>\n<#list model.subTableList as subTable>\nimport com.${cAlias}.${cPlatform}.${sys}.persistence.dao.${subTable.variables.class}Dao;\nimport com.${cAlias}.${cPlatform}.${sys}.persistence.entity.${subTable.variables.class}Po;\n</#list>\n</#if>\n<#else>\nimport com.${cAlias}.${cPlatform}.${sys}.${module}.persistence.dao.${class}Dao;\nimport com.${cAlias}.${cPlatform}.${sys}.${module}.persistence.dao.${class}QueryDao;\nimport com.${cAlias}.${cPlatform}.${sys}.${module}.persistence.entity.${class}Po;\n<#if isGenSub = 'true' && hasSub?exists && hasSub==true>\n<#list model.subTableList as subTable>\nimport com.${cAlias}.${cPlatform}.${sys}.${module}.persistence.dao.${subTable.variables.class}Dao;\nimport com.${cAlias}.${cPlatform}.${sys}.${module}.persistence.entity.${subTable.variables.class}Po;\n</#list>\n</#if>\n</#if>\n\n<#if isBaseModule = 'true'>\nimport com.${cAlias}.${cPlatform}.${sys}.repository.${class}Repository;\n<#else>\nimport com.${cAlias}.${cPlatform}.${sys}.${module}.repository.${class}Repository;\n</#if>\nimport javax.annotation.Resource;\n\n/**\n * ${model.tabComment} 领域对象实体\n *\n *<pre> \n <#if vars.company?exists>\n * 开发公司:${vars.company}\n </#if>\n <#if vars.developer?exists>\n * 开发人员:${vars.developer}\n </#if>\n <#if vars.email?exists>\n * 邮箱地址:${vars.email}\n </#if>\n * 创建时间:${date?string(\"yyyy-MM-dd HH:mm:ss\")}\n *</pre>\n */\n@SuppressWarnings(\"serial\")\n@Service\n@Transactional\n@Scope(\"prototype\")\npublic class ${class} extends AbstractDomain<String, ${class}Po>{\n\t\n\t@Resource\n\tprivate ${class}Dao ${classVar}Dao;\n\t@Resource\n\tprivate ${class}QueryDao ${classVar}QueryDao;\n\n\t<#if isGenSub = 'true' && hasSub?exists && hasSub==true>\n\t<#list model.subTableList as subTable>\n\t@Resource\n\tprivate ${subTable.variables.class}Dao ${subTable.variables.classVar}Dao;\n\t</#list>\n\t</#if>\n\n\tprotected void init(){\n\t\t//\n\t}\n\t\n\t@Override\n\tprotected IQueryDao<String, ${class}Po> getInternalQueryDao() {\n\t\treturn ${classVar}QueryDao;\n\t}\n\t\n\t@Override\n\tprotected IDao<String, ${class}Po> getInternalDao() {\n\t\treturn ${classVar}Dao;\n\t}\n\t\n\t<#if isGenSub = 'true' && hasSub?exists && hasSub==true> \n\t/**\n\t * 主从表一并保存 \n\t * void\n\t * @exception \n\t * @since 1.0.0\n\t */\n\tpublic void saveCascade(){\n\t\tsave();\n\t\tif(getData().isDelBeforeSave()){\n\t\t\t<#list model.subTableList as subTable>\n\t\t\t<#assign fromKey=getFromKeyName(subTable,model)>\n\t\t\t<#if fromKey?exists && fromKey != null && fromKey != ''>\n\t\t\t${subTable.variables.classVar}Dao.deleteByMainId(getData().get${fromKey?cap_first}());\n\t\t\t<#else>\n\t\t\t${subTable.variables.classVar}Dao.deleteByMainId(getId());\n\t\t\t</#if>\n\t\t\t</#list>\n\t\t}\n\t\t\n\t\t<#list model.subTableList as subTable>\n\t\t<#if subTable.relation = 'one2one'>\n\t\t${subTable.variables.class}Po ${subTable.variables.classVar}Po = getData().get${subTable.variables.class}();\n\t\tif(BeanUtils.isNotEmpty(${subTable.variables.classVar}Po)){\n\t\t\t//设置外键\n\t\t\t<#assign foreignKey=getFkName(subTable)>\n\t\t\t<#assign fromKey=getFromKeyName(subTable,model)>\n\t\t\t<#if fromKey?exists && fromKey != null && fromKey != ''>\n\t\t\t${subTable.variables.classVar}Po.set${foreignKey?cap_first}(getData().get${fromKey?cap_first}());\n\t\t\t<#else>\n\t\t\t${subTable.variables.classVar}Po.set${foreignKey?cap_first}(getId());\n\t\t\t</#if>\n\t\t\t${subTable.variables.classVar}Dao.create(${subTable.variables.classVar}Po);\n\t\t}\n\t\t<#else>\n\t\tif(BeanUtils.isNotEmpty(getData().get${subTable.variables.class}PoList())){\n\t\t\tfor(${subTable.variables.class}Po ${subTable.variables.classVar}Po:getData().get${subTable.variables.class}PoList()){\n\t\t\t\t//设置外键\n\t\t\t\t<#assign foreignKey=getFkName(subTable)>\n\t\t\t\t<#assign fromKey=getFromKeyName(subTable,model)>\n\t\t\t\t<#if fromKey?exists && fromKey != null && fromKey != ''>\n\t\t\t\t${subTable.variables.classVar}Po.set${foreignKey?cap_first}(getData().get${fromKey?cap_first}());\n\t\t\t\t<#else>\n\t\t\t\t${subTable.variables.classVar}Po.set${foreignKey?cap_first}(getId());\n\t\t\t\t</#if>\n\t\t\t\t${subTable.variables.classVar}Dao.create(${subTable.variables.classVar}Po);\n\t\t\t}\n\t\t}\n\t\t</#if>\n\t\t</#list>\n\t}\t\n\t\n\t/**\n\t * 主从表一并删除 \n\t * void\n\t * @exception \n\t * @since 1.0.0\n\t */\n\tpublic void deleteByIdsCascade(String[] ids){\n\t\tfor(String id : ids){\n\t\t\t${class}Po po = ${classVar}QueryDao.get(id);\n\t\t\t<#list model.subTableList as subTable>\n\t\t\t<#assign fromKey=getFromKeyName(subTable,model)>\n\t\t\t<#if fromKey?exists && fromKey != null && fromKey != ''>\n\t\t\tif(BeanUtils.isNotEmpty(po) && BeanUtils.isNotEmpty(po.get${fromKey?cap_first}())){\n\t\t\t\t${subTable.variables.classVar}Dao.deleteByMainId(po.get${fromKey?cap_first}());\n\t\t\t}\t\n\t\t\t<#else>\n\t\t\t${subTable.variables.classVar}Dao.deleteByMainId(id);\n\t\t\t</#if>\n\t\t\t</#list>\n\t\t}\n\t\tdeleteByIds(ids);\n\t}\n\t</#if>\t\t \n\t\n}\n",
"comment": null,
"isDef": "Y",
"creator": "654755459927900160",
"typeName": null,
"creatorName": "黄春艳"
},
{
"pk": "",
"name": "domainTest",
"ip": null,
"createBy": null,
"createTime": 1576823454000,
"updateBy": null,
"updateTime": null,
"tenantId": "-999",
"dataStatus": null,
"dbtype": null,
"id": "657590756352983040",
"typeId": null,
"key": "domainTest",
"filename": "{class}Test.java",
"dir": "src/test/java/com/{cAlias}/{cPlatform}/{sys}/{module}/domain",
"sub": "true",
"override": "true",
"path": "/template/codegen/test/domainTest.ftl",
"content": "<#if isBaseModule = 'true'>\npackage com.${cAlias}.${cPlatform}.${sys}.domain;\n<#else>\npackage com.${cAlias}.${cPlatform}.${sys}.${module}.domain;\n</#if>\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport javax.annotation.Resource;\n\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.springframework.test.annotation.Rollback;\n\n<#if isBaseModule = 'true'>\nimport com.${cAlias}.${cPlatform}.${sys}.domain.${class};\nimport com.${cAlias}.${cPlatform}.${sys}.repository.${class}Repository;\nimport com.${cAlias}.${cPlatform}.${sys}.persistence.entity.${class}Po;\n<#else>\nimport com.${cAlias}.${cPlatform}.${sys}.${module}.domain.${class};\nimport com.${cAlias}.${cPlatform}.${sys}.${module}.repository.${class}Repository;\nimport com.${cAlias}.${cPlatform}.${sys}.${module}.persistence.entity.${class}Po;\n</#if>\nimport com.${cAlias}.${cPlatform}.${sys}.${baseClass}BaseTest;\n\n/**\n * ${model.tabComment} 领域对象实体单元测试类\n *\n *<pre> \n <#if vars.company?exists>\n * 开发公司:${vars.company}\n </#if>\n <#if vars.developer?exists>\n * 开发人员:${vars.developer}\n </#if>\n <#if vars.email?exists>\n * 邮箱地址:${vars.email}\n </#if>\n * 创建时间:${date?string(\"yyyy-MM-dd HH:mm:ss\")}\n *</pre>\n */\npublic class ${class}Test extends ${baseClass}BaseTest{\n\t \n\t@Resource\n\tprivate ${class}Repository ${classVar}Repository;\n\t\n\t@Test\n\t@Rollback(true)\n\tpublic void create(){\t\t\t\t\n\t\t${class} ${classVar} = ${classVar}Repository.newInstance();\n\t\t\n\t\t${class}Po ${classVar}Po=new ${class}Po();\n\t\t<#list model.columnList as col>\n\t\t\t<#assign columnName=convertUnderLine(col.columnName)>\n\t\t<#if col.isPK>\n\t\t${poVar}.setId(idGenerator.getId());\n\t\t<#else>\n\t\t<#if col.isNotNull>\n\t\t<#if col.colType=\"java.util.Date\">\n\t\t${poVar}.set${col.colName?cap_first}(new Date());\n\t\t<#elseif col.colType=\"Float\">\n\t\tInteger randId=new Double(100000*Math.random()).intValue();\n\t\t${poVar}.set${col.colName?cap_first}(Float.parseFloat(randId+\"\"));\n\t\t<#elseif col.colType=\"Short\">\n\t\t${poVar}.set${col.colName?cap_first}(new Short(\"1\"));\n\t\t<#elseif col.colType=\"Integer\">\n\t\tInteger randId=new Double(100000*Math.random()).intValue();\n\t\t${poVar}.set${col.colName?cap_first}(randId);\n\t\t<#elseif col.colType=\"Long\">\n\t\tInteger randId=new Double(100000*Math.random()).intValue();\n\t\t${poVar}.set${col.colName?cap_first}(Long.parseLong(randId+\"\"));\n\t\t<#elseif col.colType=\"String\">\n\t\tInteger randId=new Double(100000*Math.random()).intValue();\n\t\t${poVar}.set${col.colName?cap_first}(\"${poVar}\" + randId);\n\t\t</#if>\n\t\t</#if>\n\t\t</#if>\n\t\t</#list>\n\t\t\n\t\t${classVar}.setData(${classVar}Po);\n\t\t\n\t\tList<String> ids = new ArrayList<String>();\n\t\t\n\t\t${classVar}.create();\t\n\t\tids.add(${classVar}.getId());\n\t\t\t\t\t\t\n\t\t${class} ${classVar}2 = ${classVar}Repository.newInstance();\n\t\t${classVar}Po.setId(idGenerator.getId());\n\t\t${classVar}2.setData(${classVar}Po);\n\t\t\n\t\t${classVar}2.create();\n\t\tids.add(${classVar}2.getId());\n\t\t\n\t\tList<${class}Po> ${classVar}PoList = ${classVar}Repository.findByIds(ids);\n\t\tAssert.assertTrue(${classVar}PoList.size()>=2);\n\t\t\n\t\tList<${class}Po>${classVar}1 = ${classVar}Repository.findAll();\n\t\tAssert.assertTrue(${classVar}1.size()>=2);\n\n\t}\n}\n",
"comment": null,
"isDef": "Y",
"creator": "654755459927900160",
"typeName": null,
"creatorName": "黄春艳"
},
{
"pk": "",
"name": "repository",
"ip": null,
"createBy": null,
"createTime": 1576823454000,
"updateBy": null,
"updateTime": null,
"tenantId": "-999",
"dataStatus": null,
"dbtype": null,
"id": "657590756562698240",
"typeId": null,
"key": "repository",
"filename": "{class}Repository.java",
"dir": "src/main/java/com/{cAlias}/{cPlatform}/{sys}/{module}/repository",
"sub": "true",
"override": "true",
"path": "/template/codegen/repository/repository.ftl",
"content": "<#if isBaseModule = 'true'>\npackage com.${cAlias}.${cPlatform}.${sys}.repository;\n<#else>\npackage com.${cAlias}.${cPlatform}.${sys}.${module}.repository;\n</#if>\n\n<#if sub?exists && sub>\nimport java.util.List;\n</#if>\nimport com.${scAlias}.${scPlatform}.base.framework.repository.IRepository;\n<#if isBaseModule = 'true'>\nimport com.${cAlias}.${cPlatform}.${sys}.domain.${class};\nimport com.${cAlias}.${cPlatform}.${sys}.persistence.entity.${class}Po;\n<#else>\nimport com.${cAlias}.${cPlatform}.${sys}.${module}.domain.${class};\nimport com.${cAlias}.${cPlatform}.${sys}.${module}.persistence.entity.${class}Po;\n</#if>\n\n/**\n * ${model.tabComment} 仓库接口\n *\n *<pre> \n <#if vars.company?exists>\n * 开发公司:${vars.company}\n </#if>\n <#if vars.developer?exists>\n * 开发人员:${vars.developer}\n </#if>\n <#if vars.email?exists>\n * 邮箱地址:${vars.email}\n </#if>\n * 创建时间:${date?string(\"yyyy-MM-dd HH:mm:ss\")}\n *</pre>\n */\npublic interface ${class}Repository extends IRepository<String, ${class}Po,${class}>{\n\t <#if sub?exists && sub>\n\t /**\n\t * 根据主表ID查询 ${model.tabComment} 列表\n\t * @param mainId\n\t * @return \n\t * List<${class}Po>\n\t */\n\tpublic List<${class}Po> findByMainId(String mainId);\n\t</#if>\n\n\t<#if isGenSub = 'true' && hasSub?exists && hasSub==true> \n\t/**\n\t * 查询全部子表的数据,并设置到主表Po中 \n\t * void\n\t */\n\tpublic ${class}Po loadCascade(String id);\n\t</#if>\n}\n",
"comment": null,
"isDef": "Y",
"creator": "654755459927900160",
"typeName": null,
"creatorName": "黄春艳"
},
{
"pk": "",
"name": "repositoryImpl",
"ip": null,
"createBy": null,
"createTime": 1576823454000,
"updateBy": null,
"updateTime": null,
"tenantId": "-999",
"dataStatus": null,
"dbtype": null,
"id": "657590756667555840",
"typeId": null,
"key": "repositoryImpl",
"filename": "{class}RepositoryImpl.java",
"dir": "src/main/java/com/{cAlias}/{cPlatform}/{sys}/{module}/repository/impl",
"sub": "true",
"override": "true",
"path": "/template/codegen/repository/impl/repositoryImpl.ftl",
"content": "<#if isBaseModule = 'true'>\npackage com.${cAlias}.${cPlatform}.${sys}.repository.impl;\n<#else>\npackage com.${cAlias}.${cPlatform}.${sys}.${module}.repository.impl;\n</#if>\n\n<#if (isGenSub = 'true' && hasSub?exists && hasSub==true) || (sub?exists && sub)>\nimport java.util.List;\n</#if>\n\nimport javax.annotation.Resource;\n\nimport org.springframework.stereotype.Repository;\n\n<#if isGenSub = 'true' && hasSub?exists && hasSub==true>\nimport com.${scAlias}.${scPlatform}.base.core.util.string.StringUtil;\nimport com.${scAlias}.${scPlatform}.base.core.util.BeanUtils;\n</#if>\nimport com.${scAlias}.${scPlatform}.base.core.util.AppUtil;\nimport com.${scAlias}.${scPlatform}.base.framework.persistence.dao.IQueryDao;\nimport com.${scAlias}.${scPlatform}.base.framework.repository.AbstractRepository;\n<#if isBaseModule = 'true'>\nimport com.${cAlias}.${cPlatform}.${sys}.domain.${class};\nimport com.${cAlias}.${cPlatform}.${sys}.repository.${class}Repository;\nimport com.${cAlias}.${cPlatform}.${sys}.persistence.dao.${class}QueryDao;\nimport com.${cAlias}.${cPlatform}.${sys}.persistence.entity.${class}Po;\n<#if isGenSub = 'true' && hasSub?exists && hasSub==true><#list model.subTableList as subTable>\nimport com.${cAlias}.${cPlatform}.${sys}.persistence.dao.${subTable.variables.class}QueryDao;\nimport com.${cAlias}.${cPlatform}.${sys}.persistence.entity.${subTable.variables.class}Po;\n</#list></#if>\n<#else>\nimport com.${cAlias}.${cPlatform}.${sys}.${module}.domain.${class};\nimport com.${cAlias}.${cPlatform}.${sys}.${module}.repository.${class}Repository;\nimport com.${cAlias}.${cPlatform}.${sys}.${module}.persistence.dao.${class}QueryDao;\nimport com.${cAlias}.${cPlatform}.${sys}.${module}.persistence.entity.${class}Po;\n<#if isGenSub = 'true' && hasSub?exists && hasSub==true><#list model.subTableList as subTable>\nimport com.${cAlias}.${cPlatform}.${sys}.${module}.persistence.dao.${subTable.variables.class}QueryDao;\nimport com.${cAlias}.${cPlatform}.${sys}.${module}.persistence.entity.${subTable.variables.class}Po;\n</#list></#if>\n</#if>\n\n/**\n * ${model.tabComment} 仓库的实现类\n *\n *<pre> \n <#if vars.company?exists>\n * 开发公司:${vars.company}\n </#if>\n <#if vars.developer?exists>\n * 开发人员:${vars.developer}\n </#if>\n <#if vars.email?exists>\n * 邮箱地址:${vars.email}\n </#if>\n * 创建时间:${date?string(\"yyyy-MM-dd HH:mm:ss\")}\n *</pre>\n */\n@Repository\npublic class ${class}RepositoryImpl extends AbstractRepository<String, ${class}Po,${class}> implements ${class}Repository{\n\t \n\t@Resource\n\tprivate ${class}QueryDao ${classVar}QueryDao;\n\t<#if isGenSub = 'true' && hasSub?exists && hasSub==true><#list model.subTableList as subTable>\n\t@Resource\n\tprivate ${subTable.variables.class}QueryDao ${subTable.variables.classVar}QueryDao;\n\t</#list>\n\t</#if>\n\n\tpublic ${class} newInstance() {\n\t\t${class}Po po = new ${class}Po();\n\t\t${class} ${classVar} = AppUtil.getBean(${class}.class);\n\t\t${classVar}.setData(po);\n\t\treturn ${classVar};\n\t}\n\n\tpublic ${class} newInstance(${class}Po po) {\n\t\t${class} ${classVar} = AppUtil.getBean(${class}.class);\n\t\t${classVar}.setData(po);\n\t\treturn ${classVar};\n\t} \n\t\n\t@Override\n\tprotected IQueryDao<String, ${class}Po> getQueryDao() {\n\t\treturn ${classVar}QueryDao;\n\t}\n\t\n\t<#if sub?exists && sub>\n\t@Override\n\tpublic List<${class}Po> findByMainId(String mainId) {\n\t\treturn ${classVar}QueryDao.findByMainId(mainId);\n\t}\n\t</#if>\n\n\t<#if isGenSub = 'true' && hasSub?exists && hasSub==true> \n\t/**\n\t * 查询全部子表的数据,并设置到主表Po中 \n\t * void\n\t */\n\t@Override\n\tpublic ${class}Po loadCascade(String id){\n\t\t${class}Po ${classVar}Po = null;\n\t\tif(StringUtil.isNotEmpty(id)){\n\t\t\t${classVar}Po = ${classVar}QueryDao.get(id);\n\t\t\t<#list model.subTableList as subTable>\n\t\t\t<#assign fromKey=getFromKeyName(subTable,model)>\n\t\t\t<#if fromKey?exists && fromKey != null && fromKey != ''>\n\t\t\tif(BeanUtils.isNotEmpty(${classVar}Po) && BeanUtils.isNotEmpty(${classVar}Po.get${fromKey?cap_first}())){\n\t\t\t\tList<${subTable.variables.class}Po> ${subTable.variables.classVar}PoList = ${subTable.variables.classVar}QueryDao.findByMainId(${classVar}Po.get${fromKey?cap_first}());\n\t\t\t\t<#if subTable.relation = 'one2one'>\n\t\t\t\tif(BeanUtils.isNotEmpty(${subTable.variables.classVar}PoList)){\n\t\t\t\t\t${classVar}Po.set${subTable.variables.class}(${subTable.variables.classVar}PoList.get(0));\n\t\t\t\t}\n\t\t\t\t<#else>\n\t\t\t\t${classVar}Po.set${subTable.variables.class}PoList(${subTable.variables.classVar}PoList);\n\t\t\t\t</#if>\n\t\t\t}\n\t\t\t<#else>\n\t\t\tif(BeanUtils.isNotEmpty(${classVar}Po)){\n\t\t\t\tList<${subTable.variables.class}Po> ${subTable.variables.classVar}PoList = ${subTable.variables.classVar}QueryDao.findByMainId(id);\n\t\t\t\t<#if subTable.relation = 'one2one'>\n\t\t\t\tif(BeanUtils.isNotEmpty(${subTable.variables.classVar}PoList)){\n\t\t\t\t\t${classVar}Po.set${subTable.variables.class}(${subTable.variables.classVar}PoList.get(0));\n\t\t\t\t}\n\t\t\t\t<#else>\n\t\t\t\t${classVar}Po.set${subTable.variables.class}PoList(${subTable.variables.classVar}PoList);\n\t\t\t\t</#if>\n\t\t\t}\n\t\t\t</#if>\n\t\t\t</#list>\n\t\t}\n\t\treturn ${classVar}Po;\n\t}\n\t</#if>\n\t\n}\n",
"comment": null,
"isDef": "Y",
"creator": "654755459927900160",
"typeName": null,
"creatorName": "黄春艳"
},
{
"pk": "",
"name": "api",
"ip": null,
"createBy": null,
"createTime": 1576823454000,
"updateBy": null,
"updateTime": null,
"tenantId": "-999",
"dataStatus": null,
"dbtype": null,
"id": "657590756877271040",
"typeId": null,
"key": "api",
"filename": "I{class}Service.java",
"dir": "src/main/java/com/{cAlias}/{cPlatform}/{sys}/{module}/api",
"sub": "true",
"override": "true",
"path": "/template/codegen/api/service.ftl",
"content": "<#if isBaseModule = 'true'>\npackage com.${cAlias}.${cPlatform}.${sys}.api;\n<#else>\npackage com.${cAlias}.${cPlatform}.${sys}.${module}.api;\n</#if>\n\nimport java.util.List;\n\nimport org.hibernate.validator.constraints.NotBlank;\nimport org.hibernate.validator.constraints.NotEmpty;\nimport org.springframework.validation.annotation.Validated;\nimport org.springframework.web.bind.annotation.RequestBody;\nimport org.springframework.web.bind.annotation.RequestMapping;\nimport org.springframework.web.bind.annotation.RequestMethod;\nimport org.springframework.web.bind.annotation.RequestParam;\nimport org.springframework.web.bind.annotation.RestController;\n\nimport com.lc.ibps.cloud.entity.APIPageList;\nimport com.lc.ibps.cloud.entity.APIRequest;\nimport com.lc.ibps.cloud.entity.APIResult;\n<#if isBaseModule = 'true'>\nimport com.${cAlias}.${cPlatform}.${sys}.persistence.entity.${class}Po;\n<#else>\nimport com.${cAlias}.${cPlatform}.${sys}.${module}.persistence.entity.${class}Po;\n</#if>\n\n\n\n/**\n * ${comment} 接口\n *\n *<pre> \n * 构建组:ibps-provider-${classVar}-api\n <#if vars.company?exists>\n * 开发公司:${vars.company}\n </#if>\n <#if vars.developer?exists>\n * 开发人员:${vars.developer}\n </#if>\n <#if vars.email?exists>\n * 邮箱地址:${vars.email}\n </#if>\n * 创建时间:${date?string(\"yyyy-MM-dd HH:mm:ss\")}\n *</pre>\n */\n@Validated\n@RequestMapping(value = \"/${classVar}\")\n@RestController\npublic interface I${class}Service {\n\n\t<#if model.variables.struType='tree'>\n\t/**\n\t * \n\t * 【${comment}】树数据\n\t *\n\t * @param request\n\t * @return\n\t */\n\t@RequestMapping(value = \"/findTreeData\", method = RequestMethod.POST)\n\tpublic APIResult<List<${class}Po>> findTreeData(\n\t\t\t@RequestBody(required = true) APIRequest request);\n\t<#else>\n\t/**\n\t * \n\t * 【${comment}】列表(分页条件查询)数据\n\t *\n\t * @param request\n\t * @return\n\t */\n\t@RequestMapping(value = \"/query\", method = RequestMethod.POST)\n\tpublic APIResult<APIPageList<${class}Po>> query(\n\t\t\t@RequestBody(required = true) APIRequest request);\n\t</#if>\n\t\n\t/**\n\t * \n\t * 根据id查询【${comment}】\n\t *\n\t * @param id\n\t * @return\n\t */\n\t@RequestMapping(value = \"/get\", method = { RequestMethod.GET })\n\tpublic APIResult<${class}Po> get(\n//\t\t\t@NotBlank(message = \"{com.${cAlias}.${cPlatform}.${sys}.provider.${class}Provider.id}\") \n\t\t\t@RequestParam(name = \"id\", required = true) String id);\n\t\n\t/**\n\t * \n\t * 批量删除【${comment}】记录\n\t *\n\t * @param ids\n\t * @return\n\t */\n\t@RequestMapping(value = \"/remove\", method = { RequestMethod.POST })\n\tpublic APIResult<Void> remove(\n//\t\t\t@NotEmpty(message = \"{com.${cAlias}.${cPlatform}.${sys}.provider.${class}Provider.ids}\")\n\t\t\t@RequestParam(name = \"ids\", required = true) String[] ids);\n\t\n\t/**\n\t * \n\t * 保存【${comment}】记录\n\t *\n\t * @param ${classVar}Po\n\t * @return\n\t */\n\t@RequestMapping(value = \"/save\", method = { RequestMethod.POST })\n\tpublic APIResult<Void> save(\n//\t\t\t@NotEmpty(message = \"{com.${cAlias}.${cPlatform}.${sys}.provider.${class}Provider.ids}\")\n\t\t\t@RequestParam(name = \"${classVar}Po\", required = true) ${class}Po ${classVar}Po);\n}\n",
"comment": null,
"isDef": "Y",
"creator": "654755459927900160",
"typeName": null,
"creatorName": "黄春艳"
},
{
"pk": "",
"name": "client",
"ip": null,
"createBy": null,
"createTime": 1576823454000,
"updateBy": null,
"updateTime": null,
"tenantId": "-999",
"dataStatus": null,
"dbtype": null,
"id": "657590757086986240",
"typeId": null,
"key": "client",
"filename": "I{class}ServiceClient.java",
"dir": "src/main/java/com/{cAlias}/{cPlatform}/{sys}/{module}/client",
"sub": "true",
"override": "true",
"path": "/template/codegen/api/client.ftl",
"content": "<#if isBaseModule = 'true'>\npackage com.${cAlias}.${cPlatform}.${sys}.client;\n<#else>\npackage com.${cAlias}.${cPlatform}.${sys}.${module}.client;\n</#if>\n\nimport org.springframework.cloud.openfeign.FeignClient;\n\nimport com.lc.ibps.cloud.client.provider.ProviderConstants;\nimport com.lc.ibps.org.api.I${class}Service;\n\n/**\n * ${comment} 接口\n *\n * <pre> \n * 构建组:ibps-provider-${classVar}-client\n <#if vars.company?exists>\n * 开发公司:${vars.company}\n </#if>\n <#if vars.developer?exists>\n * 开发人员:${vars.developer}\n </#if>\n <#if vars.email?exists>\n * 邮箱地址:${vars.email}\n </#if>\n * 创建时间:${date?string(\"yyyy-MM-dd HH:mm:ss\")}\n * </pre>\n */\n@FeignClient(name = ProviderConstants.ProviderId.${providerId})\npublic interface I${class}ServiceClient extends I${class}Service{\n\n}\n",
"comment": null,
"isDef": "Y",
"creator": "654755459927900160",
"typeName": null,
"creatorName": "黄春艳"
},
{
"pk": "",
"name": "provider",
"ip": null,
"createBy": null,
"createTime": 1576823454000,
"updateBy": null,
"updateTime": null,
"tenantId": "-999",
"dataStatus": null,
"dbtype": null,
"id": "657590757187649536",
"typeId": null,
"key": "provider",
"filename": "{class}Provider.java",
"dir": "src/main/java/com/{cAlias}/{cPlatform}/{sys}/{module}/provider",
"sub": "false",
"override": "true",
"path": "/template/codegen/provider/provider.ftl",
"content": "<#assign pkVar=pkModel.colName >\npackage com.${cAlias}.${cPlatform}.${sys}.${module}.provider;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport javax.annotation.Resource;\n\nimport org.springframework.stereotype.Service;\nimport org.springframework.web.bind.annotation.RequestBody;\nimport org.springframework.web.bind.annotation.RequestParam;\n\nimport com.lc.ibps.api.base.constants.StateEnum;\nimport com.lc.ibps.api.base.query.QueryFilter;\nimport com.lc.ibps.base.core.util.BeanUtils;\nimport com.lc.ibps.cloud.entity.APIPageList;\nimport com.lc.ibps.cloud.entity.APIRequest;\nimport com.lc.ibps.cloud.entity.APIResult;\nimport com.lc.ibps.cloud.provider.GenericProvider;\n<#if isBaseModule = 'true'>\nimport com.${cAlias}.${cPlatform}.${sys}.api.I${class}Service;\nimport com.${cAlias}.${cPlatform}.${sys}.domain.${class};\nimport com.${cAlias}.${cPlatform}.${sys}.persistence.entity.${class}Po;\nimport com.${cAlias}.${cPlatform}.${sys}.repository.${class}Repository;\n<#else>\nimport com.${cAlias}.${cPlatform}.${sys}.${module}.api.I${class}Service;\nimport com.${cAlias}.${cPlatform}.${sys}.${module}.domain.${class};\nimport com.${cAlias}.${cPlatform}.${sys}.${module}.persistence.entity.${class}Po;\nimport com.${cAlias}.${cPlatform}.${sys}.${module}.repository.${class}Repository;\n</#if>\n\nimport io.swagger.annotations.Api;\nimport io.swagger.annotations.ApiOperation;\nimport io.swagger.annotations.ApiParam;\n\n/**\n * ${comment} 服务类\n * <pre>\n * 构建组:ibps-provider-${classVar}\n <#if vars.company?exists>\n * 开发公司:${vars.company}\n </#if>\n <#if vars.developer?exists>\n * 开发人员:${vars.developer}\n </#if>\n <#if vars.email?exists>\n * 邮箱地址:${vars.email}\n </#if>\n * 创建时间:${date?string(\"yyyy-MM-dd HH:mm:ss\")}\n *</pre>\n */\n@Api(tags = \"${comment}管理\", value = \"${comment}数据\")\n@Service\npublic class ${class}Provider extends GenericProvider implements I${class}Service{\n\n\t@Resource\n\tprivate ${class}Repository ${classVar}Repository;\n\n\t<#if model.variables.struType='tree'>\n\t/**\n\t * 获取结构数据\n\t * @param request\n\t * @return\n\t */\n\t@ApiOperation(value = \"${comment}树数据\", notes = \"${comment}树数据\")\n\t@Override\n\tpublic APIResult<List<${class}Po>> findTreeData(\n\t\t\t@ApiParam(name = \"request\", value = \"传入查询请求json字符串\", required = true) \n\t\t\t@RequestBody(required = true) APIRequest request) {\n\t\tAPIResult<List<${class}Po>> result = new APIResult<>();\n\t\ttry {\n\t\t\tList<${class}Po> ${classVar}List = ${classVar}Repository.findAll();\n\t\t\tif(BeanUtils.isEmpty(${classVar}List)){\n\t\t\t\t${classVar}List=new ArrayList<${class}Po>();\n\t\t\t}\n\t\t\t/*构建${comment}根节点*/\n\t\t\t${class}Po ${classVar}=new ${class}Po();\n\t\t\t${classVar}.set${convertUnderLine(model.variables.idKey)?cap_first}(\"0\");\n\t\t\t${classVar}.set${convertUnderLine(model.variables.key)?cap_first}(\"${comment}\");\n\t\t\t${classVar}List.add(${classVar});\n\t\t\t\n\t\t\tresult.setData(${classVar}List);\n\t\t} catch (Exception e) {\n\t\t\tsetExceptionResult(result, StateEnum.ERROR.getCode(), StateEnum.ERROR.getText(), e);\n\t\t}\n\t\treturn result;\n\t}\n\t<#else>\n\t@ApiOperation(value = \"${comment}列表(分页条件查询)数据\", notes = \"${comment}列表(分页条件查询)数据\")\n\t@Override\n\tpublic APIResult<APIPageList<${class}Po>> query(\n\t\t\t@ApiParam(name = \"request\", value = \"传入查询请求json字符串\", required = true) \n\t\t\t@RequestBody(required = true) APIRequest request) {\n\t\tAPIResult<APIPageList<${class}Po>> result = new APIResult<>();\n\t\ttry {\n\t\t\tQueryFilter queryFilter = getQueryFilter(request);\n\t\t\tList<${class}Po> data = ${classVar}Repository.query(queryFilter);\n\t\t\tAPIPageList<${class}Po> apiPageData = getAPIPageList(data);\n\t\t\tresult.setData(apiPageData);\n\t\t} catch (Exception e) {\n\t\t\t// TODO ERROR => other error message\n\t\t\tsetExceptionResult(result, StateEnum.ERROR.getCode(), StateEnum.ERROR.getText(), e);\n\t\t}\n\t\treturn result;\n\t}\n\t</#if>\n\n\t@ApiOperation(value = \"根据${pkVar}查询${comment}\", notes = \"根据${pkVar}查询${comment}\")\n\t@Override\n\tpublic APIResult<${class}Po> get(\n\t\t\t@ApiParam(name = \"${pkVar}\", value = \"查询id\", required = true) \n\t\t\t@RequestParam(name = \"${pkVar}\", required = true) String ${pkVar}) {\n\t\tAPIResult<${class}Po> result = new APIResult<>();\n\t\ttry {\n\t\t\t${class}Po ${classVar}Po = ${classVar}Repository.get(${pkVar});\n\t\t\tresult.setData(${classVar}Po);\n\t\t} catch (Exception e) {\n\t\t\tsetExceptionResult(result, StateEnum.ERROR.getCode(), StateEnum.ERROR.getText(), e);\n\t\t}\n\t\treturn result;\n\t}\n\t\n\t@ApiOperation(value = \"保存\", notes = \"保存${comment}信息\")\n\t@Override\n\tpublic APIResult<Void> save(\n\t\t\t@ApiParam(name = \"${classVar}Po\", value = \"${comment}对象\", required = true) \n\t\t\t@RequestBody(required = true) ${class}Po ${classVar}Po) {\n\t\tAPIResult<Void> result = new APIResult<Void>();\n\t\ttry {\n\t\t\tlogger.info(\" com.${cAlias}.${cPlatform}.${sys}.provider.${class}Provider.save()--->${classVar}Po: {}\", ${classVar}Po.toString());\n\t\t\t${class} ${classVar} = ${classVar}Repository.newInstance(${classVar}Po);\n\t\t\t${classVar}.save();\n\t\t\tresult.setMessage(\"保存${comment}成功\");\n\t\t} catch (Exception e) {\n\t\t\tsetExceptionResult(result, StateEnum.ERROR.getCode(), StateEnum.ERROR.getText(), e);\n\t\t}\n\t\treturn result;\n\t}\n\n\t@ApiOperation(value = \"删除\", notes = \"删除${comment}\")\n\t@Override\n\tpublic APIResult<Void> remove(\n\t\t\t@ApiParam(name = \"ids\", value = \"${comment}ID数组\", required = true) \n\t\t\t@RequestParam(name = \"ids\", required = true) String[] ids) {\n\t\tAPIResult<Void> result = new APIResult<Void>();\n\t\ttry {\n\t\t\t${class} domain = ${classVar}Repository.newInstance();\n\t\t\tdomain.deleteByIds(ids);\n\t\t\tresult.setMessage(\"删除${comment}成功\");\n\t\t} catch (Exception e) {\n\t\t\tsetExceptionResult(result, StateEnum.ERROR.getCode(), StateEnum.ERROR.getText(), e);\n\t\t}\n\t\treturn result;\n\t}\n\t\n}\n",
"comment": null,
"isDef": "Y",
"creator": "654755459927900160",
"typeName": null,
"creatorName": "黄春艳"
},
{
"pk": "",
"name": "web",
"ip": null,
"createBy": null,
"createTime": 1576823454000,
"updateBy": null,
"updateTime": null,
"tenantId": "-999",
"dataStatus": null,
"dbtype": null,
"id": "657590757296701440",
"typeId": null,
"key": "web",
"filename": "{classVar}.js",
"dir": "src/api/{sys}/{module}",
"sub": "false",
"override": "true",
"path": "/template/codegen/view/request.ftl",
"content": "import request from '@/utils/request'\nconst ${class?upper_case}_URL = '/${gatewayMapping}/v3'\n\n<#if model.variables.struType='tree'>\n/**\n * 查询树信息\n * @param {*} params\n */\nexport function getTreeData(params) {\n return request({\n url: ${class?upper_case}_URL + '/${classVar}/findTreeData',\n params: params\n })\n}\n<#else>\n/**\n * 查询列表数据\n * @param {*} params\n */\nexport function queryPageList(data) {\n return request({\n url: ${class?upper_case}_URL + '/${classVar}/query',\n method: 'post',\n data: data\n })\n}\n</#if>\n/**\n * 删除数据\n * @param {*} params\n */\nexport function remove(params) {\n return request({\n url: ${class?upper_case}_URL + '/${classVar}/remove',\n method: 'post',\n params: params\n })\n}\n/**\n * 保存数据\n * @param {*} params\n */\nexport function save(params) {\n return request({\n url: ${class?upper_case}_URL + '/${classVar}/save',\n method: 'post',\n data: params\n })\n}\n\n/**\n * 获取数据\n * @param {*} params\n */\nexport function get(params) {\n return request({\n url: ${class?upper_case}_URL + '/${classVar}/get',\n method: 'get',\n params: params\n })\n}\n\n",
"comment": null,
"isDef": "Y",
"creator": "654755459927900160",
"typeName": null,
"creatorName": "黄春艳"
},
{
"pk": "",
"name": "list",
"ip": null,
"createBy": null,
"createTime": 1576823454000,
"updateBy": null,
"updateTime": null,
"tenantId": "-999",
"dataStatus": null,
"dbtype": null,
"id": "657590757527388160",
"typeId": null,
"key": "list",
"filename": "list.vue",
"dir": "src/views/{sys}/{module}/{classVar}",
"sub": "false",
"override": "true",
"path": "/template/codegen/view/list.ftl",
"content": "<template>\n <div class=\"main-container\">\n <ibps-crud\n ref=\"crud\"\n :height=\"height\"\n :data=\"listData\"\n :toolbars=\"listConfig.toolbars\"\n :search-form=\"listConfig.searchForm\"\n :pk-key=\"pkKey\"\n :columns=\"listConfig.columns\"\n :row-handle=\"listConfig.rowHandle\"\n :pagination=\"pagination\"\n :loading=\"loading\"\n @action-event=\"handleAction\"\n @sort-change=\"handleSortChange\"\n @pagination-change=\"handlePaginationChange\"\n />\n <edit\n :id=\"editId\"\n :title=\"title\"\n :visible=\"dialogFormVisible\"\n :readonly=\"readonly\"\n @callback=\"search\"\n @close=\"visible => dialogFormVisible = visible\"\n />\n </div>\n</template>\n\n<script>\nimport { queryPageList, remove } from '@/api/${sys}/${module}/${classVar}'\nimport ActionUtils from '@/utils/action'\nimport FixHeight from '@/mixins/height'\nimport Edit from './edit'\n\nexport default {\n components: {\n Edit\n },\n mixins: [FixHeight],\n data() {\n return {\n dialogFormVisible: false, // 弹窗\n apiGrantVisible: false,\n editId: '', // 编辑dialog需要使用\n readonly: false, // 是否只读\n pkKey: '${pkVar}', // 主键 如果主键不是pk需要传主键\n\n title: '',\n\n loading: true,\n height: document.clientHeight,\n\n listData: [],\n pagination: {},\n sorts: {},\n listConfig: {\n toolbars: [\n {\n key: 'search'\n },\n {\n key: 'add'\n },\n {\n key: 'edit'\n },\n {\n key: 'remove'\n }\n ],\n searchForm: {\n forms: [\n\t\t\t<#assign tmp = 0>\n\t \t\t<#list commonList as col>\n\t\t\t<#assign colName=col.colName>\n\t\t\t<#if (col.isQuery)>\n <#if (tmp>0)>,</#if>{ prop: 'Q^${col.columnName?upper_case}^${getDataType(\"${col.colType}\",\"0\")}', label: '${col.comment}' }\n\t\t\t<#assign tmp = tmp + 1>\n </#if>\n\t\t\t</#list> \n // ,{ prop: ['Q^CREATE_TIME_^DL', 'Q^CREATE_TIME_^DG'], label: '创建时间', fieldType: 'daterange' }\n ]\n },\n // 表格字段配置\n columns: [\n\t\t\t<#assign tmp=0>\n\t \t\t<#list colList as col>\n\t\t\t<#assign colName=col.colName>\n\t\t\t<#if (col.isPK) >\n\t\t\t<#elseif (col.isList)>\n <#if (tmp>0)>,</#if>{ prop: '${colName}', label: '${col.comment}' }\n <#assign tmp=tmp + 1>\n\t\t\t</#if>\n \t</#list>\n // { prop: 'createTime', label: '创建时间', sortable: 'custom' }\n ],\n rowHandle: {\n actions: [\n { key: 'edit' },\n { key: 'remove' },\n { key: 'detail' }\n ]\n }\n }\n }\n },\n created() {\n this.loadData()\n },\n methods: {\n // 加载数据\n loadData() {\n this.loading = true\n queryPageList(this.getSearcFormData()).then(response => {\n ActionUtils.handleListData(this, response.data)\n this.loading = false\n }).catch(() => {\n this.loading = false\n })\n },\n /**\n * 获取格式化参数\n */\n getSearcFormData() {\n return ActionUtils.formatParams(\n this.$refs['crud'] ? this.$refs['crud'].getSearcFormData() : {},\n this.pagination,\n this.sorts)\n },\n /**\n * 处理分页事件\n */\n handlePaginationChange(page) {\n ActionUtils.setSorts(this.sorts)\n ActionUtils.setPagination(this.pagination, page)\n this.loadData()\n },\n /**\n * 处理排序\n */\n handleSortChange(sort) {\n ActionUtils.setSorts(this.sorts, sort)\n ActionUtils.setPagination(this.pagination)\n this.loadData()\n },\n /**\n * 查询\n */\n search() {\n ActionUtils.setPagination(this.pagination)\n ActionUtils.setSorts(this.sorts)\n this.loadData()\n },\n /**\n * 处理按钮事件\n */\n handleAction(command, position, selection, data) {\n switch (command) {\n case 'search':// 查询\n this.loadData()\n break\n case 'add':// 添加\n this.handleEdit()\n this.title = '添加${comment}'\n break\n case 'edit':// 编辑\n ActionUtils.selectedRecord(selection).then((id) => {\n this.handleEdit(id)\n this.title = '编辑${comment}'\n }).catch(() => { })\n break\n case 'detail':// 明细\n ActionUtils.selectedRecord(selection).then((id) => {\n this.handleEdit(id, true)\n this.title = '${comment}明细'\n }).catch(() => { })\n break\n case 'remove':// 删除\n ActionUtils.removeRecord(selection).then((ids) => {\n this.handleRemove(ids)\n }).catch(() => { })\n break\n default:\n break\n }\n },\n /**\n * 处理编辑\n */\n handleEdit(id = '', readonly = false) {\n this.editId = id\n this.readonly = readonly\n this.dialogFormVisible = true\n },\n /**\n * 处理删除\n */\n handleRemove(ids) {\n // 获取数据\n remove({ ids: ids }).then(response => {\n ActionUtils.removeSuccessMessage()\n this.search()\n }).catch(() => {})\n }\n }\n}\n</script>\n\n\n",
"comment": null,
"isDef": "Y",
"creator": "654755459927900160",
"typeName": null,
"creatorName": "黄春艳"
},
{
"pk": "",
"name": "edit",
"ip": null,
"createBy": null,
"createTime": 1576823454000,
"updateBy": null,
"updateTime": null,
"tenantId": "-999",
"dataStatus": null,
"dbtype": null,
"id": "657590757716131840",
"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": "654755459927900160",
"typeName": null,
"creatorName": "黄春艳"
},
{
"pk": "",
"name": "tree",
"ip": null,
"createBy": null,
"createTime": 1576823454000,
"updateBy": null,
"updateTime": null,
"tenantId": "-999",
"dataStatus": null,
"dbtype": null,
"id": "657590757820989440",
"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": "654755459927900160",
"typeName": null,
"creatorName": "黄春艳"
},
{
"pk": "",
"name": "treeEdit",
"ip": null,
"createBy": null,
"createTime": 1576823454000,
"updateBy": null,
"updateTime": null,
"tenantId": "-999",
"dataStatus": null,
"dbtype": null,
"id": "657590757925847040",
"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": "654755459927900160",
"typeName": null,
"creatorName": "黄春艳"
}
]
},
"data": {
"pk": "",
"name": "数据操作层",
"ip": null,
"createBy": null,
"createTime": 1488704737000,
"updateBy": null,
"updateTime": null,
"tenantId": "-999",
"dataStatus": null,
"dbtype": null,
"id": "386814138233389054",
"typeId": null,
"key": "dao",
"subType": "template",
"subKeys": "daoTest,queryDaoImpl,queryDao,daoImpl,dao,baseTest",
"isDef": "false",
"comment": null,
"creator": "1",
"typeName": null,
"creatorName": "管理员"
}
}
返回参数说明:
名称 | 类型 | 备注 |
---|---|---|
data | DoTypePo | 代码生成器-生成类型 |
获取生成类型列表
简述:
- 获取生成类型列表
请求URL:
- http://ip:port/ibps/platform/v3/codegen/do/type/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": "树型",
"ip": null,
"createBy": null,
"createTime": 1489743567000,
"updateBy": null,
"updateTime": null,
"tenantId": "-999",
"dataStatus": null,
"dbtype": null,
"id": "386814138233389061",
"typeId": null,
"key": "tree",
"subType": "doType",
"subKeys": "db,dao,domain,service,api,controller,treeView",
"isDef": "false",
"comment": null,
"creator": "1",
"typeName": null,
"creatorName": "管理员"
},
{
"pk": "",
"name": "列表",
"ip": null,
"createBy": null,
"createTime": 1488704929000,
"updateBy": null,
"updateTime": null,
"tenantId": "-999",
"dataStatus": null,
"dbtype": null,
"id": "386814138233389059",
"typeId": null,
"key": "default",
"subType": "doType",
"subKeys": "db,dao,domain,service,api,controller,view",
"isDef": "true",
"comment": null,
"creator": "1",
"typeName": null,
"creatorName": "管理员"
},
{
"pk": "",
"name": "列表服务化",
"ip": null,
"createBy": null,
"createTime": 1488704929000,
"updateBy": null,
"updateTime": null,
"tenantId": "-999",
"dataStatus": null,
"dbtype": null,
"id": "386814138233389339",
"typeId": null,
"key": "providerDefault",
"subType": "doType",
"subKeys": "db,dao,domain,service,api,provider,consumer,controller,view",
"isDef": "true",
"comment": null,
"creator": "1",
"typeName": null,
"creatorName": "管理员"
}
],
"pageResult": {
"limit": 3,
"page": 1,
"totalCount": 14,
"totalPages": 5
}
}
}
返回参数说明:
名称 | 类型 | 备注 |
---|---|---|
data | APIPageList< DoTypePo > | 代码生成器-生成类型 |
刪除数据
简述:
- 刪除数据
请求URL:
- http://ip:port/ibps/platform/v3/codegen/do/type/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/do/type/remove?ids=675475979333795840
返回示例:
{
"state": 200,
"request": null,
"message": "",
"cause": "",
"variables": {},
"data": null
}
返回参数说明:
名称 | 类型 | 备注 |
---|---|---|
data | Void |
保存数据
简述:
- 保存数据
请求URL:
- http://ip:port/ibps/platform/v3/codegen/do/type/save
- URL中的ip需要替换为自己网关ip
- URL中的port需要替换为自己网关端口
请求方式:
- POST
请求参数:
- Headers:
名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
---|---|---|---|---|---|
X-Authorization-access_token | String | 是 | 系统令牌 |
- Query:
暂无
- Body:
DoTypePo 对象信息
名称 | 类型 | 是否必须 | 默认值 | 备注 |
---|---|---|---|---|
typeName | String | 否 | 分类名称 | |
creatorName | String | 否 | 创建人 | |
id | String | 否 | 主键 | |
typeId | String | 否 | 分类 | |
key | String | 是 | 类型key | |
name | String | 是 | 类型名称 | |
subType | String | 是 | 子集类型,doType、template | |
subKeys | String | 否 | 子集keys | |
isDef | String | 是 | 是否默认 | |
comment | String | 否 | 描述 | |
creator | String | 是 | 创建人 | |
createTime | Date | 否 | 创建时间 |
请求参数示例:
{
"key": "test",
"name": "test",
"subType": "template",
"isDef": "false",
"subKeys": "function",
"comment": "test",
"creator": "654384477392338944",
"createTime": null
}
返回示例:
{
"state": 200,
"request": null,
"message": "",
"cause": "",
"variables": {},
"data": null
}
返回参数说明:
名称 | 类型 | 备注 |
---|---|---|
data | Void |
备注
- [1] : APIRequest为动态查询请求对象,详情请移步全局请求格式