MybatisGenerator自动代码生成器的使用

article/2025/11/10 6:37:06

    之前有写过一篇文章通过RuoYi自动生成SpringBoot项目代码,这篇文章有介绍如何通过RuoYi框架来自动生成相关的SpringBoot代码。但并不是所有的小伙伴都会去下载RuoYi这一套框架代码去获取domain、mapper以及mapping,特此本人再推荐一款很实用并且也容易上手的工具“MybatisGenerator”自动代码生成器,下面将对此做详细的介绍和说明。

目录

    • 1. 文件下载
    • 2. 相关配置
      • (1)数据库驱动包位置
      • (2)数据库链接URL、用户名和密码
      • (3)要生成哪些表
    • 3. 使用方法
    • 4. 效果展示
      • (1)FacilitySideSlopeYH.java
      • (2)FacilitySideSlopeYHMapper.java
      • (3)FacilitySideSlopeYHMapper.xml
    • 5. 结束语

1. 文件下载

通过如下地址获取代码生成器工具:
链接: https://pan.baidu.com/s/17Rjg61P-VBTsmKgWa7iubg?pwd=muki
提取码: muki

得到压缩包文件解压到指定的磁盘后显示如下:
在这里插入图片描述
在这里插入图片描述

2. 相关配置

打开generatorConfig.xml配置文件,配置好相关的位置信息。
在这里插入图片描述
如下图所示有3个地方需要注意:

(1)数据库驱动包位置

即我们使用的是什么数据库,我们就得用什么数据库的驱动jar包,这个在下载文件中已经包含了,拿来直接用即可;

(2)数据库链接URL、用户名和密码

这里链接我们的本地地址或者服务器地址都可以,只要是数据库的URL能对应表的名字也没错就行,在将你的用户名和密码均填写正确即可;

(3)要生成哪些表

只需要将我们的表名与我们数据库表名保持一致,domainObjectName通过自己的定义即可。

<?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><!-- 数据库驱动包位置 --><classPathEntry location="G:\Mybatis-Generator\generator\mysql-connector-java-8.0.21.jar" />  <context id="DB2Tables" targetRuntime="MyBatis3"><commentGenerator><property name="suppressAllComments" value="true" /></commentGenerator><!-- 数据库链接URL、用户名、密码 --><jdbcConnection driverClass="com.mysql.cj.jdbc.Driver" connectionURL="jdbc:mysql://****/****" userId="****" password="****"> </jdbcConnection><javaTypeResolver><property name="forceBigDecimals" value="false" /></javaTypeResolver><!-- 生成domain的位置 --><javaModelGenerator targetPackage="com.hncr.asset.domain" targetProject="E:\asset\mybatis-Generator\src"><property name="enableSubPackages" value="true" /><property name="trimStrings" value="true" /></javaModelGenerator><!-- 生成的mapping位置 --><sqlMapGenerator targetPackage="com.hncr.asset" targetProject="E:\asset\mybatis-Generator\src"><property name="enableSubPackages" value="true" /></sqlMapGenerator><!-- 生成mapper的位置 --><javaClientGenerator type="XMLMAPPER" targetPackage="com.hncr.asset.mapper" targetProject="E:\asset\mybatis-Generator\src"><property name="enableSubPackages" value="true" /></javaClientGenerator><!-- 要生成哪些表(更改tableName和domainObjectName就可以) --><table tableName="facility_side_slope" domainObjectName="FacilitySideSlopeYH" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" /></context></generatorConfiguration>

3. 使用方法

(1)切换到配置文件夹位置,打开cmd,输入“生成文件语句.txt”中的代码生成语句:
在这里插入图片描述

java -jar mybatis-generator-core-1.3.2.jar -configfile generatorConfig.xml -overwrite

(2)回车运行,显示如下语句,证明所需代码自动生成完毕!

MyBatis Generator finished successfully, there were warnings.

4. 效果展示

(1)FacilitySideSlopeYH.java

package com.hncr.asset.domain;import java.math.BigDecimal;
import java.util.Date;public class FacilitySideSlopeYH {private Long id;private String sideSlopeCode;private String sideSlopeName;private String routeCode;private String routeName;private String roadSectionCode;private String trafficDirection;private String centerStake;private String startStake;private Float centerLongitude;private Float centerLatitude;private String endStake;private BigDecimal startLongitude;private BigDecimal startLatitude;private BigDecimal endLongitude;private BigDecimal endLatitude;private String linkid;private String picturePath;private Double slopeLength;private String slopeType;private String fillOrCut;private String maintenanceUnit;private String remark;private Integer isDelete;private String remark1;private String remark2;private String remark3;private String creater;private Date createTime;private String updator;private Date updateTime;public Long getId() {return id;}public void setId(Long id) {this.id = id;}public String getSideSlopeCode() {return sideSlopeCode;}public void setSideSlopeCode(String sideSlopeCode) {this.sideSlopeCode = sideSlopeCode == null ? null : sideSlopeCode.trim();}public String getSideSlopeName() {return sideSlopeName;}public void setSideSlopeName(String sideSlopeName) {this.sideSlopeName = sideSlopeName == null ? null : sideSlopeName.trim();}public String getRouteCode() {return routeCode;}public void setRouteCode(String routeCode) {this.routeCode = routeCode == null ? null : routeCode.trim();}public String getRouteName() {return routeName;}public void setRouteName(String routeName) {this.routeName = routeName == null ? null : routeName.trim();}public String getRoadSectionCode() {return roadSectionCode;}public void setRoadSectionCode(String roadSectionCode) {this.roadSectionCode = roadSectionCode == null ? null : roadSectionCode.trim();}public String getTrafficDirection() {return trafficDirection;}public void setTrafficDirection(String trafficDirection) {this.trafficDirection = trafficDirection == null ? null : trafficDirection.trim();}public String getCenterStake() {return centerStake;}public void setCenterStake(String centerStake) {this.centerStake = centerStake == null ? null : centerStake.trim();}public String getStartStake() {return startStake;}public void setStartStake(String startStake) {this.startStake = startStake == null ? null : startStake.trim();}public Float getCenterLongitude() {return centerLongitude;}public void setCenterLongitude(Float centerLongitude) {this.centerLongitude = centerLongitude;}public Float getCenterLatitude() {return centerLatitude;}public void setCenterLatitude(Float centerLatitude) {this.centerLatitude = centerLatitude;}public String getEndStake() {return endStake;}public void setEndStake(String endStake) {this.endStake = endStake == null ? null : endStake.trim();}public BigDecimal getStartLongitude() {return startLongitude;}public void setStartLongitude(BigDecimal startLongitude) {this.startLongitude = startLongitude;}public BigDecimal getStartLatitude() {return startLatitude;}public void setStartLatitude(BigDecimal startLatitude) {this.startLatitude = startLatitude;}public BigDecimal getEndLongitude() {return endLongitude;}public void setEndLongitude(BigDecimal endLongitude) {this.endLongitude = endLongitude;}public BigDecimal getEndLatitude() {return endLatitude;}public void setEndLatitude(BigDecimal endLatitude) {this.endLatitude = endLatitude;}public String getLinkid() {return linkid;}public void setLinkid(String linkid) {this.linkid = linkid == null ? null : linkid.trim();}public String getPicturePath() {return picturePath;}public void setPicturePath(String picturePath) {this.picturePath = picturePath == null ? null : picturePath.trim();}public Double getSlopeLength() {return slopeLength;}public void setSlopeLength(Double slopeLength) {this.slopeLength = slopeLength;}public String getSlopeType() {return slopeType;}public void setSlopeType(String slopeType) {this.slopeType = slopeType == null ? null : slopeType.trim();}public String getFillOrCut() {return fillOrCut;}public void setFillOrCut(String fillOrCut) {this.fillOrCut = fillOrCut == null ? null : fillOrCut.trim();}public String getMaintenanceUnit() {return maintenanceUnit;}public void setMaintenanceUnit(String maintenanceUnit) {this.maintenanceUnit = maintenanceUnit == null ? null : maintenanceUnit.trim();}public String getRemark() {return remark;}public void setRemark(String remark) {this.remark = remark == null ? null : remark.trim();}public Integer getIsDelete() {return isDelete;}public void setIsDelete(Integer isDelete) {this.isDelete = isDelete;}public String getRemark1() {return remark1;}public void setRemark1(String remark1) {this.remark1 = remark1 == null ? null : remark1.trim();}public String getRemark2() {return remark2;}public void setRemark2(String remark2) {this.remark2 = remark2 == null ? null : remark2.trim();}public String getRemark3() {return remark3;}public void setRemark3(String remark3) {this.remark3 = remark3 == null ? null : remark3.trim();}public String getCreater() {return creater;}public void setCreater(String creater) {this.creater = creater == null ? null : creater.trim();}public Date getCreateTime() {return createTime;}public void setCreateTime(Date createTime) {this.createTime = createTime;}public String getUpdator() {return updator;}public void setUpdator(String updator) {this.updator = updator == null ? null : updator.trim();}public Date getUpdateTime() {return updateTime;}public void setUpdateTime(Date updateTime) {this.updateTime = updateTime;}
}

(2)FacilitySideSlopeYHMapper.java

package com.hncr.asset.mapper;import com.hncr.asset.domain.FacilitySideSlopeYH;public interface FacilitySideSlopeYHMapper {int deleteByPrimaryKey(Long id);int insert(FacilitySideSlopeYH record);int insertSelective(FacilitySideSlopeYH record);FacilitySideSlopeYH selectByPrimaryKey(Long id);int updateByPrimaryKeySelective(FacilitySideSlopeYH record);int updateByPrimaryKey(FacilitySideSlopeYH record);
}

(3)FacilitySideSlopeYHMapper.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hncr.asset.mapper.FacilitySideSlopeYHMapper"><resultMap id="BaseResultMap" type="com.hncr.asset.domain.FacilitySideSlopeYH"><id column="id" jdbcType="BIGINT" property="id" /><result column="side_slope_code" jdbcType="VARCHAR" property="sideSlopeCode" /><result column="side_slope_name" jdbcType="VARCHAR" property="sideSlopeName" /><result column="route_code" jdbcType="VARCHAR" property="routeCode" /><result column="route_name" jdbcType="VARCHAR" property="routeName" /><result column="road_section_code" jdbcType="VARCHAR" property="roadSectionCode" /><result column="traffic_direction" jdbcType="VARCHAR" property="trafficDirection" /><result column="center_stake" jdbcType="VARCHAR" property="centerStake" /><result column="start_stake" jdbcType="VARCHAR" property="startStake" /><result column="center_longitude" jdbcType="REAL" property="centerLongitude" /><result column="center_latitude" jdbcType="REAL" property="centerLatitude" /><result column="end_stake" jdbcType="VARCHAR" property="endStake" /><result column="start_longitude" jdbcType="DECIMAL" property="startLongitude" /><result column="start_latitude" jdbcType="DECIMAL" property="startLatitude" /><result column="end_longitude" jdbcType="DECIMAL" property="endLongitude" /><result column="end_latitude" jdbcType="DECIMAL" property="endLatitude" /><result column="linkid" jdbcType="VARCHAR" property="linkid" /><result column="picture_path" jdbcType="VARCHAR" property="picturePath" /><result column="slope_length" jdbcType="DOUBLE" property="slopeLength" /><result column="slope_type" jdbcType="VARCHAR" property="slopeType" /><result column="fill_or_cut" jdbcType="VARCHAR" property="fillOrCut" /><result column="maintenance_unit" jdbcType="VARCHAR" property="maintenanceUnit" /><result column="remark" jdbcType="VARCHAR" property="remark" /><result column="is_delete" jdbcType="INTEGER" property="isDelete" /><result column="remark1" jdbcType="VARCHAR" property="remark1" /><result column="remark2" jdbcType="VARCHAR" property="remark2" /><result column="remark3" jdbcType="VARCHAR" property="remark3" /><result column="creater" jdbcType="VARCHAR" property="creater" /><result column="create_time" jdbcType="TIMESTAMP" property="createTime" /><result column="updator" jdbcType="VARCHAR" property="updator" /><result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /></resultMap><sql id="Base_Column_List">id, side_slope_code, side_slope_name, route_code, route_name, road_section_code, traffic_direction, center_stake, start_stake, center_longitude, center_latitude, end_stake, start_longitude, start_latitude, end_longitude, end_latitude, linkid, picture_path, slope_length, slope_type, fill_or_cut, maintenance_unit, remark, is_delete, remark1, remark2, remark3, creater, create_time, updator, update_time</sql><select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">select <include refid="Base_Column_List" />from facility_side_slopewhere id = #{id,jdbcType=BIGINT}</select><delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from facility_side_slopewhere id = #{id,jdbcType=BIGINT}</delete><insert id="insert" parameterType="com.hncr.asset.domain.FacilitySideSlopeYH">insert into facility_side_slope (id, side_slope_code, side_slope_name, route_code, route_name, road_section_code, traffic_direction, center_stake, start_stake, center_longitude, center_latitude, end_stake, start_longitude, start_latitude, end_longitude, end_latitude, linkid, picture_path, slope_length, slope_type, fill_or_cut, maintenance_unit, remark, is_delete, remark1, remark2, remark3, creater, create_time, updator, update_time)values (#{id,jdbcType=BIGINT}, #{sideSlopeCode,jdbcType=VARCHAR}, #{sideSlopeName,jdbcType=VARCHAR}, #{routeCode,jdbcType=VARCHAR}, #{routeName,jdbcType=VARCHAR}, #{roadSectionCode,jdbcType=VARCHAR}, #{trafficDirection,jdbcType=VARCHAR}, #{centerStake,jdbcType=VARCHAR}, #{startStake,jdbcType=VARCHAR}, #{centerLongitude,jdbcType=REAL}, #{centerLatitude,jdbcType=REAL}, #{endStake,jdbcType=VARCHAR}, #{startLongitude,jdbcType=DECIMAL}, #{startLatitude,jdbcType=DECIMAL}, #{endLongitude,jdbcType=DECIMAL}, #{endLatitude,jdbcType=DECIMAL}, #{linkid,jdbcType=VARCHAR}, #{picturePath,jdbcType=VARCHAR}, #{slopeLength,jdbcType=DOUBLE}, #{slopeType,jdbcType=VARCHAR}, #{fillOrCut,jdbcType=VARCHAR}, #{maintenanceUnit,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{isDelete,jdbcType=INTEGER}, #{remark1,jdbcType=VARCHAR}, #{remark2,jdbcType=VARCHAR}, #{remark3,jdbcType=VARCHAR}, #{creater,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updator,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP})</insert><insert id="insertSelective" parameterType="com.hncr.asset.domain.FacilitySideSlopeYH">insert into facility_side_slope<trim prefix="(" suffix=")" suffixOverrides=","><if test="id != null">id,</if><if test="sideSlopeCode != null">side_slope_code,</if><if test="sideSlopeName != null">side_slope_name,</if><if test="routeCode != null">route_code,</if><if test="routeName != null">route_name,</if><if test="roadSectionCode != null">road_section_code,</if><if test="trafficDirection != null">traffic_direction,</if><if test="centerStake != null">center_stake,</if><if test="startStake != null">start_stake,</if><if test="centerLongitude != null">center_longitude,</if><if test="centerLatitude != null">center_latitude,</if><if test="endStake != null">end_stake,</if><if test="startLongitude != null">start_longitude,</if><if test="startLatitude != null">start_latitude,</if><if test="endLongitude != null">end_longitude,</if><if test="endLatitude != null">end_latitude,</if><if test="linkid != null">linkid,</if><if test="picturePath != null">picture_path,</if><if test="slopeLength != null">slope_length,</if><if test="slopeType != null">slope_type,</if><if test="fillOrCut != null">fill_or_cut,</if><if test="maintenanceUnit != null">maintenance_unit,</if><if test="remark != null">remark,</if><if test="isDelete != null">is_delete,</if><if test="remark1 != null">remark1,</if><if test="remark2 != null">remark2,</if><if test="remark3 != null">remark3,</if><if test="creater != null">creater,</if><if test="createTime != null">create_time,</if><if test="updator != null">updator,</if><if test="updateTime != null">update_time,</if></trim><trim prefix="values (" suffix=")" suffixOverrides=","><if test="id != null">#{id,jdbcType=BIGINT},</if><if test="sideSlopeCode != null">#{sideSlopeCode,jdbcType=VARCHAR},</if><if test="sideSlopeName != null">#{sideSlopeName,jdbcType=VARCHAR},</if><if test="routeCode != null">#{routeCode,jdbcType=VARCHAR},</if><if test="routeName != null">#{routeName,jdbcType=VARCHAR},</if><if test="roadSectionCode != null">#{roadSectionCode,jdbcType=VARCHAR},</if><if test="trafficDirection != null">#{trafficDirection,jdbcType=VARCHAR},</if><if test="centerStake != null">#{centerStake,jdbcType=VARCHAR},</if><if test="startStake != null">#{startStake,jdbcType=VARCHAR},</if><if test="centerLongitude != null">#{centerLongitude,jdbcType=REAL},</if><if test="centerLatitude != null">#{centerLatitude,jdbcType=REAL},</if><if test="endStake != null">#{endStake,jdbcType=VARCHAR},</if><if test="startLongitude != null">#{startLongitude,jdbcType=DECIMAL},</if><if test="startLatitude != null">#{startLatitude,jdbcType=DECIMAL},</if><if test="endLongitude != null">#{endLongitude,jdbcType=DECIMAL},</if><if test="endLatitude != null">#{endLatitude,jdbcType=DECIMAL},</if><if test="linkid != null">#{linkid,jdbcType=VARCHAR},</if><if test="picturePath != null">#{picturePath,jdbcType=VARCHAR},</if><if test="slopeLength != null">#{slopeLength,jdbcType=DOUBLE},</if><if test="slopeType != null">#{slopeType,jdbcType=VARCHAR},</if><if test="fillOrCut != null">#{fillOrCut,jdbcType=VARCHAR},</if><if test="maintenanceUnit != null">#{maintenanceUnit,jdbcType=VARCHAR},</if><if test="remark != null">#{remark,jdbcType=VARCHAR},</if><if test="isDelete != null">#{isDelete,jdbcType=INTEGER},</if><if test="remark1 != null">#{remark1,jdbcType=VARCHAR},</if><if test="remark2 != null">#{remark2,jdbcType=VARCHAR},</if><if test="remark3 != null">#{remark3,jdbcType=VARCHAR},</if><if test="creater != null">#{creater,jdbcType=VARCHAR},</if><if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if><if test="updator != null">#{updator,jdbcType=VARCHAR},</if><if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if></trim></insert><update id="updateByPrimaryKeySelective" parameterType="com.hncr.asset.domain.FacilitySideSlopeYH">update facility_side_slope<set><if test="sideSlopeCode != null">side_slope_code = #{sideSlopeCode,jdbcType=VARCHAR},</if><if test="sideSlopeName != null">side_slope_name = #{sideSlopeName,jdbcType=VARCHAR},</if><if test="routeCode != null">route_code = #{routeCode,jdbcType=VARCHAR},</if><if test="routeName != null">route_name = #{routeName,jdbcType=VARCHAR},</if><if test="roadSectionCode != null">road_section_code = #{roadSectionCode,jdbcType=VARCHAR},</if><if test="trafficDirection != null">traffic_direction = #{trafficDirection,jdbcType=VARCHAR},</if><if test="centerStake != null">center_stake = #{centerStake,jdbcType=VARCHAR},</if><if test="startStake != null">start_stake = #{startStake,jdbcType=VARCHAR},</if><if test="centerLongitude != null">center_longitude = #{centerLongitude,jdbcType=REAL},</if><if test="centerLatitude != null">center_latitude = #{centerLatitude,jdbcType=REAL},</if><if test="endStake != null">end_stake = #{endStake,jdbcType=VARCHAR},</if><if test="startLongitude != null">start_longitude = #{startLongitude,jdbcType=DECIMAL},</if><if test="startLatitude != null">start_latitude = #{startLatitude,jdbcType=DECIMAL},</if><if test="endLongitude != null">end_longitude = #{endLongitude,jdbcType=DECIMAL},</if><if test="endLatitude != null">end_latitude = #{endLatitude,jdbcType=DECIMAL},</if><if test="linkid != null">linkid = #{linkid,jdbcType=VARCHAR},</if><if test="picturePath != null">picture_path = #{picturePath,jdbcType=VARCHAR},</if><if test="slopeLength != null">slope_length = #{slopeLength,jdbcType=DOUBLE},</if><if test="slopeType != null">slope_type = #{slopeType,jdbcType=VARCHAR},</if><if test="fillOrCut != null">fill_or_cut = #{fillOrCut,jdbcType=VARCHAR},</if><if test="maintenanceUnit != null">maintenance_unit = #{maintenanceUnit,jdbcType=VARCHAR},</if><if test="remark != null">remark = #{remark,jdbcType=VARCHAR},</if><if test="isDelete != null">is_delete = #{isDelete,jdbcType=INTEGER},</if><if test="remark1 != null">remark1 = #{remark1,jdbcType=VARCHAR},</if><if test="remark2 != null">remark2 = #{remark2,jdbcType=VARCHAR},</if><if test="remark3 != null">remark3 = #{remark3,jdbcType=VARCHAR},</if><if test="creater != null">creater = #{creater,jdbcType=VARCHAR},</if><if test="createTime != null">create_time = #{createTime,jdbcType=TIMESTAMP},</if><if test="updator != null">updator = #{updator,jdbcType=VARCHAR},</if><if test="updateTime != null">update_time = #{updateTime,jdbcType=TIMESTAMP},</if></set>where id = #{id,jdbcType=BIGINT}</update><update id="updateByPrimaryKey" parameterType="com.hncr.asset.domain.FacilitySideSlopeYH">update facility_side_slopeset side_slope_code = #{sideSlopeCode,jdbcType=VARCHAR},side_slope_name = #{sideSlopeName,jdbcType=VARCHAR},route_code = #{routeCode,jdbcType=VARCHAR},route_name = #{routeName,jdbcType=VARCHAR},road_section_code = #{roadSectionCode,jdbcType=VARCHAR},traffic_direction = #{trafficDirection,jdbcType=VARCHAR},center_stake = #{centerStake,jdbcType=VARCHAR},start_stake = #{startStake,jdbcType=VARCHAR},center_longitude = #{centerLongitude,jdbcType=REAL},center_latitude = #{centerLatitude,jdbcType=REAL},end_stake = #{endStake,jdbcType=VARCHAR},start_longitude = #{startLongitude,jdbcType=DECIMAL},start_latitude = #{startLatitude,jdbcType=DECIMAL},end_longitude = #{endLongitude,jdbcType=DECIMAL},end_latitude = #{endLatitude,jdbcType=DECIMAL},linkid = #{linkid,jdbcType=VARCHAR},picture_path = #{picturePath,jdbcType=VARCHAR},slope_length = #{slopeLength,jdbcType=DOUBLE},slope_type = #{slopeType,jdbcType=VARCHAR},fill_or_cut = #{fillOrCut,jdbcType=VARCHAR},maintenance_unit = #{maintenanceUnit,jdbcType=VARCHAR},remark = #{remark,jdbcType=VARCHAR},is_delete = #{isDelete,jdbcType=INTEGER},remark1 = #{remark1,jdbcType=VARCHAR},remark2 = #{remark2,jdbcType=VARCHAR},remark3 = #{remark3,jdbcType=VARCHAR},creater = #{creater,jdbcType=VARCHAR},create_time = #{createTime,jdbcType=TIMESTAMP},updator = #{updator,jdbcType=VARCHAR},update_time = #{updateTime,jdbcType=TIMESTAMP}where id = #{id,jdbcType=BIGINT}</update>
</mapper>

5. 结束语

    上述自动生成的三层代码能够实现基本的增删改查需求,其他的业务场景只需要在这些代码基础上进行更改即可,我们在开发中其实很多都是重复式的机械运动,上道了以后就会发现这样的工具生成出的代码能节省我们开发的不少时间。后续要做的大部分工作就是将我们的Service层的业务实现写明白,Controller层映射条件写清楚即可。具体也可以将上述的内容与基于SpringBoot_后端接口流程和SpringBoot_实现基本增删改查(前后端分离版)两篇文章结合着看,效果更佳呀!!!

路过的小伙伴,如果博文有帮助到你解决问题,可以点赞+关注一波呀~本人将会持续更新相关学习博文,感谢您的支持哦!!!
在这里插入图片描述


http://chatgpt.dhexx.cn/article/sl1CjXaY.shtml

相关文章

Simulink自动代码生成(一)

一个simulink模型能够生成代码首先要满足的条件&#xff1a; 1&#xff1a;确保模型仿真的正确性2&#xff1a;将需要的输入和输出改成input和output模块3&#xff1a;离散化模型&#xff0c;设置求解器为离散&#xff0c;固定步长满足上面条件后&#xff0c;接下来怎么生成嵌入…

代码一键自动生成,拿走不谢

程序猿学社的GitHub&#xff0c;欢迎Star github技术专题 本文已记录到github 文章目录 前言起源环境实战sql脚本pom.xmlapplication.yml启动类代码自动生成controller类 测试 前言 隔壁老王&#xff1a; 社长&#xff0c;我工作有一段时间咯&#xff0c;我看其他的同事&#x…

4个免费代码自动生成神器

4个免费代码自动生成神器 日常写代码&#xff0c;是一件非常需要耐心的事情&#xff0c;尤其是那些没有技术含量重复使用到的一些代码排列组合&#xff0c;比如前端的一些html和css布局&#xff0c;简单繁杂&#xff0c;这个时候就会使用到一些免费代码自动生成神器&#xff0c…

java自动代码生成

1.概述 可在线自动生成代码&#xff0c;省去复制、修改通用模板代码的繁琐过程&#xff0c;减少团队70%以上的开发工作量 基于java的template模板引擎velocity&#xff0c;在定义好模板文件后&#xff0c;动态产生适应业务的java、xml、html、sql等代码文件 2.自动生成过程 …

Linux防火墙关闭方法

Linux防火墙关闭方法 关闭防火墙&#xff1a; 1、查看状态&#xff1a;systemctl status firewalld 2、关闭&#xff1a; systemctl stop firewalld&#xff08;只执行这个&#xff0c;重启后不行&#xff0c;还必须执行systemctl status firewalld&#xff09; 1.1、查看seli…

Linux中的Java项目服务器无故关闭

部署在Linux中的项目&#xff0c;最近一直无故关闭。找了很多都找不到原因。最近发现一个现象终于让我知道是什么原因导致我的开发服务器无故关闭了。 起因 部署在linux中的java开发服务器最近一直无故关闭。且是因为我在启动脚本中加了如下命令导致的。 tail -f log/game.lo…

Linux 系统下关闭防火墙

一、重启后永久性生效&#xff1a; 开启&#xff1a; chkconfig iptables on 关闭&#xff1a; chkconfig iptables off 二、即时生效&#xff0c;重启后失效&#xff1a; 开启&#xff1a; service iptables start 关闭&#xff1a; service iptables stop 需要说明的…

linux 桌面关闭防火墙,linux如何关闭防火墙的方法

火墙是一项协助确保信息安全的设备&#xff0c;会依照特定的规则&#xff0c;允许或是限制传输的数据通过。简单的来说防火墙的作用就是保护你的网络免受非法用户的侵入&#xff0c;虽然防火墙是为了你网络安全而存在&#xff0c;但是同时也限制了你上网操作&#xff0c;有很多…

LINUX系统下关闭防火墙

所谓防火墙指的是一个由软件和硬件设备组合而成、在内部网和外部网之间、专用网与公共网之间的界面上构造的保护屏障.是一种获取安全性方法的形象说法&#xff0c;它是一种计算机硬件和软件的结合&#xff0c;使Internet与Intranet之间建立起一个安全网关。 一、重启后永久性生…

JAVA配置防火墙开放、关闭端口

要达成的目的可以描述为&#xff1a; 在JAVA程序中随机生成一个可用的端口&#xff0c;并在防火墙中开放这个端口。 随机生成可用端口 /*** 随机获取10100-10200的未占用端口** return 端口号*/private int generateLocalPort() {while (true) {int port 10100 (new Random(…

Linux系统关闭防火墙命令

Linux系统关闭防火墙命令 下面是red hat/CentOs7关闭防火墙的命令! 1:查看防火状态 systemctl status firewalld service iptables status 2:暂时关闭防火墙 systemctl stop firewalld service iptables stop 3:永久关闭防火墙 systemctl disable firewalld chkconfi…

Linux下的关闭防火墙

一、临时关闭防火墙 1、 查看防火墙的状态 /etc/init.d/iptables status 2、 临时关闭防火墙 /etc/init.d/iptables stop 3、 查看关闭后的状态 二、永久关闭防火墙 命令&#xff1a;chkconfig --level 2345 iptables off 或者 chkconfig iptables off 其中2345 代表”执…

Linux关闭防火墙命令

一、下面是red hat/CentOs7关闭防火墙的命令! 1:查看防火状态 systemctl status firewalld service iptables status 2:暂时关闭防火墙 systemctl stop firewalld service iptables stop 3:永久关闭防火墙 systemctl disable firewalld chkconfig iptables off 4:重…

原生js 实现图片轮播(图片按钮+左右轮播)

该代码可以实现左右箭头点击切换,按钮点击切换,自动播放方面还需改进 点击切换方面算是实现了效果,自我感觉还需要改进,代码仅供参考 html部分 <!DOCTYPE html> <html lang="en"> <head><meta charset="UTF-8"><title>…

JS——【案例】图片轮播图(自动轮播/手动点击/悬停显示)[技术栈:html、css、JavaScript]

1、效果&#xff1a; 2、需求&#xff1a; 3、代码实现&#xff1a; <!DOCTYPE html> <html lang"en"><head><meta charset"UTF-8"><meta name"viewport" content"widthdevice-width, initial-scale1.0"&…

如何用JS实现轮播图!

轮播图 1.思路与写法 1.1 首先我们拿到一个关于轮播图的实例我们要分析里面的功能&#xff0c;将其模块化处理&#xff1b; 1.2 首先需要实现的是自动轮播的效果&#xff1a; 1.2.1需要用到运动函数框架&#xff0c;startMove()&#xff0c;还需要用到定时器&#xff0c;这里…

javascript图片轮播技术动态实现

我们经常会在网页中见到轮播的图片&#xff0c;如京东主页面中图片自动更换。我们在这里对这一技术进行实现&#xff0c;主要能够使图片自动进行轮播&#xff0c;数字标签随着图片一同更换&#xff0c;鼠标移动到数字标签上&#xff0c;相应的图片停留&#xff0c;鼠标在整个图…

JS——实现轮播图(完整功能)

没有把细节单拎出来讲&#xff0c;但基本上所有重要步骤都在代码里边备注解释了~~ 个人认为比较难的地方就是&#xff1a; 怎么在自动播放到最后一张图片后&#xff0c;瞬间切换回第一张图片重新播放&#xff1f; 这里采用了比较取巧的方法&#xff0c;比如我用了四张例图&a…

Js实现图片点击切换与轮播

Js实现图片点击切换与轮播 图片点击切换 <!DOCTYPE html> <html><head> <meta charset"UTF-8"><title></title><script type"text/javascript">window.onloadfunction(){var btn1document.getElementById("…

原生JS-实现无限图片轮播

实现思路&#xff1a; 一、布局部分&#xff1a; 1、采用div>ul>li>img布局&#xff0c;来展示轮播的图片banner; 2、采用div>>ul>li>a标签&#xff0c;来显示小红点&#xff1b; 整个布局入下图所示&#xff1a;途中的&#xff0c;图中的第一个li和最后一…