- <?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="">
- <select id="selectTeacher" parameterType="map" resultType="map">
- select t.tid,t.tname,t.taddr
- from test_teacher t
- where 1=1
- <if test="tid != '' and tid != null">
- and tid=#{tid}
- </if>
- <if test="tname != '' and tname != null">
- and tname like #{tname}
- </if>
- <if test="addrs != '' and addrs != null">
- and taddr in
- <foreach item="item" index="index" collection="addrs" open="("
- separator="," close=")">
- #{item}
- </foreach>
- </if>
- </select>
- </mapper>
Mybatis多个条件的查询
最新推荐文章于 2024-08-02 12:25:44 发布