逆向工程(MGB1.3.6版本新功能)去掉指定前缀(如:将sys_user 转换为 User) 亲测有效

本文介绍如何使用MGB1.3.6版本的逆向工程功能,自定义去除表名前缀,例如将'sys_user'转换为'User'。通过修改配置文件和添加自定义注释,实现批量处理上百张表,提高开发效率。详细步骤包括设置pom依赖、配置文件调整,以及自定义字段注释和mapper。附带项目下载链接。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

前奏(一定要吐槽一下)

在未解决这个问题之前,你不知道我有多绝望,(ps:你知道上百张表,一张一张去改有多难受吗)但是解决了之后,真的是豁然开朗啊;

很感谢这篇文章的解惑(内心突然有种很膜拜的感觉啊) 点睛之笔 ;来吧先看效果图:

 实体结构效果:

原来的效果图:

相信大家看到上面的对比图已经有感觉了(这还只是一部分而已);废话不多说,开干:

首先是逆向工程(一定是MGB1.3.6版本),因为版本的问题可是弄了我好半天,

pom依赖:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>mybatisgenerator</groupId>
    <artifactId>mybatis-generator</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>mybatis-generator</name>
    <description>mybatis-逆向工程</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.10.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
        <commons-lang3.version>3.3.2</commons-lang3.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.mybatis.spring.boot</groupId>
            <artifactId>mybatis-spring-boot-starter</artifactId>
            <version>1.3.1</version>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <!--mybatis逆向工程-->
        <dependency>
            <groupId>org.mybatis.generator</groupId>
            <artifactId>mybatis-generator</artifactId>
            <version>1.3.7</version>
        </dependency>
        <!--生成代码插件 -->
        <dependency>
            <groupId>org.mybatis.generator</groupId>
            <artifactId>mybatis-generator-core</artifactId>
            <version>1.3.6</version>
            <type>jar</type>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>${commons-lang3.version}</version>
        </dependency>

        <!-- 分页助手 -->
        <dependency>
            <groupId>com.github.pagehelper</groupId>
            <artifactId>pagehelper</artifactId>
            <version>3.7.5</version>
        </dependency>
        <dependency>
            <groupId>com.github.jsqlparser</groupId>
            <artifactId>jsqlparser</artifactId>
            <version>0.9.1</version>
        </dependency>
        <!-- 通用mapper -->
        <dependency>
            <groupId>com.github.abel533</groupId>
            <artifactId>mapper</artifactId>
            <version>2.3.4</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

 配置文件:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
        "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<!-- 配置生成器 -->
<!--此文件简略清爽,另一篇注释详细,作为参考-->
<generatorConfiguration>
    <properties resource="mybatis-generator/mybatisGeneratorInit.properties"/>
    <context id="MysqlTables" targetRuntime="MyBatis3" defaultModelType="flat">
        <!-- 自动识别数据库关键字,默认false,如果设置为true,根据SqlReservedWords中定义的关键字列表;
         一般保留默认值,遇到数据库关键字(Java关键字),
# This file works for GuguBOT with MKS Monster8 V2.0 Only # 本配置适用于使用MKS Monster8 V2.0版本主板的GuguBOT [include misc/timelapse.cfg] [include Klicky-Probe/klicky-probe.cfg] [include Klicky-Probe/z_calibration.cfg] [include misc/Gugu_Macros.cfg] [exclude_object] [mcu] ## Obtain definition by "ls -l /dev/serial/by-id/" then unplug to verify serial: /dev/serial/by-id/usb-Klipper_stm32f407xx_2E0027001251333233363732-if00 #-------------------------------------------------------------------- ##-------------------------------------------------------------------- [printer] kinematics: corexy max_velocity: 500 max_accel: 20000 max_z_velocity: 15 max_z_accel: 300 square_corner_velocity: 5.0 ############################################# # AB电机设置 ############################################# #-------------------------------------------------------------------- # 供CoreXY AB电机方向试时使用,日常使用请勿开启 ##------------------------------------------------------------------- #[force_move] #enable_force_move: True #[respond] ##------------------------------------------------------------------- ## B电机(右后) 接主板Y驱动(Drive1:Y) [stepper_x] step_pin:PE5 dir_pin:PE4 enable_pin:!PC15 microsteps:16 rotation_distance: 40 full_steps_per_rotation:200 #set to 400 for 0.9 degree stepper endstop_pin:PA14 position_min: 0 position_endstop:300 position_max:300 homing_speed:60 second_homing_speed:10 homing_retract_speed:10 homing_retract_dist:5 homing_positive_dir:true [tmc2209 stepper_x] uart_pin: PE3 interpolate: True run_current: 1.19 hold_current: 0.6 sense_resistor: 0.110 stealthchop_threshold: 0 ## A电机(左后) 接主板X驱动(Drive0:X) [stepper_y] step_pin:PC14 dir_pin:PC13 enable_pin:!PC15 microsteps: 16 rotation_distance: 40 full_steps_per_rotation:200 #set to 400 for 0.9 degree stepper endstop_pin:PA15 position_min: 0 position_endstop: 320 position_max: 320 homing_speed:60 second_homing_speed:10 homing_retract_speed:10 homing_retract_dist:5 homing_positive_dir:true [tmc2209 stepper_y] uart_pin: PE6 interpolate: True run_current: 1.19 hold_current: 0.6 sense_resistor: 0.110 stealthchop_threshold: 0 ############################################# # Z电机设置 ############################################# ## Z0电机(左前) 接主板Z驱动(Drive2:Z1) [stepper_z] step_pin:PE1 dir_pin:!PE0 enable_pin: !PE2 microsteps: 16 rotation_distance: 2 #与丝杠导程数一致 full_steps_per_rotation: 200 endstop_pin:PB13 ## Z-position of nozzle (in mm) to z-endstop trigger point relative to print surface (Z0) ## (+) value = endstop above Z0, (-) value = endstop below ## Increasing position_endstop brings nozzle closer to the bed ## After you run Z_ENDSTOP_CALIBRATE, position_endstop will be stored at the very end of your config position_endstop:0 position_max: 300 position_min: -3 homing_speed: 6 second_homing_speed: 3.0 homing_retract_dist: 3.0 [tmc2209 stepper_z] uart_pin: PB7 interpolate: True run_current: 0.8 hold_current: 0.5 stealthchop_threshold: 0 ## Z1电机() 接主板E1驱动(Drive4:E1) [stepper_z1] step_pin:PD6 dir_pin:!PD5 enable_pin:!PD7 microsteps:16 rotation_distance: 2 #与丝杠导程数一致 full_steps_per_rotation: 200 [tmc2209 stepper_z1] uart_pin: PD4 interpolate: True run_current: 0.8 hold_current: 0.5 stealthchop_threshold: 0 ## Z2电机(右前) 接主板E2驱动(Drive5:E2) [stepper_z2] step_pin:PD2 dir_pin:!PD1 enable_pin:!PD3 microsteps: 16 rotation_distance: 2 #与丝杠导程数一致 full_steps_per_rotation: 200 [tmc2209 stepper_z2] uart_pin: PD0 interpolate: True run_current: 0.8 hold_current: 0.5 stealthchop_threshold: 0 ############################################# # 挤出机设置 ############################################# ## 挤出机电机 接主板E0驱动(Drive3:E0) [extruder] step_pin:PB5 dir_pin:PB4 enable_pin:!PB6 microsteps:16 rotation_distance: 22.75 #需要精确校准 gear_ratio: 50:10 full_steps_per_rotation: 200 #400 for 0.9 degree nozzle_diameter: 0.400 #与喷嘴保持一致 filament_diameter: 1.750 max_extrude_cross_section: 6.0 max_extrude_only_distance: 100.0 min_temp: 0 max_temp: 280 heater_pin: PB1 sensor_type: NTC 100K MGB18-104F39050L32 sensor_pin: PC1 max_power: 1.0 control : pid #校准在控制台输入PID_CALIBRATE HEATER=extruder TARGET=200 pid_kp : 18.293 pid_ki : 0.960 pid_kd : 87.119 pressure_advance: 0.035 pressure_advance_smooth_time: 0.040 [tmc2209 extruder] uart_pin: PB3 interpolate: True run_current: 0.71 hold_current: 0.4 sense_resistor: 0.110 stealthchop_threshold: 0 ##################################################################### # Probe ##################################################################### [probe] pin: PB12 x_offset: -1 y_offset: 25 z_offset: 9.90 speed: 5 samples:3 samples_result: median sample_retract_dist: 2.0 samples_tolerance: 0.01 samples_tolerance_retries: 3 [bed_mesh] speed: 100 horizontal_move_z: 16 mesh_min: 25, 25 mesh_max: 275, 275 probe_count: 5, 5 zero_reference_position: 150, 150 algorithm: bicubic mesh_pps: 2,2 fade_start: 3 fade_end: 10 fade_target: 0 [z_tilt] # 下面两项配置务必使用换行分割并缩进。分别对应z,z1,z2,注意!确保顺序正确,否则会越调越歪! # 注意确保每个points到丝杆的距离相同。确保给的XY探针能正常碰到床并触发! z_positions: # Z轴丝杆所在坐标 -52,-23 163,375 346,-23 points: # 探点喷嘴的坐标,注意不是探针坐标 10,5 164,260 286,5 speed: 100 #xy移动速度 horizontal_move_z: 16 #z轴高度 retries: 3 #尝试次数,不同点之间的高度差大于下方的retry_tolerance值时候会进行重试。 retry_tolerance: 0.01 #允许不同点的高度差 ######################################## # 热床 ######################################## [heater_bed] heater_pin: PB10 sensor_type: NTC 100K MGB18-104F39050L32 sensor_pin: PC0 max_power: 1.0 control = pid #校准在控制台输入PID_CALIBRATE HEATER=bed TARGET=50 pid_kp = 72.923 pid_ki = 0.634 pid_kd = 2097.460 min_temp: 0 max_temp: 80 ######################################## # 风扇 ######################################## #散热块风扇,接FAN0接口 #[heater_fan my_nozzle_fan] [heater_fan NozzleFan] pin: PA2 max_power: 1.0 shutdown_speed: 0 heater: extruder heater_temp: 60.0 fan_speed: 1.0 #冷却风扇,接FAN1接口 [fan] pin: PA1 max_power: 1.0 #限制最高转速 shutdown_speed: 0 #背部驱动散热风扇,接FAN2接口 [controller_fan TMC_controller_fan] pin: PA0 max_power: 0.7 shutdown_speed: 0 kick_start_time: 0.5 idle_timeout: 600 idle_speed: 0.4 stepper: stepper_x, stepper_y, stepper_z, stepper_z1, stepper_z2, extruder [temperature_sensor KlipperBox] sensor_type: temperature_host min_temp: 5 max_temp: 100 ##################################################################### # LED ##################################################################### #补光LED,白光,接HE2接口 [output_pin Light] pin: PA3 pwm: False #氛围LED,红蓝光,接HE1接口 [output_pin AmbientLight] pin: PB0 pwm: False value: 1.0 shutdown_value: 1.0 #[output_pin caselight ](Use PA9) ## Chamber Lighting - In 5V-RGB Position #pin: PA9 #pwm: true #shutdown_value: 0 #value:100 #cycle_time: 0.01 ######################################## # EXP1 / EXP2 (display) pins ######################################## [board_pins] aliases: # EXP1 header EXP1_10=<5V>, EXP1_9=<GND>, EXP1_8=PE7, EXP1_7=PE15, EXP1_6=PD8, EXP1_5=PD9, # Slot in the socket on the other side EXP1_4=PD10, EXP1_3=PE11, EXP1_2=PE10, EXP1_1=PB2, # EXP2 header EXP2_10=<5V>, EXP2_9=<GND>, EXP2_8=<RST>, EXP2_7=PB11, EXP2_6=PA7, EXP2_5=PE8, # Slot in the socket on the other side EXP2_4=PA4, EXP2_3=PE9, EXP2_2=PA5, EXP2_1=PA6 # See the sample-lcd.cfg file for definitions of common LCD displays. # Some alternate glyphs for use with 128x64 LCDs. These are used by # adding them to your printer.cfg. # See docs/Config_Reference.md for a description of parameters. ###################################################################### # MKS Mini 12864v3.0 (with neopixel backlight leds) ###################################################################### [display] lcd_type: uc1701 cs_pin: EXP1_3 a0_pin: EXP1_4 rst_pin: EXP1_5 contrast: 63 encoder_pins: ^EXP2_5, ^EXP2_3 click_pin: ^!EXP1_2 ## Some micro-controller boards may require an spi bus to be specified: #spi_bus: spi ## Alternatively, some micro-controller boards may work with software spi: spi_software_miso_pin: EXP2_1 spi_software_mosi_pin: EXP2_6 spi_software_sclk_pin: EXP2_2 [output_pin beeper] pin: EXP1_1 [neopixel fysetc_mini12864] pin: EXP1_6 chain_count: 3 color_order: RGB initial_RED: 0.0 initial_GREEN: 1.0 initial_BLUE: 0.76 ###################################################################### # ADXL345 共振量 ###################################################################### [adxl345] cs_pin: PC9 spi_bus: spi3a [resonance_tester] accel_chip: adxl345 probe_points: 150, 150, 50 #量时喷嘴所处的位置坐标 [input_shaper] shaper_freq_x: 85.2 shaper_freq_y: 65.6 shaper_type_x: ei shaper_type_y: ei ###################################################################### # gcode_macro ###################################################################### [gcode_macro CANCEL_PRINT] description: Cancel the actual running print rename_existing: CANCEL_PRINT_BASE gcode: TURN_OFF_HEATERS CANCEL_PRINT_BASE [virtual_sdcard] path: /home/pi/printer_data/gcodes #path: /home/klipper/printer_data/gcodes [pause_resume] [display_status] 这是目前我的klipper配置,下位机是mks monster8 v2 但是目前我下位机移动距离控制有点问题,全部归位都没有问题,但是我归位后移动距离,但是xy坐标值根本不变化,一直卡在归零后的坐标值。然后Z轴3个电机向下移动50mm,平台应该一起3个电机旋转下降,却只有一个电机向下移动,应该是z2动了其他俩个电机动都没动,z轴数值是有变化的
07-04
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值