select * from t_user <trim prefix="WHERE" prefixOverrides="and"> <if test="roleName != null and roleName != ''"> AND role_name=#{roleName}</if> </trim> 如果条件成立并且没有trim标签,那么sql语句就为 select * from t_user A
<select id="getFunctionByPage" resultMap="FunctionRlt"> SELECT K.FUNCTION_NAME,K.FUNCTION_NO,K.URL,K.PARAM_CLASS, FROM PUB_FUNCTION K <choose> <when test="model.parentFuncName!= null and model.parentFuncName!= ''&qu