多个having条件动态拼接
select * from sometable
GROUP BY aa,bb,cc,dd
<trim prefix="having" suffix=";" suffixOverrides="and">
<if test="id ==0 "> id is null</if>
<if test="id!=0 and aa!= null "> aa= #{aa} and</if>
<if test="id!=0 and bb!= null "> method = #{bb} and</if>
<if test="id!=0 and cc!= null "> target = #{cc} and</if>
<if test="id!=0 and dd!= null "> result = #{dd} and</if>
</trim>