When using Mybaitis to pass parameters, if only one parameter of type string is passed in, the XML file should use _parameter instead of the parameter name.
The correct wording:
[HTML]View Plaincopyprint?
- <span style="FONT-SIZE:18PX;" > <!--used to inquire if the waybill number is present -
- <Select id= "iscargobillnoexist" resulttype="Java.lang.Integer">
- Select COUNT (1)
- From T_entry_cargo_receiver_info
- where 1=1
- <if test="_parameter! = null" >
- and cargo_bill_no = #{<span style="color: #ff0000;" >_parameter</span;,jdbctype=VARCHAR}
- </If>
- </Select></span>
The wrong wording:
[HTML]View Plaincopyprint?
- <span style="FONT-SIZE:18PX;" > <!--used to inquire if the waybill number is present -
- <Select id= "iscargobillnoexist" resulttype="Java.lang.Integer">
- Select COUNT (1)
- From T_entry_cargo_receiver_info
- where 1=1
- <if test="id! = NULL" >
- and cargo_bill_no = #{<span style="color: #ff0000;" >id</span;,jdbctype=VARCHAR}
- </If>
- </Select></span>
The comment area was mentioned:
You can also add @param (value= "id") to the parameters of this method in the Mapper interface, so that you can use #{id,jdbctype=varchar} in. Xml.
It's also possible.
=============== Split Line ===============
However, the errors mentioned in this article are found in practice and are not always present. may be related to the version of MyBatis, that is, according to the "error" above the writing, in some versions is not a problem, do not have to tangle.
If there is a header error, you can resolve it as described in the article.
Mybaits Error Resolution: There is no getter-named ' ID ' in class ' java.lang.String '