代码拉取完成,页面将自动刷新
{"author":"makejava","version":"1.2.4","userSecure":"","currTypeMapperGroupName":"Default","currTemplateGroupName":"Default","currColumnConfigGroupName":"Default","currGlobalConfigGroupName":"Default","typeMapper":{},"template":{"Default":{"name":"Default","elementList":[{"name":"controller.java.vm","code":"##定义初始变量\n#set($tableName = $tool.append($tableInfo.name, \"Controller\"))\n##设置回调\n$!callback.setFileName($tool.append($tableName, \".java\"))\n$!callback.setSavePath($tool.append($tableInfo.savePath, \"/controller\"))\n##拿到主键\n#if(!$tableInfo.pkColumn.isEmpty())\n #set($pk = $tableInfo.pkColumn.get(0))\n#end\n\n#if($tableInfo.savePackageName)package $!{tableInfo.savePackageName}.#{end}controller;\n\nimport $!{tableInfo.savePackageName}.entity.$!{tableInfo.name};\nimport $!{tableInfo.savePackageName}.service.$!{tableInfo.name}Service;\nimport org.springframework.data.domain.Page;\nimport org.springframework.data.domain.PageRequest;\nimport org.springframework.http.ResponseEntity;\nimport org.springframework.web.bind.annotation.*;\n\nimport javax.annotation.Resource;\n\n/**\n * $!{tableInfo.comment}($!{tableInfo.name})表控制层\n */\n@RestController\n@RequestMapping(\"$!tool.firstLowerCase($tableInfo.name)\")\npublic class $!{tableName} {\n /**\n * 服务对象\n */\n @Autowired\n private I$!{tableInfo.name}Service $!tool.firstLowerCase($tableInfo.name)Service;\n\n /**\n * 查询所有\n *\n * @param $!{tool.firstLowerCase($tableInfo.name)} 筛选条件\n * @return 查询结果\n */\n @GetMapping(\"/list\") \n public List<$!{tableInfo.name}> list($!{tableInfo.name} $!{tool.firstLowerCase($tableInfo.name)}) {\n return this.$!{tool.firstLowerCase($tableInfo.name)}Service.queryAll($!{tool.firstLowerCase($tableInfo.name)});\n }\n\n /**\n * 通过主键查询单条数据\n *\n * @param $!pk.name 主键\n * @return 单条数据\n */\n @GetMapping(\"{$!pk.name}\")\n public $!{tableInfo.name} getById(@PathVariable(\"$!pk.name\") $!pk.shortType $!pk.name) {\n return this.$!{tool.firstLowerCase($tableInfo.name)}Service.queryById($!pk.name);\n }\n\n /**\n * 新增数据\n *\n * @param $!{tool.firstLowerCase($tableInfo.name)} 实体\n * @return 新增结果\n */\n @PostMapping\n public String add(@RequestBody $!{tableInfo.name} $!{tool.firstLowerCase($tableInfo.name)}) {\n this.$!{tool.firstLowerCase($tableInfo.name)}Service.insert($!{tool.firstLowerCase($tableInfo.name)});\n return \"ok\";\n }\n\n /**\n * 编辑数据\n *\n * @param $!{tool.firstLowerCase($tableInfo.name)} 实体\n * @return 编辑结果\n */\n @PutMapping\n public String edit(@RequestBody $!{tableInfo.name} $!{tool.firstLowerCase($tableInfo.name)}) {\n this.$!{tool.firstLowerCase($tableInfo.name)}Service.update($!{tool.firstLowerCase($tableInfo.name)});\n return \"ok\";\n }\n\n /**\n * 删除数据\n *\n * @param $!pk.name 主键\n * @return 删除是否成功\n */\n @DeleteMapping(\"/delete/{$!pk.name}\")\n public Boolean deleteById((@PathVariable $!pk.shortType $!pk.name) {\n return this.$!{tool.firstLowerCase($tableInfo.name)}Service.deleteById($!pk.name));\n }\n\n}\n"},{"name":"debug.json.vm","code":"// 禁止将生成结果写入到文件\n$!callback.setWriteFile(false)\n\n//调试表原始对象\n$!tool.debug($tableInfo.obj)\n\n//调试列原始对象\n$!tool.debug($tableInfo.fullColumn.get(0).obj)\n\n//调试列原始列类型\n$!tool.debug($tableInfo.fullColumn.get(0).obj.dataType)\n\n//获取原始列类型中的字段\nsqlType = $!tool.getField($tableInfo.fullColumn.get(0).obj.dataType, \"typeName\")\n\n//执行原始列类型中的方法\nsqlTypeLen = $!tableInfo.fullColumn.get(0).obj.dataType.getLength()\n"},{"name":"entity.java.vm","code":"##引入宏定义\n$!{define.vm}\n\n##使用宏定义设置回调(保存位置与文件后缀)\n#save(\"/entity\", \".java\")\n\n##使用宏定义设置包后缀\n#setPackageSuffix(\"entity\")\n\n##使用全局变量实现默认包导入\n$!{autoImport.vm}\nimport java.io.Serializable;\n\n##使用宏定义实现类注释信息\n#tableComment(\"实体类\")\npublic class $!{tableInfo.name} implements Serializable {\n private static final long serialVersionUID = $!tool.serial();\n#foreach($column in $tableInfo.fullColumn)\n #if(${column.comment})/**\n * ${column.comment}\n */#end\n\n private $!{tool.getClsNameByFullName($column.type)} $!{column.name};\n#end\n\n#foreach($column in $tableInfo.fullColumn)\n##使用宏定义实现get,set方法\n#getSetMethod($column)\n#end\n\n}\n"},{"name":"mapper.xml.vm","code":"##引入mybatis支持\n$!{mybatisSupport.vm}\n\n##设置保存名称与保存位置\n$!callback.setFileName($tool.append($!{tableInfo.name}, \"Mapper.xml\"))\n$!callback.setSavePath($tool.append($modulePath, \"/src/main/resources/mapper\"))\n\n##拿到主键\n#if(!$tableInfo.pkColumn.isEmpty())\n #set($pk = $tableInfo.pkColumn.get(0))\n#end\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=\"$!{tableInfo.savePackageName}.dao.$!{tableInfo.name}Dao\">\n\n <resultMap type=\"$!{tableInfo.savePackageName}.entity.$!{tableInfo.name}\" id=\"$!{tableInfo.name}Map\">\n#foreach($column in $tableInfo.fullColumn)\n <result property=\"$!column.name\" column=\"$!column.obj.name\" jdbcType=\"$!column.ext.jdbcType\"/>\n#end\n </resultMap>\n\n <!--查询单个-->\n <select id=\"queryById\" resultMap=\"$!{tableInfo.name}Map\">\n select\n #allSqlColumn()\n\n from $!tableInfo.obj.name\n where $!pk.obj.name = #{$!pk.name}\n </select>\n\n <!--查询指定行数据,支持模糊查询-->\n <select id=\"queryAllByLimit\" resultMap=\"$!{tableInfo.name}Map\">\n select\n #allSqlColumn()\n\n from $!tableInfo.obj.name\n <where>\n#foreach($column in $tableInfo.fullColumn)\n <if test=\"$!column.name != null#if($column.type.equals(\"java.lang.String\")) and $!column.name != ''#end\">\n and $!column.obj.name like concat(like concat('%', {$!column.name}, '%')\n </if>\n#end\n </where>\n limit #{pageable.offset}, #{pageable.pageSize}\n </select>\n\n <!--统计总行数-->\n <select id=\"count\" resultType=\"java.lang.Long\">\n select count(1)\n from $!tableInfo.obj.name\n <where>\n#foreach($column in $tableInfo.fullColumn)\n <if test=\"$!column.name != null#if($column.type.equals(\"java.lang.String\")) and $!column.name != ''#end\">\n and $!column.obj.name = #{$!column.name}\n </if>\n#end\n </where>\n </select>\n\n <!--新增所有列-->\n <insert id=\"insert\" keyProperty=\"$!pk.name\" useGeneratedKeys=\"true\">\n insert into $!{tableInfo.obj.name}(#foreach($column in $tableInfo.otherColumn)$!column.obj.name#if($velocityHasNext), #end#end)\n values (#foreach($column in $tableInfo.otherColumn)#{$!{column.name}}#if($velocityHasNext), #end#end)\n </insert>\n\n <!--通过主键修改数据-->\n <update id=\"update\">\n update $!{tableInfo.obj.name}\n <set>\n#foreach($column in $tableInfo.otherColumn)\n <if test=\"$!column.name != null#if($column.type.equals(\"java.lang.String\")) and $!column.name != ''#end\">\n $!column.obj.name = #{$!column.name},\n </if>\n#end\n </set>\n where $!pk.obj.name = #{$!pk.name}\n </update>\n\n <!--通过主键删除-->\n <delete id=\"deleteById\">\n delete from $!{tableInfo.obj.name} where $!pk.obj.name = #{$!pk.name}\n </delete>\n\n</mapper>\n"},{"name":"service.java.vm","code":"##定义初始变量\n#set($tableName = $tool.append($tableInfo.name, \"Service\"))\n##设置回调\n$!callback.setFileName($tool.append($tableName, \".java\"))\n$!callback.setSavePath($tool.append($tableInfo.savePath, \"/service\"))\n\n##拿到主键\n#if(!$tableInfo.pkColumn.isEmpty())\n #set($pk = $tableInfo.pkColumn.get(0))\n#end\n\n#if($tableInfo.savePackageName)package $!{tableInfo.savePackageName}.#{end}service;\n\nimport $!{tableInfo.savePackageName}.entity.$!{tableInfo.name};\nimport org.springframework.data.domain.Page;\nimport org.springframework.data.domain.PageRequest;\n\n/**\n * $!{tableInfo.comment}($!{tableInfo.name})表服务接口\n */\npublic interface I$!{tableName} {\n\n /**\n * 通过ID查询单条数据\n *\n * @param $!pk.name 主键\n * @return 实例对象\n */\n $!{tableInfo.name} queryById($!pk.shortType $!pk.name);\n\n /**\n * 查询指定行数据\n *\n * @param $!tool.firstLowerCase($!{tableInfo.name}) 筛选条件\n * @return 查询结果\n */\n List<$!{tableInfo.name}> queryAll($!{tableInfo.name} $!tool.firstLowerCase($!{tableInfo.name}));\n\n /**\n * 新增数据\n *\n * @param $!tool.firstLowerCase($!{tableInfo.name}) 实例对象\n * @return 实例对象\n */\n $!{tableInfo.name} insert($!{tableInfo.name} $!tool.firstLowerCase($!{tableInfo.name}));\n\n /**\n * 修改数据\n *\n * @param $!tool.firstLowerCase($!{tableInfo.name}) 实例对象\n * @return 实例对象\n */\n $!{tableInfo.name} update($!{tableInfo.name} $!tool.firstLowerCase($!{tableInfo.name}));\n\n /**\n * 通过主键删除数据\n *\n * @param $!pk.name 主键\n * @return 是否成功\n */\n boolean deleteById($!pk.shortType $!pk.name);\n\n}"},{"name":"serviceImpl.java.vm","code":"##定义初始变量\n#set($tableName = $tool.append($tableInfo.name, \"ServiceImpl\"))\n##设置回调\n$!callback.setFileName($tool.append($tableName, \".java\"))\n$!callback.setSavePath($tool.append($tableInfo.savePath, \"/service/impl\"))\n\n##拿到主键\n#if(!$tableInfo.pkColumn.isEmpty())\n #set($pk = $tableInfo.pkColumn.get(0))\n#end\n\n#if($tableInfo.savePackageName)package $!{tableInfo.savePackageName}.#{end}service.impl;\n\nimport $!{tableInfo.savePackageName}.entity.$!{tableInfo.name};\nimport $!{tableInfo.savePackageName}.dao.$!{tableInfo.name}Dao;\nimport $!{tableInfo.savePackageName}.service.$!{tableInfo.name}Service;\nimport org.springframework.stereotype.Service;\nimport org.springframework.data.domain.Page;\nimport org.springframework.data.domain.PageImpl;\nimport org.springframework.data.domain.PageRequest;\n\nimport javax.annotation.Resource;\n\n/**\n * $!{tableInfo.comment}($!{tableInfo.name})表服务实现类\n */\n@Service\npublic class $!{tableName} implements I$!{tableInfo.name}Service {\n @Autowired\n private $!{tableInfo.name}Mapper $!tool.firstLowerCase($!{tableInfo.name})Mapper;\n\n /**\n * 通过ID查询单条数据\n *\n * @param $!pk.name 主键\n * @return 实例对象\n */\n @Override\n public $!{tableInfo.name} queryById($!pk.shortType $!pk.name) {\n return this.$!{tool.firstLowerCase($!{tableInfo.name})}Mapper.queryById($!pk.name);\n }\n\n /**\n * 查询指定行数据\n *\n * @param $!{tool.firstLowerCase($tableInfo.name)} 筛选条件\n * @return 查询结果\n */\n @Override\n public List<$!{tableInfo.name}> queryAll($!{tableInfo.name} $!{tool.firstLowerCase($tableInfo.name)}) {\n return this.$!{tool.firstLowerCase($!{tableInfo.name})}Mapper.queryAll($!{tool.firstLowerCase($tableInfo.name)});\n }\n\n /**\n * 新增数据\n *\n * @param $!tool.firstLowerCase($!{tableInfo.name}) 实例对象\n * @return 实例对象\n */\n @Override\n public $!{tableInfo.name} insert($!{tableInfo.name} $!tool.firstLowerCase($!{tableInfo.name})) {\n return this.$!{tool.firstLowerCase($!{tableInfo.name})}Mapper.insert($!tool.firstLowerCase($!{tableInfo.name}));\n }\n\n /**\n * 修改数据\n *\n * @param $!tool.firstLowerCase($!{tableInfo.name}) 实例对象\n * @return 实例对象\n */\n @Override\n public $!{tableInfo.name} update($!{tableInfo.name} $!tool.firstLowerCase($!{tableInfo.name})) {\n return this.$!{tool.firstLowerCase($!{tableInfo.name})}Mapper.update($!tool.firstLowerCase($!{tableInfo.name}));\n }\n\n /**\n * 通过主键删除数据\n *\n * @param $!pk.name 主键\n * @return 是否成功\n */\n @Override\n public boolean deleteById($!pk.shortType $!pk.name) {\n return this.$!{tool.firstLowerCase($!{tableInfo.name})}Mapper.deleteById($!pk.name) > 0;\n }\n}"},{"name":"mapper.java.vm","code":"##定义初始变量\n#set($tableName = $tool.append($tableInfo.name, \"Mapper\"))\n##设置回调\n$!callback.setFileName($tool.append($tableName, \".java\"))\n$!callback.setSavePath($tool.append($tableInfo.savePath, \"/mapper\"))\n\n##拿到主键\n#if(!$tableInfo.pkColumn.isEmpty())\n #set($pk = $tableInfo.pkColumn.get(0))\n#end\n\n#if($tableInfo.savePackageName)package $!{tableInfo.savePackageName}.#{end}mapper;\n\nimport $!{tableInfo.savePackageName}.entity.$!{tableInfo.name};\nimport org.apache.ibatis.annotations.Param;\nimport org.springframework.data.domain.Pageable;\nimport java.util.List;\n\n/**\n * $!{tableInfo.comment}($!{tableInfo.name})表数据库访问层\n */\npublic interface $!{tableName} {\n\n /**\n * 通过ID查询单条数据\n *\n * @param $!pk.name 主键\n * @return 实例对象\n */\n $!{tableInfo.name} queryById($!pk.shortType $!pk.name);\n\n /**\n * 查询指定行数据\n *\n * @param $!tool.firstLowerCase($!{tableInfo.name}) 查询条件\n * @return 对象列表\n */\n List<$!{tableInfo.name}> queryAll($!{tableInfo.name} $!tool.firstLowerCase($!{tableInfo.name}));\n\n /**\n * 统计总行数\n *\n * @param $!tool.firstLowerCase($!{tableInfo.name}) 查询条件\n * @return 总行数\n */\n long count($!{tableInfo.name} $!tool.firstLowerCase($!{tableInfo.name}));\n\n /**\n * 新增数据\n *\n * @param $!tool.firstLowerCase($!{tableInfo.name}) 实例对象\n * @return 影响行数\n */\n int insert($!{tableInfo.name} $!tool.firstLowerCase($!{tableInfo.name}));\n\n /**\n * 修改数据\n *\n * @param $!tool.firstLowerCase($!{tableInfo.name}) 实例对象\n * @return 影响行数\n */\n int update($!{tableInfo.name} $!tool.firstLowerCase($!{tableInfo.name}));\n\n /**\n * 通过主键删除数据\n *\n * @param $!pk.name 主键\n * @return 影响行数\n */\n int deleteById($!pk.shortType $!pk.name);\n\n}\n"}]}},"columnConfig":{},"globalConfig":{}}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。