一、将前面的代码继续完善功能
1.采用XML映射文件的形式来映射sql语句;
<?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.itheima.mapper.EmpMapper">
<select id="list" resultType="com.itheima.pojo.Emp">
select * from emp where name like '%${name}%' and gender =#{gender} and
entrydate between #{begin} and #{end} order by update_time desc)
</select>
</mapper>
2.采用动态sql语句的方式,实现条件查询的分页。
<select id="list" resultType="com.itheima.pojo.Emp">
select *
from emp
<where>
<if test="name!=null">
name like concat('%',#{name},'%')
</if>
<if test="gender!=null">
and gender =#{gender}
</if>
<if test="begin!=null and end!=null">
and entrydate between #{begin} and #{end}
</if>
</where>
order by update_time desc)
</select>
<update id="update2">
update emp
<set>
<if test="username!=null">username=#{username},</if>
<if test="name!=null">name=#{name},</if>
<if test="gender!=null">gender=#{gender},</if>
<if test="image!=null">image=#{image},</if>
<if test="job!=null">job=#{job},</if>
<if test="entrydate!=null">entrydate=#{entrydate},</if>
<if test="depy_id!=null">dept_id=#{deptId},</if>
<if test="update_time!=null">update_time=#{updateTime}</if>
where id=#{id}
</set>
</update>
<delete id="deleteByIds">
delete from emp where id in
<foreach collection="ids" item="id" separator="," open="(" close=")">
#{id}
</foreach>
</delete>
二、学习git的使用。
1.每个小组将自己的项目上传到gitee,学会协作开发;
2.学会从gitee上拉取项目到本地;
复制地址点击克隆