|
|
|
|
SET NAMES utf8mb4;
|
|
|
|
|
SET FOREIGN_KEY_CHECKS = 0;
|
|
|
|
|
|
|
|
|
|
-- ----------------------------
|
|
|
|
|
-- 设置新的代码生成模板
|
|
|
|
|
-- ----------------------------
|
|
|
|
|
DROP TABLE IF EXISTS `gen_template_detail`;
|
|
|
|
|
CREATE TABLE `gen_template_detail` (
|
|
|
|
|
`id` bigint(19) NOT NULL COMMENT '主键',
|
|
|
|
|
`parent_id` bigint(19) NOT NULL COMMENT '父级ID',
|
|
|
|
|
`type` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '类型 0 后端 / 1 前端',
|
|
|
|
|
`path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '路径',
|
|
|
|
|
`file_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '文件名',
|
|
|
|
|
`file_content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '文件内容',
|
|
|
|
|
`ignore_file_name` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0' COMMENT '忽略文件名',
|
|
|
|
|
`version` int(11) NOT NULL COMMENT '版本(乐观锁)',
|
|
|
|
|
`create_by` bigint(19) NOT NULL COMMENT '创建用户',
|
|
|
|
|
`create_time` datetime(0) NOT NULL COMMENT '创建日期',
|
|
|
|
|
`update_by` bigint(19) NOT NULL COMMENT '修改用户',
|
|
|
|
|
`update_time` datetime(0) NOT NULL COMMENT '修改日期',
|
|
|
|
|
PRIMARY KEY (`id`) USING BTREE,
|
|
|
|
|
INDEX `creater_table_name`(`path`) USING BTREE
|
|
|
|
|
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '代码生成器 - 表信息' ROW_FORMAT = Dynamic;
|
|
|
|
|
INSERT INTO `gen_template_detail` VALUES (1469919953178763265, 1398253704724828162, '0', '${packageName}/${moduleName}/${subModuleName}/entity', '${model.tableHumpName}Entity.java', '#if(data.subModuleName != null && data.subModuleName != \"\")\npackage #(data.packageName+\".\"+data.moduleName+\".\"+data.subModuleName).entity;\n#else\npackage #(data.packageName+\".\"+data.moduleName).entity;\n#end\n\n#for(pkg : data.model.entityPkgList)\nimport #(pkg);\n#end\nimport com.baomidou.mybatisplus.annotation.FieldStrategy;\nimport com.baomidou.mybatisplus.annotation.TableField;\nimport com.baomidou.mybatisplus.annotation.TableLogic;\nimport lombok.Data;\nimport lombok.EqualsAndHashCode;\nimport org.opsli.core.base.entity.BaseEntity;\n\n/**\n * #(data.codeTitle) Entity\n *\n * @author #(data.authorName)\n * @date #(currTime)\n */\n@Data\n@EqualsAndHashCode(callSuper = false)\npublic class #(data.model.tableHumpName) extends BaseEntity {\n\n\n #for(column : data.model.columnList)\n ### 不等于 删除字段 和 不等于 租户字段放入上边\n #if(column.fieldHumpName != \"deleted\" && column.fieldHumpName != \"tenantId\")\n /** #(column.fieldComments) */\n #if(!column.izNotNull)\n @TableField(updateStrategy = FieldStrategy.IGNORED)\n #end\n private #(column.javaType) #(column.fieldHumpName);\n\n #end\n #end\n\n // ========================================\n\n ### 专门处理 删除字段 和 租户字段\n #for(column : data.model.columnList)\n #if(column.fieldHumpName == \"deleted\")\n /** 逻辑删除字段 */\n @TableLogic\n private Integer deleted;\n #else if(column.fieldHumpName == \"tenantId\")\n /** 多租户字段 */\n private String tenantId;\n #end\n\n #end\n\n}', '1', 0, 1, '2021-12-12 14:40:01', 1, '2021-12-12 14:40:01');
|
|
|
|
|
INSERT INTO `gen_template_detail` VALUES (1469919953401061378, 1398253704724828162, '0', '${packageName}/${moduleName}/${subModuleName}/mapper', '${model.tableHumpName}Mapper.java', '#if(data.subModuleName != null && data.subModuleName != \"\")\npackage #(data.packageName+\".\"+data.moduleName+\".\"+data.subModuleName).mapper;\n#else\npackage #(data.packageName+\".\"+data.moduleName).mapper;\n#end\n\nimport com.baomidou.mybatisplus.core.mapper.BaseMapper;\nimport org.apache.ibatis.annotations.Mapper;\nimport org.apache.ibatis.annotations.Param;\n#if(data.subModuleName != null && data.subModuleName != \"\")\nimport #(data.packageName+\".\"+data.moduleName+\".\"+data.subModuleName).entity.#(data.model.tableHumpName);\n#else\nimport #(data.packageName+\".\"+data.moduleName).entity.#(data.model.tableHumpName);\n#end\n\n/**\n * #(data.codeTitle) Mapper\n *\n * @author #(data.authorName)\n * @date #(currTime)\n */\n@Mapper\npublic interface #(data.model.tableHumpName)Mapper extends BaseMapper<#(data.model.tableHumpName)> {\n\n}', '0', 0, 1, '2021-12-12 14:40:01', 1, '2021-12-12 14:40:01');
|
|
|
|
|
INSERT INTO `gen_template_detail` VALUES (1469919953589805058, 1398253704724828162, '0', '${packageName}/${moduleName}/${subModuleName}/mapper/xml', '${model.tableHumpName}Mapper.xml', '<?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#if(data.subModuleName != null && data.subModuleName != \"\")\n<mapper namespace=\"#(data.packageName+\'.\'+data.moduleName+\'.\'+data.subModuleName).mapper.#(data.model.tableHumpName)Mapper\">\n#else\n<mapper namespace=\"#(data.packageName+\'.\'+data.moduleName).mapper.#(data.model.tableHumpName)Mapper\">\n#end\n\n\n</mapper>', '0', 0, 1, '2021-12-12 14:40:01', 1, '2021-12-12 14:40:01');
|
|
|
|
|
INSERT INTO `gen_template_detail` VALUES (1469919953728217090, 1398253704724828162, '0', 'org/opsli/api/wrapper/${moduleName}/${subModuleName}', '${model.tableHumpName}Model.java', '#if(data.subModuleName != null && data.subModuleName != \"\")\npackage #(apiPath).wrapper.#(data.moduleName+\".\"+data.subModuleName);\n#else\npackage #(apiPath).wrapper.#(data.moduleName);\n#end\n\n#for(pkg : data.model.entityPkgList)\nimport #(pkg);\n#end\nimport com.alibaba.excel.annotation.ExcelProperty;\nimport io.swagger.annotations.ApiModelProperty;\nimport lombok.Data;\nimport lombok.EqualsAndHashCode;\nimport #(apiPath).base.warpper.ApiWrapper;\nimport org.opsli.common.annotation.validator.Validator;\nimport org.opsli.common.annotation.validator.ValidatorLenMax;\nimport org.opsli.common.annotation.validator.ValidatorLenMin;\nimport org.opsli.common.enums.ValidatorType;\nimport org.opsli.plugins.excel.annotation.ExcelInfo;\nimport com.fasterxml.jackson.annotation.JsonFormat;\nimport org.springframework.format.annotation.DateTimeFormat;\n\n/**\n* #(data.codeTitle) Model\n*\n* @author #(data.authorName)\n* @date #(currTime)\n*/\n@Data\n@EqualsAndHashCode(callSuper = false)\npublic class #(data.model.tableHumpName)Model extends ApiWrapper {\n\n #for(column : data.model.columnList)\n ### 不等于 删除字段 和 不等于 租户字段放入上边\n #if(column.fieldHumpName != \"deleted\" && column.fieldHumpName != \"tenantId\")\n /** #(column.fieldComments) */\n @ApiModelProperty(value = \"#(column.fieldComments)\")\n @ExcelProperty(value = \"#(column.fieldComments)\", order = #(column.sort))\n #if(column.dictTypeCode != null && column.dictTypeCode != \"\")\n @ExcelInfo( dictType = \"#(column.dictTypeCode)\" )\n #else\n @ExcelInfo\n #end\n #if(column.validateTypeAndCommaList != null && column.validateTypeAndCommaList.size() > 0)\n @Validator({\n #for(typeAndComma : column.validateTypeAndCommaList)\n ValidatorType.#(typeAndComma)\n #end\n })\n #end\n #if(column.fieldLength != null && column.fieldLength > 0)\n #if(column.fieldPrecision != null && column.fieldPrecision > 0)\n @ValidatorLenMax(#(column.fieldLength+column.fieldPrecision))\n #else\n @ValidatorLenMax(#(column.fieldLength))\n #end\n #end\n ### 日期处理\n #if(column.javaType == \"Date\")\n #if(column.showType == \"4\")\n @JsonFormat(timezone = \"GMT+8\", pattern = \"yyyy-MM-dd\")\n @DateTimeFormat(pattern = \"yyyy-MM-dd\")\n #else\n @JsonFormat(timezone = \"GMT+8\", pattern = \"yyyy-MM-dd HH:mm:ss\")\n @DateTimeFormat(pattern = \"yyyy-MM-dd HH:mm:ss\")\n #end\n #end\n private #(column.javaType) #(column.fieldHumpName);\n\n #end\n #end\n\n\n}', '0', 0, 1, '2021-12-12 14:40:01', 1, '2021-12-12 14:40:01');
|
|
|
|
|
INSERT INTO `gen_template_detail` VALUES (1469919953849851905, 1398253704724828162, '0', 'org/opsli/api/web/${moduleName}/${subModuleName}', '${model.tableHumpName}RestApi.java', '#if(data.subModuleName != null && data.subModuleName != \"\")\npackage #(apiPath).web.#(data.moduleName+\".\"+data.subModuleName);\n#else\npackage #(apiPath).web.#(data.moduleName);\n#end\n\nimport #(apiPath).base.result.ResultVo;\nimport org.springframework.web.bind.annotation.GetMapping;\nimport org.springframework.web.bind.annotation.PostMapping;\nimport org.springframework.web.bind.annotation.RequestBody;\nimport org.springframework.web.bind.annotation.RequestParam;\nimport org.springframework.web.multipart.MultipartHttpServletRequest;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\n#if(data.subModuleName != null && data.subModuleName != \"\")\nimport #(apiPath).wrapper.#(data.moduleName+\".\"+data.subModuleName).#(data.model.tableHumpName)Model;\n#else\nimport #(apiPath).wrapper.#(data.moduleName).#(data.model.tableHumpName)Model;\n#end\n\n\n/**\n * #(data.codeTitle) Api\n *\n * 对外 API 直接 暴露 @GetMapping 或者 @PostMapping\n * 对内也推荐 单机版 不需要设置 Mapping 但是调用方法得从Controller写起\n *\n * 这样写法虽然比较绕,但是当单体项目想要改造微服务架构时 时非常容易的\n *\n * @author #(data.authorName)\n * @date #(currTime)\n */\npublic interface #(data.model.tableHumpName)RestApi {\n\n /** 标题 */\n String TITLE = \"#(data.codeTitle)\";\n /** 子标题 */\n String SUB_TITLE = \"#(data.codeTitleBrief)\";\n\n /**\n * #(data.codeTitle) 查一条\n * @param model 模型\n * @return ResultWrapper\n */\n @GetMapping(\"/get\")\n ResultWrapper<#(data.model.tableHumpName)Model> get(#(data.model.tableHumpName)Model model);\n\n /**\n * #(data.codeTitle) 查询分页\n * @param pageNo 当前页\n * @param pageSize 每页条数\n * @param request request\n * @return ResultWrapper\n */\n @GetMapping(\"/findPage\")\n ResultWrapper<?> findPage(\n @RequestParam(name = \"pageNo\", defaultValue = \"1\") Integer pageNo,\n @RequestParam(name = \"pageSize\", defaultValue = \"10\") Integer pageSize,\n HttpServletRequest request\n );\n\n /**\n * #(data.codeTitle) 新增\n * @param model 模型\n * @return ResultWrapper\n */\n @PostMapping(\"/insert\")\n ResultWrapper<?> insert(@RequestBody #(data.model.tableHumpName)Model model);\n\n /**\n * #(data.codeTitle) 修改\n * @param model 模型\n * @return ResultWrapper\n */\n @PostMapping(\"/update\")\n ResultWrapper<?> update(@RequestBody #(data.model.tableHumpName)Model model);\n\n /**\n * #(data.codeTitle) 删除\n * @param id ID\n * @return ResultWrapper\n */\n @PostMapping(\"/del\")\n ResultWrapper<?> del(String id);\n\n /**\n * #(data.codeTitle) 批量删除\n * @param ids ID 数组\n * @return ResultWrapper\n */\n @PostMapping(\"/delAll\")\n ResultWrapper<?> delAll(String ids);\n\n /**\n * #(data.codeTitle) Excel 导出\n *\n * 导出时,Token认证和方法权限认证 全部都由自定义完成\n * 因为在 导出不成功时,需要推送错误信息,\n * 前端直接走下载流,当失败时无法获得失败信息,即使前后端换一种方式后端推送二进制文件前端再次解析也是最少2倍的耗时\n * ,且如果数据量过大,前端进行渲染时直接会把浏览器卡死\n * 而直接开启socket接口推送显然是太过浪费资源了,所以目前采用Java最原始的手段\n * response 推送 javascript代码 alert 提示报错信息\n *\n * @param request request\n * @param response response\n */\n @GetMapping(\"/exportExcel\")\n void exportExcel(HttpServletRequest request, HttpServletResponse response);\n\n /**\n * #(data.codeTitle) Excel 导入\n * @param request 文件流 request\n * @return ResultWrapper\n */\n @
|
|
|
|
|
INSERT INTO `gen_template_detail` VALUES (1469919954038595585, 1398253704724828162, '0', '${packageName}/${moduleName}/${subModuleName}/web', '${model.tableHumpName}RestController.java', '#if(data.subModuleName != null && data.subModuleName != \"\")\npackage #(data.packageName+\".\"+data.moduleName+\".\"+data.subModuleName).web;\n#else\npackage #(data.packageName+\".\"+data.moduleName).web;\n#end\n\nimport cn.hutool.core.util.ReflectUtil;\nimport cn.hutool.core.convert.Convert;\nimport io.swagger.annotations.Api;\nimport io.swagger.annotations.ApiOperation;\nimport lombok.extern.slf4j.Slf4j;\nimport org.opsli.common.annotation.RequiresPermissionsCus;\nimport org.springframework.security.access.prepost.PreAuthorize;\nimport #(apiPath).base.result.ResultVo;\nimport org.opsli.common.annotation.ApiRestController;\nimport org.opsli.common.annotation.EnableLog;\nimport org.opsli.core.base.controller.BaseRestController;\nimport org.opsli.core.persistence.Page;\nimport org.opsli.core.persistence.querybuilder.QueryBuilder;\nimport org.opsli.core.persistence.querybuilder.WebQueryBuilder;\nimport org.springframework.web.multipart.MultipartHttpServletRequest;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\nimport java.lang.reflect.Method;\n\n#if(data.subModuleName != null && data.subModuleName != \"\")\nimport #(data.packageName+\".\"+data.moduleName+\".\"+data.subModuleName).entity.#(data.model.tableHumpName);\nimport #(apiPath).wrapper.#(data.moduleName+\".\"+data.subModuleName).#(data.model.tableHumpName)Model;\nimport #(data.packageName+\".\"+data.moduleName+\".\"+data.subModuleName).service.I#(data.model.tableHumpName)Service;\nimport #(apiPath).web.#(data.moduleName+\".\"+data.subModuleName).#(data.model.tableHumpName)RestApi;\n#else\nimport #(data.packageName+\".\"+data.moduleName).entity.#(data.model.tableHumpName);\nimport #(apiPath).wrapper.#(data.moduleName).#(data.model.tableHumpName)Model;\nimport #(data.packageName+\".\"+data.moduleName).service.I#(data.model.tableHumpName)Service;\nimport #(apiPath).web.#(data.moduleName).#(data.model.tableHumpName)RestApi;\n#end\n\n/**\n * #(data.codeTitle) Controller\n *\n * @author #(data.authorName)\n * @date #(currTime)\n */\n@Api(tags = #(data.model.tableHumpName)RestApi.TITLE)\n@Slf4j\n#if(data.subModuleName != null && data.subModuleName != \"\")\n@ApiRestController(\"/{ver}/#(data.moduleName)/#(data.subModuleName)\")\n#else\n@ApiRestController(\"/{ver}/#(data.moduleName)\")\n#end\npublic class #(data.model.tableHumpName)RestController extends BaseRestController<#(data.model.tableHumpName), #(data.model.tableHumpName)Model, I#(data.model.tableHumpName)Service>\n implements #(data.model.tableHumpName)RestApi {\n\n\n /**\n * #(data.codeTitleBrief) 查一条\n * @param model 模型\n * @return ResultWrapper\n */\n @ApiOperation(value = \"获得单条#(data.codeTitleBrief)\", notes = \"获得单条#(data.codeTitleBrief) - ID\")\n #if(data.subModuleName != null && data.subModuleName != \"\")\n @RequiresPermissions(\"#(data.moduleName.toLowerCase())_#(data.subModuleName.toLowerCase())_select\")\n #else\n @RequiresPermissions(\"#(data.moduleName.toLowerCase())_select\")\n #end\n @Override\n public ResultWrapper<#(data.model.tableHumpName)Model> get(#(data.model.tableHumpName)Model model) {\n // 如果系统内部调用 则直接查数据库\n if(model != null && model.getIzApi() != null && model.getIzApi()){\n model = IService.get(model);\n }\n return ResultVo.success(model);\n }\n\n /**\n * #(data.codeTitleBrief) 查询分页\n * @param pageNo 当前页\n * @param pageSize 每页条数\n * @param request request\n * @return ResultWrapper\n */\n @ApiOperation(value = \"获得分页数据\", notes = \"获得分页数据 - 查询构造器\")\n #if(data.subModuleName != null && data.subModuleName != \"\")\n @RequiresPermissions(\"#(data.moduleName.toLowerCase())_#(data.subModuleName.toLowerCase())_select\")\n #else\n @Req
|
|
|
|
|
INSERT INTO `gen_template_detail` VALUES (1469919954235727874, 1398253704724828162, '0', '${packageName}/${moduleName}/${subModuleName}/service/impl', '${model.tableHumpName}ServiceImpl.java', '#if(data.subModuleName != null && data.subModuleName != \"\")\npackage #(data.packageName+\".\"+data.moduleName+\".\"+data.subModuleName).service.impl;\n#else\npackage #(data.packageName+\".\"+data.moduleName).service.impl;\n#end\n\n\nimport org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.stereotype.Service;\nimport org.springframework.transaction.annotation.Transactional;\nimport org.opsli.core.base.service.impl.CrudServiceImpl;\n\n#if(data.subModuleName != null && data.subModuleName != \"\")\nimport #(data.packageName+\".\"+data.moduleName+\".\"+data.subModuleName).entity.#(data.model.tableHumpName);\nimport #(apiPath).wrapper.#(data.moduleName+\".\"+data.subModuleName).#(data.model.tableHumpName)Model;\nimport #(data.packageName+\".\"+data.moduleName+\".\"+data.subModuleName).service.I#(data.model.tableHumpName)Service;\nimport #(data.packageName+\".\"+data.moduleName+\".\"+data.subModuleName).mapper.#(data.model.tableHumpName)Mapper;\n#else\nimport #(data.packageName+\".\"+data.moduleName).entity.#(data.model.tableHumpName);\nimport #(apiPath).wrapper.#(data.moduleName).#(data.model.tableHumpName)Model;\nimport #(data.packageName+\".\"+data.moduleName).service.I#(data.model.tableHumpName)Service;\nimport #(data.packageName+\".\"+data.moduleName).mapper.#(data.model.tableHumpName)Mapper;\n#end\n\n\n/**\n * #(data.codeTitle) Service Impl\n *\n * @author #(data.authorName)\n * @date #(currTime)\n */\n@Service\npublic class #(data.model.tableHumpName)ServiceImpl extends CrudServiceImpl<#(data.model.tableHumpName)Mapper, #(data.model.tableHumpName), #(data.model.tableHumpName)Model>\n implements I#(data.model.tableHumpName)Service {\n\n @Autowired(required = false)\n private #(data.model.tableHumpName)Mapper mapper;\n\n}', '0', 0, 1, '2021-12-12 14:40:02', 1, '2021-12-12 14:40:02');
|
|
|
|
|
INSERT INTO `gen_template_detail` VALUES (1469919954428665858, 1398253704724828162, '0', '${packageName}/${moduleName}/${subModuleName}/service', 'I${model.tableHumpName}Service.java', '#if(data.subModuleName != null && data.subModuleName != \"\")\npackage #(data.packageName+\".\"+data.moduleName+\".\"+data.subModuleName).service;\n#else\npackage #(data.packageName+\".\"+data.moduleName).service;\n#end\n\nimport org.opsli.core.base.service.interfaces.CrudServiceInterface;\n\n\n#if(data.subModuleName != null && data.subModuleName != \"\")\nimport #(data.packageName+\".\"+data.moduleName+\".\"+data.subModuleName).entity.#(data.model.tableHumpName);\nimport #(apiPath).wrapper.#(data.moduleName+\".\"+data.subModuleName).#(data.model.tableHumpName)Model;\n#else\nimport #(data.packageName+\".\"+data.moduleName).entity.#(data.model.tableHumpName);\nimport #(apiPath).wrapper.#(data.moduleName).#(data.model.tableHumpName)Model;\n#end\n\n/**\n * #(data.codeTitle) Service\n *\n * @author #(data.authorName)\n * @date #(currTime)\n */\npublic interface I#(data.model.tableHumpName)Service extends CrudServiceInterface<#(data.model.tableHumpName), #(data.model.tableHumpName)Model> {\n\n}', '0', 0, 1, '2021-12-12 14:40:02', 1, '2021-12-12 14:40:02');
|
|
|
|
|
INSERT INTO `gen_template_detail` VALUES (1469919954567077890, 1398253704724828162, '1', 'src/api/${moduleName}/${subModuleName}', '${model.tableHumpName}ManagementApi.js', 'import request from \"@/utils/request\";\nimport { downloadFileByData } from \"@/utils/download\";\n\nexport function getList(data) {\n return request({\n #if(data.subModuleName != null && data.subModuleName != \"\")\n url: \"/api/v1/#(data.moduleName)/#(data.subModuleName)/findPage\",\n #else\n url: \"/api/v1/#(data.moduleName)/findPage\",\n #end\n method: \"get\",\n params: data,\n });\n}\n\nexport function doInsert(data) {\n return request({\n #if(data.subModuleName != null && data.subModuleName != \"\")\n url: \"/api/v1/#(data.moduleName)/#(data.subModuleName)/insert\",\n #else\n url: \"/api/v1/#(data.moduleName)/insert\",\n #end\n method: \"post\",\n data,\n });\n}\n\nexport function doUpdate(data) {\n return request({\n #if(data.subModuleName != null && data.subModuleName != \"\")\n url: \"/api/v1/#(data.moduleName)/#(data.subModuleName)/update\",\n #else\n url: \"/api/v1/#(data.moduleName)/update\",\n #end\n method: \"post\",\n data,\n });\n}\n\nexport function doDelete(data) {\n return request({\n #if(data.subModuleName != null && data.subModuleName != \"\")\n url: \"/api/v1/#(data.moduleName)/#(data.subModuleName)/del\",\n #else\n url: \"/api/v1/#(data.moduleName)/del\",\n #end\n method: \"post\",\n params: data,\n });\n}\n\nexport function doDeleteAll(data) {\n return request({\n #if(data.subModuleName != null && data.subModuleName != \"\")\n url: \"/api/v1/#(data.moduleName)/#(data.subModuleName)/delAll\",\n #else\n url: \"/api/v1/#(data.moduleName)/delAll\",\n #end\n method: \"post\",\n params: data,\n });\n}\n\n/**\n * 导出Excel 目前只支持一层参数传递\n * @param data\n * @returns file\n */\nexport function doExportExcel(data) {\n #if(data.subModuleName != null && data.subModuleName != \"\")\n let requestURL = \"/api/v1/#(data.moduleName)/#(data.subModuleName)/exportExcel\";\n #else\n let requestURL = \"/api/v1/#(data.moduleName)/exportExcel\";\n #end\n // 下载文件\n downloadFileByData(requestURL, data);\n}\n\n/**\n * 下载模版\n * @returns file\n */\nexport function doDownloadTemplate() {\n let data = {};\n #if(data.subModuleName != null && data.subModuleName != \"\")\n let requestURL = \"/api/v1/#(data.moduleName)/#(data.subModuleName)/importExcel/template\";\n #else\n let requestURL = \"/api/v1/#(data.moduleName)/importExcel/template\";\n #end\n // 下载文件\n downloadFileByData(requestURL, data);\n}\n\n/**\n * 导入Excel\n * @returns file\n */\nexport function doImportExcel(data) {\n return request({\n #if(data.subModuleName != null && data.subModuleName != \"\")\n url: \"/api/v1/#(data.moduleName)/#(data.subModuleName)/importExcel\",\n #else\n url: \"/api/v1/#(data.moduleName)/importExcel\",\n #end\n method: \"post\",\n // 最长超时时间 3 分钟\n timeout: 180000,\n headers: {\n \"Content-Type\": \"multipart/form-data\"\n },\n data,\n });\n}', '0', 0, 1, '2021-12-12 14:40:02', 1, '2021-12-12 14:40:02');
|
|
|
|
|
INSERT INTO `gen_template_detail` VALUES (1469919954760015874, 1398253704724828162, '1', 'src/views/modules/${moduleName}/${subModuleName}/components', '${model.tableHumpName}ManagementEdit.vue', '<template>\n <el-dialog\n :title=\"title\"\n :visible.sync=\"dialogFormVisible\"\n :close-on-click-modal=\"false\"\n width=\"800px\"\n @close=\"close\"\n >\n <el-form ref=\"form\" :model=\"form\" :rules=\"rules\" label-width=\"105px\">\n <el-row :gutter=\"10\" >\n #for(column : data.model.formList)\n ### 文本框\n #if(column.showType == \"0\")\n <el-col :xs=\"24\" :sm=\"24\" :md=\"24\" :lg=\"12\" :xl=\"12\">\n <el-form-item label=\"#(column.fieldComments)\" prop=\"#(column.fieldHumpName)\">\n <el-input v-model=\"form.#(column.fieldHumpName)\" autocomplete=\"off\"></el-input>\n </el-form-item>\n </el-col>\n ### 文本域\n #else if(column.showType == \"1\")\n <el-col :xs=\"24\" :sm=\"24\" :md=\"24\" :lg=\"12\" :xl=\"12\">\n <el-form-item label=\"#(column.fieldComments)\" prop=\"#(column.fieldHumpName)\">\n <el-input type=\"textarea\" v-model=\"form.#(column.fieldHumpName)\" autocomplete=\"off\"></el-input>\n </el-form-item>\n </el-col>\n ### 字典\n #else if(column.showType == \"2\")\n <el-col :xs=\"24\" :sm=\"24\" :md=\"24\" :lg=\"12\" :xl=\"12\">\n <el-form-item label=\"#(column.fieldComments)\" prop=\"#(column.fieldHumpName)\">\n <el-select v-model=\"form.#(column.fieldHumpName)\" clearable\n placeholder=\"请选择\" style=\"width: 100%\">\n <el-option\n v-for=\"item in dict.#(column.dictTypeCode)\"\n :key=\"item.dictValue\"\n :label=\"item.dictName\"\n :value=\"item.dictValue\"\n ></el-option>\n </el-select>\n </el-form-item>\n </el-col>\n ### 日期时间\n #else if(column.showType == \"3\")\n <el-col :xs=\"24\" :sm=\"24\" :md=\"24\" :lg=\"12\" :xl=\"12\">\n <el-form-item label=\"#(column.fieldComments)\" prop=\"#(column.fieldHumpName)\">\n <el-date-picker\n v-model=\"form.#(column.fieldHumpName)\"\n type=\"datetime\"\n placeholder=\"选择#(column.fieldComments)\"\n style=\"width: 100%\"\n ></el-date-picker>\n </el-form-item>\n </el-col>\n ### 日期\n #else if(column.showType == \"4\")\n <el-col :xs=\"24\" :sm=\"24\" :md=\"24\" :lg=\"12\" :xl=\"12\">\n <el-form-item label=\"#(column.fieldComments)\" prop=\"#(column.fieldHumpName)\">\n <el-date-picker\n v-model=\"form.#(column.fieldHumpName)\"\n type=\"date\"\n placeholder=\"选择#(column.fieldComments)\"\n style=\"width: 100%\"\n ></el-date-picker>\n </el-form-item>\n </el-col>\n #end\n\n #end\n </el-row>\n\n </el-form>\n <div slot=\"footer\" class=\"dialog-footer\">\n <el-button @click=\"close\">取 消</el-button>\n <el-button type=\"primary\" @click=\"save\">确 定</el-button>\n </div>\n </el-dialog>\n</template>\n\n<script>\n #if(data.subModuleName != null && data.subModuleName != \"\")\n import { doInsert, doUpdate } from \"@/api/#(data.moduleName)/#(data.subModuleName)/#(data.model.tableHumpName)ManagementApi\";\n #else\n import { doInsert, doUpdate } from \"@/api/#(data.moduleName)/#(data.model.tableHumpName)ManagementApi\";\n #end\n import { isNull } from \"@/utils/validate\";\n import { formateDate } from \"@/utils/format\";\n import { validatorRule } from \"@/utils/validateRlue\";\n\n export default {\n name: \"#(data.model.tableHumpName)ManagementEdit\",\n data() {\n\n return {\n form: {\n // 设置默认值\n version: 0\n },\n dict: {},\n
|
|
|
|
|
INSERT INTO `gen_template_detail` VALUES (1469919954948759553, 1398253704724828162, '1', 'src/views/modules/${moduleName}/${subModuleName}/components', '${model.tableHumpName}ManagementImport.vue', '<template>\n <el-dialog\n :title=\"title\"\n :visible.sync=\"dialogFormVisible\"\n :close-on-click-modal=\"false\"\n width=\"800px\"\n class=\"import-excel\"\n @close=\"close\"\n >\n <el-upload\n ref=\"excelImport\"\n drag\n accept=\".xls,.xlsx\"\n style=\"width: 100%\"\n :action=\"importExcelUrl\"\n :multiple=\"false\"\n :before-upload=\"beforeUpload\"\n :http-request=\"handleImport\"\n :on-success=\"onSuccess\"\n :on-error=\"onError\"\n :on-progress=\"onProcess\"\n >\n <i class=\"el-icon-upload\"></i>\n <div class=\"el-upload__text\">将文件拖到此处,或<em>点击导入</em></div>\n <div class=\"el-upload__tip\" slot=\"tip\">只能上传xls/xlsx文件,且不超过5MB</div>\n </el-upload>\n\n <div slot=\"footer\" class=\"dialog-footer\">\n <el-button type=\"primary\" @click=\"downloadExcelTemplate\">下载模版</el-button>\n <el-button @click=\"close\">关 闭</el-button>\n </div>\n </el-dialog>\n</template>\n\n<script>\n #if(data.subModuleName != null && data.subModuleName != \"\")\n import { doDownloadTemplate, doImportExcel } from \"@/api/#(data.moduleName)/#(data.subModuleName)/#(data.model.tableHumpName)ManagementApi\";\n #else\n import { doDownloadTemplate, doImportExcel } from \"@/api/#(data.moduleName)/#(data.model.tableHumpName)ManagementApi\";\n #end\n import {isNull} from \"@/utils/validate\";\n import {random} from \"@/utils\";\n\n export default {\n name: \"#(data.model.tableHumpName)ManagementImport\",\n data() {\n return {\n title: \"导入Excel\",\n importExcelUrl: \'\',\n dialogFormVisible: false,\n loadProgress: 0, // 动态显示进度条\n progressFlag: false, // 关闭进度条,\n progressMap: {}\n };\n },\n created() {},\n mounted() {},\n methods: {\n show() {\n this.dialogFormVisible = true;\n },\n close() {\n this.dialogFormVisible = false;\n this.$refs[\"excelImport\"].clearFiles();\n },\n // 下载模版\n downloadExcelTemplate() {\n doDownloadTemplate();\n },\n // 上传成功\n onSuccess(response, file, fileList){\n this.successProcess(file.uid);\n this.$emit(\"fetchData\");\n },\n // 上传失败\n onError(err, file, fileList){\n this.errorProcess(file.uid);\n },\n // 进度条\n onProcess(event, file, fileList) {\n file.status = \'uploading\';\n file.percentage = 0;\n this.progressMap[file.uid] = {\n file: file,\n }\n this.autoLoadingProcess(file.uid);\n },\n\n // 导入文件限制验证\n beforeUpload(file) {\n let testMsg = file.name.substring(file.name.lastIndexOf(\'.\')+1)\n const extension = testMsg === \'xls\'\n const extension2 = testMsg === \'xlsx\'\n const isLt2M = file.size / 1024 / 1024 < 5\n if(!extension && !extension2) {\n this.$baseMessage(\'上传文件只能是 xls、xlsx格式!\', \"warning\");\n }\n if(!isLt2M) {\n this.$baseMessage(\'上传文件大小不能超过 5MB!\', \"warning\");\n }\n return (extension || extension2) && isLt2M\n },\n // 自定义导入\n handleImport(params){\n if(!isNull(params)){\n let blobObject = new Blob([params.file]);\n let formData = new window.FormData()\n formData.append(\"file\", blobObject);\n const ret = doImportExcel(formData);\n ret.then((v) => {\n const {success,msg,data} = v;\n if(success){\n this.$baseMessage(msg, \"success\");\n // 成功\n params.onSuccess();\n }else{\n // 文件进度 100%\n this.errorProcess
|
|
|
|
|
INSERT INTO `gen_template_detail` VALUES (1469919955074588673, 1398253704724828162, '1', 'src/views/modules/${moduleName}/${subModuleName}', 'index.vue', '<template>\n <div class=\"tenantManagement-container\">\n\n <el-collapse-transition>\n <div class=\"more-query\" v-show=\"this.moreQueryFlag\">\n <!-- 更多查找 -->\n <vab-query-form>\n <vab-query-form-left-panel :span=\"24\">\n <el-form :inline=\"true\" :model=\"queryForm\" @submit.native.prevent>\n #for(column : data.model.moreQueryList)\n\n ### 字典\n #if(column.showType == \"2\")\n <el-form-item>\n <el-select v-model=\"queryForm.#(column.fieldHumpName+\'_\'+column.queryType)\" placeholder=\"请选择#(column.fieldComments)\" clearable style=\"width: 100%\">\n <el-option\n v-for=\"item in dict.#(column.dictTypeCode)\"\n :key=\"item.dictValue\"\n :label=\"item.dictName\"\n :value=\"item.dictValue\"\n ></el-option>\n </el-select>\n </el-form-item>\n #else if(column.showType == \"3\")\n ### 时间\n <el-form-item>\n <el-date-picker\n v-model=\"#(column.fieldHumpName)DatePicker\"\n type=\"datetimerange\"\n :picker-options=\"pickerOptions\"\n range-separator=\"至\"\n start-placeholder=\"开始#(column.fieldComments)\"\n end-placeholder=\"结束#(column.fieldComments)\"\n align=\"right\">\n </el-date-picker>\n </el-form-item>\n #else if(column.showType == \"4\")\n ### 日期\n <el-form-item>\n <el-date-picker\n v-model=\"#(column.fieldHumpName)DatePicker\"\n type=\"daterange\"\n align=\"right\"\n range-separator=\"至\"\n start-placeholder=\"开始#(column.fieldComments)\"\n end-placeholder=\"结束#(column.fieldComments)\"\n ></el-date-picker>\n </el-form-item>\n #else\n #if(column.queryType == \"EQ\" || column.queryType == \"LIKE\")\n <el-form-item>\n <el-input\n v-model.trim=\"queryForm.#(column.fieldHumpName)_#(column.queryType)\"\n placeholder=\"请输入#(column.fieldComments)\"\n clearable\n />\n </el-form-item>\n #else if(column.queryType == \"RANGE\")\n <el-col :span=\"12\" >\n <el-form-item style=\"text-align: center\">\n <el-input\n v-model.trim=\"queryForm.#(column.fieldHumpName)_BEGIN\"\n placeholder=\"#(column.fieldComments)开始\"\n clearable\n style=\"float: left;width: calc(50% - 6px)\"\n />\n <div style=\"float:left;width: 12px\">-</div>\n <el-input\n v-model.trim=\"queryForm.#(column.fieldHumpName)_END\"\n placeholder=\"#(column.fieldComments)结束\"\n clearable\n style=\"float: right;width: calc(50% - 6px)\"\n />\n </el-form-item>\n </el-col>\n #end\n #end\n #end\n\n\n </el-form>\n </vab-query-form-left-panel>\n\n </vab-query-form>\n <el-divider></el-divider>\n </div>\n </el-collapse-transition>\n\n <!-- 主要操作 -->\n <vab-query-form>\n <vab-query-form-left-panel :span=\"10\">\n <el-button\n #if(data.subModuleName != null && data.subModuleName != \"\")\n v-if=\"$perms(\'#(data.moduleName.toLowerCase())_#(data.subModuleName.toLowerCase())_insert\')\"\n #else\n v-if=\"$perm
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- 新增登录日志表
|
|
|
|
|
CREATE TABLE `sys_login_logs` (
|
|
|
|
|
`id` bigint(19) NOT NULL COMMENT '唯一主键',
|
|
|
|
|
`org_ids` varchar(500) DEFAULT '0' COMMENT '父级主键集合',
|
|
|
|
|
`type` varchar(1) NOT NULL DEFAULT '1' COMMENT '日志类型 1登录日志 2退出日志',
|
|
|
|
|
`remote_addr` varchar(255) DEFAULT NULL COMMENT '操作IP地址',
|
|
|
|
|
`user_agent` varchar(255) DEFAULT NULL COMMENT '用户代理',
|
|
|
|
|
`username` varchar(32) NOT NULL COMMENT '登录账户',
|
|
|
|
|
`real_name` varchar(50) NOT NULL COMMENT '真实姓名',
|
|
|
|
|
`tenant_id` bigint(19) DEFAULT NULL COMMENT '多租户ID',
|
|
|
|
|
`version` int(11) NOT NULL COMMENT '版本',
|
|
|
|
|
`create_by` bigint(19) NOT NULL COMMENT '创建者',
|
|
|
|
|
`create_time` datetime NOT NULL COMMENT '创建时间',
|
|
|
|
|
`update_by` bigint(19) NOT NULL COMMENT '修改人',
|
|
|
|
|
`update_time` datetime NOT NULL COMMENT '修改时间',
|
|
|
|
|
PRIMARY KEY (`id`) USING BTREE
|
|
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='登录信息表';
|
|
|
|
|
|
|
|
|
|
-- 操作日志表 新增多租户 与 组织机构字段
|
|
|
|
|
ALTER TABLE sys_logs
|
|
|
|
|
ADD COLUMN `org_ids` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '父级主键集合' AFTER `ts`,
|
|
|
|
|
ADD COLUMN `tenant_id` bigint(19) NULL DEFAULT NULL COMMENT '多租户ID' AFTER `org_ids`;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- 菜单相关
|
|
|
|
|
DELETE FROM sys_menu WHERE id = 1314782733087555586;
|
|
|
|
|
INSERT INTO `sys_menu`(`id`, `parent_id`, `parent_ids`, `menu_name`, `permissions`, `icon`, `label`, `type`, `url`, `component`, `redirect`, `sort_no`, `always_show`, `hidden`, `deleted`, `version`, `create_by`, `create_time`, `update_by`, `update_time`, `ts`) VALUES (1504780214448308226, 1504779965155655682, '0', '查看', 'devops_login_logs_select', NULL, '0,1', '2', NULL, NULL, NULL, 1, '0', '0', '0', 0, 1, '2022-03-18 19:22:15', 1, '2022-03-18 19:22:15', '2022-03-18 19:22:26');
|
|
|
|
|
INSERT INTO `sys_menu`(`id`, `parent_id`, `parent_ids`, `menu_name`, `permissions`, `icon`, `label`, `type`, `url`, `component`, `redirect`, `sort_no`, `always_show`, `hidden`, `deleted`, `version`, `create_by`, `create_time`, `update_by`, `update_time`, `ts`) VALUES (1504779965155655682, 1504776412970254338, '0', '登录日志', NULL, '', '0,1', '1', 'login-logs', 'views/modules/system/loginLogsManagement/index', NULL, 1, '0', '0', '0', 1, 1, '2022-03-18 19:21:16', 1, '2022-03-18 19:21:40', '2022-03-18 19:21:51');
|
|
|
|
|
INSERT INTO `sys_menu`(`id`, `parent_id`, `parent_ids`, `menu_name`, `permissions`, `icon`, `label`, `type`, `url`, `component`, `redirect`, `sort_no`, `always_show`, `hidden`, `deleted`, `version`, `create_by`, `create_time`, `update_by`, `update_time`, `ts`) VALUES (1504776412970254338, 0, '0', '日志监控', NULL, 'file-contract', '0,1', '1', '/log', 'Layout', NULL, 98, '0', '0', '0', 1, 1, '2022-03-18 19:07:09', 1, '2022-03-18 19:07:22', '2022-03-18 19:07:33');
|
|
|
|
|
UPDATE `sys_menu` SET `parent_id` = 1314616518671085570, `parent_ids` = '0,1504776412970254338,1314616518671085570', `menu_name` = '查看', `permissions` = 'devops_logs_select', `icon` = NULL, `label` = '0,1', `type` = '2', `url` = NULL, `component` = NULL, `redirect` = NULL, `sort_no` = 1, `always_show` = '0', `hidden` = '0', `deleted` = '0', `version` = 0, `create_by` = 1, `create_time` = '2020-10-09 23:19:53', `update_by` = 1, `update_time` = '2022-03-18 19:07:47', `ts` = '2022-03-18 19:07:58' WHERE `id` = 1314782679522099201;
|
|
|
|
|
UPDATE `sys_menu` SET `parent_id` = 1504776412970254338, `parent_ids` = '0,1504776412970254338,1314616518671085570', `menu_name` = '操作日志', `permissions` = NULL, `icon` = NULL, `label` = '0,1', `type` = '1', `url` = 'logs', `component` = 'views/modules/system/logsManagement/index', `redirect` = NULL, `sort_no` = 2, `always_show` = '0', `hidden` = '0', `deleted` = '0', `version` = 2, `create_by` = 1, `create_time` = '2020-10-09 12:19:37', `update_by` = 1, `update_time` = '2022-03-18 19:07:47', `ts` = '2022-03-18 19:07:58' WHERE `id` = 1314616518671085570;
|
|
|
|
|
|
|
|
|
|
-- 角色与菜单
|
|
|
|
|
DELETE FROM sys_role_menu_ref
|
|
|
|
|
WHERE menu_id IN (1314782733087555586, 1504780214448308226, 1504779965155655682, 1504776412970254338, 1314616518671085570, 1504776412970254338);
|
|
|
|
|
INSERT INTO `sys_role_menu_ref`(`id`, `menu_id`, `role_id`) VALUES (1505730836832075814, 1314616518671085570, 2);
|
|
|
|
|
INSERT INTO `sys_role_menu_ref`(`id`, `menu_id`, `role_id`) VALUES (1504780316210511897, 1314616518671085570, 1463431580473810945);
|
|
|
|
|
INSERT INTO `sys_role_menu_ref`(`id`, `menu_id`, `role_id`) VALUES (1505730836832075811, 1504776412970254338, 2);
|
|
|
|
|
INSERT INTO `sys_role_menu_ref`(`id`, `menu_id`, `role_id`) VALUES (1504780316210511894, 1504776412970254338, 1463431580473810945);
|
|
|
|
|
INSERT INTO `sys_role_menu_ref`(`id`, `menu_id`, `role_id`) VALUES (1505730836832075812, 1504779965155655682, 2);
|
|
|
|
|
INSERT INTO `sys_role_menu_ref`(`id`, `menu_id`, `role_id`) VALUES (1504780316210511895, 1504779965155655682, 1463431580473810945);
|
|
|
|
|
INSERT INTO `sys_role_menu_ref`(`id`, `menu_id`, `role_id`) VALUES (1505730836832075813, 1504780214448308226, 2);
|
|
|
|
|
INSERT INTO `sys_role_menu_ref`(`id`, `menu_id`, `role_id`) VALUES (1504780316210511896, 1504780214448308226, 1463431580473810945);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SET FOREIGN_KEY_CHECKS = 1;
|