新建一个项目,将逆向工程的生成的拷贝进来
配置文件
log4j.properties
### \u914D\u7F6E\u6839 ###
log4j.rootLogger = debug,console ,fileAppender,dailyRollingFile,ROLLING_FILE,MAIL,DATABASE
### \u8BBE\u7F6E\u8F93\u51FAsql\u7684\u7EA7\u522B\uFF0C\u5176\u4E2Dlogger\u540E\u9762\u7684\u5185\u5BB9\u5168\u90E8\u4E3Ajar\u5305\u4E2D\u6240\u5305\u542B\u7684\u5305\u540D ###
log4j.logger.org.apache=dubug
log4j.logger.java.sql.Connection=dubug
log4j.logger.java.sql.Statement=dubug
log4j.logger.java.sql.PreparedStatement=dubug
log4j.logger.java.sql.ResultSet=dubug
### \u914D\u7F6E\u8F93\u51FA\u5230\u63A7\u5236\u53F0 ###
log4j.appender.console = org.apache.log4j.ConsoleAppender
log4j.appender.console.Target = System.out
log4j.appender.console.layout = org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern = %d{ABSOLUTE} %5p %c{1}:%L - %m%n
mybatis-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<settings>
<setting name="useGeneratedKeys" value="true"/>
</settings>
<typeAliases>
<typeAlias type="com.geyao.mybatis.pojo.Blog" alias="Blog"/>
</typeAliases>
<environments default="development">
<environment id="development">
<transactionManager type="JDBC" />
<!-- 配置数据库连接信息 -->
<dataSource type="POOLED">
<property name="driver" value="com.mysql.cj.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost:3306/blog_gp1701?serverTimezone=GMT%2B8" />
<property name="username" value="root" />
<property name="password" value="123" />
</dataSource>
</environment>
</environments>
<mappers>
<!-- 注册userMapper.xml文件,
userMapper.xml位于me.gacl.mapping这个包下,所以resource写成me/gacl/mapping/userMapper.xml-->
<mapper resource="com/geyao/mybatis/mapper/BlogMapper.xml"/>
</mappers>
</configuration>
com.geyao.mybatis.mapper
BlogMapper.java
package com.geyao.mybatis.mapper;
import com.geyao.mybatis.pojo.Blog;
import com.geyao.mybatis.pojo.BlogExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface BlogMapper {
int countByExample(BlogExample example);
int deleteByExample(BlogExample example);
int insert(Blog record);
int insertSelective(Blog record);
List<Blog> selectByExample(BlogExample example);
int updateByExampleSelective(@Param("record") Blog record, @Param("example") BlogExample example);
int updateByExample(@Param("record") Blog record, @Param("example") BlogExample example);
}
BlogMapper.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.geyao.mybatis.mapper.BlogMapper" >
<resultMap id="BaseResultMap" type="com.geyao.mybatis.pojo.Blog" >
<result column="id" property="id" jdbcType="INTEGER" />
<result column="title" property="title" jdbcType="VARCHAR" />
<result column="authod_id" property="authodId" jdbcType="INTEGER" />
<result column="state" property="state" jdbcType="VARCHAR" />
<result column="featured" property="featured" jdbcType="TINYINT" />
<result column="style" property="style" jdbcType="VARCHAR" />
</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" >
id, title, authod_id, state, featured, style
</sql>
<select id="selectByExample" resultMap="BaseResultMap" parameterType="com.geyao.mybatis.pojo.BlogExample" >
select
<if test="distinct" >
distinct
</if>
<include refid="Base_Column_List" />
from blog
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null" >
order by ${orderByClause}
</if>
</select>
<delete id="deleteByExample" parameterType="com.geyao.mybatis.pojo.BlogExample" >
delete from blog
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.geyao.mybatis.pojo.Blog" >
insert into blog (id, title, authod_id,
state, featured, style
)
values (#{id,jdbcType=INTEGER}, #{title,jdbcType=VARCHAR}, #{authodId,jdbcType=INTEGER},
#{state,jdbcType=VARCHAR}, #{featured,jdbcType=TINYINT}, #{style,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="com.geyao.mybatis.pojo.Blog" >
insert into blog
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="title != null" >
title,
</if>
<if test="authodId != null" >
authod_id,
</if>
<if test="state != null" >
state,
</if>
<if test="featured != null" >
featured,
</if>
<if test="style != null" >
style,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=INTEGER},
</if>
<if test="title != null" >
#{title,jdbcType=VARCHAR},
</if>
<if test="authodId != null" >
#{authodId,jdbcType=INTEGER},
</if>
<if test="state != null" >
#{state,jdbcType=VARCHAR},
</if>
<if test="featured != null" >
#{featured,jdbcType=TINYINT},
</if>
<if test="style != null" >
#{style,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.geyao.mybatis.pojo.BlogExample" resultType="java.lang.Integer" >
select count(*) from blog
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map" >
update blog
<set >
<if test="record.id != null" >
id = #{record.id,jdbcType=INTEGER},
</if>
<if test="record.title != null" >
title = #{record.title,jdbcType=VARCHAR},
</if>
<if test="record.authodId != null" >
authod_id = #{record.authodId,jdbcType=INTEGER},
</if>
<if test="record.state != null" >
state = #{record.state,jdbcType=VARCHAR},
</if>
<if test="record.featured != null" >
featured = #{record.featured,jdbcType=TINYINT},
</if>
<if test="record.style != null" >
style = #{record.style,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null" >
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map" >
update blog
set id = #{record.id,jdbcType=INTEGER},
title = #{record.title,jdbcType=VARCHAR},
authod_id = #{record.authodId,jdbcType=INTEGER},
state = #{record.state,jdbcType=VARCHAR},
featured = #{record.featured,jdbcType=TINYINT},
style = #{record.style,jdbcType=VARCHAR}
<if test="_parameter != null" >
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
</mapper>
com.geyao.mybatis.pojo
Blog
package com.geyao.mybatis.pojo;
public class Blog {
private Integer id;
private String title;
private Integer authodId;
private String state;
private Byte featured;
private String style;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title == null ? null : title.trim();
}
public Integer getAuthodId() {
return authodId;
}
public void setAuthodId(Integer authodId) {
this.authodId = authodId;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state == null ? null : state.trim();
}
public Byte getFeatured() {
return featured;
}
public void setFeatured(Byte featured) {
this.featured = featured;
}
public String getStyle() {
return style;
}
public void setStyle(String style) {
this.style = style == null ? null : style.trim();
}
}
BlogExample
package com.geyao.mybatis.pojo;
import java.util.ArrayList;
import java.util.List;
public class BlogExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public BlogExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Integer value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Integer value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Integer value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Integer value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Integer value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Integer value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Integer> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Integer> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Integer value1, Integer value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Integer value1, Integer value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andTitleIsNull() {
addCriterion("title is null");
return (Criteria) this;
}
public Criteria andTitleIsNotNull() {
addCriterion("title is not null");
return (Criteria) this;
}
public Criteria andTitleEqualTo(String value) {
addCriterion("title =", value, "title");
return (Criteria) this;
}
public Criteria andTitleNotEqualTo(String value) {
addCriterion("title <>", value, "title");
return (Criteria) this;
}
public Criteria andTitleGreaterThan(String value) {
addCriterion("title >", value, "title");
return (Criteria) this;
}
public Criteria andTitleGreaterThanOrEqualTo(String value) {
addCriterion("title >=", value, "title");
return (Criteria) this;
}
public Criteria andTitleLessThan(String value) {
addCriterion("title <", value, "title");
return (Criteria) this;
}
public Criteria andTitleLessThanOrEqualTo(String value) {
addCriterion("title <=", value, "title");
return (Criteria) this;
}
public Criteria andTitleLike(String value) {
addCriterion("title like", value, "title");
return (Criteria) this;
}
public Criteria andTitleNotLike(String value) {
addCriterion("title not like", value, "title");
return (Criteria) this;
}
public Criteria andTitleIn(List<String> values) {
addCriterion("title in", values, "title");
return (Criteria) this;
}
public Criteria andTitleNotIn(List<String> values) {
addCriterion("title not in", values, "title");
return (Criteria) this;
}
public Criteria andTitleBetween(String value1, String value2) {
addCriterion("title between", value1, value2, "title");
return (Criteria) this;
}
public Criteria andTitleNotBetween(String value1, String value2) {
addCriterion("title not between", value1, value2, "title");
return (Criteria) this;
}
public Criteria andAuthodIdIsNull() {
addCriterion("authod_id is null");
return (Criteria) this;
}
public Criteria andAuthodIdIsNotNull() {
addCriterion("authod_id is not null");
return (Criteria) this;
}
public Criteria andAuthodIdEqualTo(Integer value) {
addCriterion("authod_id =", value, "authodId");
return (Criteria) this;
}
public Criteria andAuthodIdNotEqualTo(Integer value) {
addCriterion("authod_id <>", value, "authodId");
return (Criteria) this;
}
public Criteria andAuthodIdGreaterThan(Integer value) {
addCriterion("authod_id >", value, "authodId");
return (Criteria) this;
}
public Criteria andAuthodIdGreaterThanOrEqualTo(Integer value) {
addCriterion("authod_id >=", value, "authodId");
return (Criteria) this;
}
public Criteria andAuthodIdLessThan(Integer value) {
addCriterion("authod_id <", value, "authodId");
return (Criteria) this;
}
public Criteria andAuthodIdLessThanOrEqualTo(Integer value) {
addCriterion("authod_id <=", value, "authodId");
return (Criteria) this;
}
public Criteria andAuthodIdIn(List<Integer> values) {
addCriterion("authod_id in", values, "authodId");
return (Criteria) this;
}
public Criteria andAuthodIdNotIn(List<Integer> values) {
addCriterion("authod_id not in", values, "authodId");
return (Criteria) this;
}
public Criteria andAuthodIdBetween(Integer value1, Integer value2) {
addCriterion("authod_id between", value1, value2, "authodId");
return (Criteria) this;
}
public Criteria andAuthodIdNotBetween(Integer value1, Integer value2) {
addCriterion("authod_id not between", value1, value2, "authodId");
return (Criteria) this;
}
public Criteria andStateIsNull() {
addCriterion("state is null");
return (Criteria) this;
}
public Criteria andStateIsNotNull() {
addCriterion("state is not null");
return (Criteria) this;
}
public Criteria andStateEqualTo(String value) {
addCriterion("state =", value, "state");
return (Criteria) this;
}
public Criteria andStateNotEqualTo(String value) {
addCriterion("state <>", value, "state");
return (Criteria) this;
}
public Criteria andStateGreaterThan(String value) {
addCriterion("state >", value, "state");
return (Criteria) this;
}
public Criteria andStateGreaterThanOrEqualTo(String value) {
addCriterion("state >=", value, "state");
return (Criteria) this;
}
public Criteria andStateLessThan(String value) {
addCriterion("state <", value, "state");
return (Criteria) this;
}
public Criteria andStateLessThanOrEqualTo(String value) {
addCriterion("state <=", value, "state");
return (Criteria) this;
}
public Criteria andStateLike(String value) {
addCriterion("state like", value, "state");
return (Criteria) this;
}
public Criteria andStateNotLike(String value) {
addCriterion("state not like", value, "state");
return (Criteria) this;
}
public Criteria andStateIn(List<String> values) {
addCriterion("state in", values, "state");
return (Criteria) this;
}
public Criteria andStateNotIn(List<String> values) {
addCriterion("state not in", values, "state");
return (Criteria) this;
}
public Criteria andStateBetween(String value1, String value2) {
addCriterion("state between", value1, value2, "state");
return (Criteria) this;
}
public Criteria andStateNotBetween(String value1, String value2) {
addCriterion("state not between", value1, value2, "state");
return (Criteria) this;
}
public Criteria andFeaturedIsNull() {
addCriterion("featured is null");
return (Criteria) this;
}
public Criteria andFeaturedIsNotNull() {
addCriterion("featured is not null");
return (Criteria) this;
}
public Criteria andFeaturedEqualTo(Byte value) {
addCriterion("featured =", value, "featured");
return (Criteria) this;
}
public Criteria andFeaturedNotEqualTo(Byte value) {
addCriterion("featured <>", value, "featured");
return (Criteria) this;
}
public Criteria andFeaturedGreaterThan(Byte value) {
addCriterion("featured >", value, "featured");
return (Criteria) this;
}
public Criteria andFeaturedGreaterThanOrEqualTo(Byte value) {
addCriterion("featured >=", value, "featured");
return (Criteria) this;
}
public Criteria andFeaturedLessThan(Byte value) {
addCriterion("featured <", value, "featured");
return (Criteria) this;
}
public Criteria andFeaturedLessThanOrEqualTo(Byte value) {
addCriterion("featured <=", value, "featured");
return (Criteria) this;
}
public Criteria andFeaturedIn(List<Byte> values) {
addCriterion("featured in", values, "featured");
return (Criteria) this;
}
public Criteria andFeaturedNotIn(List<Byte> values) {
addCriterion("featured not in", values, "featured");
return (Criteria) this;
}
public Criteria andFeaturedBetween(Byte value1, Byte value2) {
addCriterion("featured between", value1, value2, "featured");
return (Criteria) this;
}
public Criteria andFeaturedNotBetween(Byte value1, Byte value2) {
addCriterion("featured not between", value1, value2, "featured");
return (Criteria) this;
}
public Criteria andStyleIsNull() {
addCriterion("style is null");
return (Criteria) this;
}
public Criteria andStyleIsNotNull() {
addCriterion("style is not null");
return (Criteria) this;
}
public Criteria andStyleEqualTo(String value) {
addCriterion("style =", value, "style");
return (Criteria) this;
}
public Criteria andStyleNotEqualTo(String value) {
addCriterion("style <>", value, "style");
return (Criteria) this;
}
public Criteria andStyleGreaterThan(String value) {
addCriterion("style >", value, "style");
return (Criteria) this;
}
public Criteria andStyleGreaterThanOrEqualTo(String value) {
addCriterion("style >=", value, "style");
return (Criteria) this;
}
public Criteria andStyleLessThan(String value) {
addCriterion("style <", value, "style");
return (Criteria) this;
}
public Criteria andStyleLessThanOrEqualTo(String value) {
addCriterion("style <=", value, "style");
return (Criteria) this;
}
public Criteria andStyleLike(String value) {
addCriterion("style like", value, "style");
return (Criteria) this;
}
public Criteria andStyleNotLike(String value) {
addCriterion("style not like", value, "style");
return (Criteria) this;
}
public Criteria andStyleIn(List<String> values) {
addCriterion("style in", values, "style");
return (Criteria) this;
}
public Criteria andStyleNotIn(List<String> values) {
addCriterion("style not in", values, "style");
return (Criteria) this;
}
public Criteria andStyleBetween(String value1, String value2) {
addCriterion("style between", value1, value2, "style");
return (Criteria) this;
}
public Criteria andStyleNotBetween(String value1, String value2) {
addCriterion("style not between", value1, value2, "style");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}
com.geyao.mybatis.util
MybatisUtil
package com.geyao.mybatis.util;
import java.io.InputStream;
import java.io.Reader;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
public class MyBatisUtil {
private static SqlSessionFactory sqlSessionFactory =null;
static {
try {
InputStream in = Resources.getResourceAsStream("mybatis-config.xml");
sqlSessionFactory = new SqlSessionFactoryBuilder().build(in);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private MyBatisUtil() {}
public static SqlSession getSqlSession() {
return sqlSessionFactory.openSession();
}
}
com.geyao.mybatis.mapper
BlogMapperTest
package com.geyao.mybatis.mapper;
import java.util.ArrayList;
import java.util.List;
import org.apache.ibatis.session.SqlSession;
import org.junit.Test;
import com.geyao.mybatis.pojo.Blog;
import com.geyao.mybatis.pojo.BlogExample;
import com.geyao.mybatis.pojo.BlogExample.Criteria;
import com.geyao.mybatis.util.MyBatisUtil;
public class BlogMapperTest {
@Test
public void testSelect() {
SqlSession session =MyBatisUtil.getSqlSession();
BlogMapper blogMapper =session.getMapper(BlogMapper.class);
BlogExample blogExample=new BlogExample();
BlogExample.Criteria blogcriteria=blogExample.createCriteria();
blogcriteria.andTitleLike("%g%");
List<Blog> blogList=blogMapper.selectByExample(blogExample);
System.out.print(blogList);
}
}
运行结果