<select id="findList" parameterType="object" resultType="自定义的返回对象">
SELECT
*
FROM
表名 n
<where>
<if test="condition.code!=null and condition.code!='' ">
and n.code=#{condition.code}
</if>
<if test="condition.name!=null and condition.name!='' ">
and n.name like concat('%',#{condition.name},'%')
</if>
<if test="condition.ids!=null and condition.ids.size()>0">
and n.id in
<foreach collection="condition.ids" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
</select>