<!--List<Emp> getEmpListByMoreTJ(Emp emp);--> <selectid="getEmpListByMoreTJ"resultType="Emp"> select * from t_emp where 1=1 <iftest="ename != '' and ename != null"> and ename = #{ename} </if> <iftest="age != '' and age != null"> and age = #{age} </if> <iftest="sex != '' and sex != null"> and sex = #{sex} </if> </select>
2 where
1 2 3 4 5 6 7 8 9 10 11 12 13 14
<selectid="getEmpListByMoreTJ2"resultType="Emp"> select * from t_emp <where> <iftest="ename != '' and ename != null"> ename = #{ename} </if> <iftest="age != '' and age != null"> and age = #{age} </if> <iftest="sex != '' and sex != null"> and sex = #{sex} </if> </where> </select>
<selectid="getEmpListByMoreTJ"resultType="Emp"> select * from t_emp <trimprefix="where"suffixOverrides="and"> <iftest="ename != '' and ename != null"> ename = #{ename} and </if> <iftest="age != '' and age != null"> age = #{age} and </if> <iftest="sex != '' and sex != null"> sex = #{sex} </if> </trim> </select>
<!--int deleteMoreByArray(int[] eids);--> <deleteid="deleteMoreByArray"> delete from t_emp where <foreachcollection="eids"item="eid"separator="or"> eid = #{eid} </foreach> </delete>
<!--int deleteMoreByArray(int[] eids);--> <deleteid="deleteMoreByArray"> delete from t_emp where eid in <foreachcollection="eids"item="eid"separator=","open="("close=")"> #{eid} </foreach> </delete>