Parameters of interfaces in mybatis and mapping relationships in mapper files

Source: Internet
Author: User

There are several situations:

    • A parameter
      • Do not use annotations

1. The parameter is the base type or package type.

            Parameter comment: #{any character}

2. The parameter is an object.

            Parameter comments are: #{Object Properties}

      • Using Annotations (@Param)

1. The parameter is the base type or package type.

parameter Comment: #{annotation name} | #{param1}

2. The parameter is an object.

            Parameter comment is: #{annotation name. Object Properties} | #{param1. Object Properties}

    • Multiple parameters
      • Do not use annotations

1. The parameter is the base type or package type.

            Parameter comment: #{parameter position [0..n-1]} | #{param[1..n]}

        2. The parameter is an object.

            Parameter comments are: #{parameter position [0..n-1]. Object Properties} | #{param[1..n]. Object Properties}

      • Using annotations

1. The parameter is the base type or package type.

            Parameter comment: #{Note name} | #{param[1..n]}

2. The parameter is an object.

parameter comments are: #{annotation name. Object Properties} | #{param[1..n]. Object Properties}

Summarize:

1. The role of annotation @param is to set parameter aliases. The set parameter can only be accessed by ' #{param[1..n ' or ' #{note alias} ' or #{annotation name. Object Properties} to access

2. For multiple parameters, use the ' #{parameter position [0..n-1]} ' | ' #{param[1..n]} ' to access parameters

The test code is too messy to be posted.

Parameters of interfaces in mybatis and mapping relationships in mapper files

Related Article

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.