Commit 0d84b0df by dengshichuan

Merge branch 'dsc' into 'develop'

删除优化

See merge request 8timerv2/8timerapiv200!171
parents ab828eb7 20a07dd4
...@@ -25,6 +25,7 @@ import org.springframework.web.bind.annotation.RequestBody; ...@@ -25,6 +25,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
...@@ -47,6 +48,7 @@ import cn.timer.api.bean.crm.CrmSeaRule; ...@@ -47,6 +48,7 @@ import cn.timer.api.bean.crm.CrmSeaRule;
import cn.timer.api.bean.yggl.YgglMainEmp; import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.config.annotation.CurrentUser; import cn.timer.api.config.annotation.CurrentUser;
import cn.timer.api.config.annotation.UserBean; import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.dao.crm.CrmClientContactsMapper;
import cn.timer.api.dao.crm.CrmClientDataMapper; import cn.timer.api.dao.crm.CrmClientDataMapper;
import cn.timer.api.utils.CheckUtil; import cn.timer.api.utils.CheckUtil;
import cn.timer.api.utils.Result; import cn.timer.api.utils.Result;
...@@ -72,6 +74,9 @@ public class CrmController { ...@@ -72,6 +74,9 @@ public class CrmController {
@Autowired @Autowired
private CrmClientDataMapper crmClientDataMapper; private CrmClientDataMapper crmClientDataMapper;
@Autowired
private CrmClientContactsMapper crmClientContactsMapper;
private Integer getEmpNum(UserBean userBean) { private Integer getEmpNum(UserBean userBean) {
return userBean.getEmpNum(); return userBean.getEmpNum();
} }
...@@ -581,15 +586,15 @@ public class CrmController { ...@@ -581,15 +586,15 @@ public class CrmController {
@DeleteMapping("delCilentLinkMan") @DeleteMapping("delCilentLinkMan")
@Transactional @Transactional
@ApiOperation(value = "删除客户联系人", httpMethod = "DELETE", notes = "接口发布说明") @ApiOperation(value = "删除客户联系人", httpMethod = "DELETE", notes = "接口发布说明")
public Result<Void> delCilentLinkMan(@CurrentUser UserBean userBean, CrmClientContacts crmClientContacts) { public Result<Void> delCilentLinkMan(@CurrentUser UserBean userBean, @RequestParam Integer id,
Integer cid = crmClientContacts.getCid(); @RequestParam Integer cid) {
if (cid == null) if (cid == null)
return ResultUtil.error("编辑失败,请传入客户id"); return ResultUtil.error("删除失败,请传入客户id");
Integer num = CrmClientData.builder().id(cid).build().selectById().getContactsNum(); Integer num = CrmClientData.builder().id(cid).build().selectById().getContactsNum();
CrmClientData.builder().id(crmClientContacts.getCid()).contactsNum(--num).build().updateById(); CrmClientData.builder().id(cid).contactsNum(--num).build().updateById();
if (crmClientContacts.deleteById()) if (crmClientContactsMapper.deleteById(id) > 0)
return ResultUtil.success("删除成功"); return ResultUtil.success("删除成功");
return ResultUtil.success("删除失败"); return ResultUtil.error("删除失败");
} }
...@@ -999,5 +1004,9 @@ public class CrmController { ...@@ -999,5 +1004,9 @@ public class CrmController {
} }
// TODO 导入客户 // TODO 导入客户
@PostMapping("importexcel")
public Object importWatchExcel(@RequestParam("excelFile") MultipartFile xlsFile) {
return xlsFile;
}
} }
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