<?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">
<!-- namespace:命名空间,与sql标签的id属性共同构成唯一标识,代理开发方式:应与接口全限定类名一致-->
<mapper namespace="com.ceshiren.dao.UserMapper">
<!--resultMap标签 id:标签的唯一标识 type:封装的实体类型,使用别名-->
<resultMap id="resultUserMap" type="TestUser">
<!-- 手动配置映射关系 -->
<!--property:实体类的属性名 column:表中字段名-->
<!--id标签:表中主键字段封装-->
<id property="id" column="id"/>
<!--result标签:表中普通字段封装-->
<!--如果查询结果有 字段与属性是对应的,可以省略手动封装-->
<result property="userName" column="user_name"/>
<result property="autoCreateCaseJobName" column="auto_create_case_job_name"/>
<result property="startTestJobNameab" column="startTestJobName"/>
<result property="defaultJenkinsIdab" column="defaultJenkinsId"/>
<result property="createTimeab" column="createTime"/>
<result property="updateTimeab" column="updateTime"/>
</resultMap>
<select id ="findById" parameterType="int" resultMap="resultUserMap">
SELECT * FROM test_user WHERE id=${id}
</select>
<!-- <select id ="findById" parameterType="int" resultType="testUser">-->
<!-- SELECT * FROM test_user WHERE id=${id}-->
<!-- </select>-->
</mapper>
评论