//更新
<update id="updateJob" parameterType="SysJob">
update sys_job
<trim prefix="SET" suffixOverrides=",">
<if test="jobName != null and jobName != ''">job_name = #{jobName},</if>
<if test="jobGroup != null and jobGroup != ''">job_group = #{jobGroup},</if>
<if test="invokeTarget != null and invokeTarget != ''">invoke_target = #{invokeTarget},</if>
<if test="cronExpression != null and cronExpression != ''">cron_expression = #{cronExpression},</if>
<if test="misfirePolicy != null and misfirePolicy != ''">misfire_policy = #{misfirePolicy},</if>
<if test="concurrent != null and concurrent != ''">concurrent = #{concurrent},</if>
<if test="status !=null">status = #{status},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = now()
</trim>
where job_id = #{jobId}
</update>
//新增
<insert id="insertJob" parameterType="SysJob" useGeneratedKeys="true" keyProperty="jobId">
insert into sys_job
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="jobId != null and jobId != 0">job_id,</if>
<if test="jobName != null and jobName != ''">job_name,</if>
<if test="jobGroup != null and jobGroup != ''">job_group,</if>
<if test="invokeTarget != null and invokeTarget != ''">invoke_target,</if>
<if test="cronExpression != null and cronExpression != ''">cron_expression,</if>
<if test="misfirePolicy != null and misfirePolicy != ''">misfire_policy,</if>
<if test="concurrent != null and concurrent != ''">concurrent,</if>
<if test="status != null and status != ''">status,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="jobId != null and jobId != 0">#{jobId},</if>
<if test="jobName != null and jobName != ''">#{jobName},</if>
<if test="jobGroup != null and jobGroup != ''">#{jobGroup},</if>
<if test="invokeTarget != null and invokeTarget != ''">#{invokeTarget},</if>
<if test="cronExpression != null and cronExpression != ''">#{cronExpression},</if>
<if test="misfirePolicy != null and misfirePolicy != ''">#{misfirePolicy},</if>
<if test="concurrent != null and concurrent != ''">#{concurrent},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
now()
</trim>
</insert>
//批量刪除
<delete id="deleteJobByIds" parameterType="Long">
delete from sys_job where job_id in
<foreach collection="array" item="jobId" open="(" separator="," close=")">
#{jobId}
</foreach>
</delete>
//批量更新
<update id="updateDeptChildren" parameterType="java.util.List">
update sys_dept set ancestors =
<foreach collection="depts" item="item" index="index"
separator=" " open="case dept_id" close="end">
when #{item.deptId} then #{item.ancestors}
</foreach>
where dept_id in
<foreach collection="depts" item="item" index="index"
separator="," open="(" close=")">
#{item.deptId}
</foreach>
</update>
//批量新增
<insert id="batchInsert">
insert into ict_order_device ( order_id, device_id, device_type, device_name,
device_price,device_num,device_ico, create_by, create_time )
VALUES
<foreach collection="list" item="item" separator="," >
(#{orderId},#{item.deviceId},#{item.deviceType},
#{item.deviceName},#{item.devicePrice},#{item.deviceNum},
#{item.deviceIco},#{userName}, sysDate())
</foreach>
</insert>
<update id="deletePersonIds">
update bus_key_person set del_flag = '1'
WHERE person_id IN
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</update>
mybatis 動(dòng)態(tài)語法
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
- 文/潘曉璐 我一進(jìn)店門尿赚,熙熙樓的掌柜王于貴愁眉苦臉地迎上來散庶,“玉大人,你說我怎么就攤上這事吼畏《匠啵” “怎么了?”我有些...
- 文/不壞的土叔 我叫張陵泻蚊,是天一觀的道長躲舌。 經(jīng)常有香客問我,道長性雄,這世上最難降的妖魔是什么没卸? 我笑而不...
- 正文 為了忘掉前任,我火速辦了婚禮秒旋,結(jié)果婚禮上约计,老公的妹妹穿的比我還像新娘。我一直安慰自己迁筛,他們只是感情好煤蚌,可當(dāng)我...
- 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著细卧,像睡著了一般尉桩。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上贪庙,一...
- 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場(chǎng)噩夢(mèng)啊……” “哼撩匕!你這毒婦竟也來了助隧?” 一聲冷哼從身側(cè)響起,我...
- 序言:老撾萬榮一對(duì)情侶失蹤,失蹤者是張志新(化名)和其女友劉穎并村,沒想到半個(gè)月后巍实,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
- 正文 獨(dú)居荒郊野嶺守林人離奇死亡哩牍,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
- 正文 我和宋清朗相戀三年棚潦,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片膝昆。...
- 正文 年R本政府宣布收叶,位于F島的核電站骄呼,受9級(jí)特大地震影響,放射性物質(zhì)發(fā)生泄漏判没。R本人自食惡果不足惜蜓萄,卻給世界環(huán)境...
- 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望澄峰。 院中可真熱鬧嫉沽,春花似錦、人聲如沸俏竞。這莊子的主人今日做“春日...
- 文/蒼蘭香墨 我抬頭看了看天上的太陽魂毁。三九已至玻佩,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間漱牵,已是汗流浹背夺蛇。 一陣腳步聲響...
- 正文 我出身青樓娶聘,卻偏偏與公主長得像闻镶,于是被迫代替她去往敵國和親。 傳聞我的和親對(duì)象是個(gè)殘疾皇子丸升,可洞房花燭夜當(dāng)晚...
推薦閱讀更多精彩內(nèi)容
- 1铆农、choose選擇判斷等于固定值 type 字段為字符型,直接寫<when test="params.type ...
- 開始第一個(gè)例子: Hello World 新建Java工程,設(shè)置maven依賴 新建maven工程墩剖,設(shè)置項(xiàng)目編...
- 1. 初步認(rèn)識(shí)一蛤OGNL OGNL猴凹,Object Graph Navigation Language,是一種強(qiáng)大...
- 實(shí)際開發(fā)中,標(biāo)簽的class通常不會(huì)使用一個(gè)普通字符串寫死岭皂,而是動(dòng)態(tài)地給標(biāo)簽綁定class郊霎,有2種綁定語法:對(duì)象語...
- 一、Wrappers查詢構(gòu)造器: 二爷绘、Wrappers更新構(gòu)造器: 三书劝、快捷創(chuàng)建構(gòu)造器實(shí)例對(duì)象語法:1、查詢:Wr...