国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Java > 正文

Mybatis多參數(shù)及實(shí)體對象傳遞實(shí)例講解

2019-11-26 13:23:25
字體:
供稿:網(wǎng)友

在使用Mybatis的時候,經(jīng)常會有各種各樣的參數(shù)傳遞,不同類型,不同個數(shù)的參數(shù)。

先上個例子:

 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 andlifetouchRelease.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>

上面是一個包含:實(shí)體對象,普通類型,多個參數(shù)的傳遞。

多個參數(shù):使用注解的方式實(shí)現(xiàn)

實(shí)體對象:實(shí)體對象跟普通類型參數(shù)傳遞方法一樣,只是在用的時候,以 對象名.(點(diǎn))對象屬性名 的方式調(diào)用就可以了。

其它傳遞,不過數(shù)據(jù)類型多復(fù)雜也是如此。

以上所述是小編給大家介紹的Mybatis多參數(shù)及實(shí)體對象傳遞實(shí)例講解,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復(fù)大家的。在此也非常感謝大家對武林網(wǎng)網(wǎng)站的支持!

發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 临武县| 缙云县| 维西| 青田县| 荔浦县| 清河县| 兰坪| 邹城市| 永宁县| 普定县| 扎兰屯市| 二手房| 洞头县| 宁都县| 金塔县| 新营市| 五家渠市| 吴川市| 沙坪坝区| 扶绥县| 长沙县| 泸溪县| 鄂伦春自治旗| 河津市| 昌宁县| 依兰县| 米易县| 南宫市| 蓝山县| 中方县| 孟津县| 庆城县| 蓬安县| 鄱阳县| 资溪县| 杭锦旗| 沿河| 吐鲁番市| 尚志市| 沂南县| 麻阳|