• script

    script

    For using dynamic SQL in annotated mapper class, script element can be used. For example:

    1. @Update({"<script>",
    2. "update Author",
    3. " <set>",
    4. " <if test='username != null'>username=#{username},</if>",
    5. " <if test='password != null'>password=#{password},</if>",
    6. " <if test='email != null'>email=#{email},</if>",
    7. " <if test='bio != null'>bio=#{bio}</if>",
    8. " </set>",
    9. "where id=#{id}",
    10. "</script>"})
    11. void updateAuthorValues(Author author);