diff --git a/agent/EasyCodeConfig.json b/agent/EasyCodeConfig.json new file mode 100644 index 0000000..c2e7667 --- /dev/null +++ b/agent/EasyCodeConfig.json @@ -0,0 +1,145 @@ +{ + "author" : "makejava", + "version" : "1.2.7", + "userSecure" : "", + "currTypeMapperGroupName" : "Default", + "currTemplateGroupName" : "Default", + "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" : "date", + "javaType" : "java.time.LocalDate" + }, { + "matchType" : "ORDINARY", + "columnType" : "datetime", + "javaType" : "java.time.LocalDateTime" + }, { + "matchType" : "ORDINARY", + "columnType" : "timestamp", + "javaType" : "java.time.LocalDateTime" + }, { + "matchType" : "ORDINARY", + "columnType" : "time", + "javaType" : "java.time.LocalTime" + }, { + "matchType" : "ORDINARY", + "columnType" : "boolean", + "javaType" : "java.lang.Boolean" + }, { + "matchType" : "ORDINARY", + "columnType" : "bigint unsigned", + "javaType" : "java.lang.Long" + }, { + "matchType" : "ORDINARY", + "columnType" : "tinyint unsigned", + "javaType" : "java.lang.Integer" + }, { + "matchType" : "ORDINARY", + "columnType" : "tinyint", + "javaType" : "java.lang.Integer" + } ] + } + }, + "template" : { + "Default" : { + "name" : "Default", + "elementList" : [ { + "name" : "dao.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#set($savePackageName = $tool.append($tableInfo.savePackageName, \".mapper\"))\n\n##拿到主键\n#if(!$tableInfo.pkColumn.isEmpty())\n #set($pk = $tableInfo.pkColumn.get(0))\n#end\n\n##引入宏定义\n$!{define.vm}\n## customize the Po name\n#setTableInfoSuffix(\"PO\")\n\n#if($tableInfo.savePackageName)package $!{tableInfo.savePackageName}.#{end}mapper;\n\nimport $!{tableInfo.savePackageName}.beans.po.$!{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 *\n * @author $!author\n * @since $!time.currTime()\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 * @param pageable 分页对象\n * @return 对象列表\n */\n List<$!{tableInfo.name}> queryAllByLimit($!{tableInfo.name} $!tool.firstLowerCase($!{tableInfo.name}), @Param(\"pageable\") Pageable pageable);\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 * 批量新增数据(MyBatis原生foreach方法)\n *\n * @param entities List<$!{tableInfo.name}> 实例对象列表\n * @return 影响行数\n */\n int insertBatch(@Param(\"entities\") List<$!{tableInfo.name}> entities);\n\n /**\n * 批量新增或按主键更新数据(MyBatis原生foreach方法)\n *\n * @param entities List<$!{tableInfo.name}> 实例对象列表\n * @return 影响行数\n * @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参\n */\n int insertOrUpdateBatch(@Param(\"entities\") List<$!{tableInfo.name}> entities);\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" + }, { + "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}.beans.po.$!{tableInfo.name};\nimport $!{tableInfo.savePackageName}.service.$!{tableInfo.name}Service;\nimport org.springframework.data.domain.Page;\nimport org.springframework.data.domain.PageRequest;\nimport io.wdd.wddcommon.utils.R;\nimport org.springframework.web.bind.annotation.*;\n\nimport javax.annotation.Resource;\n\n/**\n * $!{tableInfo.comment}($!{tableInfo.name})表控制层\n *\n * @author $!author\n * @since $!time.currTime()\n */\n@RestController\n@RequestMapping(\"/$!tool.firstLowerCase($tableInfo.name)\")\npublic class $!{tableName} {\n /**\n * 服务对象\n */\n @Resource\n private $!{tableInfo.name}Service $!tool.firstLowerCase($tableInfo.name)Service;\n\n /**\n * 分页查询\n *\n * @param $!{tool.firstLowerCase($tableInfo.name)} 筛选条件\n * @param pageRequest 分页对象\n * @return 查询结果\n */\n @GetMapping\n public R> queryByPage($!{tableInfo.name} $!{tool.firstLowerCase($tableInfo.name)}, PageRequest pageRequest) {\n return R.ok(this.$!{tool.firstLowerCase($tableInfo.name)}Service.queryByPage($!{tool.firstLowerCase($tableInfo.name)}, pageRequest));\n }\n\n /**\n * 通过主键查询单条数据\n *\n * @param id 主键\n * @return 单条数据\n */\n @GetMapping(\"{id}\")\n public R<$!{tableInfo.name}> queryById(@PathVariable(\"id\") $!pk.shortType id) {\n return R.ok(this.$!{tool.firstLowerCase($tableInfo.name)}Service.queryById(id));\n }\n\n /**\n * 新增数据\n *\n * @param $!{tool.firstLowerCase($tableInfo.name)} 实体\n * @return 新增结果\n */\n @PostMapping\n public R<$!{tableInfo.name}> add($!{tableInfo.name} $!{tool.firstLowerCase($tableInfo.name)}) {\n return R.ok(this.$!{tool.firstLowerCase($tableInfo.name)}Service.insert($!{tool.firstLowerCase($tableInfo.name)}));\n }\n\n /**\n * 编辑数据\n *\n * @param $!{tool.firstLowerCase($tableInfo.name)} 实体\n * @return 编辑结果\n */\n @PutMapping\n public R<$!{tableInfo.name}> edit($!{tableInfo.name} $!{tool.firstLowerCase($tableInfo.name)}) {\n return R.ok(this.$!{tool.firstLowerCase($tableInfo.name)}Service.update($!{tool.firstLowerCase($tableInfo.name)}));\n }\n\n /**\n * 删除数据\n *\n * @param id 主键\n * @return 删除是否成功\n */\n @DeleteMapping\n public R deleteById($!pk.shortType id) {\n return R.ok(this.$!{tool.firstLowerCase($tableInfo.name)}Service.deleteById(id));\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(\"/beans/po\", \".java\")\n\n##使用宏定义设置包后缀\n#setPackageSuffix(\"beans.po\")\n\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\n\n\n\n\n \n \n#foreach($column in $tableInfo.fullColumn)\n \n#end\n \n\n \n \n\n \n \n\n \n \n select count(1)\n from $!tableInfo.obj.name\n \n#foreach($column in $tableInfo.fullColumn)\n \n and $!column.obj.name = #{$!column.name}\n \n#end\n \n \n\n \n \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 \n\n \n insert into $!{tableInfo.obj.name}(#foreach($column in $tableInfo.otherColumn)$!column.obj.name#if($velocityHasNext), #end#end)\n values\n \n (#foreach($column in $tableInfo.otherColumn)#{entity.$!{column.name}}#if($velocityHasNext), #end#end)\n \n \n\n \n insert into $!{tableInfo.obj.name}(#foreach($column in $tableInfo.otherColumn)$!column.obj.name#if($velocityHasNext), #end#end)\n values\n \n (#foreach($column in $tableInfo.otherColumn)#{entity.$!{column.name}}#if($velocityHasNext), #end#end)\n \n on duplicate key update\n #foreach($column in $tableInfo.otherColumn)$!column.obj.name = values($!column.obj.name)#if($velocityHasNext),\n #end#end\n\n \n\n \n \n update $!{tableInfo.obj.name}\n \n#foreach($column in $tableInfo.otherColumn)\n \n $!column.obj.name = #{$!column.name},\n \n#end\n \n where $!pk.obj.name = #{$!pk.name}\n \n\n \n \n delete from $!{tableInfo.obj.name} where $!pk.obj.name = #{$!pk.name}\n \n\n\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\n\n#if($tableInfo.savePackageName)package $!{tableInfo.savePackageName}.#{end}service;\n\nimport $!{tableInfo.savePackageName}.beans.po.$!{tableInfo.name};\nimport org.springframework.data.domain.Page;\nimport org.springframework.data.domain.PageRequest;\n\n/**\n * $!{tableInfo.comment}($!{tableInfo.name})表服务接口\n *\n * @author $!author\n * @since $!time.currTime()\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 * @param pageRequest 分页对象\n * @return 查询结果\n */\n Page<$!{tableInfo.name}> queryByPage($!{tableInfo.name} $!tool.firstLowerCase($!{tableInfo.name}), PageRequest pageRequest);\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\n\nimport $!{tableInfo.savePackageName}.beans.po.$!{tableInfo.name};\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 * @author $!author\n * @since $!time.currTime()\n */\n@Service(\"$!tool.firstLowerCase($!{tableInfo.name})Service\")\npublic class $!{tableName} implements $!{tableInfo.name}Service {\n @Resource\n private $!{tableInfo.name}Dao $!tool.firstLowerCase($!{tableInfo.name})Dao;\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})}Dao.queryById($!pk.name);\n }\n\n /**\n * 分页查询\n *\n * @param $!{tool.firstLowerCase($tableInfo.name)} 筛选条件\n * @param pageRequest 分页对象\n * @return 查询结果\n */\n @Override\n public Page<$!{tableInfo.name}> queryByPage($!{tableInfo.name} $!{tool.firstLowerCase($tableInfo.name)}, PageRequest pageRequest) {\n long total = this.$!{tool.firstLowerCase($tableInfo.name)}Dao.count($!{tool.firstLowerCase($tableInfo.name)});\n return new PageImpl<>(this.$!{tool.firstLowerCase($tableInfo.name)}Dao.queryAllByLimit($!{tool.firstLowerCase($tableInfo.name)}, pageRequest), pageRequest, total);\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 this.$!{tool.firstLowerCase($!{tableInfo.name})}Dao.insert($!tool.firstLowerCase($!{tableInfo.name}));\n return $!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 this.$!{tool.firstLowerCase($!{tableInfo.name})}Dao.update($!tool.firstLowerCase($!{tableInfo.name}));\n return this.queryById($!{tool.firstLowerCase($!{tableInfo.name})}.get$!tool.firstUpperCase($pk.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})}Dao.deleteById($!pk.name) > 0;\n }\n}" + }, { + "name" : "vo.java.vm", + "code" : "##引入宏定义\n$!{define.vm}\n\n##使用宏定义设置回调(保存位置与文件后缀)\n#save(\"/beans/vo\", \".java\")\n\n##使用宏定义设置包后缀\n#setPackageSuffix(\"beans.vo\")\n\n\n##使用全局变量实现默认包导入\n$!{autoImport.vm}\nimport java.io.Serializable;\n\n##使用宏定义实现类注释信息\n#tableComment(\"实体类对应的VO类\")\npublic class $!{tableInfo.name} {\n \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" + } ] + } + }, + "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##定义设置表名后缀的宏定义,调用方式:#setTableInfoSuffix(\"Test\")\n#macro(setTableInfoSuffix $suffix)\n #set($tableInfo.name = $!tool.append($tableInfo.name, $suffix))\n#end\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 public $!{tool.getClsNameByFullName($column.type)} get$!{tool.firstUpperCase($column.name)}() {\n return $!{column.name};\n }\n\n public void set$!{tool.firstUpperCase($column.name)}($!{tool.getClsNameByFullName($column.type)} $!{column.name}) {\n this.$!{column.name} = $!{column.name};\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" + } ] + } + } +} \ No newline at end of file diff --git a/server/src/main/java/io/wdd/server/beans/po/AppInfoPO.java b/server/src/main/java/io/wdd/server/beans/po/AppInfoPO.java index 97b514e..a6e4726 100644 --- a/server/src/main/java/io/wdd/server/beans/po/AppInfoPO.java +++ b/server/src/main/java/io/wdd/server/beans/po/AppInfoPO.java @@ -1,14 +1,12 @@ package io.wdd.server.beans.po; -import com.baomidou.mybatisplus.annotation.*; - +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; import java.io.Serializable; -import java.time.LocalDateTime; import java.util.Date; - -import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; -import org.springframework.cglib.core.Local; /** * @@ -39,18 +37,19 @@ public class AppInfoPO implements Serializable { private String appVersion; /** - * + * app associated domain name */ - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - @TableField(fill = FieldFill.INSERT) - private LocalDateTime createTime; + private String appDomainName; /** * */ - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - @TableField(fill = FieldFill.INSERT_UPDATE) - private LocalDateTime updateTime; + private Date createTime; + + /** + * + */ + private Date updateTime; /** * @@ -81,6 +80,7 @@ public class AppInfoPO implements Serializable { && (this.getAppName() == null ? other.getAppName() == null : this.getAppName().equals(other.getAppName())) && (this.getAppInfo() == null ? other.getAppInfo() == null : this.getAppInfo().equals(other.getAppInfo())) && (this.getAppVersion() == null ? other.getAppVersion() == null : this.getAppVersion().equals(other.getAppVersion())) + && (this.getAppDomainName() == null ? other.getAppDomainName() == null : this.getAppDomainName().equals(other.getAppDomainName())) && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())) && (this.getCommont() == null ? other.getCommont() == null : this.getCommont().equals(other.getCommont())) @@ -95,6 +95,7 @@ public class AppInfoPO implements Serializable { result = prime * result + ((getAppName() == null) ? 0 : getAppName().hashCode()); result = prime * result + ((getAppInfo() == null) ? 0 : getAppInfo().hashCode()); result = prime * result + ((getAppVersion() == null) ? 0 : getAppVersion().hashCode()); + result = prime * result + ((getAppDomainName() == null) ? 0 : getAppDomainName().hashCode()); result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode()); result = prime * result + ((getCommont() == null) ? 0 : getCommont().hashCode()); @@ -112,6 +113,7 @@ public class AppInfoPO implements Serializable { sb.append(", appName=").append(appName); sb.append(", appInfo=").append(appInfo); sb.append(", appVersion=").append(appVersion); + sb.append(", appDomainName=").append(appDomainName); sb.append(", createTime=").append(createTime); sb.append(", updateTime=").append(updateTime); sb.append(", commont=").append(commont); diff --git a/server/src/main/java/io/wdd/server/beans/po/ServerAppRelationPO.java b/server/src/main/java/io/wdd/server/beans/po/ServerAppRelationPO.java new file mode 100644 index 0000000..20f6269 --- /dev/null +++ b/server/src/main/java/io/wdd/server/beans/po/ServerAppRelationPO.java @@ -0,0 +1,67 @@ +package io.wdd.server.beans.po; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import lombok.Data; + +/** + * + * @TableName server_app_relation + */ +@TableName(value ="server_app_relation") +@Data +public class ServerAppRelationPO implements Serializable { + /** + * + */ + private Long serverId; + + /** + * + */ + private Long appId; + + @TableField(exist = false) + private static final long serialVersionUID = 1L; + + @Override + public boolean equals(Object that) { + if (this == that) { + return true; + } + if (that == null) { + return false; + } + if (getClass() != that.getClass()) { + return false; + } + ServerAppRelationPO other = (ServerAppRelationPO) that; + return (this.getServerId() == null ? other.getServerId() == null : this.getServerId().equals(other.getServerId())) + && (this.getAppId() == null ? other.getAppId() == null : this.getAppId().equals(other.getAppId())); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getServerId() == null) ? 0 : getServerId().hashCode()); + result = prime * result + ((getAppId() == null) ? 0 : getAppId().hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", serverId=").append(serverId); + sb.append(", appId=").append(appId); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/server/src/main/java/io/wdd/server/beans/po/ServerInfoPO.java b/server/src/main/java/io/wdd/server/beans/po/ServerInfoPO.java index de9f551..1066c64 100644 --- a/server/src/main/java/io/wdd/server/beans/po/ServerInfoPO.java +++ b/server/src/main/java/io/wdd/server/beans/po/ServerInfoPO.java @@ -4,97 +4,120 @@ import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.util.Date; import lombok.Data; -import java.io.Serializable; -import java.time.LocalDateTime; - /** + * * @TableName server_info */ -@TableName(value = "server_info") +@TableName(value ="server_info") @Data public class ServerInfoPO implements Serializable { - @TableField(exist = false) - private static final long serialVersionUID = 1L; /** * server primary key */ @TableId(type = IdType.AUTO) private Long serverId; + /** * server host name */ private String serverName; + /** * server public ipv4 + */ private String serverIpPbV4; + /** * server inner ipv4 + */ private String serverIpInV4; + /** * server public ipv6 + */ private String serverIpPbV6; + /** * server inner ipv6 + */ private String serverIpInV6; + /** - * + * */ - private LocalDateTime registerTime; + private Date registerTime; + /** - * + * */ - private LocalDateTime expireTime; + private Date expireTime; + /** - * + * */ - private LocalDateTime updateTime; + private Date updateTime; + /** - * + * */ private String location; + /** - * + * */ private String provider; + /** * split by , */ private String managePort; + /** - * + * */ private Integer cpuCore; + /** - * + * */ private String cpuBrand; + /** - * + * */ private String osInfo; + /** - * + * */ private String osKernelInfo; + /** - * + * */ private String comment; + /** * 0 alive || 1 deleted */ private Integer isDelete; + /** * optimistic lock for concurrent */ private Integer version; + @TableField(exist = false) + private static final long serialVersionUID = 1L; + @Override public boolean equals(Object that) { if (this == that) { @@ -108,24 +131,24 @@ public class ServerInfoPO implements Serializable { } ServerInfoPO other = (ServerInfoPO) that; return (this.getServerId() == null ? other.getServerId() == null : this.getServerId().equals(other.getServerId())) - && (this.getServerName() == null ? other.getServerName() == null : this.getServerName().equals(other.getServerName())) - && (this.getServerIpPbV4() == null ? other.getServerIpPbV4() == null : this.getServerIpPbV4().equals(other.getServerIpPbV4())) - && (this.getServerIpInV4() == null ? other.getServerIpInV4() == null : this.getServerIpInV4().equals(other.getServerIpInV4())) - && (this.getServerIpPbV6() == null ? other.getServerIpPbV6() == null : this.getServerIpPbV6().equals(other.getServerIpPbV6())) - && (this.getServerIpInV6() == null ? other.getServerIpInV6() == null : this.getServerIpInV6().equals(other.getServerIpInV6())) - && (this.getRegisterTime() == null ? other.getRegisterTime() == null : this.getRegisterTime().equals(other.getRegisterTime())) - && (this.getExpireTime() == null ? other.getExpireTime() == null : this.getExpireTime().equals(other.getExpireTime())) - && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())) - && (this.getLocation() == null ? other.getLocation() == null : this.getLocation().equals(other.getLocation())) - && (this.getProvider() == null ? other.getProvider() == null : this.getProvider().equals(other.getProvider())) - && (this.getManagePort() == null ? other.getManagePort() == null : this.getManagePort().equals(other.getManagePort())) - && (this.getCpuCore() == null ? other.getCpuCore() == null : this.getCpuCore().equals(other.getCpuCore())) - && (this.getCpuBrand() == null ? other.getCpuBrand() == null : this.getCpuBrand().equals(other.getCpuBrand())) - && (this.getOsInfo() == null ? other.getOsInfo() == null : this.getOsInfo().equals(other.getOsInfo())) - && (this.getOsKernelInfo() == null ? other.getOsKernelInfo() == null : this.getOsKernelInfo().equals(other.getOsKernelInfo())) - && (this.getComment() == null ? other.getComment() == null : this.getComment().equals(other.getComment())) - && (this.getIsDelete() == null ? other.getIsDelete() == null : this.getIsDelete().equals(other.getIsDelete())) - && (this.getVersion() == null ? other.getVersion() == null : this.getVersion().equals(other.getVersion())); + && (this.getServerName() == null ? other.getServerName() == null : this.getServerName().equals(other.getServerName())) + && (this.getServerIpPbV4() == null ? other.getServerIpPbV4() == null : this.getServerIpPbV4().equals(other.getServerIpPbV4())) + && (this.getServerIpInV4() == null ? other.getServerIpInV4() == null : this.getServerIpInV4().equals(other.getServerIpInV4())) + && (this.getServerIpPbV6() == null ? other.getServerIpPbV6() == null : this.getServerIpPbV6().equals(other.getServerIpPbV6())) + && (this.getServerIpInV6() == null ? other.getServerIpInV6() == null : this.getServerIpInV6().equals(other.getServerIpInV6())) + && (this.getRegisterTime() == null ? other.getRegisterTime() == null : this.getRegisterTime().equals(other.getRegisterTime())) + && (this.getExpireTime() == null ? other.getExpireTime() == null : this.getExpireTime().equals(other.getExpireTime())) + && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())) + && (this.getLocation() == null ? other.getLocation() == null : this.getLocation().equals(other.getLocation())) + && (this.getProvider() == null ? other.getProvider() == null : this.getProvider().equals(other.getProvider())) + && (this.getManagePort() == null ? other.getManagePort() == null : this.getManagePort().equals(other.getManagePort())) + && (this.getCpuCore() == null ? other.getCpuCore() == null : this.getCpuCore().equals(other.getCpuCore())) + && (this.getCpuBrand() == null ? other.getCpuBrand() == null : this.getCpuBrand().equals(other.getCpuBrand())) + && (this.getOsInfo() == null ? other.getOsInfo() == null : this.getOsInfo().equals(other.getOsInfo())) + && (this.getOsKernelInfo() == null ? other.getOsKernelInfo() == null : this.getOsKernelInfo().equals(other.getOsKernelInfo())) + && (this.getComment() == null ? other.getComment() == null : this.getComment().equals(other.getComment())) + && (this.getIsDelete() == null ? other.getIsDelete() == null : this.getIsDelete().equals(other.getIsDelete())) + && (this.getVersion() == null ? other.getVersion() == null : this.getVersion().equals(other.getVersion())); } @Override @@ -156,30 +179,31 @@ public class ServerInfoPO implements Serializable { @Override public String toString() { - String sb = getClass().getSimpleName() + - " [" + - "Hash = " + hashCode() + - ", serverId=" + serverId + - ", serverName=" + serverName + - ", serverIpPbV4=" + serverIpPbV4 + - ", serverIpInV4=" + serverIpInV4 + - ", serverIpPbV6=" + serverIpPbV6 + - ", serverIpInV6=" + serverIpInV6 + - ", registerTime=" + registerTime + - ", expireTime=" + expireTime + - ", updateTime=" + updateTime + - ", location=" + location + - ", provider=" + provider + - ", managePort=" + managePort + - ", cpuCore=" + cpuCore + - ", cpuBrand=" + cpuBrand + - ", osInfo=" + osInfo + - ", osKernelInfo=" + osKernelInfo + - ", comment=" + comment + - ", isDelete=" + isDelete + - ", version=" + version + - ", serialVersionUID=" + serialVersionUID + - "]"; - return sb; + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", serverId=").append(serverId); + sb.append(", serverName=").append(serverName); + sb.append(", serverIpPbV4=").append(serverIpPbV4); + sb.append(", serverIpInV4=").append(serverIpInV4); + sb.append(", serverIpPbV6=").append(serverIpPbV6); + sb.append(", serverIpInV6=").append(serverIpInV6); + sb.append(", registerTime=").append(registerTime); + sb.append(", expireTime=").append(expireTime); + sb.append(", updateTime=").append(updateTime); + sb.append(", location=").append(location); + sb.append(", provider=").append(provider); + sb.append(", managePort=").append(managePort); + sb.append(", cpuCore=").append(cpuCore); + sb.append(", cpuBrand=").append(cpuBrand); + sb.append(", osInfo=").append(osInfo); + sb.append(", osKernelInfo=").append(osKernelInfo); + sb.append(", comment=").append(comment); + sb.append(", isDelete=").append(isDelete); + sb.append(", version=").append(version); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); } } \ No newline at end of file diff --git a/server/src/main/java/io/wdd/server/beans/vo/AppInfoVO.java b/server/src/main/java/io/wdd/server/beans/vo/AppInfoVO.java index 78458f0..e93e78e 100644 --- a/server/src/main/java/io/wdd/server/beans/vo/AppInfoVO.java +++ b/server/src/main/java/io/wdd/server/beans/vo/AppInfoVO.java @@ -1,51 +1,47 @@ package io.wdd.server.beans.vo; -import com.baomidou.mybatisplus.annotation.FieldFill; -import com.baomidou.mybatisplus.annotation.TableField; + +import java.time.LocalDateTime; + import com.fasterxml.jackson.annotation.JsonFormat; -import io.wdd.server.beans.po.AppInfoPO; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import lombok.experimental.SuperBuilder; -import java.time.LocalDateTime; - - +/** + * (AppInfo)实体类对应的VO类 + * + * @author icederce + * @since 2022-11-26 11:42:54 + */ @Data @AllArgsConstructor @NoArgsConstructor @SuperBuilder(toBuilder = true) -public class AppInfoVO { +public class AppInfoVO { private String appName; - - /** - * - */ + private String appInfo; - - /** - * - */ + private String appVersion; - /** - * + * app associated domain name */ + private String appDomainName; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - @TableField(fill = FieldFill.INSERT) private LocalDateTime createTime; - /** - * - */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - @TableField(fill = FieldFill.INSERT_UPDATE) private LocalDateTime updateTime; - - /** - * - */ + private String commont; + /** + * 0 alive || 1 deleted + */ + private Integer isDelete; + } + diff --git a/server/src/main/java/io/wdd/server/controller/ServerController.java b/server/src/main/java/io/wdd/server/controller/ServerController.java index c3d2788..f705a77 100644 --- a/server/src/main/java/io/wdd/server/controller/ServerController.java +++ b/server/src/main/java/io/wdd/server/controller/ServerController.java @@ -1,6 +1,7 @@ package io.wdd.server.controller; +import io.wdd.server.beans.vo.AppInfoVO; import io.wdd.wddcommon.utils.R; import io.wdd.server.beans.po.ServerInfoPO; import io.wdd.server.beans.vo.ServerInfoVO; @@ -72,4 +73,19 @@ public class ServerController { return R.failed("Delete Server Failed !"); } + + /* + * Associated with appInfo + * server 1______n app + * */ + + @GetMapping("/getAllApp") + public R> getAllAppInfo( + @RequestParam(value = "serverId", required = true) Long serverId + ){ + + return R.ok(coreServerService.getAllAppInfo(serverId)); + } + + } diff --git a/server/src/main/java/io/wdd/server/coreService/CoreServerService.java b/server/src/main/java/io/wdd/server/coreService/CoreServerService.java index c3b6db2..9b9b592 100644 --- a/server/src/main/java/io/wdd/server/coreService/CoreServerService.java +++ b/server/src/main/java/io/wdd/server/coreService/CoreServerService.java @@ -1,6 +1,7 @@ package io.wdd.server.coreService; import io.wdd.server.beans.po.ServerInfoPO; +import io.wdd.server.beans.vo.AppInfoVO; import io.wdd.server.beans.vo.ServerInfoVO; import java.util.List; @@ -18,4 +19,6 @@ public interface CoreServerService { boolean updateServerInfo(ServerInfoPO serverInfoPO); boolean deleteServer(Long serverId, String serverName); + + List getAllAppInfo(Long serverId); } diff --git a/server/src/main/java/io/wdd/server/coreService/impl/CoreServerServiceImpl.java b/server/src/main/java/io/wdd/server/coreService/impl/CoreServerServiceImpl.java index 32e4f6d..6e9d3a7 100644 --- a/server/src/main/java/io/wdd/server/coreService/impl/CoreServerServiceImpl.java +++ b/server/src/main/java/io/wdd/server/coreService/impl/CoreServerServiceImpl.java @@ -2,16 +2,24 @@ package io.wdd.server.coreService.impl; import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper; +import com.google.errorprone.annotations.Var; +import io.wdd.server.beans.po.AppInfoPO; +import io.wdd.server.beans.po.ServerAppRelationPO; import io.wdd.server.beans.po.ServerInfoPO; +import io.wdd.server.beans.vo.AppInfoVO; import io.wdd.server.beans.vo.ServerInfoVO; import io.wdd.server.coreService.CoreServerService; +import io.wdd.server.service.AppInfoService; +import io.wdd.server.service.ServerAppRelationService; import io.wdd.server.service.ServerInfoService; +import io.wdd.server.utils.EntityUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import javax.annotation.Resource; import java.util.Collections; import java.util.List; import java.util.stream.Collectors; @@ -20,9 +28,17 @@ import java.util.stream.Collectors; @Service public class CoreServerServiceImpl implements CoreServerService { - @Autowired + @Resource ServerInfoService serverInfoService; + @Resource + ServerAppRelationService serverAppRelationService; + + @Resource + AppInfoService appInfoService; + + + @Override public List getServerInfoSingle(String serverName, String ipv4, String serverLocation) { @@ -47,7 +63,10 @@ public class CoreServerServiceImpl implements CoreServerService { @Override public List getServerInfoListIncludeDelete() { - return this.covertServerPOtoVO(serverInfoService.getAll()); + // todo how to solve the problem? +// this.covertServerPOtoVO(serverInfoService.getAll()); + + return null; } @Override @@ -84,10 +103,29 @@ public class CoreServerServiceImpl implements CoreServerService { .eq(StringUtils.isNoneEmpty(serverName), ServerInfoPO::getServerName, serverName) .set(ServerInfoPO::getIsDelete, 1) .update(); - + } - private List covertServerPOtoVO(List serverInfoPOList){ + @Override + public List getAllAppInfo(Long serverId) { + + // serverInfo --- server_app_relation --- appInfo + + List serverAppRelationPOList = new LambdaQueryChainWrapper(serverAppRelationService.getBaseMapper()).eq(ServerAppRelationPO::getServerId, serverId).list(); + + + // query the app info with specific server id + List appInfoPOList = appInfoService.listByIds(serverAppRelationPOList.stream().map( + serverAppRelationPO -> { + return serverAppRelationPO.getAppId(); + } + ).collect(Collectors.toList())); + + + return EntityUtils.cvToTarget(appInfoPOList,AppInfoVO.class); + } + + private List covertServerPOtoVO(List serverInfoPOList) { if (null == serverInfoPOList || serverInfoPOList.size() == 0) { return Collections.emptyList(); diff --git a/server/src/main/java/io/wdd/server/mapper/AppInfoMapper.java b/server/src/main/java/io/wdd/server/mapper/AppInfoMapper.java index 5dadc3f..90a485e 100644 --- a/server/src/main/java/io/wdd/server/mapper/AppInfoMapper.java +++ b/server/src/main/java/io/wdd/server/mapper/AppInfoMapper.java @@ -6,7 +6,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; /** * @author wdd * @description 针对表【app_info】的数据库操作Mapper -* @createDate 2022-11-20 16:49:20 +* @createDate 2022-11-27 13:52:13 * @Entity io.wdd.server.beans.po.AppInfoPO */ public interface AppInfoMapper extends BaseMapper { diff --git a/server/src/main/java/io/wdd/server/mapper/ServerAppRelationMapper.java b/server/src/main/java/io/wdd/server/mapper/ServerAppRelationMapper.java new file mode 100644 index 0000000..39c4a14 --- /dev/null +++ b/server/src/main/java/io/wdd/server/mapper/ServerAppRelationMapper.java @@ -0,0 +1,18 @@ +package io.wdd.server.mapper; + +import io.wdd.server.beans.po.ServerAppRelationPO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** +* @author wdd +* @description 针对表【server_app_relation】的数据库操作Mapper +* @createDate 2022-11-27 13:53:22 +* @Entity io.wdd.server.beans.po.ServerAppRelationPO +*/ +public interface ServerAppRelationMapper extends BaseMapper { + +} + + + + diff --git a/server/src/main/java/io/wdd/server/mapper/ServerInfoMapper.java b/server/src/main/java/io/wdd/server/mapper/ServerInfoMapper.java index c60b4ea..fa11968 100644 --- a/server/src/main/java/io/wdd/server/mapper/ServerInfoMapper.java +++ b/server/src/main/java/io/wdd/server/mapper/ServerInfoMapper.java @@ -3,17 +3,14 @@ package io.wdd.server.mapper; import io.wdd.server.beans.po.ServerInfoPO; import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import java.util.List; - /** * @author wdd * @description 针对表【server_info】的数据库操作Mapper -* @createDate 2022-11-20 16:16:52 +* @createDate 2022-11-27 13:46:54 * @Entity io.wdd.server.beans.po.ServerInfoPO */ public interface ServerInfoMapper extends BaseMapper { - List getAll(); } diff --git a/server/src/main/java/io/wdd/server/service/AppInfoService.java b/server/src/main/java/io/wdd/server/service/AppInfoService.java index 839a3ba..823bbd3 100644 --- a/server/src/main/java/io/wdd/server/service/AppInfoService.java +++ b/server/src/main/java/io/wdd/server/service/AppInfoService.java @@ -6,7 +6,7 @@ import com.baomidou.mybatisplus.extension.service.IService; /** * @author wdd * @description 针对表【app_info】的数据库操作Service -* @createDate 2022-11-20 16:49:20 +* @createDate 2022-11-27 13:52:13 */ public interface AppInfoService extends IService { diff --git a/server/src/main/java/io/wdd/server/service/ServerAppRelationService.java b/server/src/main/java/io/wdd/server/service/ServerAppRelationService.java new file mode 100644 index 0000000..dd6ca39 --- /dev/null +++ b/server/src/main/java/io/wdd/server/service/ServerAppRelationService.java @@ -0,0 +1,13 @@ +package io.wdd.server.service; + +import io.wdd.server.beans.po.ServerAppRelationPO; +import com.baomidou.mybatisplus.extension.service.IService; + +/** +* @author wdd +* @description 针对表【server_app_relation】的数据库操作Service +* @createDate 2022-11-27 13:53:22 +*/ +public interface ServerAppRelationService extends IService { + +} diff --git a/server/src/main/java/io/wdd/server/service/ServerInfoService.java b/server/src/main/java/io/wdd/server/service/ServerInfoService.java index cfd3658..26c8c35 100644 --- a/server/src/main/java/io/wdd/server/service/ServerInfoService.java +++ b/server/src/main/java/io/wdd/server/service/ServerInfoService.java @@ -3,18 +3,11 @@ package io.wdd.server.service; import io.wdd.server.beans.po.ServerInfoPO; import com.baomidou.mybatisplus.extension.service.IService; -import java.util.List; - /** * @author wdd * @description 针对表【server_info】的数据库操作Service -* @createDate 2022-11-20 16:16:52 +* @createDate 2022-11-27 13:46:54 */ public interface ServerInfoService extends IService { - /** - * @return all servers include delete servers - */ - List getAll(); - } diff --git a/server/src/main/java/io/wdd/server/service/impl/AppInfoServiceImpl.java b/server/src/main/java/io/wdd/server/service/impl/AppInfoServiceImpl.java index 3ddaf6d..79246f8 100644 --- a/server/src/main/java/io/wdd/server/service/impl/AppInfoServiceImpl.java +++ b/server/src/main/java/io/wdd/server/service/impl/AppInfoServiceImpl.java @@ -9,7 +9,7 @@ import org.springframework.stereotype.Service; /** * @author wdd * @description 针对表【app_info】的数据库操作Service实现 -* @createDate 2022-11-20 16:49:20 +* @createDate 2022-11-27 13:52:13 */ @Service public class AppInfoServiceImpl extends ServiceImpl diff --git a/server/src/main/java/io/wdd/server/service/impl/ServerAppRelationServiceImpl.java b/server/src/main/java/io/wdd/server/service/impl/ServerAppRelationServiceImpl.java new file mode 100644 index 0000000..0071c44 --- /dev/null +++ b/server/src/main/java/io/wdd/server/service/impl/ServerAppRelationServiceImpl.java @@ -0,0 +1,22 @@ +package io.wdd.server.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import io.wdd.server.beans.po.ServerAppRelationPO; +import io.wdd.server.service.ServerAppRelationService; +import io.wdd.server.mapper.ServerAppRelationMapper; +import org.springframework.stereotype.Service; + +/** +* @author wdd +* @description 针对表【server_app_relation】的数据库操作Service实现 +* @createDate 2022-11-27 13:53:22 +*/ +@Service +public class ServerAppRelationServiceImpl extends ServiceImpl + implements ServerAppRelationService{ + +} + + + + diff --git a/server/src/main/java/io/wdd/server/service/impl/ServerInfoServiceImpl.java b/server/src/main/java/io/wdd/server/service/impl/ServerInfoServiceImpl.java index f8c2fb3..e3fa2d7 100644 --- a/server/src/main/java/io/wdd/server/service/impl/ServerInfoServiceImpl.java +++ b/server/src/main/java/io/wdd/server/service/impl/ServerInfoServiceImpl.java @@ -6,22 +6,15 @@ import io.wdd.server.service.ServerInfoService; import io.wdd.server.mapper.ServerInfoMapper; import org.springframework.stereotype.Service; -import java.util.List; - /** * @author wdd * @description 针对表【server_info】的数据库操作Service实现 -* @createDate 2022-11-20 16:16:52 +* @createDate 2022-11-27 13:46:54 */ @Service public class ServerInfoServiceImpl extends ServiceImpl implements ServerInfoService{ - @Override - public List getAll() { - - return this.baseMapper.getAll(); - } } diff --git a/server/src/main/resources/mapper/AppInfoMapper.xml b/server/src/main/resources/mapper/AppInfoMapper.xml index 608a740..962632c 100644 --- a/server/src/main/resources/mapper/AppInfoMapper.xml +++ b/server/src/main/resources/mapper/AppInfoMapper.xml @@ -9,6 +9,7 @@ + @@ -17,7 +18,7 @@ app_id,app_name,app_info, - app_version,create_time,update_time, - commont,is_delete + app_version,app_domain_name,create_time, + update_time,commont,is_delete diff --git a/server/src/main/resources/mapper/ServerAppRelationMapper.xml b/server/src/main/resources/mapper/ServerAppRelationMapper.xml new file mode 100644 index 0000000..9d5aa11 --- /dev/null +++ b/server/src/main/resources/mapper/ServerAppRelationMapper.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + server_id,app_id + + diff --git a/server/src/main/resources/mapper/ServerInfoMapper.xml b/server/src/main/resources/mapper/ServerInfoMapper.xml index 1b13614..02fa5b2 100644 --- a/server/src/main/resources/mapper/ServerInfoMapper.xml +++ b/server/src/main/resources/mapper/ServerInfoMapper.xml @@ -35,11 +35,4 @@ os_kernel_info,comment,is_delete, version - -