加申购车参数校验

This commit is contained in:
dinggang 2022-04-21 17:05:19 +08:00
parent 3deac71914
commit 5932ba8f8e
1 changed files with 7 additions and 2 deletions

View File

@ -1,5 +1,6 @@
package io.renren.modules.resourceCar.controller; package io.renren.modules.resourceCar.controller;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import io.renren.common.annotation.LogOperation; import io.renren.common.annotation.LogOperation;
@ -67,8 +68,12 @@ public class ResourceCarController {
public Result save(@RequestBody ResourceCarDTO dto){ public Result save(@RequestBody ResourceCarDTO dto){
//效验数据 //效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
resourceCarService.insertOrUpdate(dto); if (ObjectUtil.isAllNotEmpty(dto.getResourceId()) || ObjectUtil.isAllNotEmpty(dto.getUserId())) {
return new Result(); resourceCarService.insertOrUpdate(dto);
return new Result();
} else {
return new Result().error(500, "加申购车失败,请重试!");
}
} }
@DeleteMapping("/delete") @DeleteMapping("/delete")