<select id="findUser" resultType="User"> select * from users <where> <choose> <when test="id != null"> and id = #{id} </when> <when test="email != null"> and email = #{email} </when> <otherwise> and username = #{username} </otherwise> </choose> </where> </select>
文章版权声明:除非注明,否则均为我爱教程术原创文章,转载或复制请以超链接形式并注明出处。