批量或單個 刪除主表的同時也刪除子表業務處理

2021-08-26 08:38:13 字數 1531 閱讀 2290

##場景:乙個消防栓對應多個硬體裝置,

##所以需要刪除主表資料的同時,也要把子表的資料全部刪除

@autowired

@autowired

@autowired

/** * 批量或單個

* 邏輯刪除消防裝置表和硬體裝置表的資料

* 先根據消防裝置id查詢出所有硬體裝置id

*/@override

@transactional

public

intdelete

(string[

] devicesid)

//邏輯刪除硬體表的所有資料

deleteonenetdevice

(ids)

;//物理刪除onenet平台上的資料

for(onenetdevice od:list)

}//最後邏輯刪除消防裝置表中的資料

delete

(devicesid)

;return iden;

}

/**

* 邏輯刪除,可以批量

*/intdelete

(@param

("devicesid"

)string[

] devicesid)

;<

!--邏輯刪除 可批量 --

>

"delete"

>

update sys_devices

status =

1<

/set>

where devices_id in

"devicesid" index=

"index" collection=

"devicesid" open=

"(" separator=

"," close=

")">

#<

/foreach>

<

/update>

/**

* 批量刪除

* @param onenetdevicesid

* @return

*/public integer deleteonenetdevice(@param("id")string id);

"deleteonenetdevice"

>

update sys_onenet_device

>

status = 1

set>

where id in

item

="id"

index

="index"

collection

="id"

open

="("

separator

=","

close

=")"

>

#foreach

>

delete

>

layui實現單個刪除和批量刪除

二 批量刪除 使用者列表 列表操作 ajaxres負責響應給頁面是否成功 public class ajaxres public void setsuccess boolean success public string getmsg public void setmsg string msg 刪除...

tp5 的單個刪除和批量刪除

不多說了直接上 頁面html 查詢 樣式css show頁面樣式 sh dv sh dv tay dv select input sb input sel input btn input btn hover sh dv contact sh ul sh li sh li name sh li ema...

Oracle如何刪除主鍵約束的同時也刪除索引

一 現象 在oracle10g中刪除主鍵約束後,在插入重複資料時候仍然報 ora 00001 錯誤。二 原因 oracle在的10g版本中對內部函式 atbdui 進行了調整,導致在刪除約束的時候無法刪除使用者建立的索引。這個現象被oracle分類到了 problem 三 方法 在刪除約束的時候需要...