//获取1,2,3,4,5 批量数据,拆成数组 String[] idsString=entity.getIds().split(","); //将数组转成Long List<Long> ids = Arrays.asList((Long[]) ConvertUtils.convert(idsString, Long.class)); //去重复 //这里看你前端了,是否需要使用 ids=ids.stream().distinct().collect(Collectors.toList()); //修改条件:这里根据faculty_id QueryWrapper<Assistant> queryWrapper = new QueryWrapper<>(); queryWrapper.in("faculty_id",ids); //要修改的类 Assistant assistant=new Assistant(); assistant.setIs_history(1); assistant.setOn_duty_status("离岗"); //执行:我这里是根据Service的,根据Mapper自己来了 assistantService.update(assistant,queryWrapper);
//生成的sql语句
UPDATE st_assistant SET on_duty_status='离岗', is_history=1 WHERE (faculty_id IN (3));