When using Mybatis, there are often various parameters passing, different types and different numbers of parameters.
Let's take an example first:
public List<LifetouchRelease> findOfficeList(@Param("lifetouchRelease") LifetouchRelease lifetouchRelease, @Param("advertisementId") String advertisementId, @Param("officeName") String officeName, @Param("isOnline") Integer isOnline); <select id="findOfficeList" resultType="LifetouchRelease"> SELECT <include refid="lifetouchReleaseColumns"/> FROM lifetouch_release a <include refid="lifetouchReleaseJoins"/> <where> <if test="lifetouchRelease.typeIdentification > 0"> AND a.type_identification = #{lifetouchRelease.typeIdentification} </if> <if test="lifetouchRelease.category != null and lifetouchRelease.category.id != null and lifetouchRelease.category.id != ''"> AND a.release_type_id = #{lifetouchRelease.category.id} </if> AND a.office_id is not null AND a.advertisement_id like '%${advertisementId}%' AND (select name from sys_office where id=a.office_id) like '%${officeName}%' <if test="isOnline != null"> AND a.del_flag = #{isOnline} </if> </where> <choose> <when test="lifetouchRelease.page !=null andlifetouchRelease.page.orderBy != null and lifetouchRelease.page.orderBy != ''"> ORDER BY ${lifetouchRelease.page.orderBy} </when> <otherwise> ORDER BY a.update_date DESC </otherwise> </choose> </select>The above is a passing of: entity object, normal type, and multiple parameters.
Multiple parameters: using annotations to implement
Entity object: An entity object is the same as the normal type parameter passing method. It is only when used, it can be called in the form of the object name and (point) object attribute name.
Other passes, but the same is true for the data types that are so complex.
The above is an example explanation of Mybatis multi-parameter and entity object delivery that the editor introduced to you. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. Thank you very much for your support to Wulin.com website!