{
"codeTemplates": [
{
"type": "appCode",
"applyFor": "797A1496-D649-4261-89B4-544132EC3F36",
" JpaBean": "{{ var today=new Date();\n var fullYear=today.getFullYear();\n var month=today.getMonth() + 1;\n var days=today.getDate();\n \n var pkVarName = \"undefinedId\";\n var pkDataType = \"String\";\n it.entity.fields.forEach(function(field){\n if(field.primaryKey){\n pkVarName = it.func.camel(field.defKey,false);\n pkDataType = field[\"type\"];\n return;\n }\n });\n \n var pkgName = it.entity.env.base.nameSpace;\n var beanClass = it.entity.env.base.codeRoot;\n var beanVarName = beanClass.charAt(0).toLowerCase()+beanClass.slice(1);\n var serviceClass = beanClass+'Service';\n var serviceVarName= beanVarName+'Service';\n \n}}package {{=pkgName}}.entity;\n$blankline\nimport java.time.LocalDateTime;\nimport lombok.Data;\nimport java.math.BigDecimal;\n$blankline\n\n /**\n * {{=it.entity.defName}};{{=it.entity.comment}}\n * @author : heimi\n * @date : {{=fullYear}}-{{=month}}-{{=days}}\n */\n\n@Data\npublic class {{=beanClass}} implements {\n{{~it.entity.fields:field:index}}\n /** {{=it.func.join(field.defName,field.comment,';')}} */\n private {{=field.type}} {{=it.func.camel(field.defKey,false)}} ;\n{{~}}\n$blankline\n\n\n}",
"apply": "797A1496-D649-4261-89B4-544132EC3F36"
},
{
"type": "appCode",
"applyFor": "F3AC2415-E86B-40C6-9FEB-F4B7937D2C30",
"Default": "using System;\nusing System.Collections.Generic;\n\n$blankline\n{{\n var today=new Date();\n var fullYear=today.getFullYear();\n var month=today.getMonth() + 1;\n var days=today.getDate();\n}}\n/*\n * @author : http://www.chiner.com.cn\n * @date : {{=fullYear}}-{{=month}}-{{=days}}\n * @desc : {{=it.func.join(it.entity.defName,it.entity.comment,'-')}}\n */\nnamespace PDManer.Application\n{\n public partial class {{=it.func.camel(it.entity.defKey,true) }}\n {\n \n {{~it.entity.fields:field:index}}\n /// <summary>\n /// {{=it.func.join(field.defName,field.comment,';')}}\n /// </summary>\n public {{=field.type}} {{=it.func.camel(field.defKey,true)}} { get; set; }\n $blankline\n {{~}}\n \n }\n}",
"SqlSugar": "using System;\nusing System.Collections.Generic;\nusing SqlSugar;\n\n$blankline\n{{\n var today=new Date();\n var fullYear=today.getFullYear();\n var month=today.getMonth() + 1;\n var days=today.getDate();\n var sqlSugartable='[SugarTable(\"{{=it.entity.defKey}}\", TableDescription = \"{{=it.func.join(it.entity.defName,it.entity.comment,';')}}\")]';\n}}\n/*\n * @author : [email protected]\n * @date : {{=fullYear}}-{{=month}}-{{=days}}\n * @desc : {{=it.func.join(it.entity.defName,it.entity.comment,'-')}}\n */\nnamespace Model.DBModel\n{\n /// <summary>\n /// {{=it.func.join(it.entity.defName,it.entity.comment,';')}}\n /// </summary>\n {{=sqlSugartable}}\n public class {{=it.entity.defKey}}\n {\n {{~it.entity.fields:field:index}}\n /// <summary>\n /// {{=it.func.join(field.defName,field.comment,';')}}\n /// </summary>\n {{? field.primaryKey }}\n [SugarColumn(IsIdentity = true, IsPrimaryKey = true)]\n {{?}}\n public {{=field.type}} {{=it.func.camel(field.defKey,true)}}{ get; set; }\n $blankline\n {{~}}\n }\n}"
},
{
"applyFor": "895CFD1D-4273-4D32-A2C4-CAC70200AB5B",
"type": "appCode",
"Controller": "{{ var today=new Date();\n var fullYear=today.getFullYear();\n var month=today.getMonth() + 1;\n var days=today.getDate();\n \n var pkVarName = \"undefinedId\";\n var pkDataType = \"String\";\n it.entity.fields.forEach(function(field){\n if(field.primaryKey){\n pkVarName = it.func.camel(field.defKey,false);\n pkDataType = field[\"type\"];\n return;\n }\n });\n \n var pkgName = it.entity.env.base.nameSpace;\n var beanClass = it.entity.env.base.codeRoot;\n var beanVarName = beanClass.charAt(0).toLowerCase()+beanClass.slice(1);\n var serviceClass = beanClass+'Service';\n var serviceVarName= beanVarName+'Service';\n \n}}package {{=pkgName}}.controller;\n$blankline\nimport io.swagger.annotations.Api;\nimport io.swagger.annotations.ApiOperation;\nimport org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.data.domain.Page;\nimport org.springframework.data.domain.PageRequest;\nimport org.springframework.http.ResponseEntity;\nimport org.springframework.web.bind.annotation.*;\nimport {{=pkgName}}.entity.{{=beanClass}};\nimport {{=pkgName}}.service.{{=serviceClass}};\n$blankline\n\n /**\n * {{=it.entity.defName}};({{=it.entity.defKey}})表控制层\n * @author : http://www.chiner.pro\n * @date : {{=fullYear}}-{{=month}}-{{=days}}\n */\n@Api(tags = \"{{=it.entity.defName}}对象功能接口\")\n@RestController\n@RequestMapping(\"/{{=it.func.camel(it.entity.defKey,false)}}\")\npublic class {{=beanClass}}Controller{\n @Autowired\n private {{=serviceClass}} {{=serviceVarName}};\n $blankline\n /** \n * 通过ID查询单条数据 \n *\n * @param {{=pkVarName}} 主键\n * @return 实例对象\n */\n @ApiOperation(\"通过ID查询单条数据\")\n @GetMapping(\"{{{=it.func.camel(pkVarName,false)}}}\")\n public ResponseEntity<{{=beanClass}}> queryById({{=pkDataType}} {{=pkVarName}}){\n return ResponseEntity.ok({{=serviceVarName}}.queryById({{=pkVarName}}));\n }\n $blankline\n /** \n * 分页查询\n *\n * @param {{=beanVarName}} 筛选条件\n * @param pageRequest 分页对象\n * @return 查询结果\n */\n @ApiOperation(\"分页查询\")\n @GetMapping\n public ResponseEntity<Page<{{=beanClass}}>> paginQuery({{=beanClass}} {{=beanVarName}}, PageRequest pageRequest){\n return ResponseEntity.ok({{=serviceVarName}}.paginQuery({{=beanVarName}}, pageRequest));\n }\n $blankline\n /** \n * 新增数据\n *\n * @param {{=beanVarName}} 实例对象\n * @return 实例对象\n */\n @ApiOperation(\"新增数据\")\n @PostMapping\n public ResponseEntity<{{=beanClass}}> add({{=beanClass}} {{=beanVarName}}){\n return ResponseEntity.ok({{=serviceVarName}}.insert({{=beanVarName}}));\n }\n $blankline\n /** \n * 更新数据\n *\n * @param {{=beanVarName}} 实例对象\n * @return 实例对象\n */\n @ApiOperation(\"更新数据\")\n @PutMapping\n public ResponseEntity<{{=beanClass}}> edit({{=beanClass}} {{=beanVarName}}){\n return ResponseEntity.ok({{=serviceVarName}}.update({{=beanVarName}}));\n }\n $blankline\n /** \n * 通过主键删除数据\n *\n * @param {{=pkVarName}} 主键\n * @return 是否成功\n */\n @ApiOperation(\"通过主键删除数据\")\n @DeleteMapping\n public ResponseEntity<Boolean> deleteById({{=pkDataType}} {{=pkVarName}}){\n return ResponseEntity.ok({{=serviceVarName}}.deleteById({{=pkVarName}}));\n }\n}",
"Service": "{{ var today=new Date();\n var fullYear=today.getFullYear();\n var month=today.getMonth() + 1;\n var days=today.getDate();\n \n var pkVarName = \"undefinedId\";\n var pkDataType = \"String\";\n it.entity.fields.forEach(function(field){\n if(field.primaryKey){\n pkVarName = it.func.camel(field.defKey,false);\n pkDataType = field[\"type\"];\n return;\n }\n });\n \n var pkgName = it.entity.env.base.nameSpace;\n var beanClass = it.entity.env.base.codeRoot;\n var beanVarName = beanClass.charAt(0).toLowerCase()+beanClass.slice(1);\n var serviceClass = beanClass+'Service';\n var serviceVarName= beanVarName+'Service';\n \n}}package {{=pkgName}}.service;\n$blankline\nimport org.springframework.data.domain.Page;\nimport org.springframework.data.domain.PageRequest;\nimport {{=pkgName}}.entity.{{=beanClass}};\n$blankline\n\n /**\n * {{=it.entity.defName}};({{=it.entity.defKey}})表服务接口\n * @author : http://www.chiner.pro\n * @date : {{=fullYear}}-{{=month}}-{{=days}}\n */\npublic interface {{=serviceClass}}{\n /** \n * 通过ID查询单条数据 \n *\n * @param {{=pkVarName}} 主键\n * @return 实例对象\n */\n {{=beanClass}} queryById({{=pkDataType}} {{=pkVarName}});\n \n /** \n * 分页查询\n *\n * @param {{=beanVarName}} 筛选条件\n * @param pageRequest 分页对象\n * @return 查询结果\n */\n Page<{{=beanClass}}> paginQuery({{=beanClass}} {{=beanVarName}}, PageRequest pageRequest);\n\n /** \n * 新增数据\n *\n * @param {{=beanVarName}} 实例对象\n * @return 实例对象\n */\n {{=beanClass}} insert({{=beanClass}} {{=beanVarName}});\n\n \n /** \n * 更新数据\n *\n * @param {{=beanVarName}} 实例对象\n * @return 实例对象\n */\n {{=beanClass}} update({{=beanClass}} {{=beanVarName}});\n\n /** \n * 通过主键删除数据\n *\n * @param {{=pkVarName}} 主键\n * @return 是否成功\n */\n boolean deleteById({{=pkDataType}} {{=pkVarName}});\n}",
"ServiceImpl": "{{ var today=new Date();\n var fullYear=today.getFullYear();\n var month=today.getMonth() + 1;\n var days=today.getDate();\n \n var pkVarName = \"undefinedId\";\n var pkVarNameU = \"UndefinedId\";\n var pkDataType = \"String\";\n it.entity.fields.forEach(function(field){\n if(field.primaryKey){\n pkVarName = it.func.camel(field.defKey,false);\n pkVarNameU = it.func.camel(field.defKey,true);\n pkDataType = field[\"type\"];\n return;\n }\n });\n \n var pkgName = it.entity.env.base.nameSpace;\n var beanClass = it.entity.env.base.codeRoot;\n var beanVarName = beanClass.charAt(0).toLowerCase()+beanClass.slice(1);\n var serviceClass = beanClass+'Service';\n var serviceVarName= beanVarName+'Service';\n var mapperName = beanVarName+'Mapper';\n \n}}package {{=pkgName}}.service.impl;\n$blankline\nimport org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.stereotype.Service;\nimport org.springframework.data.domain.Page;\nimport org.springframework.data.domain.PageImpl;\nimport org.springframework.data.domain.PageRequest;\nimport {{=pkgName}}.entity.{{=beanClass}};\nimport {{=pkgName}}.mapper.{{=beanClass}}Mapper;\nimport {{=pkgName}}.service.{{=serviceClass}};\n\n /**\n * {{=it.entity.defName}};({{=it.entity.defKey}})表服务实现类\n * @author : http://www.chiner.pro\n * @date : {{=fullYear}}-{{=month}}-{{=days}}\n */\n@Service\npublic class {{=serviceClass}}Impl implements {{=serviceClass}}{\n @Autowired\n private {{=beanClass}}Mapper {{=mapperName}};\n $blankline\n /** \n * 通过ID查询单条数据 \n *\n * @param {{=pkVarName}} 主键\n * @return 实例对象\n */\n public {{=beanClass}} queryById({{=pkDataType}} {{=pkVarName}}){\n return {{=mapperName}}.queryById({{=pkVarName}});\n }\n $blankline\n /** \n * 分页查询\n *\n * @param {{=beanVarName}} 筛选条件\n * @param pageRequest 分页对象\n * @return 查询结果\n */\n public Page<{{=beanClass}}> paginQuery({{=beanClass}} {{=beanVarName}}, PageRequest pageRequest){\n long total = {{=mapperName}}.count({{=beanVarName}});\n return new PageImpl<>({{=mapperName}}.queryAllByLimit({{=beanVarName}}, pageRequest), pageRequest, total);\n }\n $blankline\n /** \n * 新增数据\n *\n * @param {{=beanVarName}} 实例对象\n * @return 实例对象\n */\n public {{=beanClass}} insert({{=beanClass}} {{=beanVarName}}){\n {{=mapperName}}.insert({{=beanVarName}});\n return {{=beanVarName}};\n }\n $blankline\n /** \n * 更新数据\n *\n * @param {{=beanVarName}} 实例对象\n * @return 实例对象\n */\n public {{=beanClass}} update({{=beanClass}} {{=beanVarName}}){\n {{=mapperName}}.update({{=beanVarName}});\n return queryById({{=beanVarName}}.get{{=pkVarNameU}}());\n }\n $blankline\n /** \n * 通过主键删除数据\n *\n * @param {{=pkVarName}} 主键\n * @return 是否成功\n */\n public boolean deleteById({{=pkDataType}} {{=pkVarName}}){\n int total = {{=mapperName}}.deleteById({{=pkVarName}});\n return total > 0;\n }\n}",
"Mapper": "{{ var today=new Date();\n var fullYear=today.getFullYear();\n var month=today.getMonth() + 1;\n var days=today.getDate();\n \n var pkVarName = \"undefinedId\";\n var pkDataType = \"String\";\n it.entity.fields.forEach(function(field){\n if(field.primaryKey){\n pkVarName = it.func.camel(field.defKey,false);\n pkDataType = field[\"type\"];\n return;\n }\n });\n \n var pkgName = it.entity.env.base.nameSpace;\n var beanClass = it.entity.env.base.codeRoot;\n var beanVarName = beanClass.charAt(0).toLowerCase()+beanClass.slice(1);\n var serviceClass = beanClass+'Service';\n var serviceVarName= beanVarName+'Service';\n \n}}package {{=pkgName}}.mapper;\n$blankline\nimport java.util.List;\nimport org.apache.ibatis.annotations.Mapper;\nimport org.apache.ibatis.annotations.Param;\nimport org.springframework.data.domain.Pageable;\nimport {{=pkgName}}.entity.{{=beanClass}};\n$blankline\n\n /**\n * {{=it.entity.defName}};({{=it.entity.defKey}})表数据库访问层\n * @author : http://www.chiner.pro\n * @date : {{=fullYear}}-{{=month}}-{{=days}}\n */\n@Mapper\npublic interface {{=beanClass}}Mapper{\n /** \n * 通过ID查询单条数据 \n *\n * @param {{=pkVarName}} 主键\n * @return 实例对象\n */\n {{=beanClass}} queryById({{=pkDataType}} {{=pkVarName}});\n \n /** \n * 分页查询指定行数据\n *\n * @param {{=beanVarName}} 查询条件\n * @param pageable 分页对象\n * @return 对象列表\n */\n List<{{=beanClass}}> queryAllByLimit({{=beanClass}} {{=beanVarName}}, @Param(\"pageable\") Pageable pageable);\n\n /** \n * 统计总行数\n *\n * @param {{=beanVarName}} 查询条件\n * @return 总行数\n */\n long count({{=beanClass}} {{=beanVarName}});\n\n /** \n * 新增数据\n *\n * @param {{=beanVarName}} 实例对象\n * @return 影响行数\n */\n int insert({{=beanClass}} {{=beanVarName}});\n\n /** \n * 批量新增数据\n *\n * @param entities List<{{=beanClass}}> 实例对象列表\n * @return 影响行数\n */\n int insertBatch(@Param(\"entities\") List<{{=beanClass}}> entities);\n \n /** \n * 批量新增或按主键更新数据\n *\n * @param entities List<{{=beanClass}}> 实例对象列表\n * @return 影响行数\n */\n int insertOrUpdateBatch(@Param(\"entities\") List<{{=beanClass}}> entities);\n \n /** \n * 更新数据\n *\n * @param {{=beanVarName}} 实例对象\n * @return 影响行数\n */\n int update({{=beanClass}} {{=beanVarName}});\n\n /** \n * 通过主键删除数据\n *\n * @param {{=pkVarName}} 主键\n * @return 影响行数\n */\n int deleteById({{=pkDataType}} {{=pkVarName}});\n}",
"Mapper.xml": "{{ var today=new Date();\n var fullYear=today.getFullYear();\n var month=today.getMonth() + 1;\n var days=today.getDate();\n \n var pkVarName = \"undefinedId\";\n var pkDataType = \"String\";\n var pkField = \"UNDEFINED_ID\";\n it.entity.fields.forEach(function(field){\n if(field.primaryKey){\n pkField = field.defKey;\n pkVarName = it.func.camel(field.defKey,false);\n pkDataType = field[\"type\"];\n return;\n }\n });\n \n var pkgName = it.entity.env.base.nameSpace;\n var beanClass = it.entity.env.base.codeRoot;\n var beanVarName = beanClass.charAt(0).toLowerCase()+beanClass.slice(1);\n var serviceClass = beanClass+'Service';\n var serviceVarName= beanVarName+'Service';\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=\"{{=pkgName}}.mapper.{{=beanClass}}Mapper\">\n <resultMap type=\"{{=pkgName}}.entity.{{=beanClass}}\" id=\"{{=beanClass}}Map\">\n {{~it.entity.fields:field:index}}\n <result property=\"{{=it.func.camel(field.defKey,false)}}\" column=\"{{=field.defKey}}\" jdbcType=\"{{=field.type}}\"/>\n {{~}}\n </resultMap>\n $blankline\n <!-- 通过ID查询单条数据 -->\n <select id=\"queryById\" resultMap=\"{{=beanClass}}Map\">\n select\n {{=it.entity.fields.map(function(e,i){return e.defKey}).join(',')}}\n from {{=it.entity.defKey}}\n where {{=pkField}} = #{{{=pkVarName}}}\n </select>\n $blankline\n <!--分页查询指定行数据-->\n <select id=\"queryAllByLimit\" resultMap=\"{{=beanClass}}Map\">\n select\n {{=it.entity.fields.map(function(e,i){return e.defKey}).join(',')}}\n from {{=it.entity.defKey}}\n <where>\n {{~it.entity.fields:field:index}}\n <if test=\"{{=it.func.camel(field.defKey,false)}} != null and {{=it.func.camel(field.defKey,false)}} != ''\">\n and {{=field.defKey}} = #{{{=it.func.camel(field.defKey,false)}}}\n </if>\n {{~}}\n </where>\n limit #{pageable.offset}, #{pageable.pageSize}\n </select>\n $blankline\n <!--统计总行数-->\n <select id=\"count\" resultType=\"java.lang.Long\">\n select count(1)\n from {{=it.entity.defKey}}\n <where>\n {{~it.entity.fields:field:index}}\n <if test=\"{{=it.func.camel(field.defKey,false)}} != null and {{=it.func.camel(field.defKey,false)}} != ''\">\n and {{=field.defKey}} = #{{{=it.func.camel(field.defKey,false)}}}\n </if>\n {{~}}\n </where>\n </select>\n $blankline\n <!--新增数据-->\n <insert id=\"insert\" keyProperty=\"{{=pkField}}\" useGeneratedKeys=\"true\">\n insert into {{=it.entity.defKey}}({{=it.entity.fields.map(function(e,i){return e.defKey}).join(',')}})\n values ({{=it.entity.fields.map(function(e,i){return '#{'+it.func.camel(e.defKey,false)+'}'}).join(',')}})\n </insert>\n $blankline\n <!-- 批量新增数据 -->\n <insert id=\"insertBatch\" keyProperty=\"{{=pkField}}\" useGeneratedKeys=\"true\">\n insert into {{=it.entity.defKey}}({{=it.entity.fields.map(function(e,i){return e.defKey}).join(',')}})\n values\n <foreach collection=\"entities\" item=\"entity\" separator=\",\">\n ({{=it.entity.fields.map(function(e,i){return '#{entity.'+it.func.camel(e.defKey,false)+'}'}).join(',')}})\n </foreach>\n </insert>\n $blankline\n <!-- 批量新增或按主键更新数据 -->\n <insert id=\"insertOrUpdateBatch\" keyProperty=\"{{=pkField}}\" useGeneratedKeys=\"true\">\n insert into {{=it.entity.defKey}}({{=it.entity.fields.map(function(e,i){return e.defKey}).join(',')}})\n values\n <foreach collection=\"entities\" item=\"entity\" separator=\",\">\n ({{=it.entity.fields.map(function(e,i){return '#{entity.'+it.func.camel(e.defKey,false)+'}'}).join(',')}})\n </foreach>\n on duplicate key update\n {{=it.entity.fields.map(function(e,i){return e.defKey + '=values('+e.defKey+')'}).join(',\\n\\t\\t')}}\n </insert>\n $blankline\n <!-- 更新数据 -->\n <update id=\"update\">\n update {{=it.entity.defKey}}\n <set>\n {{~it.entity.fields:field:index}}\n <if test=\"{{=it.func.camel(field.defKey,false)}} != null and {{=it.func.camel(field.defKey,false)}} != ''\">\n {{=field.defKey}} = #{{{=it.func.camel(field.defKey,false)}}},\n </if>\n {{~}}\n </set>\n where {{=pkField}} = #{{{=pkVarName}}}\n </update>\n $blankline\n <!--通过主键删除-->\n <delete id=\"deleteById\">\n delete from {{=it.entity.defKey}} where {{=pkField}} = #{{{=pkVarName}}}\n </delete>\n</mapper>\n\n",
"Entity": "{{ var today=new Date();\n var fullYear=today.getFullYear();\n var month=today.getMonth() + 1;\n var days=today.getDate();\n \n var pkVarName = \"undefinedId\";\n var pkDataType = \"String\";\n it.entity.fields.forEach(function(field){\n if(field.primaryKey){\n pkVarName = it.func.camel(field.defKey,false);\n pkDataType = field[\"type\"];\n return;\n }\n });\n \n var pkgName = it.entity.env.base.nameSpace;\n var beanClass = it.entity.env.base.codeRoot;\n var beanVarName = beanClass.charAt(0).toLowerCase()+beanClass.slice(1);\n var serviceClass = beanClass+'Service';\n var serviceVarName= beanVarName+'Service';\n \n}}package {{=pkgName}}.entity;\n$blankline\nimport io.swagger.annotations.ApiModel;\nimport io.swagger.annotations.ApiModelProperty;\nimport java.io.Serializable;\nimport java.util.Date;\n$blankline\n\n /**\n * {{=it.entity.defName}};{{=it.entity.comment}}\n * @author : http://www.chiner.pro\n * @date : {{=fullYear}}-{{=month}}-{{=days}}\n */\n@ApiModel(value = \"{{=it.entity.defName}}\",description = \"{{=it.entity.comment}}\")\npublic class {{=beanClass}} implements Serializable,Cloneable{\n{{~it.entity.fields:field:index}}\n /** {{=it.func.join(field.defName,field.comment,';')}} */\n @ApiModelProperty(name = \"{{=field.defName}}\",notes = \"{{=field.comment}}\")\n private {{=field.type}} {{=it.func.camel(field.defKey,false)}} ;\n{{~}}\n$blankline\n\n{{~it.entity.fields:field:index}}\n /** {{=it.func.join(field.defName,field.comment,';')}} */\n public {{=field.type}} get{{=it.func.camel(field.defKey,true)}}(){\n return this.{{=it.func.camel(field.defKey,false)}};\n }\n /** {{=it.func.join(field.defName,field.comment,';')}} */\n public void set{{=it.func.camel(field.defKey,true)}}({{=field.type}} {{= it.func.camel(field.defKey,false) }}){\n this.{{=it.func.camel(field.defKey,false)}}={{=it.func.camel(field.defKey,false)}};\n }\n{{~}}\n}"
},
{
"applyFor": "A2EE7B4A-CE62-4290-B00C-B26C1BF18073",
"type": "appCode",
"Controller": "{{ var today=new Date();\n var fullYear=today.getFullYear();\n var month=today.getMonth() + 1;\n var days=today.getDate();\n \n var pkVarName = \"undefinedId\";\n var pkDataType = \"String\";\n it.entity.fields.forEach(function(field){\n if(field.primaryKey){\n pkVarName = it.func.camel(field.defKey,false);\n pkDataType = field[\"type\"];\n return;\n }\n });\n \n var pkgName = it.entity.env.base.nameSpace;\n var beanClass = it.entity.env.base.codeRoot;\n var beanVarName = beanClass.charAt(0).toLowerCase()+beanClass.slice(1);\n var serviceClass = beanClass+'Service';\n var serviceVarName= beanVarName+'Service';\n \n}}package {{=pkgName}}.controller;\n$blankline\nimport java.util.List;\nimport io.swagger.annotations.Api;\nimport io.swagger.annotations.ApiOperation;\nimport org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.data.domain.PageImpl;\nimport org.springframework.data.domain.PageRequest;\nimport org.springframework.http.ResponseEntity;\nimport org.springframework.web.bind.annotation.*;\nimport {{=pkgName}}.entity.{{=beanClass}};\nimport {{=pkgName}}.service.{{=serviceClass}};\n$blankline\n\n /**\n * {{=it.entity.defName}};({{=it.entity.defKey}})表控制层\n * @author : http://www.chiner.pro\n * @date : {{=fullYear}}-{{=month}}-{{=days}}\n */\n@Api(tags = \"{{=it.entity.defName}}对象功能接口\")\n@RestController\n@RequestMapping(\"/{{=it.func.camel(it.entity.defKey,false)}}\")\npublic class {{=beanClass}}Controller{\n @Autowired\n private {{=serviceClass}} {{=serviceVarName}};\n $blankline\n /** \n * 通过ID查询单条数据 \n *\n * @param {{=pkVarName}} 主键\n * @return 实例对象\n */\n @ApiOperation(\"通过ID查询单条数据\")\n @GetMapping(\"{{{=it.func.camel(pkVarName,false)}}}\")\n public ResponseEntity<{{=beanClass}}> queryById({{=pkDataType}} {{=pkVarName}}){\n return ResponseEntity.ok({{=serviceVarName}}.queryById({{=pkVarName}}));\n }\n $blankline\n /** \n * 分页查询\n *\n * @param {{=beanVarName}} 筛选条件\n * @param pageRequest 分页对象\n * @return 查询结果\n */\n @ApiOperation(\"分页查询\")\n @GetMapping\n public ResponseEntity<PageImpl<{{=beanClass}}>> paginQuery({{=beanClass}} {{=beanVarName}}, PageRequest pageRequest){\n //1.分页参数\n long current = pageRequest.getPageNumber();\n long size = pageRequest.getPageSize();\n\n //2.分页查询\n /*把Mybatis的分页对象做封装转换,MP的分页对象上有一些SQL敏感信息,还是通过spring的分页模型来封装数据吧*/\n com.baomidou.mybatisplus.extension.plugins.pagination.Page<{{=beanClass}}> pageResult = {{=serviceVarName}}.paginQuery({{=beanVarName}}, current,size);\n\n //3. 分页结果组装\n List<{{=beanClass}}> dataList = pageResult.getRecords();\n long total = pageResult.getTotal();\n PageImpl<{{=beanClass}}> retPage = new PageImpl<{{=beanClass}}>(dataList,pageRequest,total);\n return ResponseEntity.ok(retPage);\n }\n $blankline\n /** \n * 新增数据\n *\n * @param {{=beanVarName}} 实例对象\n * @return 实例对象\n */\n @ApiOperation(\"新增数据\")\n @PostMapping\n public ResponseEntity<{{=beanClass}}> add({{=beanClass}} {{=beanVarName}}){\n return ResponseEntity.ok({{=serviceVarName}}.insert({{=beanVarName}}));\n }\n $blankline\n /** \n * 更新数据\n *\n * @param {{=beanVarName}} 实例对象\n * @return 实例对象\n */\n @ApiOperation(\"更新数据\")\n @PutMapping\n public ResponseEntity<{{=beanClass}}> edit({{=beanClass}} {{=beanVarName}}){\n return ResponseEntity.ok({{=serviceVarName}}.update({{=beanVarName}}));\n }\n $blankline\n /** \n * 通过主键删除数据\n *\n * @param {{=pkVarName}} 主键\n * @return 是否成功\n */\n @ApiOperation(\"通过主键删除数据\")\n @DeleteMapping\n public ResponseEntity<Boolean> deleteById({{=pkDataType}} {{=pkVarName}}){\n return ResponseEntity.ok({{=serviceVarName}}.deleteById({{=pkVarName}}));\n }\n}",
"Service": "{{ var today=new Date();\n var fullYear=today.getFullYear();\n var month=today.getMonth() + 1;\n var days=today.getDate();\n \n var pkVarName = \"undefinedId\";\n var pkDataType = \"String\";\n it.entity.fields.forEach(function(field){\n if(field.primaryKey){\n pkVarName = it.func.camel(field.defKey,false);\n pkDataType = field[\"type\"];\n return;\n }\n });\n \n var pkgName = it.entity.env.base.nameSpace;\n var beanClass = it.entity.env.base.codeRoot;\n var beanVarName = beanClass.charAt(0).toLowerCase()+beanClass.slice(1);\n var serviceClass = beanClass+'Service';\n var serviceVarName= beanVarName+'Service';\n \n}}package {{=pkgName}}.service;\n$blankline\nimport com.baomidou.mybatisplus.extension.plugins.pagination.Page;\nimport {{=pkgName}}.entity.{{=beanClass}};\n$blankline\n\n /**\n * {{=it.entity.defName}};({{=it.entity.defKey}})表服务接口\n * @author : http://www.chiner.pro\n * @date : {{=fullYear}}-{{=month}}-{{=days}}\n */\npublic interface {{=serviceClass}}{\n $blankline\n /** \n * 通过ID查询单条数据 \n *\n * @param {{=pkVarName}} 主键\n * @return 实例对象\n */\n {{=beanClass}} queryById({{=pkDataType}} {{=pkVarName}});\n $blankline\n /**\n * 分页查询\n *\n * @param {{=beanVarName}} 筛选条件\n * @param current 当前页码\n * @param size 每页大小\n * @return\n */\n Page<{{=beanClass}}> paginQuery({{=beanClass}} {{=beanVarName}}, long current, long size);\n\n /** \n * 新增数据\n *\n * @param {{=beanVarName}} 实例对象\n * @return 实例对象\n */\n {{=beanClass}} insert({{=beanClass}} {{=beanVarName}});\n\n \n /** \n * 更新数据\n *\n * @param {{=beanVarName}} 实例对象\n * @return 实例对象\n */\n {{=beanClass}} update({{=beanClass}} {{=beanVarName}});\n\n /** \n * 通过主键删除数据\n *\n * @param {{=pkVarName}} 主键\n * @return 是否成功\n */\n boolean deleteById({{=pkDataType}} {{=pkVarName}});\n}",
"ServiceImpl": "{{ var today=new Date();\n var fullYear=today.getFullYear();\n var month=today.getMonth() + 1;\n var days=today.getDate();\n \n var pkVarName = \"undefinedId\";\n var pkVarNameU = \"UndefinedId\";\n var pkFieldKey = \"UNDEFINED\";\n var pkDataType = \"String\";\n it.entity.fields.forEach(function(field){\n if(field.primaryKey){\n pkFieldKey = field.defKey;\n pkVarName = it.func.camel(field.defKey,false);\n pkVarNameU = it.func.camel(field.defKey,true);\n pkDataType = field[\"type\"];\n return;\n }\n });\n \n var pkgName = it.entity.env.base.nameSpace;\n var beanClass = it.entity.env.base.codeRoot;\n var beanVarName = beanClass.charAt(0).toLowerCase()+beanClass.slice(1);\n var serviceClass = beanClass+'Service';\n var serviceVarName= beanVarName+'Service';\n var mapperName = beanVarName+'Mapper';\n \n}}package {{=pkgName}}.service.impl;\n$blankline\nimport cn.hutool.core.util.StrUtil;\nimport org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.stereotype.Service;\nimport com.baomidou.mybatisplus.core.metadata.IPage;\nimport com.baomidou.mybatisplus.extension.plugins.pagination.Page;\nimport com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;\nimport com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper;\n\nimport {{=pkgName}}.entity.{{=beanClass}};\nimport {{=pkgName}}.mapper.{{=beanClass}}Mapper;\nimport {{=pkgName}}.service.{{=serviceClass}};\n\n /**\n * {{=it.entity.defName}};({{=it.entity.defKey}})表服务实现类\n * @author : http://www.chiner.pro\n * @date : {{=fullYear}}-{{=month}}-{{=days}}\n */\n@Service\npublic class {{=serviceClass}}Impl implements {{=serviceClass}}{\n @Autowired\n private {{=beanClass}}Mapper {{=mapperName}};\n $blankline\n /** \n * 通过ID查询单条数据 \n *\n * @param {{=pkVarName}} 主键\n * @return 实例对象\n */\n public {{=beanClass}} queryById({{=pkDataType}} {{=pkVarName}}){\n return {{=mapperName}}.selectById({{=pkVarName}});\n }\n $blankline\n /**\n * 分页查询\n *\n * @param {{=beanVarName}} 筛选条件\n * @param current 当前页码\n * @param size 每页大小\n * @return\n */\n public Page<{{=beanClass}}> paginQuery({{=beanClass}} {{=beanVarName}}, long current, long size){\n //1. 构建动态查询条件\n LambdaQueryWrapper<{{=beanClass}}> queryWrapper = new LambdaQueryWrapper<>();\n {{~it.entity.fields.filter(function(e){return e[\"type\"]===\"String\"&&e.defKey !== pkFieldKey}):field:index}}\n if(StrUtil.isNotBlank({{=beanVarName}}.get{{=it.func.camel(field.defKey,true)}}())){\n queryWrapper.eq({{=beanClass}}::get{{=it.func.camel(field.defKey,true)}}, {{=beanVarName}}.get{{=it.func.camel(field.defKey,true)}}());\n }\n {{~}}\n\n //2. 执行分页查询\n Page<{{=beanClass}}> pagin = new Page<>(current , size , true);\n IPage<{{=beanClass}}> selectResult = {{=mapperName}}.selectByPage(pagin , queryWrapper);\n pagin.setPages(selectResult.getPages());\n pagin.setTotal(selectResult.getTotal());\n pagin.setRecords(selectResult.getRecords());\n\n //3. 返回结果\n return pagin;\n }\n $blankline\n /** \n * 新增数据\n *\n * @param {{=beanVarName}} 实例对象\n * @return 实例对象\n */\n public {{=beanClass}} insert({{=beanClass}} {{=beanVarName}}){\n {{=mapperName}}.insert({{=beanVarName}});\n return {{=beanVarName}};\n }\n $blankline\n /** \n * 更新数据\n *\n * @param {{=beanVarName}} 实例对象\n * @return 实例对象\n */\n public {{=beanClass}} update({{=beanClass}} {{=beanVarName}}){\n //1. 根据条件动态更新\n LambdaUpdateChainWrapper<{{=beanClass}}> chainWrapper = new LambdaUpdateChainWrapper<{{=beanClass}}>({{=mapperName}});\n {{~it.entity.fields.filter(function(e){return e[\"type\"]===\"String\"&&e.defKey !== pkFieldKey}):field:index}}\n if(StrUtil.isNotBlank({{=beanVarName}}.get{{=it.func.camel(field.defKey,true)}}())){\n chainWrapper.eq({{=beanClass}}::get{{=it.func.camel(field.defKey,true)}}, {{=beanVarName}}.get{{=it.func.camel(field.defKey,true)}}());\n }\n {{~}}\n //2. 设置主键,并更新\n chainWrapper.set({{=beanClass}}::get{{=pkVarNameU}}, {{=beanVarName}}.get{{=pkVarNameU}}());\n boolean ret = chainWrapper.update();\n //3. 更新成功了,查询最最对象返回\n if(ret){\n return queryById({{=beanVarName}}.get{{=pkVarNameU}}());\n }else{\n return {{=beanVarName}};\n }\n }\n $blankline\n /** \n * 通过主键删除数据\n *\n * @param {{=pkVarName}} 主键\n * @return 是否成功\n */\n public boolean deleteById({{=pkDataType}} {{=pkVarName}}){\n int total = {{=mapperName}}.deleteById({{=pkVarName}});\n return total > 0;\n }\n}",
"Mapper": "{{ var today=new Date();\n var fullYear=today.getFullYear();\n var month=today.getMonth() + 1;\n var days=today.getDate();\n \n var pkVarName = \"undefinedId\";\n var pkDataType = \"String\";\n it.entity.fields.forEach(function(field){\n if(field.primaryKey){\n pkVarName = it.func.camel(field.defKey,false);\n pkDataType = field[\"type\"];\n return;\n }\n });\n \n var pkgName = it.entity.env.base.nameSpace;\n var beanClass = it.entity.env.base.codeRoot;\n var beanVarName = beanClass.charAt(0).toLowerCase()+beanClass.slice(1);\n var serviceClass = beanClass+'Service';\n var serviceVarName= beanVarName+'Service';\n \n}}package {{=pkgName}}.mapper;\n$blankline\n\nimport com.baomidou.mybatisplus.core.conditions.Wrapper;\nimport com.baomidou.mybatisplus.core.mapper.BaseMapper;\nimport com.baomidou.mybatisplus.core.metadata.IPage;\nimport com.baomidou.mybatisplus.core.toolkit.Constants;\nimport org.apache.ibatis.annotations.Mapper;\nimport org.apache.ibatis.annotations.Param;\nimport {{=pkgName}}.entity.{{=beanClass}};\n$blankline\n\n /**\n * {{=it.entity.defName}};({{=it.entity.defKey}})表数据库访问层\n * @author : http://www.chiner.pro\n * @date : {{=fullYear}}-{{=month}}-{{=days}}\n */\n@Mapper\npublic interface {{=beanClass}}Mapper extends BaseMapper<{{=beanClass}}>{\n /** \n * 分页查询指定行数据\n *\n * @param page 分页参数\n * @param wrapper 动态查询条件\n * @return 分页对象列表\n */\n IPage<{{=beanClass}}> selectByPage(IPage<{{=beanClass}}> page , @Param(Constants.WRAPPER) Wrapper<{{=beanClass}}> wrapper);\n}",
"Mapper.xml": "{{ var today=new Date();\n var fullYear=today.getFullYear();\n var month=today.getMonth() + 1;\n var days=today.getDate();\n \n var pkVarName = \"undefinedId\";\n var pkDataType = \"String\";\n var pkField = \"UNDEFINED_ID\";\n it.entity.fields.forEach(function(field){\n if(field.primaryKey){\n pkField = field.defKey;\n pkVarName = it.func.camel(field.defKey,false);\n pkDataType = field[\"type\"];\n return;\n }\n });\n \n var pkgName = it.entity.env.base.nameSpace;\n var beanClass = it.entity.env.base.codeRoot;\n var beanVarName = beanClass.charAt(0).toLowerCase()+beanClass.slice(1);\n var serviceClass = beanClass+'Service';\n var serviceVarName= beanVarName+'Service';\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$blankline\n\n<mapper namespace=\"{{=pkgName}}.mapper.{{=beanClass}}Mapper\">\n <select id=\"selectByPage\" resultType=\"{{=pkgName}}.entity.{{=beanClass}}\">\n select * from user ${ew.customSqlSegment}\n </select>\n</mapper>\n\n",
"Entity": "{{ var today=new Date();\n var fullYear=today.getFullYear();\n var month=today.getMonth() + 1;\n var days=today.getDate();\n \n var pkVarName = \"undefinedId\";\n var pkDataType = \"String\";\n it.entity.fields.forEach(function(field){\n if(field.primaryKey){\n pkVarName = it.func.camel(field.defKey,false);\n pkDataType = field[\"type\"];\n return;\n }\n });\n \n var pkgName = it.entity.env.base.nameSpace;\n var beanClass = it.entity.env.base.codeRoot;\n var beanVarName = beanClass.charAt(0).toLowerCase()+beanClass.slice(1);\n var serviceClass = beanClass+'Service';\n var serviceVarName= beanVarName+'Service';\n \n}}package {{=pkgName}}.entity;\n$blankline\nimport io.swagger.annotations.ApiModel;\nimport io.swagger.annotations.ApiModelProperty;\nimport com.baomidou.mybatisplus.annotation.TableName;\nimport com.baomidou.mybatisplus.annotation.TableId;\nimport java.io.Serializable;\nimport java.util.Date;\n$blankline\n\n /**\n * {{=it.entity.defName}};{{=it.entity.comment}}\n * @author : http://www.chiner.pro\n * @date : {{=fullYear}}-{{=month}}-{{=days}}\n */\n@ApiModel(value = \"{{=it.entity.defName}}\",description = \"{{=it.entity.comment}}\")\n@TableName(\"{{=it.entity.defKey}}\")\npublic class {{=beanClass}} implements Serializable,Cloneable{\n{{~it.entity.fields:field:index}}\n /** {{=it.func.join(field.defName,field.comment,';')}} */\n @ApiModelProperty(name = \"{{=field.defName}}\",notes = \"{{=field.comment}}\")\n {{? field.primaryKey }}\n @TableId\n {{?}}\n private {{=field.type}} {{=it.func.camel(field.defKey,false)}} ;\n{{~}}\n$blankline\n\n{{~it.entity.fields:field:index}}\n /** {{=it.func.join(field.defName,field.comment,';')}} */\n public {{=field.type}} get{{=it.func.camel(field.defKey,true)}}(){\n return this.{{=it.func.camel(field.defKey,false)}};\n }\n /** {{=it.func.join(field.defName,field.comment,';')}} */\n public void set{{=it.func.camel(field.defKey,true)}}({{=field.type}} {{= it.func.camel(field.defKey,false) }}){\n this.{{=it.func.camel(field.defKey,false)}}={{=it.func.camel(field.defKey,false)}};\n }\n{{~}}\n}"
},
{
"applyFor": "B91D99E0-9B7C-416C-8737-B760957DAF09",
"type": "appCode",
"content": "{{\n var today=new Date();\n var fullYear=today.getFullYear();\n var month=today.getMonth() + 1<10?\"0\"+today.getMonth():today.getMonth();\n var days=today.getDate()<10?\"0\"+today.getDate():today.getDate();\n var hours = today.getHours()<10?\"0\"+today.getHours():today.getHours(); \n\tvar minutes = today.getMinutes()<10?\"0\"+today.getMinutes():today.getMinutes(); \n\tvar seconds = today.getSeconds()<10?\"0\"+today.getSeconds():today.getSeconds(); \n}}\n// Package models {{=it.func.join(it.entity.defName,it.entity.comment,',')}}\n// author : http://www.liyang.love\n// date : {{=fullYear}}-{{=month}}-{{=days}} {{=hours}}:{{=minutes}}\n// desc : {{=it.func.join(it.entity.defName,it.entity.comment,',')}}\npackage models\n\n$blankline\n\n// {{=it.func.camel(it.entity.defKey,true) }} {{=it.func.join(it.entity.defName,it.entity.comment,',')}}。\n// 说明:{{=it.entity.comment}}\n// 表名:{{=it.entity.defKey}}\n// group: {{=it.func.camel(it.entity.defKey,true) }}\n// obsolete:\n// appliesto:go 1.8+;\n// namespace:hongmouer.his.models.{{=it.func.camel(it.entity.defKey,true) }}\n// assembly: hongmouer.his.models.go\n// class:HongMouer.HIS.Models.{{=it.func.camel(it.entity.defKey,true) }}\n// version:{{=fullYear}}-{{=month}}-{{=days}} {{=hours}}:{{=minutes}}\ntype {{=it.func.camel(it.entity.defKey,true) }} struct {\n {{~it.entity.fields:field:index}}\n {{=formatGoLang(it.func.camel(field.defKey,true),null,field,it.entity.fields,null,1)}} {{=formatGoLang(field.type,\"type\",field,it.entity.fields,10,3)}} `gorm:\"column:{{=field.primaryKey?\"primaryKey;\":\"\"}}{{=field.defKey}}\" json:\"{{=it.func.camel(field.defKey,true)}}\"` {{=formatGoLang(\"gorm:column:\"+field.defKey+\" json:\"+it.func.camel(field.defKey,true),null,field,it.entity.fields,null,2)}} //type:{{=formatGoLang(field.type,\"type\",field,it.entity.fields,null,3)}} comment:{{=formatGoLang(it.func.join(field.defName,field.comment,';'),\"defName\",field,it.entity.fields,null,4)}} version:{{=fullYear}}-{{=month}}-{{=days}} {{=hours}}:{{=minutes}}\n {{~}}\n}\n\n\n$blankline\n// TableName 表名:{{=it.entity.defKey}},{{=it.entity.defName}}。\n// 说明:{{=it.entity.comment}}\nfunc (ZentaoUserInfo) TableName() string {\n\treturn \"{{=it.entity.defKey}}\"\n}\n\n{{\n\nfunction formatGoLang(str, fieldName, field, fileds, emptLength, isFiled) {\n var maxLength = 0;\n\n if (isFiled == 1) {\n for (var i = 0; i < fileds.length; i++) {\n if (getBlength(it.func.camel(fileds[i].defKey, true)) > maxLength) {\n maxLength = getBlength(it.func.camel(fileds[i].defKey, true)) + 2;\n }\n }\n } else if (isFiled == 2) {\n for (var i = 0; i < fileds.length; i++) {\n var newStr = \"gorm:column:\" + fileds[i].defKey + \" json:\" + it.func.camel(fileds[i].defKey, true);\n if (getBlength(newStr) > maxLength) {\n maxLength = getBlength(newStr) + 2;\n }\n }\n var empt = \"\";\n var strLength = getBlength(str);\n if (field.primaryKey) {\n strLength += getBlength(\"primaryKey;\");\n }\n for (var j = 0; j < maxLength - strLength; j++) {\n empt += ' ';\n }\n return empt;\n } else if (isFiled == 3) {\n /*获取某个字段的最大长度*/\n for (var i = 0; i < fileds.length; i++) {\n var newStr = eval(\"fileds[\" + i + \"].\" + fieldName);\n if (getBlength(newStr) > maxLength) {\n maxLength = getBlength(newStr) + 1;\n }\n }\n } else if (isFiled == 4) {\n /*获取某个字段的最大长度*/\n for (var i = 0; i < fileds.length; i++) {\n var newStr = fileds[i].comment + \";\" + fileds[i].defName;\n if (getBlength(newStr) > maxLength) {\n maxLength = getBlength(newStr) + 1;\n }\n }\n }\n else {\n maxLength = emptLength;\n }\n\n var strLength = getBlength(str);\n for (var j = 0; j < maxLength - strLength; j++) {\n str += ' ';\n }\n return str;\n}\n\nfunction getBlength(str) {\n var n = 0;\n for (var i = str.length; i--;) {\n n += str.charCodeAt(i) > 255 ? 2 : 1;\n }\n return n;\n} \n\n}}"
},
{
"applyFor": "BDF457FD-9F98-4AC3-A705-7587B00A3BAB",
"type": "appCode",
"struct": "use chrono::{DateTime, Local};\nuse serde::{Deserialize, Serialize};\n$blankline\n/// {{=it.entity.defName}}\n#[derive(Serialize, Deserialize, Debug, Clone)]\n{{ var today=new Date();\n var fullYear=today.getFullYear();\n var month=today.getMonth() + 1;\n var days=today.getDate();\n \n var pkVarName = \"undefinedId\";\n var pkDataType = \"String\";\n it.entity.fields.forEach(function(field){\n if(field.primaryKey){\n pkVarName = it.func.camel(field.defKey,false);\n pkDataType = field[\"type\"];\n return;\n }\n });\n \n var pkgName = it.entity.env.base.nameSpace;\n var beanClass = it.entity.env.base.codeRoot;\n var beanVarName = beanClass.charAt(0).toLowerCase()+beanClass.slice(1);\n \n}}\npub struct {{=beanClass}} {\n {{~it.entity.fields:field:index}}\n {{\n let fieldDateType = field.type;\n if(!field.notNull){\n fieldDateType = 'Option<'+fieldDateType+'>';\n }\n }}/// {{=field.defName}}\n pub {{=it.func.camel(field.defKey,false)}}: {{=fieldDateType}},\n {{~}}\n}\n"
},
{
"applyFor": "C41609C1-9CE3-4C96-BF3D-0CEE324359B7",
"type": "appCode",
"Dao": "{{ var today=new Date();\n var fullYear=today.getFullYear();\n var month=today.getMonth() + 1;\n var days=today.getDate();\n \n var pkVarName = \"undefinedId\";\n var pkDataType = \"String\";\n it.entity.fields.forEach(function(field){\n if(field.primaryKey){\n pkVarName = it.func.camel(field.defKey,false);\n pkDataType = field[\"type\"];\n return;\n }\n });\n \n var pkgName = it.entity.env.base.nameSpace;\n var beanClass = it.entity.env.base.codeRoot;\n var beanVarName = beanClass.charAt(0).toLowerCase()+beanClass.slice(1);\n var serviceClass = beanClass+'Service';\n var serviceVarName= beanVarName+'Service';\n \n}}package {{=pkgName}}.dao;\n$blankline\nimport java.util.List;\nimport org.apache.ibatis.annotations.Mapper;\nimport org.apache.ibatis.annotations.Param;\nimport cn.example.core.annotations.PageX;\nimport {{=pkgName}}.model.*;\n$blankline\n\n /**\n * {{=it.entity.defName}};({{=it.entity.defKey}})表数据库访问层\n * @author : hanbing\n * @date : {{=fullYear}}-{{=month}}-{{=days}}\n */\n@Mapper\npublic interface {{=beanClass}}Dao{\n\n\n @PageX\n List<{{=beanClass}}> select({{=beanClass}}Query query);\n\n Integer insert({{=beanClass}} {{=beanVarName}});\n \n Integer insertBatch(List<{{=beanClass}}> {{=beanVarName}}s);\n\n Integer update({{=beanClass}} {{=beanVarName}});\n\n Integer delete(Integer id);\n\n\n}",
"Mapper.xml": "{{ var today=new Date();\n var fullYear=today.getFullYear();\n var month=today.getMonth() + 1;\n var days=today.getDate();\n \n var pkVarName = \"undefinedId\";\n var pkDataType = \"String\";\n var pkField = \"UNDEFINED_ID\";\n it.entity.fields.forEach(function(field){\n if(field.primaryKey){\n pkField = field.defKey;\n pkVarName = it.func.camel(it.func.underline(field.defKey,true),false);\n pkDataType = field[\"type\"];\n return;\n }\n });\n \n var pkgName = it.entity.env.base.nameSpace;\n var beanClass = it.entity.env.base.codeRoot;\n var beanVarName = beanClass.charAt(0).toLowerCase()+beanClass.slice(1);\n var serviceClass = beanClass+'Service';\n var serviceVarName= beanVarName+'Service';\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=\"{{=pkgName}}.dao.{{=beanClass}}Dao\">\n <resultMap type=\"{{=pkgName}}.model.{{=beanClass}}\" id=\"{{=beanClass}}Map\">\n {{~it.entity.fields:field:index}}\n <result property=\"{{=field.defKey}}\" column=\"{{=field.defKey}}\" />\n {{~}}\n </resultMap>\n $blankline\n \n $blankline\n <!--通用查询-->\n <select id=\"select\" resultMap=\"{{=beanClass}}Map\">\n select\n {{=it.entity.fields.map(function(e,i){return e.defKey}).join(',')}}\n from {{=it.entity.defKey}}\n <where>\n {{~it.entity.fields:field:index}}\n <if test=\"{{=it.func.camel(it.func.underline(field.defKey,true),false)}} != null and {{=it.func.camel(it.func.underline(field.defKey,true),false)}} != ''\">\n and {{=field.defKey}} = #{{{=field.defKey}}}\n </if>\n {{~}}\n </where>\n \n </select>\n $blankline\n\n <!--新增数据-->\n <insert id=\"insert\" keyProperty=\"{{=pkField}}\" useGeneratedKeys=\"true\">\n insert into {{=it.entity.defKey}}({{=it.entity.fields.map(function(e,i){return e.defKey}).join(',')}})\n values ({{=it.entity.fields.map(function(e,i){return '#{'+it.func.camel(it.func.underline(e.defKey,true),false)+'}'}).join(',')}})\n </insert>\n $blankline\n <!-- 批量新增数据 -->\n <insert id=\"insertBatch\" keyProperty=\"{{=pkField}}\" useGeneratedKeys=\"true\">\n insert into {{=it.entity.defKey}}({{=it.entity.fields.map(function(e,i){return e.defKey}).join(',')}})\n values\n <foreach collection=\"entities\" item=\"entity\" separator=\",\">\n ({{=it.entity.fields.map(function(e,i){return '#{entity.'+it.func.camel(it.func.underline(e.defKey,true),false)+'}'}).join(',')}})\n </foreach>\n </insert>\n \n $blankline\n <!-- 更新数据 -->\n <update id=\"update\">\n update {{=it.entity.defKey}}\n <set>\n {{~it.entity.fields:field:index}}\n <if test=\"{{=it.func.camel(it.func.underline(field.defKey,true),false)}} != null and {{=it.func.camel(it.func.underline(field.defKey,true),false)}} != ''\">\n {{=field.defKey}} = #{{{=it.func.camel(it.func.underline(field.defKey,true),false)}}},\n </if>\n {{~}}\n </set>\n where {{=pkField}} = #{{{=pkVarName}}}\n </update>\n $blankline\n <!--通过主键软删除-->\n <update id=\"delete\">\n update {{=it.entity.defKey}} set status = 0 where {{=pkField}} = #{{{=pkVarName}}}\n </update>\n</mapper>\n\n",
"Service": "{{ var today=new Date();\n var fullYear=today.getFullYear();\n var month=today.getMonth() + 1;\n var days=today.getDate();\n \n var pkVarName = \"undefinedId\";\n var pkVarNameU = \"UndefinedId\";\n var pkDataType = \"String\";\n it.entity.fields.forEach(function(field){\n if(field.primaryKey){\n pkVarName = it.func.camel(field.defKey,false);\n pkVarNameU = it.func.camel(field.defKey,true);\n pkDataType = field[\"type\"];\n return;\n }\n });\n \n var pkgName = it.entity.env.base.nameSpace;\n var beanClass = it.entity.env.base.codeRoot;\n var beanVarName = beanClass.charAt(0).toLowerCase()+beanClass.slice(1);\n var serviceClass = beanClass+'Service';\n var serviceVarName= beanVarName+'Service';\n var daoName = beanVarName+'Dao';\n \n}}package {{=pkgName}}.service;\n$blankline\nimport org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.stereotype.Service;\nimport {{=pkgName}}.model.*;\nimport {{=pkgName}}.dao.*;\nimport java.util.List;\n\n /**\n * {{=it.entity.defName}};({{=it.entity.defKey}})表服务实现类\n * @author : hanbing\n * @date : {{=fullYear}}-{{=month}}-{{=days}}\n */\n@Service\npublic class {{=serviceClass}}{\n \n $blankline\n @Autowired\n private {{=beanClass}}Dao {{=daoName}};\n $blankline\n \n public List<{{=beanClass}}> select({{=beanClass}}Query query) {\n return {{=daoName}}.select(query);\n }\n $blankline\n public Integer insert({{=beanClass}} {{=beanVarName}}) {\n return {{=daoName}}.insert({{=beanVarName}});\n }\n $blankline\n public Integer update({{=beanClass}} {{=beanVarName}}) {\n return {{=daoName}}.update({{=beanVarName}});\n }\n $blankline\n public Integer delete(Integer id) {\n return {{=daoName}}.delete(id);\n }\n \n \n \n\n}",
"Controller": "{{ var today=new Date();\n var fullYear=today.getFullYear();\n var month=today.getMonth() + 1;\n var days=today.getDate();\n \n var pkVarName = \"undefinedId\";\n var pkDataType = \"String\";\n it.entity.fields.forEach(function(field){\n if(field.primaryKey){\n pkVarName = it.func.camel(field.defKey,false);\n pkDataType = field[\"type\"];\n return;\n }\n });\n \n var pkgName = it.entity.env.base.nameSpace;\n var beanClass = it.entity.env.base.codeRoot;\n var beanVarName = beanClass.charAt(0).toLowerCase()+beanClass.slice(1);\n var serviceClass = beanClass+'Service';\n var serviceVarName= beanVarName+'Service';\n \n}}package {{=pkgName}}.controller;\n$blankline\n\nimport org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.web.bind.annotation.*;\nimport {{=pkgName}}.model.*;\nimport {{=pkgName}}.service.{{=serviceClass}};\nimport java.util.List;\n$blankline\n\n /**\n * {{=it.entity.defName}};({{=it.entity.defKey}})控制层\n * @author : hanbing\n * @date : {{=fullYear}}-{{=month}}-{{=days}}\n */\n\n@RestController\n@RequestMapping(\"/api/{{=beanVarName}}\")\npublic class {{=beanClass}}Controller{\n @Autowired\n private {{=serviceClass}} {{=serviceVarName}};\n $blankline\n /** \n * 查询接口\n */\n @GetMapping\n public List<{{=beanClass}}> select({{=beanClass}}Query query){\n \n return {{=serviceVarName}}.select(query);\n }\n \n $blankline\n \n @PostMapping \n public Integer insert(@RequestBody {{=beanClass}} {{=beanVarName}}){\n return {{=serviceVarName}}.insert({{=beanVarName}});\n }\n $blankline\n @PutMapping \n public Integer update(@RequestBody {{=beanClass}} {{=beanVarName}}){\n return {{=serviceVarName}}.update({{=beanVarName}});\n }\n $blankline\n @DeleteMapping\n public Integer delete(Integer id){\n return {{=serviceVarName}}.delete(id);\n }\n \n}",
"Model": "{{ var today=new Date();\n var fullYear=today.getFullYear();\n var month=today.getMonth() + 1;\n var days=today.getDate();\n \n var pkVarName = \"undefinedId\";\n var pkDataType = \"String\";\n it.entity.fields.forEach(function(field){\n if(field.primaryKey){\n pkVarName = it.func.camel(field.defKey,false);\n pkDataType = field[\"type\"];\n return;\n }\n });\n \n var pkgName = it.entity.env.base.nameSpace;\n var beanClass = it.entity.env.base.codeRoot;\n var beanVarName = beanClass.charAt(0).toLowerCase()+beanClass.slice(1);\n var serviceClass = beanClass+'Service';\n var serviceVarName= beanVarName+'Service';\n \n}}package {{=pkgName}}.model;\n$blankline\nimport java.time.LocalDateTime;\nimport lombok.Data;\nimport java.math.BigDecimal;\n$blankline\n\n /**\n * {{=it.entity.defName}};{{=it.entity.comment}}\n * @author : hanbing\n * @date : {{=fullYear}}-{{=month}}-{{=days}}\n */\n\n@Data\npublic class {{=beanClass}} extends BaseModel {\n{{~it.entity.fields:field:index}}\n /** {{=it.func.join(field.defName,field.comment,';')}} */\n private {{=field.type}} {{=it.func.camel(it.func.underline(field.defKey,true),false)}} ;\n{{~}}\n$blankline\n\n\n}"
}
],
"dataTypeSupports": [
{
"defKey": "JAVA",
"id": "797A1496-D649-4261-89B4-544132EC3F36"
},
{
"defKey": "JavaMybatis",
"id": "895CFD1D-4273-4D32-A2C4-CAC70200AB5B"
},
{
"defKey": "JavaMybatisPlus",
"id": "A2EE7B4A-CE62-4290-B00C-B26C1BF18073"
},
{
"defKey": "C#",
"id": "F3AC2415-E86B-40C6-9FEB-F4B7937D2C30"
},
{
"defKey": "Golang",
"id": "B91D99E0-9B7C-416C-8737-B760957DAF09"
},
{
"defKey": "Rust",
"id": "BDF457FD-9F98-4AC3-A705-7587B00A3BAB"
},
{
"defKey": "MyJava",
"id": "C41609C1-9CE3-4C96-BF3D-0CEE324359B7"
}
],
"dataTypeMapping": {
"referURL": "",
"mappings": [
{
"defKey": "string",
"id": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64",
"defName": "字串",
"797A1496-D649-4261-89B4-544132EC3F36": "String",
"895CFD1D-4273-4D32-A2C4-CAC70200AB5B": "String",
"A2EE7B4A-CE62-4290-B00C-B26C1BF18073": "String",
"F3AC2415-E86B-40C6-9FEB-F4B7937D2C30": "string",
"B91D99E0-9B7C-416C-8737-B760957DAF09": "string",
"BDF457FD-9F98-4AC3-A705-7587B00A3BAB": "String",
"C41609C1-9CE3-4C96-BF3D-0CEE324359B7": "String"
},
{
"defKey": "double",
"id": "1A0BDC09-0792-4174-9E8E-80BE8DF44B8E",
"defName": "小数",
"797A1496-D649-4261-89B4-544132EC3F36": "Double",
"895CFD1D-4273-4D32-A2C4-CAC70200AB5B": "Double",
"A2EE7B4A-CE62-4290-B00C-B26C1BF18073": "Double",
"F3AC2415-E86B-40C6-9FEB-F4B7937D2C30": "decimal",
"B91D99E0-9B7C-416C-8737-B760957DAF09": "*float64",
"BDF457FD-9F98-4AC3-A705-7587B00A3BAB": "f64",
"C41609C1-9CE3-4C96-BF3D-0CEE324359B7": "Double"
},
{
"defKey": "int",
"id": "1D764C4A-6F9F-421E-B11A-6F3E23B51811",
"defName": "整数",
"797A1496-D649-4261-89B4-544132EC3F36": "Integer",
"895CFD1D-4273-4D32-A2C4-CAC70200AB5B": "Integer",
"A2EE7B4A-CE62-4290-B00C-B26C1BF18073": "Integer",
"F3AC2415-E86B-40C6-9FEB-F4B7937D2C30": "float",
"B91D99E0-9B7C-416C-8737-B760957DAF09": "*int",
"BDF457FD-9F98-4AC3-A705-7587B00A3BAB": "i32",
"C41609C1-9CE3-4C96-BF3D-0CEE324359B7": "Integer"
},
{
"defKey": "date",
"id": "89D69E81-EA34-42EE-9FA2-93B8BD27E098",
"defName": "日期",
"797A1496-D649-4261-89B4-544132EC3F36": "Date",
"895CFD1D-4273-4D32-A2C4-CAC70200AB5B": "Date",
"A2EE7B4A-CE62-4290-B00C-B26C1BF18073": "Date",
"F3AC2415-E86B-40C6-9FEB-F4B7937D2C30": "DateTime",
"B91D99E0-9B7C-416C-8737-B760957DAF09": "*time.Time",
"BDF457FD-9F98-4AC3-A705-7587B00A3BAB": "DateTime<Local>",
"C41609C1-9CE3-4C96-BF3D-0CEE324359B7": "LocalDateTime"
},
{
"defKey": "bytes",
"id": "D516E75B-90F5-4741-B9B3-A186A263F04C",
"defName": "二进制",
"797A1496-D649-4261-89B4-544132EC3F36": "byte[]",
"895CFD1D-4273-4D32-A2C4-CAC70200AB5B": "byte[]",
"A2EE7B4A-CE62-4290-B00C-B26C1BF18073": "byte[]",
"F3AC2415-E86B-40C6-9FEB-F4B7937D2C30": "binary",
"B91D99E0-9B7C-416C-8737-B760957DAF09": "[]byte",
"C41609C1-9CE3-4C96-BF3D-0CEE324359B7": "byte[]"
},
{
"defKey": "largeText",
"id": "B17BDED3-085F-40E1-9019-3B79CF2BF075",
"defName": "大文本",
"797A1496-D649-4261-89B4-544132EC3F36": "String",
"895CFD1D-4273-4D32-A2C4-CAC70200AB5B": "String",
"A2EE7B4A-CE62-4290-B00C-B26C1BF18073": "String",
"F3AC2415-E86B-40C6-9FEB-F4B7937D2C30": "string",
"B91D99E0-9B7C-416C-8737-B760957DAF09": "string",
"BDF457FD-9F98-4AC3-A705-7587B00A3BAB": "String",
"C41609C1-9CE3-4C96-BF3D-0CEE324359B7": "String"
}
]
},
"domains": [
{
"defKey": "DefaultString",
"defName": "默认字串",
"applyFor": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64",
"len": 255,
"scale": "",
"uiHint": "",
"id": "9092C4E0-1A54-4859-ABBB-5B62DBC27573"
},
{
"defKey": "IdOrKey",
"defName": "主键标识",
"applyFor": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64",
"len": 32,
"scale": "",
"uiHint": "",
"id": "16120F75-6AA7-4483-868D-F07F511BB081"
},
{
"defKey": "Name",
"defName": "名称",
"applyFor": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64",
"len": 90,
"scale": "",
"uiHint": "",
"id": "54611CCC-CA4B-42E1-9F32-4944C85B85A6"
},
{
"defKey": "Int",
"defName": "整数",
"applyFor": "1D764C4A-6F9F-421E-B11A-6F3E23B51811",
"len": "",
"scale": "",
"uiHint": "",
"id": "6BC8F04B-6CFA-4995-98D3-318F5CDD774E"
},
{
"defKey": "Double",
"defName": "小数",
"applyFor": "1A0BDC09-0792-4174-9E8E-80BE8DF44B8E",
"len": 24,
"scale": 6,
"uiHint": "",
"id": "FF4459C5-6B45-4DBF-8FC0-E06239BC05B4"
},
{
"defKey": "Money",
"defName": "金额",
"applyFor": "1A0BDC09-0792-4174-9E8E-80BE8DF44B8E",
"len": 24,
"scale": 6,
"uiHint": "",
"id": "C3B1681B-99F9-4818-9E80-DE1652A51D85"
},
{
"defKey": "DateTime",
"defName": "日期时间",
"applyFor": "89D69E81-EA34-42EE-9FA2-93B8BD27E098",
"len": "",
"scale": "",
"uiHint": "",
"id": "7CFFA0D3-6A93-4DDC-BC10-DF21211064DC"
},
{
"defKey": "YesNo",
"defName": "是否",
"applyFor": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64",
"len": "1",
"scale": "",
"uiHint": "",
"id": "6F7C1C5C-D159-41E6-BF9D-54DEEFA79AFF"
},
{
"defKey": "Dict",
"defName": "数据字典",
"applyFor": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64",
"len": "32",
"scale": "",
"uiHint": "",
"id": "73FD2BAD-2358-4336-B96D-45DC897BD792"
},
{
"defKey": "DescText",
"defName": "描述文本",
"applyFor": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64",
"len": "900",
"scale": "",
"uiHint": "",
"id": "3E948CEC-3070-472C-AF92-F3CA11EC9D15"
}
]
}