1.前端VUE js代码:
export function updateListProductCategory(data) {
return request({
url: '/admin/product/category/updateList',
method: 'post',
data: data
})
}
2.调用updateListProductCategory()方法时 对data的处理需要和后端Vo类中的List名称相同
let list= {carrierProductCategoryList:com} //{}中的名称与后端Vo类中的名称相同就可以了
updateListProductCategory(list)
3后端需要封装一个List成Vo类 //lombok提供的@Data注解 会自动给 get/set方法
import lombok.Data;
import java.util.List;
@Data
public class CarrierProductCategoryVo {
private List<CarrierProductCategory> carrierProductCategoryList;
}
4.后端Controller层
@PostMapping("updateList")
public AjaxResult updateList(@RequestBody CarrierProductCategoryVo carrierProductCategoryVo){
return toAjax(carrierProductCategoryService.updateCarrierProductCategoryList(carrierProductCategoryVo.getCarrierProductCategoryList()));
}