feat(oa): 跟进记录功能修复添加顾客重id,导致查询失败
This commit is contained in:
@@ -118,7 +118,7 @@ public class OaFollowUpRecordController extends BaseController {
|
||||
*/
|
||||
@GetMapping("/list/{customerId}")
|
||||
public R<OaFollowUpRecordQueryVo> selectByCustomerIdId(
|
||||
@NotNull(message = "主键不能为空")
|
||||
@NotNull(message = "顾客id不能为空")
|
||||
@PathVariable Long customerId) {
|
||||
return R.ok(iOaFollowUpRecordService.selectByCustomerId(customerId));
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.ruoyi.oa.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
@@ -106,7 +107,11 @@ public class OaFollowUpRecordServiceImpl implements IOaFollowUpRecordService {
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(OaFollowUpRecord entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
//TODO 做一些数据校验,如唯一约束--(仅仅验证了顾客id唯一,如有不对可删去)
|
||||
if(!checkCustomerId(entity)){
|
||||
throw new ServiceException("操作跟进记录失败, 跟进记录客服ID已存在!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -133,6 +138,17 @@ public class OaFollowUpRecordServiceImpl implements IOaFollowUpRecordService {
|
||||
return baseMapper.selectVoList(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证customerid是否可以操作
|
||||
*/
|
||||
public Boolean checkCustomerId(OaFollowUpRecord entity) {
|
||||
if(entity.getCustomerId() != null){
|
||||
OaFollowUpRecord followUpRecord=baseMapper.selectOne(new LambdaQueryWrapper<OaFollowUpRecord>().eq(OaFollowUpRecord::getCustomerId,entity.getCustomerId()));
|
||||
if(followUpRecord!=null&&!entity.getFollowId().equals(followUpRecord.getFollowId()))return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加跟进记录
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user