insert into user (NAME,AGE)values('mjp',18);
insert into user (NAME,AGE)values('wxx',23);
5. Create a User entity class
Create a class in the com.jd.dal.entity package (the plugin lombok plug-in is required, because you need to use @Data and other annotations, you can install the Baidu lombok plug-in by yourself)
Under the resource resource path, create a package: com.jd.dal.mapper (note that the writing method when creating a package is: com/jd/dal/mapper, do not com.jd.dal.mapper, otherwise there is only A com.jd.dal.mapper package, not a hierarchical package)
resource
jd
dal
mapper
UserMapper.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.jd.dal.mapper.UserMapper"><resultMap id="BaseResultMap" type="com.jd.dal.entity.User"><id column="ID" property="id"/><result column="NAME" property="name"/><result column="AGE" property="age"/></resultMap><sql id="Base_Column_List">
ID, NAME,AGE
</sql><select id="selectUser" resultType="com.jd.lean.dal.entity.User">
select
<include refid="Base_Column_List"></include>
from user
</select></mapper>