<select id="selectSelective" resultMap="xxx" parameterType="xxx"> select <include refid="Base_Column_List"/> from xxx where del_flag=0 <choose> <when test="xxx !=null and xxx != ''"> and xxx like concat(concat('%', #{xxx}), '%') </when> <otherwise> and xxx like '**%' </otherwise> </choose> </select>
下面就是MyBatis中的if....else...表示方法
<choose> <when test=""> //... </when> <otherwise> //... </otherwise> </choose>