PIG 代码生成器独立模块部署 欢迎来喷

2024-03-15 13:30

本文主要是介绍PIG 代码生成器独立模块部署 欢迎来喷,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

                                       Pig 代码生成器代码部署

创建表

执行脚本

 

CREATE TABLE `sys_tenancy` (

  `id` varchar(32) NOT NULL COMMENT '主键ID',

  `tenancy_name` varchar(64) NOT NULL COMMENT '租户名称',

  `valid_time` datetime NOT NULL COMMENT '承租生效时间',

  `invalid_time` datetime NOT NULL COMMENT '承租失效时间',

  `app_key` varchar(64) NOT NULL COMMENT '租户访问令牌',

  `is_del` tinyint(4) DEFAULT '0',

  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',

  `update_time` datetime DEFAULT NULL COMMENT '更新时间',

  `is_encrypt` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否加密传输:0否 1是',

  `max_fill_month_limit` int(11) NOT NULL DEFAULT '2' COMMENT '最大填报期限(月份)',

  PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='租户信息';

 

生成代码

 

导入数据库脚本

 

-- 该脚本不要执行,请完善 ID 对应关系,注意层级关系 !!!!

 

创建新模块

INSERT INTO `pig`.`sys_menu` (`menu_id`, `name`, `permission`, `path`, `parent_id`, `icon`, `component`, `sort`, `keep_alive`, `type`, `create_time`, `update_time`, `del_flag`) VALUES ('6000', '业务模块', NULL, '', '-1', 'icon-xitongguanli', 'Layout', '4', '0', '0', '2017-11-07 20:56:00', '2019-12-24 16:59:17', '0');

 

创建模块菜单

-- 菜单SQL

insert into `sys_menu` ( `parent_id`, `component`, `permission`, `type`, `path`, `icon`, `menu_id`, `del_flag`, `create_time`, `sort`, `update_time`, `name`)

    values ( '6000', 'views/test/systenancy/index', '', '0', 'systenancy', 'icon-bangzhushouji', '6100', '0', '2018-01-20 13:17:19', '1', '2018-07-29 13:38:19', '租户信息管理');

 

-- 菜单对应按钮SQL

insert into `sys_menu` ( `parent_id`, `component`, `permission`, `type`, `path`, `icon`, `menu_id`, `del_flag`, `create_time`, `sort`, `update_time`, `name`)

    values ( '6100', null, 'test_systenancy_add', '1', null, '1', '6101', '0', '2018-05-15 21:35:18', '0', '2018-07-29 13:38:59', '租户信息新增');

insert into `sys_menu` ( `parent_id`, `component`, `permission`, `type`, `path`, `icon`, `menu_id`, `del_flag`, `create_time`, `sort`, `update_time`, `name`)

    values ( '6100', null, 'test_systenancy_edit', '1', null, '1', '6102', '0', '2018-05-15 21:35:18', '1', '2018-07-29 13:38:59', '租户信息修改');

insert into `sys_menu` ( `parent_id`, `component`, `permission`, `type`, `path`, `icon`, `menu_id`, `del_flag`, `create_time`, `sort`, `update_time`, `name`)

values ( '6100', null, 'test_systenancy_del', '1', null, '1', '6103', '0', '2018-05-15 21:35:18', '2', '2018-07-29 13:38:59', '租户信息删除');

 

菜单角色授权

分配新模块权限

后端独立模块部署

拷贝 pig-upms-biz 工程,创建 pig-upms-test 工程,导入 module,删除无用包,导入生成的代码文件,补充修改缺失文件

 

添加 mybatis 扫描配置类,注意 扫描包配置,创建Appliaction 自定, 修改 Dockerfile、pom.xml 相关模块名称。bootstrap.yml 配置文件 端口修改 4001。

 

修改配置文件

登入 http://127.0.0.1:8848/nacos

 

账号密码: nacos/nacos, 创建配置文件,拷贝 pig-upms-biz.yml ,创建 pig-upms-test.yml

 

security:

  oauth2:

    client:

      client-id: ENC(imENTO7M8bLO38LFSIxnzw==)

      client-secret: ENC(i3cDFhs26sa2Ucrfz2hnQw==)

      scope: server

 

# 数据源

spring:

  datasource:

    type: com.zaxxer.hikari.HikariDataSource

    driver-class-name: com.mysql.cj.jdbc.Driver

    username: root

    password: mysqladmin

    url: jdbc:mysql://pig-mysql:3306/pig?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai

 

# 直接放行URL

ignore:

  urls:

    - /v2/api-docs

    - /actuator/**

    - /user/info/*

    - /log/**

 

mybatis-plus:

  configuration:

    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl   

 

 

打开 mybtais-plus SQL 语句输出(方便调试)

 

 

启动服务状态监控

 

查看服务是否正常启动 http://127.0.0.1:5001/login ,账号密码 pig/pig

显示 正常启动模块

前端部署

导入文件

拷贝生成的前端文件到指定目录

修改配置文件

前端文件放置到对应的文件夹下,修改   vue.config.js

添加配置

 

后端网关修改

修改网关配置文件

 修改配置文件,nacos 配置控制台修改,(处理前端访问后台资源无法访问问题

添加 网关配置

- id: pig-upms-test

          uri: lb://pig-upms-test

          predicates:

            - Path=/test/**

          filters:

            # 限流配置

            - name: RequestRateLimiter

              args:

                key-resolver: '#{@remoteAddrKeyResolver}'

                redis-rate-limiter.replenishRate: 10

                redis-rate-limiter.burstCapacity: 20

              # 降级配置

            - name: Hystrix

              args:

                name: default

                fallbackUri: 'forward:/fallback'       

        # 代码生成模块

 

扩展

修改Run Dashboard 配置

修改目录\pig\.idea\workspace.xml,,方便项目本地启动运行

 

<component name="RunDashboard">

    <option name="configurationTypes">

      <set>

        <option value="SpringBootApplicationConfigurationType" />

      </set>

    </option>

    <option name="ruleStates">

      <list>

        <RuleState>

          <option name="name" value="ConfigurationTypeDashboardGroupingRule" />

        </RuleState>

        <RuleState>

          <option name="name" value="StatusDashboardGroupingRule" />

        </RuleState>

      </list>

    </option>

  </component>

  <component name="RunManager" selected="Spring Boot.PigAdminApplication-4">

    <configuration name="PigAdminApplication-4" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">

      <module name="pig-upms-biz" />

      <option name="SPRING_BOOT_MAIN_CLASS" value="com.pig4cloud.pig.admin.PigAdminApplication" />

      <method v="2">

        <option name="Make" enabled="true" />

      </method>

    </configuration>

    <configuration name="PigAuthApplication-3" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">

      <module name="pig-auth" />

      <option name="SPRING_BOOT_MAIN_CLASS" value="com.pig4cloud.pig.auth.PigAuthApplication" />

      <method v="2">

        <option name="Make" enabled="true" />

      </method>

    </configuration>

    <configuration name="PigBizApplication-7" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">

      <module name="pig-upms-test" />

      <option name="SPRING_BOOT_MAIN_CLASS" value="com.pig4cloud.pig.test.PigBizApplication" />

      <method v="2">

        <option name="Make" enabled="true" />

      </method>

    </configuration>

    <configuration name="PigCodeGenApplication-5" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">

      <module name="pig-codegen" />

      <option name="SPRING_BOOT_MAIN_CLASS" value="com.pig4cloud.pig.codegen.PigCodeGenApplication" />

      <method v="2">

        <option name="Make" enabled="true" />

      </method>

    </configuration>

    <configuration name="PigGatewayApplication-2" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">

      <module name="pig-gateway" />

      <option name="SPRING_BOOT_MAIN_CLASS" value="com.pig4cloud.pig.gateway.PigGatewayApplication" />

      <method v="2">

        <option name="Make" enabled="true" />

      </method>

    </configuration>

    <configuration name="PigMonitorApplication-6" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">

      <module name="pig-monitor" />

      <option name="SPRING_BOOT_MAIN_CLASS" value="com.pig4cloud.pig.monitor.PigMonitorApplication" />

      <method v="2">

        <option name="Make" enabled="true" />

      </method>

    </configuration>

    <configuration name="PigNacosApplication-1" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">

      <module name="pig-register" />

      <option name="SPRING_BOOT_MAIN_CLASS" value="com.alibaba.nacos.PigNacosApplication" />

      <method v="2">

        <option name="Make" enabled="true" />

      </method>

    </configuration>

  </component>

 

RunDashboard启动顺序编号效果

这篇关于PIG 代码生成器独立模块部署 欢迎来喷的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/812122

相关文章

Python中logging模块用法示例总结

《Python中logging模块用法示例总结》在Python中logging模块是一个强大的日志记录工具,它允许用户将程序运行期间产生的日志信息输出到控制台或者写入到文件中,:本文主要介绍Pyt... 目录前言一. 基本使用1. 五种日志等级2.  设置报告等级3. 自定义格式4. C语言风格的格式化方法

redis-sentinel基础概念及部署流程

《redis-sentinel基础概念及部署流程》RedisSentinel是Redis的高可用解决方案,通过监控主从节点、自动故障转移、通知机制及配置提供,实现集群故障恢复与服务持续可用,核心组件包... 目录一. 引言二. 核心功能三. 核心组件四. 故障转移流程五. 服务部署六. sentinel部署

Python 基于http.server模块实现简单http服务的代码举例

《Python基于http.server模块实现简单http服务的代码举例》Pythonhttp.server模块通过继承BaseHTTPRequestHandler处理HTTP请求,使用Threa... 目录测试环境代码实现相关介绍模块简介类及相关函数简介参考链接测试环境win11专业版python

spring AMQP代码生成rabbitmq的exchange and queue教程

《springAMQP代码生成rabbitmq的exchangeandqueue教程》使用SpringAMQP代码直接创建RabbitMQexchange和queue,并确保绑定关系自动成立,简... 目录spring AMQP代码生成rabbitmq的exchange and 编程queue执行结果总结s

Nginx添加内置模块过程

《Nginx添加内置模块过程》文章指导如何检查并添加Nginx的with-http_gzip_static模块:确认该模块未默认安装后,需下载同版本源码重新编译,备份替换原有二进制文件,最后重启服务验... 目录1、查看Nginx已编辑的模块2、Nginx官网查看内置模块3、停止Nginx服务4、Nginx

python urllib模块使用操作方法

《pythonurllib模块使用操作方法》Python提供了多个库用于处理URL,常用的有urllib、requests和urlparse(Python3中为urllib.parse),下面是这些... 目录URL 处理库urllib 模块requests 库urlparse 和 urljoin编码和解码

Linux部署中的文件大小写问题的解决方案

《Linux部署中的文件大小写问题的解决方案》在本地开发环境(Windows/macOS)一切正常,但部署到Linux服务器后出现模块加载错误,核心原因是Linux文件系统严格区分大小写,所以本文给大... 目录问题背景解决方案配置要求问题背景在本地开发环境(Windows/MACOS)一切正常,但部署到

创建springBoot模块没有目录结构的解决方案

《创建springBoot模块没有目录结构的解决方案》2023版IntelliJIDEA创建模块时可能出现目录结构识别错误,导致文件显示异常,解决方法为选择模块后点击确认,重新校准项目结构设置,确保源... 目录创建spChina编程ringBoot模块没有目录结构解决方案总结创建springBoot模块没有目录

idea Maven Springboot多模块项目打包时90%的问题及解决方案

《ideaMavenSpringboot多模块项目打包时90%的问题及解决方案》:本文主要介绍ideaMavenSpringboot多模块项目打包时90%的问题及解决方案,具有很好的参考价值,... 目录1. 前言2. 问题3. 解决办法4. jar 包冲突总结1. 前言之所以写这篇文章是因为在使用Mav

Python标准库datetime模块日期和时间数据类型解读

《Python标准库datetime模块日期和时间数据类型解读》文章介绍Python中datetime模块的date、time、datetime类,用于处理日期、时间及日期时间结合体,通过属性获取时间... 目录Datetime常用类日期date类型使用时间 time 类型使用日期和时间的结合体–日期时间(