提交 7581a23e authored 作者: renjiancai's avatar renjiancai

--no commit message

上级 1e6cc6d0
...@@ -57,19 +57,13 @@ public class PublishingController { ...@@ -57,19 +57,13 @@ public class PublishingController {
} }
publishing.setCreateTime(new Date()); publishing.setCreateTime(new Date());
publishing.setId(UUIDUtil.getUUID()); publishing.setId(UUIDUtil.getUUID());
if (!service.insert(publishing)) { publishing=service.queryByName(publishing.getName(),null);
throw new BaseException(ResponseCodeEnum.FAIL);
}
return CallBack.success();
}
@ApiOperation(value = "重复资源验证" , notes ="重复资源验证")
@GetMapping(value = ResourceRequestPath.REPEST+ResourceRequestPath.NAME)
public CallBack<?> selectByName(@PathVariable String name){
service.createCriteria().andEqualTo("name", name);
Publishing publishing = service.selectOneByCriteria();
if(publishing!=null){ if(publishing!=null){
throw new BaseException(ResponseCodeEnum.REPEST); throw new BaseException(ResponseCodeEnum.REPEST);
} }
if (!service.insert(publishing)) {
throw new BaseException(ResponseCodeEnum.FAIL);
}
return CallBack.success(); return CallBack.success();
} }
@ApiOperation(value = "批量删除", notes = "批量删除") @ApiOperation(value = "批量删除", notes = "批量删除")
...@@ -90,11 +84,11 @@ public class PublishingController { ...@@ -90,11 +84,11 @@ public class PublishingController {
@PostMapping(value = ResourceRequestPath.UPDATE) @PostMapping(value = ResourceRequestPath.UPDATE)
public CallBack<Boolean> update(@RequestBody PublishingForm form) { public CallBack<Boolean> update(@RequestBody PublishingForm form) {
Publishing publishing = new Publishing(); Publishing publishing = new Publishing();
try { BeanUtils.copyProperties(form, publishing);
BeanUtils.copyProperties(form, publishing);
} catch (Exception e) { publishing=service.queryByName(publishing.getName(),publishing.getId());
e.printStackTrace(); if(publishing!=null){
throw new BaseException(7, "复制对象时创建对象失败。"); throw new BaseException(ResponseCodeEnum.REPEST);
} }
if (!service.updateByPrimaryKeySelective(publishing)) { if (!service.updateByPrimaryKeySelective(publishing)) {
throw new BaseException(ResponseCodeEnum.FAIL); throw new BaseException(ResponseCodeEnum.FAIL);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论