Mysql 根据条件 更新 使用中间表
update t_staff_year set AUTHORITY = 1 where STAFF_NO IN (select STAFF_NO from (SELECT * FROM t_staff_year where POSITION LIKE "%助理")t)
Mybatis 处理批量删除
<!--批量删除员工号和部门信息-->
<delete id="deleteBatchDep">
delete from dep_auth where (ASSISTANT_NO,DEPARTMENT_ID) in
<foreach collection="list" item="item" index="index" separator="," open="(" close=")">
(#{item.staffNo},#{item.departmentId})
</foreach>
</delete>
Mybatis 处理批量添加
<!--批量插入员工号和部门信息-->
<insert id="insertAssistantDept">
insert into dep_auth(ASSISTANT_NO,DEPARTMENT_ID,UPDATE_TIME) values
<foreach collection="list" index="index" separator="," item="item" >
(#{item.staffNo},#{item.departmentId},#{item.updateTime})
</foreach>
</insert>