判断list是否为空
<where> <if test="CodeList!=null and CodeList.size > 0"> loc.eb_code in <foreach collection="locationCodeList" item="Code" open="(" separator="," close=")"> #{Code} </foreach> </if> <if test="queryVo.level != null "> and loc.eb_level = #{queryVo.level} </if> and arg.is_deleted = 0 </where>
mybatis 写<where> 可以判断是否是第一个条件,不用写where 1=1