transportMapper.update(null,new LambdaUpdateWrapper<Transport>().in(Transport::getId,ids).set(Transport::getOrderStatus,OrderStatusEnum.ORDERED));
sql批量更新
update嵌套select语句
我要更新 tms_goods_copy1 里的 meter_unit 字段 ,值在 sys_dict_data 表里对应的 dict_label 字段里的 数据,查询条件 dict.dict_type = ‘meter_unit’ and dict_value = CONCAT(g.system_id,‘-’,g.jd_meter_unit_code) 。这样就能实现更新meter_unit 字段里的数据
update tms_goods_copy1 g set g.meter_unit =( select dict.dict_label from sys_dict_data dict where dict.dict_type = 'meter_unit' and dict_value = CONCAT(g.system_id,'-',g.jd_meter_unit_code));