mybatis mybatis-generator 代码自动生成工具

2024-08-26 04:32

本文主要是介绍mybatis mybatis-generator 代码自动生成工具,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

一、简介

mybatis generator是很好用的mybatis自动代码生成工具。最近公司使用maven和mybatis开发项目,手动写入一个个实体类和mapper还有xml配置文件感觉会很麻烦,使用mybatis generator只需要简单的配置就能完成我们的工作,这里简述一下开发步骤。

二、开发流程

2.1 创建maven项目

我们选择开发工具创建maven项目,我这里使用myeclipse开发,建议使用eclipse或者idea开发。 
这里写图片描述

2.2 在pom配置文件中加入依赖包

<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>mybatis-generator-base</groupId><artifactId>mybatis-generator-base</artifactId><version>0.0.1-SNAPSHOT</version><packaging>war</packaging><name/><description/><properties><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding></properties><dependencies><dependency><groupId>javax.servlet</groupId><artifactId>jstl</artifactId><version>1.2</version><scope>provided</scope></dependency><dependency><groupId>javax.servlet.jsp</groupId><artifactId>jsp-api</artifactId><version>2.1</version><scope>provided</scope></dependency><dependency><groupId>org.glassfish</groupId><artifactId>javax.annotation</artifactId><version>3.0.1</version></dependency><dependency><groupId>org.glassfish</groupId><artifactId>javax.ejb</artifactId><version>3.0.1</version></dependency><dependency><groupId>org.jboss.weld</groupId><artifactId>weld-osgi-bundle</artifactId><version>1.0.1-SP3</version></dependency><dependency><groupId>org.glassfish</groupId><artifactId>javax.servlet</artifactId><version>3.0.1</version></dependency><!--测试框架  --><dependency><groupId>junit</groupId><artifactId>junit</artifactId><version>4.12</version></dependency><!-- Mysql --><dependency><groupId>org.mybatis</groupId><artifactId>mybatis</artifactId><version>3.2.7</version></dependency><!-- Mysql 依赖 --><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId><version>5.1.6</version></dependency><!--生成代码插件--><dependency><groupId>org.mybatis.generator</groupId><artifactId>mybatis-generator-core</artifactId><version>1.3.2</version><type>jar</type></dependency></dependencies><build><plugins><plugin><artifactId>maven-war-plugin</artifactId></plugin><plugin><artifactId>maven-compiler-plugin</artifactId><configuration><source>1.6</source><target>1.6</target></configuration></plugin></plugins></build>
</project>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85

2.3 新建生成代码的配置文件mybatis-generator-config.xml

将配置文件配置在合适的位置就可以,但是要访问的到,我这里放置在resources文件下。

<?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><context id="prod"><!-- RowBounds pagination --><plugin type="org.mybatis.generator.plugins.RowBoundsPlugin" /><plugin type="org.mybatis.generator.plugins.CaseInsensitiveLikePlugin" /><plugin type="org.mybatis.generator.plugins.SerializablePlugin" /><commentGenerator><property name="suppressDate" value="true" /><property name="suppressAllComments" value="true" /></commentGenerator><!-- jdbc连接 --><jdbcConnection driverClass="com.mysql.jdbc.Driver"connectionURL="jdbc:mysql://127.0.0.1:3306/generator" userId="root"password="123456" /><javaModelGenerator targetPackage="com.mybatis.entity"targetProject="src/main/java"><!-- 是否针对string类型的字段在set的时候进行trim调用 --><property name="trimStrings" value="true" /></javaModelGenerator><sqlMapGenerator targetPackage="mappers" targetProject="src/main/java" /><javaClientGenerator targetPackage="com.mybatis.mapper"targetProject="src/main/java" type="XMLMAPPER" /><table tableName="wx_ranking_flow" domainObjectName="WxRankingFlow"></table></context>
</generatorConfiguration>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35

(1)在javaModelGenerator标签下配置你需要生成的数据库实体的地址 
(2)在sqlMapGenerator标签下配置mysql的xml配置文件 
(3)在javaClientGenerator标签下配置mapper方法 
(4)在table标签下配置数据库的表面和生成实体的表名

2.4 新建批处理类main方法

package com.mybatis.test;import org.mybatis.generator.api.ShellRunner;public class App {public static void main(String[] args) {args = new String[] { "-configfile", "src\\main\\resources\\mybatis-generator-config.xml", "-overwrite" };ShellRunner.main(args);}}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13

这里要处理的就是我们的mybatis-generator-config.xml配置文件,路径一定要对应我们的存放路径。 
执行main方法就可以生成对应的实体和xml配置文件了。 
这里写图片描述 
我们会发现我们生成了两个实体对象,一个是数据库映射对象,一个是Example对象。Example对象就是为了方便我们执行sql操作的类,可以使用Example类进行数据库的条件查询。同时mybatis-generator还帮助我们生成了sql的CRUD等操作。

WxRankingFlowMapper接口

package com.mybatis.mapper;import java.util.List;import com.mybatis.entity.WxRankingFlow;
import com.mybatis.entity.WxRankingFlowExample;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds;public interface WxRankingFlowMapper {int countByExample(WxRankingFlowExample example);int deleteByExample(WxRankingFlowExample example);int deleteByPrimaryKey(String rId);int insert(WxRankingFlow record);int insertSelective(WxRankingFlow record);List<WxRankingFlow> selectByExampleWithRowbounds(WxRankingFlowExample example, RowBounds rowBounds);List<WxRankingFlow> selectByExample(WxRankingFlowExample example);WxRankingFlow selectByPrimaryKey(String rId);int updateByExampleSelective(@Param("record") WxRankingFlow record, @Param("example") WxRankingFlowExample example);int updateByExample(@Param("record") WxRankingFlow record, @Param("example") WxRankingFlowExample example);int updateByPrimaryKeySelective(WxRankingFlow record);int updateByPrimaryKey(WxRankingFlow record);
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34

WxRankingFlowMapper.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.mybatis.mapper.WxRankingFlowMapper" ><resultMap id="BaseResultMap" type="com.mybatis.entity.WxRankingFlow" ><id column="r_id" property="rId" jdbcType="VARCHAR" /><result column="r_gift_date" property="rGiftDate" jdbcType="VARCHAR" /><result column="r_sid" property="rSid" jdbcType="VARCHAR" /><result column="r_card_no" property="rCardNo" jdbcType="VARCHAR" /><result column="r_card_name" property="rCardName" jdbcType="VARCHAR" /><result column="r_re_openid" property="rReOpenid" jdbcType="VARCHAR" /><result column="r_number" property="rNumber" jdbcType="INTEGER" /><result column="r_chain_code" property="rChainCode" jdbcType="VARCHAR" /><result column="r_chain_id" property="rChainId" jdbcType="VARCHAR" /><result column="r_chain_name" property="rChainName" jdbcType="VARCHAR" /><result column="r_total_amount" property="rTotalAmount" jdbcType="INTEGER" /><result column="r_total_count" property="rTotalCount" jdbcType="INTEGER" /><result column="r_praise_count" property="rPraiseCount" jdbcType="INTEGER" /><result column="r_create_time" property="rCreateTime" jdbcType="TIMESTAMP" /><result column="r_update_time" property="rUpdateTime" jdbcType="TIMESTAMP" /></resultMap><sql id="Example_Where_Clause" ><where ><foreach collection="oredCriteria" item="criteria" separator="or" ><if test="criteria.valid" ><trim prefix="(" suffix=")" prefixOverrides="and" ><foreach collection="criteria.criteria" item="criterion" ><choose ><when test="criterion.noValue" >and ${criterion.condition}</when><when test="criterion.singleValue" >and ${criterion.condition} #{criterion.value}</when><when test="criterion.betweenValue" >and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}</when><when test="criterion.listValue" >and ${criterion.condition}<foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >#{listItem}</foreach></when></choose></foreach></trim></if></foreach></where></sql><sql id="Update_By_Example_Where_Clause" ><where ><foreach collection="example.oredCriteria" item="criteria" separator="or" ><if test="criteria.valid" ><trim prefix="(" suffix=")" prefixOverrides="and" ><foreach collection="criteria.criteria" item="criterion" ><choose ><when test="criterion.noValue" >and ${criterion.condition}</when><when test="criterion.singleValue" >and ${criterion.condition} #{criterion.value}</when><when test="criterion.betweenValue" >and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}</when><when test="criterion.listValue" >and ${criterion.condition}<foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >#{listItem}</foreach></when></choose></foreach></trim></if></foreach></where></sql><sql id="Base_Column_List" >r_id, r_gift_date, r_sid, r_card_no, r_card_name, r_re_openid, r_number, r_chain_code, r_chain_id, r_chain_name, r_total_amount, r_total_count, r_praise_count, r_create_time, r_update_time</sql><select id="selectByExample" resultMap="BaseResultMap" parameterType="com.mybatis.entity.WxRankingFlowExample" >select<if test="distinct" >distinct</if><include refid="Base_Column_List" />from wx_ranking_flow<if test="_parameter != null" ><include refid="Example_Where_Clause" /></if><if test="orderByClause != null" >order by ${orderByClause}</if></select><select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >select <include refid="Base_Column_List" />from wx_ranking_flowwhere r_id = #{rId,jdbcType=VARCHAR}</select><delete id="deleteByPrimaryKey" parameterType="java.lang.String" >delete from wx_ranking_flowwhere r_id = #{rId,jdbcType=VARCHAR}</delete><delete id="deleteByExample" parameterType="com.mybatis.entity.WxRankingFlowExample" >delete from wx_ranking_flow<if test="_parameter != null" ><include refid="Example_Where_Clause" /></if></delete><insert id="insert" parameterType="com.mybatis.entity.WxRankingFlow" >insert into wx_ranking_flow (r_id, r_gift_date, r_sid, r_card_no, r_card_name, r_re_openid, r_number, r_chain_code, r_chain_id, r_chain_name, r_total_amount, r_total_count, r_praise_count, r_create_time, r_update_time)values (#{rId,jdbcType=VARCHAR}, #{rGiftDate,jdbcType=VARCHAR}, #{rSid,jdbcType=VARCHAR}, #{rCardNo,jdbcType=VARCHAR}, #{rCardName,jdbcType=VARCHAR}, #{rReOpenid,jdbcType=VARCHAR}, #{rNumber,jdbcType=INTEGER}, #{rChainCode,jdbcType=VARCHAR}, #{rChainId,jdbcType=VARCHAR}, #{rChainName,jdbcType=VARCHAR}, #{rTotalAmount,jdbcType=INTEGER}, #{rTotalCount,jdbcType=INTEGER}, #{rPraiseCount,jdbcType=INTEGER}, #{rCreateTime,jdbcType=TIMESTAMP}, #{rUpdateTime,jdbcType=TIMESTAMP})</insert><insert id="insertSelective" parameterType="com.mybatis.entity.WxRankingFlow" >insert into wx_ranking_flow<trim prefix="(" suffix=")" suffixOverrides="," ><if test="rId != null" >r_id,</if><if test="rGiftDate != null" >r_gift_date,</if><if test="rSid != null" >r_sid,</if><if test="rCardNo != null" >r_card_no,</if><if test="rCardName != null" >r_card_name,</if><if test="rReOpenid != null" >r_re_openid,</if><if test="rNumber != null" >r_number,</if><if test="rChainCode != null" >r_chain_code,</if><if test="rChainId != null" >r_chain_id,</if><if test="rChainName != null" >r_chain_name,</if><if test="rTotalAmount != null" >r_total_amount,</if><if test="rTotalCount != null" >r_total_count,</if><if test="rPraiseCount != null" >r_praise_count,</if><if test="rCreateTime != null" >r_create_time,</if><if test="rUpdateTime != null" >r_update_time,</if></trim><trim prefix="values (" suffix=")" suffixOverrides="," ><if test="rId != null" >#{rId,jdbcType=VARCHAR},</if><if test="rGiftDate != null" >#{rGiftDate,jdbcType=VARCHAR},</if><if test="rSid != null" >#{rSid,jdbcType=VARCHAR},</if><if test="rCardNo != null" >#{rCardNo,jdbcType=VARCHAR},</if><if test="rCardName != null" >#{rCardName,jdbcType=VARCHAR},</if><if test="rReOpenid != null" >#{rReOpenid,jdbcType=VARCHAR},</if><if test="rNumber != null" >#{rNumber,jdbcType=INTEGER},</if><if test="rChainCode != null" >#{rChainCode,jdbcType=VARCHAR},</if><if test="rChainId != null" >#{rChainId,jdbcType=VARCHAR},</if><if test="rChainName != null" >#{rChainName,jdbcType=VARCHAR},</if><if test="rTotalAmount != null" >#{rTotalAmount,jdbcType=INTEGER},</if><if test="rTotalCount != null" >#{rTotalCount,jdbcType=INTEGER},</if><if test="rPraiseCount != null" >#{rPraiseCount,jdbcType=INTEGER},</if><if test="rCreateTime != null" >#{rCreateTime,jdbcType=TIMESTAMP},</if><if test="rUpdateTime != null" >#{rUpdateTime,jdbcType=TIMESTAMP},</if></trim></insert><select id="countByExample" parameterType="com.mybatis.entity.WxRankingFlowExample" resultType="java.lang.Integer" >select count(*) from wx_ranking_flow<if test="_parameter != null" ><include refid="Example_Where_Clause" /></if></select><update id="updateByExampleSelective" parameterType="map" >update wx_ranking_flow<set ><if test="record.rId != null" >r_id = #{record.rId,jdbcType=VARCHAR},</if><if test="record.rGiftDate != null" >r_gift_date = #{record.rGiftDate,jdbcType=VARCHAR},</if><if test="record.rSid != null" >r_sid = #{record.rSid,jdbcType=VARCHAR},</if><if test="record.rCardNo != null" >r_card_no = #{record.rCardNo,jdbcType=VARCHAR},</if><if test="record.rCardName != null" >r_card_name = #{record.rCardName,jdbcType=VARCHAR},</if><if test="record.rReOpenid != null" >r_re_openid = #{record.rReOpenid,jdbcType=VARCHAR},</if><if test="record.rNumber != null" >r_number = #{record.rNumber,jdbcType=INTEGER},</if><if test="record.rChainCode != null" >r_chain_code = #{record.rChainCode,jdbcType=VARCHAR},</if><if test="record.rChainId != null" >r_chain_id = #{record.rChainId,jdbcType=VARCHAR},</if><if test="record.rChainName != null" >r_chain_name = #{record.rChainName,jdbcType=VARCHAR},</if><if test="record.rTotalAmount != null" >r_total_amount = #{record.rTotalAmount,jdbcType=INTEGER},</if><if test="record.rTotalCount != null" >r_total_count = #{record.rTotalCount,jdbcType=INTEGER},</if><if test="record.rPraiseCount != null" >r_praise_count = #{record.rPraiseCount,jdbcType=INTEGER},</if><if test="record.rCreateTime != null" >r_create_time = #{record.rCreateTime,jdbcType=TIMESTAMP},</if><if test="record.rUpdateTime != null" >r_update_time = #{record.rUpdateTime,jdbcType=TIMESTAMP},</if></set><if test="_parameter != null" ><include refid="Update_By_Example_Where_Clause" /></if></update><update id="updateByExample" parameterType="map" >update wx_ranking_flowset r_id = #{record.rId,jdbcType=VARCHAR},r_gift_date = #{record.rGiftDate,jdbcType=VARCHAR},r_sid = #{record.rSid,jdbcType=VARCHAR},r_card_no = #{record.rCardNo,jdbcType=VARCHAR},r_card_name = #{record.rCardName,jdbcType=VARCHAR},r_re_openid = #{record.rReOpenid,jdbcType=VARCHAR},r_number = #{record.rNumber,jdbcType=INTEGER},r_chain_code = #{record.rChainCode,jdbcType=VARCHAR},r_chain_id = #{record.rChainId,jdbcType=VARCHAR},r_chain_name = #{record.rChainName,jdbcType=VARCHAR},r_total_amount = #{record.rTotalAmount,jdbcType=INTEGER},r_total_count = #{record.rTotalCount,jdbcType=INTEGER},r_praise_count = #{record.rPraiseCount,jdbcType=INTEGER},r_create_time = #{record.rCreateTime,jdbcType=TIMESTAMP},r_update_time = #{record.rUpdateTime,jdbcType=TIMESTAMP}<if test="_parameter != null" ><include refid="Update_By_Example_Where_Clause" /></if></update><update id="updateByPrimaryKeySelective" parameterType="com.mybatis.entity.WxRankingFlow" >update wx_ranking_flow<set ><if test="rGiftDate != null" >r_gift_date = #{rGiftDate,jdbcType=VARCHAR},</if><if test="rSid != null" >r_sid = #{rSid,jdbcType=VARCHAR},</if><if test="rCardNo != null" >r_card_no = #{rCardNo,jdbcType=VARCHAR},</if><if test="rCardName != null" >r_card_name = #{rCardName,jdbcType=VARCHAR},</if><if test="rReOpenid != null" >r_re_openid = #{rReOpenid,jdbcType=VARCHAR},</if><if test="rNumber != null" >r_number = #{rNumber,jdbcType=INTEGER},</if><if test="rChainCode != null" >r_chain_code = #{rChainCode,jdbcType=VARCHAR},</if><if test="rChainId != null" >r_chain_id = #{rChainId,jdbcType=VARCHAR},</if><if test="rChainName != null" >r_chain_name = #{rChainName,jdbcType=VARCHAR},</if><if test="rTotalAmount != null" >r_total_amount = #{rTotalAmount,jdbcType=INTEGER},</if><if test="rTotalCount != null" >r_total_count = #{rTotalCount,jdbcType=INTEGER},</if><if test="rPraiseCount != null" >r_praise_count = #{rPraiseCount,jdbcType=INTEGER},</if><if test="rCreateTime != null" >r_create_time = #{rCreateTime,jdbcType=TIMESTAMP},</if><if test="rUpdateTime != null" >r_update_time = #{rUpdateTime,jdbcType=TIMESTAMP},</if></set>where r_id = #{rId,jdbcType=VARCHAR}</update><update id="updateByPrimaryKey" parameterType="com.mybatis.entity.WxRankingFlow" >update wx_ranking_flowset r_gift_date = #{rGiftDate,jdbcType=VARCHAR},r_sid = #{rSid,jdbcType=VARCHAR},r_card_no = #{rCardNo,jdbcType=VARCHAR},r_card_name = #{rCardName,jdbcType=VARCHAR},r_re_openid = #{rReOpenid,jdbcType=VARCHAR},r_number = #{rNumber,jdbcType=INTEGER},r_chain_code = #{rChainCode,jdbcType=VARCHAR},r_chain_id = #{rChainId,jdbcType=VARCHAR},r_chain_name = #{rChainName,jdbcType=VARCHAR},r_total_amount = #{rTotalAmount,jdbcType=INTEGER},r_total_count = #{rTotalCount,jdbcType=INTEGER},r_praise_count = #{rPraiseCount,jdbcType=INTEGER},r_create_time = #{rCreateTime,jdbcType=TIMESTAMP},r_update_time = #{rUpdateTime,jdbcType=TIMESTAMP}where r_id = #{rId,jdbcType=VARCHAR}</update><select resultMap="BaseResultMap" parameterType="com.mybatis.entity.WxRankingFlowExample" id="selectByExampleWithRowbounds" >select<if test="distinct" >distinct</if><include refid="Base_Column_List" />from wx_ranking_flow<if test="_parameter != null" ><include refid="Example_Where_Clause" /></if><if test="orderByClause != null" >order by ${orderByClause}</if></select>
</mapper
MAC 系统和Windows 系统注意路径问题 。Windows是:\  MAC是:/

这篇关于mybatis mybatis-generator 代码自动生成工具的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



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

相关文章

Linux中压缩、网络传输与系统监控工具的使用完整指南

《Linux中压缩、网络传输与系统监控工具的使用完整指南》在Linux系统管理中,压缩与传输工具是数据备份和远程协作的桥梁,而系统监控工具则是保障服务器稳定运行的眼睛,下面小编就来和大家详细介绍一下它... 目录引言一、压缩与解压:数据存储与传输的优化核心1. zip/unzip:通用压缩格式的便捷操作2.

Java中调用数据库存储过程的示例代码

《Java中调用数据库存储过程的示例代码》本文介绍Java通过JDBC调用数据库存储过程的方法,涵盖参数类型、执行步骤及数据库差异,需注意异常处理与资源管理,以优化性能并实现复杂业务逻辑,感兴趣的朋友... 目录一、存储过程概述二、Java调用存储过程的基本javascript步骤三、Java调用存储过程示

Visual Studio 2022 编译C++20代码的图文步骤

《VisualStudio2022编译C++20代码的图文步骤》在VisualStudio中启用C++20import功能,需设置语言标准为ISOC++20,开启扫描源查找模块依赖及实验性标... 默认创建Visual Studio桌面控制台项目代码包含C++20的import方法。右键项目的属性:

浏览器插件cursor实现自动注册、续杯的详细过程

《浏览器插件cursor实现自动注册、续杯的详细过程》Cursor简易注册助手脚本通过自动化邮箱填写和验证码获取流程,大大简化了Cursor的注册过程,它不仅提高了注册效率,还通过友好的用户界面和详细... 目录前言功能概述使用方法安装脚本使用流程邮箱输入页面验证码页面实战演示技术实现核心功能实现1. 随机

sqlite3 命令行工具使用指南

《sqlite3命令行工具使用指南》本文系统介绍sqlite3CLI的启动、数据库操作、元数据查询、数据导入导出及输出格式化命令,涵盖文件管理、备份恢复、性能统计等实用功能,并说明命令分类、SQL语... 目录一、启动与退出二、数据库与文件操作三、元数据查询四、数据操作与导入导出五、查询输出格式化六、实用功

MySQL数据库的内嵌函数和联合查询实例代码

《MySQL数据库的内嵌函数和联合查询实例代码》联合查询是一种将多个查询结果组合在一起的方法,通常使用UNION、UNIONALL、INTERSECT和EXCEPT关键字,下面:本文主要介绍MyS... 目录一.数据库的内嵌函数1.1聚合函数COUNT([DISTINCT] expr)SUM([DISTIN

Java实现自定义table宽高的示例代码

《Java实现自定义table宽高的示例代码》在桌面应用、管理系统乃至报表工具中,表格(JTable)作为最常用的数据展示组件,不仅承载对数据的增删改查,还需要配合布局与视觉需求,而JavaSwing... 目录一、项目背景详细介绍二、项目需求详细介绍三、相关技术详细介绍四、实现思路详细介绍五、完整实现代码

Go语言代码格式化的技巧分享

《Go语言代码格式化的技巧分享》在Go语言的开发过程中,代码格式化是一个看似细微却至关重要的环节,良好的代码格式化不仅能提升代码的可读性,还能促进团队协作,减少因代码风格差异引发的问题,Go在代码格式... 目录一、Go 语言代码格式化的重要性二、Go 语言代码格式化工具:gofmt 与 go fmt(一)

HTML5实现的移动端购物车自动结算功能示例代码

《HTML5实现的移动端购物车自动结算功能示例代码》本文介绍HTML5实现移动端购物车自动结算,通过WebStorage、事件监听、DOM操作等技术,确保实时更新与数据同步,优化性能及无障碍性,提升用... 目录1. 移动端购物车自动结算概述2. 数据存储与状态保存机制2.1 浏览器端的数据存储方式2.1.

基于 HTML5 Canvas 实现图片旋转与下载功能(完整代码展示)

《基于HTML5Canvas实现图片旋转与下载功能(完整代码展示)》本文将深入剖析一段基于HTML5Canvas的代码,该代码实现了图片的旋转(90度和180度)以及旋转后图片的下载... 目录一、引言二、html 结构分析三、css 样式分析四、JavaScript 功能实现一、引言在 Web 开发中,