admin管理员组文章数量:1586184
之前有写过一篇文章通过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/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//DTD MyBatis Generator Configuration 1.0//EN" "http://mybatis/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//DTD Mapper 3.0//EN" "http://mybatis/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_slope
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from facility_side_slope
where 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_slope
set 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_实现基本增删改查(前后端分离版)两篇文章结合着看,效果更佳呀!!!
路过的小伙伴,如果博文有帮助到你解决问题,可以点赞+关注一波呀~本人将会持续更新相关学习博文,感谢您的支持哦!!!
本文标签: 代码生成器MybatisGenerator
版权声明:本文标题:MybatisGenerator自动代码生成器的使用 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/dongtai/1727971502a1140220.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论