批量新增:
<insert id="insertTitle" parameterType="java.util.List" keyProperty="id_" useGeneratedKeys="true">
insert into gha_kb_title(OPTIME,OPER,UPDATETIME,UPDATOR,VERSION_CODE,TITLE_CODE,TITLE_NAME,PARENT_ID,DATA_SOURCE)
values
<foreach collection="list" item="entity" separator=",">
(#{entity.optime},#{entity.oper},#{entity.updatetime},#{entity.updator},#{entity.versionCode},#{entity.titleCode},#{entity.titleName},#{entity.parentId},#{entity.dataSource})
</foreach>
</insert>
用法:
/**
* 新增标题
* @param ghaKbTitle
* @return
*/
int insertTitle(List<GhaKbTitle> ghaKbTitle);
批量删除:
<!-- 删除标题按父节点 int deleteTitleByParent(List<Integer> ids) throws Exception;-->
<delete id="deleteTitleByParent" parameterType="java.util.List">
update
gha_kb_title
set
ISDELETED = '1'
where
ISDELETED = '0' and
PARENT_ID
in
<foreach item="item" collection="list" open="(" separator="," close=")">
#{item,jdbcType = INTEGER}
</foreach>
</delete>
用法:
/**
* 删除标题按父节点
* @param ids
* @return
* @throws Exception
*/
int deleteTitleByParent(List<Integer> ids) throws Exception;