Commit 7645f06d by 邓实川 Committed by chenzg

添加删除客户联系人 容错

parent bb5fdf25
......@@ -563,13 +563,18 @@ public class CrmController {
@ApiOperation(value = "新增/编辑客户联系人", httpMethod = "POST", notes = "接口发布说明")
public Result<Void> addCilentLinkMan(@CurrentUser UserBean userBean,
@RequestBody CrmClientContacts crmClientContacts) {
Integer cid = crmClientContacts.getCid();
if (crmClientContacts.getId() == null) {
if (cid == null)
return ResultUtil.error("编辑失败,请传入客户id");
Integer num = CrmClientData.builder().id(crmClientContacts.getCid()).build().selectById().getContactsNum();
CrmClientData.builder().id(crmClientContacts.getCid()).contactsNum(++num).build().updateById();
CrmClientData.builder().id(cid).contactsNum(++num).build().updateById();
}
if (crmClientContacts.insertOrUpdate())
return ResultUtil.success("新增/编辑成功");
return ResultUtil.success("新增/编辑失败");
return ResultUtil.error("新增/编辑失败");
}
......@@ -577,7 +582,10 @@ public class CrmController {
@Transactional
@ApiOperation(value = "删除客户联系人", httpMethod = "DELETE", notes = "接口发布说明")
public Result<Void> delCilentLinkMan(@CurrentUser UserBean userBean, CrmClientContacts crmClientContacts) {
Integer num = CrmClientData.builder().build().selectById().getContactsNum();
Integer cid = crmClientContacts.getCid();
if (cid == null)
return ResultUtil.error("编辑失败,请传入客户id");
Integer num = CrmClientData.builder().id(cid).build().selectById().getContactsNum();
CrmClientData.builder().id(crmClientContacts.getCid()).contactsNum(--num).build().updateById();
if (crmClientContacts.deleteById())
return ResultUtil.success("删除成功");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment