[mybatis] trim

<trim prefix="where" prefixOverrides="where" suffixOverrides="and">
          <if test="select_items != null">
              ID = #{select_items,jdbcType=VARCHAR}
              or HOME_URL = #{select_items,jdbcType=VARCHAR}
              or CHIEF = #{select_items,jdbcType=VARCHAR}
              or CONTACT_PERSON = #{select_items,jdbcType=VARCHAR}
              and
          </if>
          <if test="groupName != null">
              GROUP_NAME = #{groupName,jdbcType=VARCHAR}
          </if>
</trim>

 

 

prefix : Add a prefix to the SQL statement wrapped in <trim>.

suffix : Add a suffix to the SQL statement wrapped in <trim>.

prefixOverrides: If the SQL statement wrapped in <trim> is an empty statement (often appearing in the case of if judged to be no), cancel the specified prefix, such as where.

suffixOverrides: If the sql statement wrapped by <trim> is an empty statement (often appearing in the case of if judged to be no), cancel the specified suffix, such as and | or. comma, etc.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325590532&siteId=291194637