MyBatis nested query column passes multiple parameter descriptions

Source: Internet
Author: User

The code is as follows, and the red part is the key code.

Pay attention to ParameterType for Java.util.HashMap.

<resultmap id= "Baseresultmap" type= "Blog" >

<association property= "Author" column= "{id=author_id,likename=author_name}" javatype= "author" select= " Selectauthor "/>

</resultMap>

<select id= "Selectauthor" resulttype= "Author" parametertype= "Java.util.HashMap" >

SELECT * from AUTHOR WHERE 1=1

<IF test= "id! = NULL and ID! =" >

and ID = #{id}

</if>

<if test= "likename ! = null and likename ! =" ">

and name like CONCAT ('% ', #{likename}, '% ')

</if>

<if test= "author_id! = null and author_id! =" ">

and id=#{author_id}

</if>

</select>

MyBatis nested query column passes multiple parameter descriptions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.