一、动态sql语句
where只自动处理拼接后语句第一个and
二、foreach
1、处理对象
2、简单类型数组
3、对象数组
4、集合
5、SQL片段
<sql id="sql1">
<where>
<if test="">
<!-- 集合 语句始 语句末 集合每部分名 集合元素分割符 -->
<foreach collection="stuNos" open="and stuo in (" close=")" item="stuNo" separator=",">
#{stuNo}
</foreach>
</if>
</where>
</sql>
<select id="queryAllStudents" parameterType="person" resultType="sTuDenT" >
select * from student
<!-->本地直接使用sql id,非本地则加上文件名<-->
<include refid="sql1"></include>
</select>
三、查询
1、一对一
(1)业务拓展类
业务拓展类构造:继承变量多的,补充变量少的
(2)使用Map
构造map
2、一对多
两个类
mapper