Mybatis的参数传递、动态SQL、缓存、逆向工程

参数的传递

1、一个普通数据类型

推荐使用#{变量名}(优先) 或 #{value}


方法:
	public User queryUserById(int id);

在xml中传递参数值的使用方法:
<!-- 	public User queryUserById(int id); -->
	<select id="queryUserById" resultType="com.ddh.pojo.User">
		select `id`,`last_name` lastName,`sex` from t_user where id = #{id}
	</select>

2、多个普通数据类型

在方法的参数是多个普通数据类型的情况,传递的参数的方式是使用#{ param1 }、#{param2} ……

第一个参数使用#{param1}传递
第二个参数使用#{param2}传递
第三个参数使用#{param3}传递	
……
第N个,参数使用#{paramN}传递

代码方法是:
	public List<User> queryUsersByNameAndSex(String name, int sex);

在xml中传递参数值的使用方法:
<!-- 	public List<User> queryUsersByNameAndSex(String name, int sex); -->
	<select id="queryUsersByNameAndSex" resultType="com.ddh.pojo.User">
		select `id`,`last_name` lastName,`sex` from t_user where last_name like #{param1} and sex = #{param2}
	</select>

3、@Param注解命名参数

代码中:
	public List<User> queryUsersByNameAndSex(@Param("name") String name,
			@Param("sex") int sex);

在xml中传递参数如下:
	<select id="queryUsersByNameAndSex" resultType="com.ddh.pojo.User">
		select `id`,`last_name` lastName,`sex` from t_user where last_name like #{name} and sex = #{sex}
	</select>

4、传递一个Map对象作为参数

当代码中以map做为参数值传递。
			Map<String, Object>param = new HashMap<String, Object>();
			param.put("name", "%bbb%");
		param.put("sex", 1);
那么在xml中配置的时候,以#{mapKey}的方式输出参数值。

代码:
	public List<User> queryUsersByMap(Map<String, Object> param);


xml中如何输入map中参数的值:
<!-- 	public List<User> queryUsersByMap(Map<String, Object> param);  -->
	<select id="queryUsersByMap" resultType="com.ddh.pojo.User">
		select `id`,`last_name` lastName,`sex` from t_user where last_name like #{name} and sex = #{sex}
	</select>

5、一个Pojo数据类型

如果传入的参数是pojo数据类型(javaBean对象)。那么在xml中使用#{属性名}

代码中:
	public List<User> queryUsersByUser(User user);

在xml配置文件中:
<!-- 		public List<User> queryUsersByUser(User user); -->
	<select id="queryUsersByUser" resultType="com.ddh.pojo.User">
		select `id`,`last_name` lastName,`sex` from t_user where last_name like #{lastName} and sex = #{sex}
	</select>

6、多个Pojo数据类型

如果参数是传入多个pojo对象。
第一个pojo对象,使用 param1表示
要输出第一个pojo对象的属性#{ param1.property }
第二个pojo对象,使用param2表示
要输出第一个pojo对象的属性#{ param2.property }

代码:
	public List<User> queryUsersByUsers(User name, User sex);

在xml中的配置是:

<!-- 		public List<User> queryUsersByUsers(User name, User sex); -->
	<select id="queryUsersByUsers" resultType="com.ddh.pojo.User">
		select `id`,`last_name` lastName,`sex` from t_user where last_name like #{param1.lastName} and sex = #{param2.sex}
	</select>

7、模糊查询

需求:现在要根据用户名查询用户对象。 
查询如下:	select * from t_user where user_name like '%张%'

8、#{}和${}的区别

#{}	是占位符 ?
xml中的配置:
select `id`,`last_name` lastName,`sex` from t_user where last_name like #{name} 
解析后的sql语句是:
select `id`,`last_name` lastName,`sex` from t_user where last_name like ? 

${}	是原样输出参数的值。然后做字符串的拼接操作。
xml中的配置:
select `id`,`last_name` lastName,`sex` from t_user where last_name like '${name}'  
解析后的sql语句是:																			
select `id`,`last_name` lastName,`sex` from t_user where last_name like '%bbbb%' 

9、MySQL的字符串拼接,concat函数实现

代码中:
	public List<User> queryUsersByName(@Param("name")String name);

xml中的配置推荐:
	<select id="queryUsersByName" resultType="com.ddh.pojo.User">
		select `id`,`last_name` lastName,`sex` from t_user where last_name like concat('%',#{name},'%') 
	</select>

动态SQL语句

1、if 语句

准备工作:

public class User {
	private int id;
	private String lastName;
	private int sex;

说明:	if语句,可以动态的根据你的值来决定,是否需要动态的添加查询条件。

代码:
public List<User> queryUsersByNameAndSex(String name, int sex);

配置:
<!-- 	public List<User> queryUsersByNameAndSex(String name, int sex);	 -->
	<select id="queryUsersByNameAndSex" resultType="com.ddh.pojo.User">
		select id,last_name lastName,sex from t_user 
		where 
		<if test="param1 != null">
			last_name like concat('%',#{param1},'%')
		</if>
		<if test="param2 == 1 || param2 == 0">
		 	and sex = #{param2}
		</if>
	</select>


测试:
	@Test
	public void testQueryUsersByNameAndSex() throws Exception {
		SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder()
				.build(Resources.getResourceAsStream("mybatis-config.xml"));

		SqlSession session = sqlSessionFactory.openSession();
		try {
			UserMapper userMapper = session.getMapper(UserMapper.class);
			// name的值,如果等于null ,这个时候会出现问题。
			// sex 性别 。1是男,0是女	如果出现0或1之外的值。也是非法值。
			System.out.println( userMapper.queryUsersByNameAndSex("bbb", 10) );
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			session.close();
		}
	}


2、where 语句

说明:	where语句,可以帮我们在多个动态语句中,有效的去掉前面的多余的and  或 or 之类的多余关键字
where标签,还只可以动态的判断中间是否包含查询条件。如果没有连where关键字也不会出现。


	<select id="queryUsersByNameAndSex" resultType="com.ddh.pojo.User">
		select id,last_name lastName,sex from t_user 
		<where>
			<if test="param1 != null">
				last_name like concat('%',#{param1},'%')
			</if>
			<if test="param2 == 1 || param2 == 0">
			 	and sex = #{param2}
			</if>
		</where> 
	</select>

3、trim语句

	说明:	trim 可以动态在包含的语句前面和后面添加内容。也可以去掉前面或者后面给定的内容
				prefix 前面添加内容
				suffix 后面添加内容
				suffixOverrides 去掉的后面内容
				prefixOverrides 去掉的前面内容


	<select id="queryUsersByNameAndSexTrim" resultType="com.ddh.pojo.User">
		select id,last_name lastName,sex from t_user 
		<where>
			<!-- 
				prefix 前面添加内容
				suffix 后面添加内容
				suffixOverrides 去掉的后面内容
				prefixOverrides 去掉的前面内容
			 -->
			<trim prefixOverrides="and" suffixOverrides="and">
				<if test="param1 != null">
					last_name like concat('%',#{param1},'%') and
				</if>
				<if test="param2 == 1 || param2 == 0">
				 	sex = #{param2}
				</if>
			</trim>
		</where> 
	</select>

4、choose( when , otherwise )语句

说明:choose when otherwise 可以执行多路选择判断,但是只会有一个分支会被执行。
类似switch case 语句


方法代码:
	public List<User> queryUsersByNameAndSexChoose(String name, int sex);

xml中的配置:
	<select id="queryUsersByNameAndSexChoose" resultType="com.ddh.pojo.User">
		select id,last_name lastName,sex from t_user 
		<where>	
			<!-- 我们希望,如果name的值非空,只查询name
				如果name的值非法,而sex的值合法。只查询sex
				如果两个都不合法,都不要(或者你可以自己加一些查询条件)
			 -->
			 <choose>
			 	<when test="param1 != null">
			 		last_name like concat('%',#{param1},'%')
			 	</when>
			 	<when test="param2 == 1 || param2 == 0">
			 		sex = #{param2}
			 	</when>
			 	<otherwise>
			 		sex = 0
			 	</otherwise>
			 </choose>
		</where> 
	</select>


测试代码:
	@Test
	public void testQueryUsersByNameAndSexChoose() throws Exception {
		SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder()
		.build(Resources.getResourceAsStream("mybatis-config.xml"));
		
		SqlSession session = sqlSessionFactory.openSession();
		try {
			UserMapper userMapper = session.getMapper(UserMapper.class);
			// name的值,如果等于null ,这个时候会出现问题。
			// sex 性别 。1是男,0是女	如果出现0或1之外的值。也是非法值。
			System.out.println( userMapper.queryUsersByNameAndSexChoose(null, 1) );
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			session.close();
		}
	}

5、set语句

删除条件后的逗号
代码:
	public int updateUser(User user);
	
xml中的配置:
	<update id="updateUser" parameterType="com.ddh.pojo.User">
		update t_user 
		<set>
			last_name = #{lastName} ,
			<!-- 我们希望可以动态的判断,如果sex非法,不更新sex的值。 -->
			<if test="sex == 1 || sex == 0">
				sex = #{sex}
			</if> 
		</set> 
		where id = #{id}
	</update>

测试的代码:
	@Test
	public void testUpdateUser() throws Exception {
		SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder()
		.build(Resources.getResourceAsStream("mybatis-config.xml"));
		
		SqlSession session = sqlSessionFactory.openSession();
		try {
			UserMapper userMapper = session.getMapper(UserMapper.class);
			// name的值,如果等于null ,这个时候会出现问题。
			// sex 性别 。1是男,0是女	如果出现0或1之外的值。也是非法值。
			userMapper.updateUser(new User(5, "bbb", 10));
session.commit();
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			session.close();
		}
	}

6、foreach语句

代码:
	/**
	 * select * from t_user where id in(1,2,3,4,5)
	 */
	public List<User> queryUsersByIds(List<Integer> ids);

xml中的配置:
<!-- 	public List<User> queryUsersByIds(List<Integer> ids); -->
	<select id="queryUsersByIds" resultType="com.ddh.pojo.User">
		select id,last_name lastName,sex from t_user 
		<where>
			id in 
			<!-- 
				foreach标签用来遍历集合
					collection遍历的数据源
					open属性设置遍历的开始内容
					close属性设置遍历的结束内容
					item属性是当前遍历到的数据
					separator属性设置遍历的每个元素之间的间隔符
			 -->
			<foreach collection="list" open="(" close=")" item="i" separator=",">
				#{i}
			</foreach>
		</where>
	</select>

测试代码:

	@Test
	public void testQueryUsersByIds() throws Exception {
		SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder()
		.build(Resources.getResourceAsStream("mybatis-config.xml"));
		
		SqlSession session = sqlSessionFactory.openSession();
		try {
			UserMapper userMapper = session.getMapper(UserMapper.class);
			List<Integer> ids = new ArrayList<Integer>();
			ids.add(1);
			ids.add(2);
			ids.add(5);
			ids.add(6);
			System.out.println( userMapper.queryUsersByIds( ids ) );
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			session.close();
		}
	}

mybatis缓存

缓存:缓存指的是将经常访问的数据保存到一个高速的数据存储区。缓存的目的就是为了快速访问
一级缓存:	指的是将数据保存一以SqlSession中(同一个SqlSession)		内存上
二级缓存:	指的是将数据保存到mapper中(同一个sqlSessionFactory)	磁盘上

准备一个UserMapper
public interface UserMapper {
	public User queryUserById(int id);
	public int updateUser(User user);
}

UserMapper.xml中的配置:
<mapper namespace="com.ddh.dao.UserMapper">
<!-- 	public User queryUserById(int id); -->
	<select id="queryUserById" resultType="com.ddh.pojo.User">
		select id,last_name lastName,sex from t_user where id = #{id}
	</select>
	
<!-- 	public User updateUser(User user); -->
	<update id="updateUser" parameterType="com.ddh.pojo.User" >
		update t_user set last_name = #{lastName},sex = #{sex} where id = #{id}
	</update>
</mapper>

1、mybatis的一级缓存的示例

@Test
	public void testQueryUserById() throws Exception {
		SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder()
				.build(Resources.getResourceAsStream("mybatis-config.xml"));
		SqlSession session = sqlSessionFactory.openSession();

		UserMapper mapper = session.getMapper(UserMapper.class);
		User user = mapper.queryUserById(1);
		System.out.println(user);
		user = mapper.queryUserById(1);
		System.out.println(user);
		session.close();
	}

一级缓存的管理
缓存失效的四种情况:
1.不在同一个SqlSession对象中
	// 1.不在同一个SqlSession对象中
	@Test
	public void testQueryUserByIdFail1() throws Exception {
		SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder()
				.build(Resources.getResourceAsStream("mybatis-config.xml"));
		SqlSession session = sqlSessionFactory.openSession();
		UserMapper mapper = session.getMapper(UserMapper.class);
		User user = mapper.queryUserById(1);
		System.out.println(user);
		session.close();

		SqlSession session2 = sqlSessionFactory.openSession();
		UserMapper userMapper2 = session2.getMapper(UserMapper.class);
		User user2 = userMapper2.queryUserById(1);
		System.out.println(user2);
		session2.close();
	}


2.执行语句的参数不同。缓存中也不存在数据。
	// 2.执行语句的参数不同。缓存中也不存在数据。
	public void testQueryUserByIdFail2() throws Exception {
		SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder()
				.build(Resources.getResourceAsStream("mybatis-config.xml"));
		SqlSession session = sqlSessionFactory.openSession();

		UserMapper mapper = session.getMapper(UserMapper.class);
		User user = mapper.queryUserById(1);
		System.out.println(user);
		user = mapper.queryUserById(2);
		System.out.println(user);
		session.close();
	}


3.执行增,删,改,语句,会清空缓存
	@Test
	// 3.执行增,删,改,语句,会清空缓存
	public void testQueryUserByIdFail3() throws Exception {
		SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder()
				.build(Resources.getResourceAsStream("mybatis-config.xml"));
		SqlSession session = sqlSessionFactory.openSession();

		UserMapper mapper = session.getMapper(UserMapper.class);
		User user = mapper.queryUserById(1);
		System.out.println(user);
		
		mapper.updateUser(new User(5, "cccc", 1));
		session.commit();
		
		///
		user = mapper.queryUserById(1);
		System.out.println(user);
		session.close();
	}


4.手动清空缓存数据
	@Test
	// 4.手动清空缓存数据
	public void testQueryUserByIdFail4() throws Exception {
		SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder()
				.build(Resources.getResourceAsStream("mybatis-config.xml"));
		SqlSession session = sqlSessionFactory.openSession();

		UserMapper mapper = session.getMapper(UserMapper.class);
		User user = mapper.queryUserById(1);
		System.out.println(user);
		session.clearCache();
		user = mapper.queryUserById(1);
		System.out.println(user);
		session.close();
	}

2、mybatis的二级缓存

二级缓存的使用:
myBatis的二级缓存默认是不开启的。我们需要在mybatis的核心配置文件中配置setting选项 和 在Mapper的配置文件中加入cache标签。并且需要被二级缓存的对象必须要实现java的序列化接口。

二级缓存的使用步骤:
1、在mybatis-config.xml中配置选项
	<settings>
		<!-- 开启二级缓存 -->
		<setting name="cacheEnabled" value="true"/>
	</settings>
2、在Mapper.xml中去添加一个cache标签
3、对象必须要实现java的序列化接口。implements Serializable
 
二级缓存的演示
@Test
	public void testCacheLevel2() throws IOException {
		SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder()
				.build(Resources.getResourceAsStream("mybatis-config.xml"));
		SqlSession session = sqlSessionFactory.openSession();
		UserMapper mapper = session.getMapper(UserMapper.class);
		User user = mapper.queryUserById(1);
		System.out.println(user);
		session.close();

		SqlSession session2 = sqlSessionFactory.openSession();
		UserMapper userMapper2 = session2.getMapper(UserMapper.class);
		User user2 = userMapper2.queryUserById(1);
		System.out.println(user2);
		session2.close();
	}

缓存的使用顺序说明:
1、当我们执行一个查询语句的时候。mybatis会先去二级缓存中查询数据。如果二级缓存中没有。就到一级缓存中查找。
2、如果二级缓存和一级缓存都没有。就发sql语句到数据库中去查询。
3、查询出来之后马上把数据保存到一级缓存中。
4、当SqlSession关闭的时候,会把一级缓存中的数据保存到二级缓存中。

mybatis 逆向工程

1、准备工作

MyBatis逆向工程,简称MBG。是一个专门为MyBatis框架使用者定制的代码生成器。可以快速的根据表生成对应的映射文件,接口,以及Bean类对象。
在Mybatis中,有一个可以自动对单表生成的增,删,改,查代码的插件。
叫 mybatis-generator-core-1.3.2。

它可以帮我们对比数据库表之后,生成大量的这个基础代码。
这些基础代码有:
1、数据库表对应的javaBean对象
2、这些javaBean对象对应的Mapper接口
3、这些Mapper接口对应的配置文件

  	<!-- 去掉全部的注释 -->
	<commentGenerator>
        <property name="suppressAllComments" value="true" />
    </commentGenerator>

创建一个Java工程
log4j-1.2.17.jar
mybatis-3.4.1.jar
mybatis-generator-core-1.3.2.jar
mysql-connector-java-5.1.7-bin.jar

生成代码:
public class Runner {

	public static void main(String[] args) throws Exception {
		List<String> warnings = new ArrayList<String>();
		boolean overwrite = true;
		File configFile = new File("mbg.xml");
		ConfigurationParser cp = new ConfigurationParser(warnings);
		Configuration config = cp.parseConfiguration(configFile);
		DefaultShellCallback callback = new DefaultShellCallback(overwrite);
		MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config,
				callback, warnings);
		myBatisGenerator.generate(null);
	}
}

2、准备数据库表

drop database if exists mbg;
create database mbg;
use mbg;
create table t_user(
	`id` int primary key auto_increment,
	`username` varchar(30) not null unique,
	`password` varchar(40) not null,
	`email` varchar(50)
);

insert into t_user(`username`,`password`,`email`) values('admin','admin','admin@ddh.com');
insert into t_user(`username`,`password`,`email`) values('wzg168','123456','admin@ddh.com');
insert into t_user(`username`,`password`,`email`) values('admin168','123456','admin@ddh.com');
insert into t_user(`username`,`password`,`email`) values('lisi','123456','admin@ddh.com');
insert into t_user(`username`,`password`,`email`) values('wangwu','123456','admin@ddh.com');

create table t_book(
	`id` int primary key auto_increment,
	`name` varchar(50),
	`author` varchar(50),
	`price`	decimal(11,2),
	`sales`	int,
	`stock` int
);


## 插入初始化测试数据
insert into t_book(`id` , `name` , `author` , `price` , `sales` , `stock` ) 
values(null , 'java' , '高斯林' , 80 , 9999 , 9);

insert into t_book(`id` , `name` , `author` , `price` , `sales` , `stock` ) 
values(null , '数据结构' , '张三' , 78.5 , 6 , 13);

insert into t_book(`id` , `name` , `author` , `price` , `sales` , `stock` ) 
values(null , '如何获取富婆青睐' , '博主' , 68, 99999 , 52);

insert into t_book(`id` , `name` , `author` , `price` , `sales` , `stock` ) 
values(null , '青椒炒肉' , '张四' , 16, 1000 , 50);

insert into t_book(`id` , `name` , `author` , `price` , `sales` , `stock` ) 
values(null , '爆照鸡丁' , '张五' , 45.5 , 14 , 95);

insert into t_book(`id` , `name` , `author` , `price` , `sales` , `stock` ) 
values(null , '蛋炒番茄' , '张六' , 9.9, 12 , 53);
 
insert into t_book(`id` , `name` , `author` , `price` , `sales` , `stock` ) 
values(null , '问就是菜鸟' , '张七' , 66.5, 125 , 535);

select * from t_user;
select * from t_book;

导入下面的包:
log4j-1.2.17.jar
mybatis-3.2.8.jar
mybatis-generator-core-1.3.2.jar
mysql-connector-java-5.1.7-bin.jar


在src目录下准备log4j.properties配置文件
# Global logging configuration
log4j.rootLogger=DEBUG, stdout
# MyBatis logging configuration...
#log4j.logger.org.mybatis.example.BlogMapper=TRACE
# Console output...
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n

3、准备 mybatis-generator-core 的配置文件

<?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>
   <!-- 
   		targetRuntime 属性设置生成的代码是什么样的版本
   			MyBatis3Simple 	表示带有单表的简单的增,删,改,查
   			MyBatis3		表示带有单表的增,删,改,查,之外,还有类似Hiberante 的 QBC复杂查询
    -->
  <context id="DB2Tables" targetRuntime="MyBatis3">
  	<!-- 去掉全部的注释 -->
	<commentGenerator>
        <property name="suppressAllComments" value="true" />
    </commentGenerator>
  	<!-- 
  		jdbcConnection 为数据库连接的四要素信息。
  		请修改成为你自己的内容
  	 -->
    <jdbcConnection driverClass="com.mysql.jdbc.Driver"
        connectionURL="jdbc:mysql://localhost:3306/mbg"
        userId="root"
        password="root">
    </jdbcConnection>

    <javaTypeResolver >
      <property name="forceBigDecimals" value="false" />
    </javaTypeResolver>

	<!-- 
		javaModelGenerator 生成表对应的javaBean
		targetPackage 属性设置生成的类的包名
		targetProject 属性设置生成的工程的路径    一般生成为当前工程。写为 .\
	 -->
    <javaModelGenerator targetPackage="com.ddh.bean" targetProject=".\src">
      <property name="enableSubPackages" value="true" />
      <property name="trimStrings" value="true" />
    </javaModelGenerator>
	<!-- 
		sqlMapGenerator 生成表对应的sql的xml配置文件
		targetPackage 属性设置生成的sql配置文件的包名
		targetProject 属性设置生成的工程的路径    一般生成为当前工程。写为 .\		
	 -->
    <sqlMapGenerator targetPackage="com.ddh.mapper"  targetProject=".\src">
      <property name="enableSubPackages" value="true" />
    </sqlMapGenerator>
	
	<!-- 
		javaClientGenerator 生成mybatis客户端的代码 ===dao或mapper之类
		targetPackage 属性设置生成的mybatis的调用代码,比如mapper之类的接口
		targetProject 属性设置生成的工程的路径    一般生成为当前工程。写为 .\	
	 -->
    <javaClientGenerator type="XMLMAPPER" targetPackage="com.ddh.mapper"  targetProject=".\src">
      <property name="enableSubPackages" value="true" />
    </javaClientGenerator>
	
	<!-- 
		table 配置哪些表需要我们映射生成java代码
			tableName 			是表名
			domainObjectName	是javaBean名
	 -->
	<table tableName="t_user" domainObjectName="User"></table>
	<table tableName="t_book" domainObjectName="Book"></table>
  </context>
</generatorConfiguration>

4、用于生成的java代码

public static void main(String[] args) throws Exception, Exception {
		List<String> warnings = new ArrayList<String>();
		boolean overwrite = true;
		// 配置文件的名称		mbg_config.xml
		File configFile = new File("mbg_config.xml");
		ConfigurationParser cp = new ConfigurationParser(warnings);
		Configuration config = cp.parseConfiguration(configFile);
		DefaultShellCallback callback = new DefaultShellCallback(overwrite);
		MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, callback, warnings);
		myBatisGenerator.generate(null);
	}

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Java开发-斗灵

客官打个赏呗

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值