<?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="EmpMapper">
<select id="findAll" resultType="com.cy.pojo.Emp">
select * from emp
</select>
<update id="insert" >
insert into emp value (null ,"蔡恒","程序猿",54564);
</update>
<update id="update">
update emp set name="哈哈哈",job="公务员" where id=9
</update>
<select id="findById" resultType="com.cy.pojo.Emp">
select * from emp where id=#{id}
</select>
<update id="insertEmp" >
insert into emp value (null,#{name },#{job},#{salary})
</update>
<select id="findEmp" resultType="com.cy.pojo.Emp">
select * from emp
<if test="name!=null">
where name like #{name}
</if>
</select>
<select id="selectBySal" resultType="com.tedu.pojo.Emp">
select * from emp where 1=1 <!-- 防止后面的条件连接不上 -->
<if test="minSal!=null">
and sal>=#{minSal}
</if>
<if test="maxSal!=null">
<!-- < 表示<
> 表示>
≤ 表示<=
≥ 表示>= -->
and sal<![CDATA[<=]]>#{maxSal}
</if>
</select>
</mapper>