Easy Code 生成 Dynamic query基础代码

Easy Code 生成 Dynamic query基础代码

Scroll Down
  1. 首先在idea插件商店中下载 Easy Code 并安装.
    image.png

  2. 复制以下json文本内容.

{"author":"wangjin","version":"1.2.4","userSecure":"","currTypeMapperGroupName":"Default","currTemplateGroupName":"Dynamic-Query","currColumnConfigGroupName":"Default","currGlobalConfigGroupName":"Default","typeMapper":{"Default":{"name":"Default","elementList":[{"matchType":"REGEX","columnType":"varchar(\\(\\d+\\))?","javaType":"java.lang.String"},{"matchType":"REGEX","columnType":"char(\\(\\d+\\))?","javaType":"java.lang.String"},{"matchType":"REGEX","columnType":"(tiny|medium|long)*text","javaType":"java.lang.String"},{"matchType":"REGEX","columnType":"decimal(\\(\\d+,\\d+\\))?","javaType":"java.lang.Double"},{"matchType":"ORDINARY","columnType":"integer","javaType":"java.lang.Integer"},{"matchType":"REGEX","columnType":"(tiny|small|medium)*int(\\(\\d+\\))?","javaType":"java.lang.Integer"},{"matchType":"ORDINARY","columnType":"int4","javaType":"java.lang.Integer"},{"matchType":"ORDINARY","columnType":"int8","javaType":"java.lang.Long"},{"matchType":"REGEX","columnType":"bigint(\\(\\d+\\))?","javaType":"java.lang.Long"},{"matchType":"ORDINARY","columnType":"timestamp","javaType":"java.util.Date"},{"matchType":"ORDINARY","columnType":"time","javaType":"java.time.LocalTime"},{"matchType":"ORDINARY","columnType":"boolean","javaType":"java.lang.Boolean"},{"matchType":"ORDINARY","columnType":"bigint(20) unsigned","javaType":"java.lang.Long"},{"matchType":"ORDINARY","columnType":"tinyint(2) unsigned","javaType":"java.lang.Integer"},{"matchType":"ORDINARY","columnType":"int(10) unsigned","javaType":"java.lang.Integer"},{"matchType":"ORDINARY","columnType":"tinyint(4) unsigned","javaType":"java.lang.Integer"},{"matchType":"ORDINARY","columnType":"date","javaType":"java.sql.Timestamp"},{"matchType":"ORDINARY","columnType":"datetime","javaType":"java.sql.Timestamp"},{"matchType":"ORDINARY","columnType":"tinyint(1) unsigned","javaType":"java.lang.Integer"}]}},"template":{"Dynamic-Query":{"name":"Dynamic-Query","elementList":[{"name":"DO.java.vm","code":"##引入宏定义\n$!{define.vm}\n##使用宏定义设置回调(保存位置与文件后缀)\n#save(\"/model/entity\", \"DO.java\")\n##使用宏定义设置包后缀\n#setPackageSuffix(\"model.entity\")\n#set($ClassName = $tool.append($tableInfo.name, \"DO\"))\n$!callback.setReformat(true)\n##使用全局变量实现默认包导入\n$!{autoImport.vm}\nimport javax.persistence.*;\n##使用宏定义实现类注释信息\n/**\n * $!{tableInfo.comment}表实体对象\n *\n * @author $!author\n */\n@Table(name=\"$tool.hump2Underline($tableInfo.name)\")\npublic class $!{ClassName} {\n    ## 获取主键(一般主键都是实体类名+Id)\n#set($id= \"$tool.firstLowerCase($!{tableInfo.name})Id\")\n#foreach($column in $tableInfo.fullColumn)\n    #if(${column.comment})/**\n     * ${column.comment}\n     */#end\n\n    #if(${column.name} == \"id\")\n    @Id\n    @GeneratedValue(strategy = GenerationType.IDENTITY )\n    @Column\n    private $!{tool.getClsNameByFullName($column.type)} $!{column.name};\n    #else\n    @Column\n    private $!{tool.getClsNameByFullName($column.type)} $!{column.name};\n    #end\n#end\n#foreach($column in $tableInfo.fullColumn)\n##使用宏定义实现get,set方法\n#getSetMethod($column)\n#end\n\n}\n"},{"name":"DTO.java.vm","code":"##引入宏定义\n$!{define.vm}\n#set($EntityDO = $tool.append($tableInfo.name, \"DO\"))\n#set($ClassName = $tool.append($tableInfo.name, \"DTO\"))\n##使用宏定义设置回调(保存位置与文件后缀)\n#save(\"/model/dto\", \"DTO.java\")\n##使用宏定义设置包后缀\n#setPackageSuffix(\"model.dto\")\n$!callback.setReformat(true)\n\n##使用全局变量实现默认包导入\n$!{autoImport.vm}\nimport io.swagger.annotations.ApiModelProperty;\nimport $!{tableInfo.savePackageName}.model.entity.$!{EntityDO};\n##使用宏定义实现类注释信息\n/**\n * $!{tableInfo.comment}表DTO对象 {@link $!{EntityDO}}\n *\n * @author $!author\n */\npublic class $!{ClassName} {\n    ## 获取主键(一般主键都是实体类名+Id)\n#set($id= \"$tool.firstLowerCase($!{tableInfo.name})Id\")\n#foreach($column in $tableInfo.fullColumn)\n    @ApiModelProperty(\"${column.comment}\")\n    private $!{tool.getClsNameByFullName($column.type)} $!{column.name};\n#end\n#foreach($column in $tableInfo.fullColumn)\n##使用宏定义实现get,set方法\n#getSetMethod($column)\n#end\n\n}"},{"name":"RequestDTO.java.vm","code":"##引入宏定义\n$!{define.vm}\n#set($EntityDO = $tool.append($tableInfo.name, \"DO\"))\n#set($ClassName = $tool.append($tableInfo.name, \"RequestDTO\"))\n##使用宏定义设置回调(保存位置与文件后缀)\n#save(\"/model/dto/request\", \"RequestDTO.java\")\n##使用宏定义设置包后缀\n#setPackageSuffix(\"model.dto.request\")\n$!callback.setReformat(true)\n\n##使用全局变量实现默认包导入\n$!{autoImport.vm}\nimport io.swagger.annotations.ApiModelProperty;\nimport $!{tableInfo.savePackageName}.model.entity.$!{EntityDO};\n##使用宏定义实现类注释信息\n/**\n * $!{tableInfo.comment}表Request DTO对象 {@link $!{EntityDO}}\n *\n * @author $!author\n */\npublic class $!{ClassName} {\n    ## 获取主键(一般主键都是实体类名+Id)\n#set($id= \"$tool.firstLowerCase($!{tableInfo.name})Id\")\n#foreach($column in $tableInfo.fullColumn)\n    @ApiModelProperty(\"${column.comment}\")\n    private $!{tool.getClsNameByFullName($column.type)} $!{column.name};\n#end\n#foreach($column in $tableInfo.fullColumn)\n##使用宏定义实现get,set方法\n#getSetMethod($column)\n#end\n\n}\n"},{"name":"ResponseDTO.java.vm","code":"##引入宏定义\n$!{define.vm}\n#set($EntityDO = $tool.append($tableInfo.name, \"DO\"))\n#set($ClassName = $tool.append($tableInfo.name, \"ResponseDTO\"))\n##使用宏定义设置回调(保存位置与文件后缀)\n#save(\"/model/dto/response\", \"ResponseDTO.java\")\n##使用宏定义设置包后缀\n#setPackageSuffix(\"model.dto.response\")\n$!callback.setReformat(true)\n\n##使用全局变量实现默认包导入\n$!{autoImport.vm}\nimport io.swagger.annotations.ApiModelProperty;\nimport $!{tableInfo.savePackageName}.model.entity.$!{EntityDO};\n##使用宏定义实现类注释信息\n/**\n * $!{tableInfo.comment}表Response DTO对象 {@link $!{EntityDO}}\n *\n * @author $!author\n */\npublic class $!{ClassName} {\n    ## 获取主键(一般主键都是实体类名+Id)\n#set($id= \"$tool.firstLowerCase($!{tableInfo.name})Id\")\n#foreach($column in $tableInfo.fullColumn)\n    @ApiModelProperty(\"${column.comment}\")\n    private $!{tool.getClsNameByFullName($column.type)} $!{column.name};\n#end\n#foreach($column in $tableInfo.fullColumn)\n##使用宏定义实现get,set方法\n#getSetMethod($column)\n#end\n\n}\n"},{"name":"Mapper.java.vm","code":"##定义初始变量\n#set($ClassName = $tool.append($tableInfo.name, \"Mapper\"))\n#set($Comment = $!{tableInfo.comment})\n#set($EntityDO = $tool.append($tableInfo.name, \"DO\"))\n##设置回调\n$!callback.setFileName($tool.append($ClassName, \".java\"))\n$!callback.setSavePath($tool.append($tableInfo.savePath, \"/mapper\"))\n$!callback.setReformat(true)\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 com.github.wz2cool.dynamic.mybatis.mapper.DynamicQueryMapper;\nimport $!{tableInfo.savePackageName}.model.entity.$!{EntityDO};\n\n/**\n * $!{Comment}表DynamicQueryMapper层 {@link $!{EntityDO}}\n *\n * @author $!author\n */\npublic interface $!{ClassName} extends DynamicQueryMapper<$!{EntityDO}> {\n\n}\n"},{"name":"DAO.java.vm","code":"##定义初始变量\n#set($ClassName = $tool.append($tableInfo.name, \"DAO\"))\n#set($EntityMapper = $tool.append($tableInfo.name, \"Mapper\"))\n#set($entityMapper = $tool.firstLowerCase($tool.append($tableInfo.name, \"Mapper\")))\n#set($EntityDO = $tool.append($tableInfo.name, \"DO\"))\n#set($Entity = $tableInfo.name)\n#set($Entitys = $tool.append($Entity, \"s\"))\n#set($entity = $tool.firstLowerCase($tableInfo.name))\n#set($entitys = $tool.append($entity, \"s\"))\n#set($Comment = $!{tableInfo.comment})\n##设置回调\n$!callback.setFileName($tool.append($ClassName, \".java\"))\n$!callback.setSavePath($tool.append($tableInfo.savePath, \"/dao\"))\n$!callback.setReformat(true)\n\n#if(!$tableInfo.pkColumn.isEmpty())\n    #set($pk = $tableInfo.pkColumn.get(0))\n#end\n\n#if($tableInfo.savePackageName)package $!{tableInfo.savePackageName}.#{end}dao;\n\nimport com.github.wz2cool.dynamic.DynamicQuery;\nimport com.github.wz2cool.dynamic.mybatis.mapper.batch.MapperBatchAction;\nimport org.springframework.stereotype.Repository;\nimport $!{tableInfo.savePackageName}.mapper.$!{EntityMapper};\nimport $!{tableInfo.savePackageName}.model.entity.$!{EntityDO};\nimport org.apache.commons.collections4.CollectionUtils;\nimport org.apache.ibatis.session.SqlSessionFactory;\nimport org.springframework.transaction.annotation.Transactional;\nimport javax.annotation.Resource;\nimport java.util.List;\nimport java.util.Optional;\nimport static com.github.wz2cool.dynamic.builder.DynamicQueryBuilderHelper.isEqual;\n\n\n /**\n * $!{Comment}表数据库访问层 {@link $!{EntityDO}}\n * 对$!{EntityMapper}层做出简单封装 {@link $!{EntityMapper}}\n *\n * @author $!author\n */\n@Repository\npublic class $!{ClassName}  {\n\n    @Resource\n    private $!{EntityMapper} $!{entityMapper};\n    @Resource\n    private SqlSessionFactory sqlSessionFactory;\n    \n    /**\n     * 根据ID查询$!{Comment}\n     *\n     * @param id {@link $!{EntityDO}#getId()}\n     * @return Optional<$!{EntityDO}>$!{Comment} {@link $!{EntityDO}}\n     */\n    public Optional<$!{EntityDO}> get$!{tableInfo.name}ById(Long id) {\n        return $!{entityMapper}.selectFirstByDynamicQuery(DynamicQuery.createQuery($!{EntityDO}.class)\n                .and($!{EntityDO}::getId, isEqual(id)));\n    }\n        \n    /**\n     * 批量新增$!{Comment}\n     *\n     * @param $!{entitys} {@link $!{EntityDO}}\n     * @return 影响的行数\n     */\n    @Transactional(rollbackFor = Exception.class, transactionManager = TODO)\n    public int insertBatch$!{Entitys}(final List<$!{EntityDO}> $!{entitys}) {\n        if (CollectionUtils.isEmpty($!{entitys})) {\n            return 0;\n        }\n        final MapperBatchAction<$!{tableInfo.name}Mapper> updateBatchAction = MapperBatchAction\n                .create($!{tableInfo.name}Mapper.class, sqlSessionFactory);\n        for ($!{EntityDO} $!{entity} : $!{entitys}) {\n            updateBatchAction.addAction(mapper -> mapper.insertSelective($!{entity}));\n        }\n        return updateBatchAction.doBatchActions();\n    }\n\n    /**\n     * 批量更新$!{Comment}\n     *\n     * @param $!{entitys} {@link $!{EntityDO}}\n     * @return 影响的行数\n     */\n    @Transactional(rollbackFor = Exception.class, transactionManager = TODO)\n    public int updateBatch$!{Entitys}ByPrimaryKey(final List<$!{EntityDO}> $!{entitys}) {\n        if (CollectionUtils.isEmpty($!{entitys})) {\n            return 0;\n        }\n        final MapperBatchAction<$!{tableInfo.name}Mapper> updateBatchAction = MapperBatchAction\n                .create($!{tableInfo.name}Mapper.class, sqlSessionFactory);\n        for ($!{EntityDO} $!{entity} : $!{entitys}) {\n            updateBatchAction.addAction(mapper -> mapper.updateByPrimaryKey($!{entity}));\n        }\n        return updateBatchAction.doBatchActions();\n    }\n\n    /**\n     * 更新测试表\n     *\n     * @param $!{entity} {@link $!{EntityDO}}\n     * @return 影响的行数\n     */\n    public int insert$!{Entity}($!{EntityDO} $!{entity}) {\n        return $!{entityMapper}.insertSelective($!{entity});\n    }\n\n    /**\n     * 更新测试表\n     *\n     * @param $!{entity} {@link $!{EntityDO}}\n     * @return 影响的行数\n     */\n    public int update$!{Entity}ById($!{EntityDO} $!{entity}) {\n        return $!{entityMapper}.insertSelective($!{entity});\n    }\n\n    /**\n     * 根据ID删除$!{Comment}\n     *\n     * @param id {@link $!{EntityDO}#getId()}\n     * @return 影响的行数\n     */\n    public int delete$!{Entity}ById(Long id) {\n        return $!{entityMapper}.deleteByDynamicQuery(DynamicQuery.createQuery($!{EntityDO}.class)\n                .and($!{EntityDO}::getId, isEqual(id)));\n    }\n}\n"},{"name":"Service.java.vm","code":"##定义初始变量\n#set($ClassName = $tool.append($tableInfo.name, \"Service\"))\n#set($EntityMapper = $tool.append($tableInfo.name, \"Mapper\"))\n#set($entityMapper = $tool.firstLowerCase($tool.append($tableInfo.name, \"Mapper\")))\n#set($EntityDAO = $tool.append($tableInfo.name, \"DAO\"))\n#set($entityDAO = $tool.firstLowerCase($tool.append($tableInfo.name, \"DAO\")))\n#set($EntityDO = $tool.append($tableInfo.name, \"DO\"))\n#set($entityDO = $tool.firstLowerCase($EntityDO))\n#set($EntityRequestDTO = $tool.append($tableInfo.name, \"RequestDTO\"))\n#set($entityRequestDTO = $tool.firstLowerCase($EntityRequestDTO))\n#set($Entity = $tableInfo.name)\n#set($Entitys = $tool.append($Entity, \"s\"))\n#set($entity = $tool.firstLowerCase($tableInfo.name))\n#set($entitys = $tool.append($entity, \"s\"))\n#set($Comment = $!{tableInfo.comment})\n##设置回调\n$!callback.setFileName($tool.append($ClassName, \".java\"))\n$!callback.setSavePath($tool.append($tableInfo.savePath, \"/service\"))\n$!callback.setReformat(true)\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 com.innodealing.commons.object.BeanCopyUtils;\nimport $!{tableInfo.savePackageName}.dao.$!{EntityDAO};\nimport $!{tableInfo.savePackageName}.model.entity.$!{EntityDO};\nimport $!{tableInfo.savePackageName}.model.dto.request.$!{EntityRequestDTO};\nimport org.springframework.transaction.annotation.Transactional;\nimport org.springframework.stereotype.Service;\nimport java.util.Optional;\n\n\n /**\n * $!{Comment}表Service层 {@link $!{EntityDO}}\n *\n * @author $!author\n */\n@Service\npublic class $!{ClassName}  {\n\n    private final $!{EntityDAO} $!{entityDAO};\n\n    /**\n     * construction method\n     *\n     * @param $!{entityDAO} $!{entityDAO} {@link $!{EntityDAO}}\n     */\n    public $!{ClassName}($!{EntityDAO} $!{entityDAO}){\n        this.$!{entityDAO} = $!{entityDAO};\n    }\n    \n    /**\n     * 根据ID查询$!{Comment}\n     *\n     * @param id {@link $!{EntityDO}#getId()}\n     * @return Optional<$!{EntityDO}>$!{Comment} {@link $!{EntityDO}}\n     */\n    public Optional<$!{EntityDO}> get$!{tableInfo.name}ById(Long id) {\n        return $!{entityDAO}.get$!{Entity}ById(id);\n    }\n\n    /**\n     * 更新测试表\n     *\n     * @param $!{entityRequestDTO} {@link $!{EntityRequestDTO}}\n     * @return 影响的行数\n     */\n    @Transactional(rollbackFor = Exception.class, transactionManager = TODO)\n    public void insert$!{Entity}($!{EntityRequestDTO} $!{entityRequestDTO}) {\n        $!{EntityDO} $!{entityDO} = BeanCopyUtils.copyProperties($!{entityRequestDTO}, $!{EntityDO}.class);\n        $!{entityDAO}.insert$!{Entity}($!{entityDO});\n    }\n\n    /**\n     * 更新测试表\n     *\n     * @param $!{entityRequestDTO} {@link $!{EntityRequestDTO}}\n     * @return 影响的行数\n     */\n    @Transactional(rollbackFor = Exception.class, transactionManager = TODO)\n    public void update$!{Entity}($!{EntityRequestDTO} $!{entityRequestDTO}) {\n        $!{EntityDO} $!{entityDO} = BeanCopyUtils.copyProperties($!{entityRequestDTO}, $!{EntityDO}.class);\n        $!{entityDAO}.update$!{Entity}ById($!{entityDO});\n    }\n}\n"}]}},"columnConfig":{"Default":{"name":"Default","elementList":[{"title":"disable","type":"BOOLEAN","selectValue":""},{"title":"support","type":"SELECT","selectValue":"add,edit,query,del,ui"}]}},"globalConfig":{"Default":{"name":"Default","elementList":[{"name":"autoImport.vm","value":"##自动导入包(仅导入实体属性需要的包,通常用于实体类)\n#foreach($import in $importList)\nimport $!import;\n#end"},{"name":"define.vm","value":"##(Velocity宏定义)\n\n##定义设置表名后缀的宏定义,调用方式:#setTableSuffix(\"Test\")\n#macro(setTableSuffix $suffix)\n    #set($tableName = $!tool.append($tableInfo.name, $suffix))\n#end\n\n##定义设置包名后缀的宏定义,调用方式:#setPackageSuffix(\"Test\")\n#macro(setPackageSuffix $suffix)\n#if($suffix!=\"\")package #end#if($tableInfo.savePackageName!=\"\")$!{tableInfo.savePackageName}.#{end}$!suffix;\n#end\n\n##定义直接保存路径与文件名简化的宏定义,调用方式:#save(\"/entity\", \".java\")\n#macro(save $path $fileName)\n    $!callback.setSavePath($tool.append($tableInfo.savePath, $path))\n    $!callback.setFileName($tool.append($tableInfo.name, $fileName))\n#end\n\n##定义表注释的宏定义,调用方式:#tableComment(\"注释信息\")\n#macro(tableComment $desc)\n/**\n * $!{tableInfo.comment}($!{tableInfo.name})$desc\n *\n * @author $!author\n * @since $!time.currTime()\n */\n#end\n\n##定义GET,SET方法的宏定义,调用方式:#getSetMethod($column)\n#macro(getSetMethod $column)\n\n  \n    public $!{tool.getClsNameByFullName($column.type)} get$!{tool.firstUpperCase($column.name)}() {\n        #if($!{tool.getClsNameByFullName($column.type)} == \"Timestamp\")\n        return java.util.Objects.isNull($!{column.name}) ? null : new $!{tool.getClsNameByFullName($column.type)}($!{column.name}.getTime());\n        #else\n        return $!{column.name};\n        #end\n    }\n\n    public void set$!{tool.firstUpperCase($column.name)}($!{tool.getClsNameByFullName($column.type)} $!{column.name}) {\n        #if($!{tool.getClsNameByFullName($column.type)} == \"Timestamp\")\n        this.$!{column.name} = java.util.Objects.isNull($!{column.name}) ? null : new $!{tool.getClsNameByFullName($column.type)}($!{column.name}.getTime());\n        #else\n        this.$!{column.name} = $!{column.name};\n        #end\n    }\n#end"},{"name":"init.vm","value":"##初始化区域\n\n##去掉表的t_前缀\n$!tableInfo.setName($tool.getClassName($tableInfo.obj.name.replaceFirst(\"book_\",\"\")))\n\n##参考阿里巴巴开发手册,POJO 类中布尔类型的变量,都不要加 is 前缀,否则部分框架解析会引起序列化错误\n#foreach($column in $tableInfo.fullColumn)\n#if($column.name.startsWith(\"is\") && $column.type.equals(\"java.lang.Boolean\"))\n    $!column.setName($tool.firstLowerCase($column.name.substring(2)))\n#end\n#end\n\n##实现动态排除列\n#set($temp = $tool.newHashSet(\"testCreateTime\", \"otherColumn\"))\n#foreach($item in $temp)\n    #set($newList = $tool.newArrayList())\n    #foreach($column in $tableInfo.fullColumn)\n        #if($column.name!=$item)\n            ##带有反回值的方法调用时使用$tool.call来消除返回值\n            $tool.call($newList.add($column))\n        #end\n    #end\n    ##重新保存\n    $tableInfo.setFullColumn($newList)\n#end\n\n##对importList进行篡改\n#set($temp = $tool.newHashSet())\n#foreach($column in $tableInfo.fullColumn)\n    #if(!$column.type.startsWith(\"java.lang.\"))\n        ##带有反回值的方法调用时使用$tool.call来消除返回值\n        $tool.call($temp.add($column.type))\n    #end\n#end\n##覆盖\n#set($importList = $temp)"},{"name":"mybatisSupport.vm","value":"##针对Mybatis 进行支持,主要用于生成xml文件\n#foreach($column in $tableInfo.fullColumn)\n    ##储存列类型\n    $tool.call($column.ext.put(\"sqlType\", $tool.getField($column.obj.dataType, \"typeName\")))\n    #if($tool.newHashSet(\"java.lang.String\").contains($column.type))\n        #set($jdbcType=\"VARCHAR\")\n    #elseif($tool.newHashSet(\"java.lang.Boolean\", \"boolean\").contains($column.type))\n        #set($jdbcType=\"BOOLEAN\")\n    #elseif($tool.newHashSet(\"java.lang.Byte\", \"byte\").contains($column.type))\n        #set($jdbcType=\"BYTE\")\n    #elseif($tool.newHashSet(\"java.lang.Integer\", \"int\", \"java.lang.Short\", \"short\").contains($column.type))\n        #set($jdbcType=\"INTEGER\")\n    #elseif($tool.newHashSet(\"java.lang.Long\", \"long\").contains($column.type))\n        #set($jdbcType=\"INTEGER\")\n    #elseif($tool.newHashSet(\"java.lang.Float\", \"float\", \"java.lang.Double\", \"double\").contains($column.type))\n        #set($jdbcType=\"NUMERIC\")\n    #elseif($tool.newHashSet(\"java.util.Date\", \"java.sql.Timestamp\", \"java.time.Instant\", \"java.time.LocalDateTime\", \"java.time.OffsetDateTime\", \"\tjava.time.ZonedDateTime\").contains($column.type))\n        #set($jdbcType=\"TIMESTAMP\")\n    #elseif($tool.newHashSet(\"java.sql.Date\", \"java.time.LocalDate\").contains($column.type))\n        #set($jdbcType=\"TIMESTAMP\")\n    #else\n        ##其他类型\n        #set($jdbcType=\"VARCHAR\")\n    #end\n    $tool.call($column.ext.put(\"jdbcType\", $jdbcType))\n#end\n\n##定义宏,查询所有列\n#macro(allSqlColumn)#foreach($column in $tableInfo.fullColumn)$column.obj.name#if($velocityHasNext), #end#end#end\n"}]}}}
  1. 点击从剪贴板导入即可
    image.png

然后就可以尽情的玩耍啦
image.png

image.png

image.png

注意: 默认生成实体的set/get只支持Timestamp的clone模式. 要想支持更多set/get clone模式. 则参考:set/get clone模式