Live2D

Mysql 根据条件 批量数据处理

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>
posted @ 2021-10-20 16:55  没有梦想的java菜鸟  阅读(199)  评论(0编辑  收藏  举报