第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

請教一下mybatis 的傳入?yún)?shù)如何既有對象又有單個(gè)參數(shù)?

請教一下mybatis 的傳入?yún)?shù)如何既有對象又有單個(gè)參數(shù)?

冉冉說 2019-11-26 19:07:05
mybatis 的傳入?yún)?shù)如何既有對象又有單個(gè)參數(shù)
查看完整描述

3 回答

?
catspeake

TA貢獻(xiàn)1111條經(jīng)驗(yàn) 獲得超0個(gè)贊

使用@Param注解

1List<Person> query(@Param("query") PersonQuery query, @Param("offset"int offset, @Param("rows"int rows);

mapper中sql使用#{參數(shù)名}獲取參數(shù)。#{query.a}是取PersonQuery對象里的a字段的值

12345<select id="query" resultMap="result">    SELECT * FROM XXX    WHERE A=#{query.a} AND B=#{query.b}     LIMIT #{offset},#{rows}</select>


查看完整回答
反對 回復(fù) 2019-12-01
?
撒科打諢

TA貢獻(xiàn)1934條經(jīng)驗(yàn) 獲得超2個(gè)贊

mybatis支持foreach語句,
語法大致如下:
<update id="batchUpdate">
update tblsupertitleresult
<trim prefix="set" suffixOverrides=",">
<trim prefix="checkState =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.checkState!=null">
when (userHhCode=#{i.userHhCode} and titleId=#{i.titleId}) then #{i.checkState}
</if>
</foreach>
</trim>
<trim prefix=" correctDate =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.correctDate!=null">
when (userHhCode=#{i.userHhCode} and titleId=#{i.titleId}) then #{i.correctDate}
</if>
</foreach>
</trim>
<trim prefix="result =case" suffix="end," >
<foreach collection="list"item="i" index="index">
<if test="i.result!=null">
when (userHhCode=#{i.userHhCode} and titleId=#{i.titleId}) then #{i.result}
</if>
</foreach>
</trim>
</trim>
where
<foreach collection="list" separator="or"item="i" index="index" >
(userHhCode =#{i.userHhCode} andtitleId=#{i.titleId})
</foreach>
</update>



查看完整回答
反對 回復(fù) 2019-12-01
  • 3 回答
  • 0 關(guān)注
  • 2096 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號