Просмотр исходного кода

feat(customer): 添加客户消息功能并优化客户信息中的部门额度显示

- 新增客户消息相关实体类、控制器、服务及映射器
- 实现客户消息的增删改查功能
- 在客户信息中添加部门额度字段并实现计算逻辑
- 优化客户联系人信息处理逻辑,使用Optional避免空指针异常
- 实现客户消息的安全验证机制,确保数据访问权限控制
hurx 2 дней назад
Родитель
Сommit
0c5be8aa2b

+ 106 - 0
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/controller/CustomerMessageController.java

@@ -0,0 +1,106 @@
+package org.dromara.customer.controller;
+
+import jakarta.servlet.http.HttpServletResponse;
+import jakarta.validation.constraints.NotEmpty;
+import jakarta.validation.constraints.NotNull;
+import lombok.RequiredArgsConstructor;
+import org.dromara.common.core.domain.R;
+import org.dromara.common.core.validate.AddGroup;
+import org.dromara.common.core.validate.EditGroup;
+import org.dromara.common.excel.utils.ExcelUtil;
+import org.dromara.common.idempotent.annotation.RepeatSubmit;
+import org.dromara.common.log.annotation.Log;
+import org.dromara.common.log.enums.BusinessType;
+import org.dromara.common.mybatis.core.page.PageQuery;
+import org.dromara.common.mybatis.core.page.TableDataInfo;
+import org.dromara.common.web.core.BaseController;
+import org.dromara.customer.domain.bo.CustomerMessageBo;
+import org.dromara.customer.domain.vo.CustomerMessageVo;
+import org.dromara.customer.service.ICustomerMessageService;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 客户消息
+ * 前端访问路由地址为:/customer/customerMessage
+ *
+ * @author LionLi
+ * @date 2026-04-15
+ */
+@Validated
+@RequiredArgsConstructor
+@RestController
+@RequestMapping("/customerMessage")
+public class CustomerMessageController extends BaseController {
+
+    private final ICustomerMessageService customerMessageService;
+
+    /**
+     * 查询客户消息列表
+     */
+    //@SaCheckPermission("customer:customerMessage:list")
+    @GetMapping("/list")
+    public TableDataInfo<CustomerMessageVo> list(CustomerMessageBo bo, PageQuery pageQuery) {
+        return customerMessageService.queryPageList(bo, pageQuery);
+    }
+
+    /**
+     * 导出客户消息列表
+     */
+    //@SaCheckPermission("customer:customerMessage:export")
+    @Log(title = "客户消息", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(CustomerMessageBo bo, HttpServletResponse response) {
+        List<CustomerMessageVo> list = customerMessageService.queryList(bo);
+        ExcelUtil.exportExcel(list, "客户消息", CustomerMessageVo.class, response);
+    }
+
+    /**
+     * 获取客户消息详细信息
+     *
+     * @param id 主键
+     */
+    //@SaCheckPermission("customer:customerMessage:query")
+    @GetMapping("/{id}")
+    public R<CustomerMessageVo> getInfo(@NotNull(message = "主键不能为空")
+                                        @PathVariable("id") Long id) {
+        return R.ok(customerMessageService.queryById(id));
+    }
+
+    /**
+     * 新增客户消息
+     */
+    //@SaCheckPermission("customer:customerMessage:add")
+    @Log(title = "客户消息", businessType = BusinessType.INSERT)
+    @RepeatSubmit()
+    @PostMapping()
+    public R<Void> add(@Validated(AddGroup.class) @RequestBody CustomerMessageBo bo) {
+        return toAjax(customerMessageService.insertByBo(bo));
+    }
+
+    /**
+     * 修改客户消息
+     */
+    //@SaCheckPermission("customer:customerMessage:edit")
+    @Log(title = "客户消息", businessType = BusinessType.UPDATE)
+    @RepeatSubmit()
+    @PutMapping()
+    public R<Void> edit(@Validated(EditGroup.class) @RequestBody CustomerMessageBo bo) {
+        return toAjax(customerMessageService.updateByBo(bo));
+    }
+
+    /**
+     * 删除客户消息
+     *
+     * @param ids 主键串
+     */
+    //@SaCheckPermission("customer:customerMessage:remove")
+    @Log(title = "客户消息", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    public R<Void> remove(@NotEmpty(message = "主键不能为空")
+                          @PathVariable("ids") Long[] ids) {
+        return toAjax(customerMessageService.deleteWithValidByIds(List.of(ids), true));
+    }
+}

+ 125 - 0
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/controller/pc/PcCustomerMessageController.java

@@ -0,0 +1,125 @@
+package org.dromara.customer.controller.pc;
+
+import jakarta.validation.constraints.NotEmpty;
+import jakarta.validation.constraints.NotNull;
+import lombok.RequiredArgsConstructor;
+import org.dromara.common.core.domain.R;
+import org.dromara.common.core.validate.AddGroup;
+import org.dromara.common.core.validate.EditGroup;
+import org.dromara.common.idempotent.annotation.RepeatSubmit;
+import org.dromara.common.log.annotation.Log;
+import org.dromara.common.log.enums.BusinessType;
+import org.dromara.common.mybatis.core.page.PageQuery;
+import org.dromara.common.mybatis.core.page.TableDataInfo;
+import org.dromara.common.satoken.utils.LoginHelper;
+import org.dromara.common.web.core.BaseController;
+import org.dromara.customer.domain.bo.CustomerMessageBo;
+import org.dromara.customer.domain.vo.CustomerMessageVo;
+import org.dromara.customer.service.ICustomerMessageService;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@Validated
+@RequiredArgsConstructor
+@RestController
+@RequestMapping("/pcCustomerMessage")
+public class PcCustomerMessageController extends BaseController {
+
+    private final ICustomerMessageService customerMessageService;
+
+    /**
+     * 查询客户消息列表
+     */
+    @GetMapping("/list")
+    public TableDataInfo<CustomerMessageVo> list(CustomerMessageBo bo, PageQuery pageQuery) {
+        // 获取当前登录用户的企业ID
+        Long customerId = LoginHelper.getLoginUser().getCustomerId();
+        bo.setCustomerId(customerId);
+        return customerMessageService.queryPageList(bo, pageQuery);
+    }
+
+    /**
+     * 获取客户消息详细信息
+     *
+     * @param id 主键
+     */
+    @GetMapping("/{id}")
+    public R<CustomerMessageVo> getInfo(@NotNull(message = "主键不能为空")
+                                        @PathVariable("id") Long id) {
+
+        // 查询消息通知
+        CustomerMessageVo vo = customerMessageService.queryById(id);
+
+        // 验证消息通知是否属于当前用户的企业
+        if (vo != null) {
+            Long customerId = LoginHelper.getLoginUser().getCustomerId();
+            if (!customerId.equals(vo.getCustomerId())) {
+                return R.fail("无权访问该消息通知");
+            }
+        }
+        return R.ok(customerMessageService.queryById(id));
+    }
+
+    /**
+     * 新增客户消息
+     */
+    @Log(title = "客户消息", businessType = BusinessType.INSERT)
+    @RepeatSubmit()
+    @PostMapping()
+    public R<Void> add(@Validated(AddGroup.class) @RequestBody CustomerMessageBo bo) {
+        Long customerId = LoginHelper.getLoginUser().getCustomerId();
+        bo.setCustomerId(customerId);
+        Long userId = LoginHelper.getLoginUser().getUserId();
+        bo.setUserId(userId);
+        return toAjax(customerMessageService.insertByBo(bo));
+    }
+
+    /**
+     * 修改客户消息
+     */
+    @Log(title = "客户消息", businessType = BusinessType.UPDATE)
+    @RepeatSubmit()
+    @PutMapping()
+    public R<Void> edit(@Validated(EditGroup.class) @RequestBody CustomerMessageBo bo) {
+        // 获取当前登录用户的企业ID
+        Long customerId = LoginHelper.getLoginUser().getCustomerId();
+
+        // 验证消息通知是否属于当前用户的企业
+        CustomerMessageVo customerMessageVo = customerMessageService.queryById(bo.getId());
+        if (customerMessageVo == null) {
+            return R.fail("消息通知不存在");
+        }
+        if (!customerId.equals(customerMessageVo.getCustomerId())) {
+            return R.fail("无权修改该消息通知");
+        }
+        return toAjax(customerMessageService.updateByBo(bo));
+    }
+
+    /**
+     * 删除客户消息
+     *
+     * @param ids 主键串
+     */
+    @Log(title = "客户消息", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    public R<Void> remove(@NotEmpty(message = "主键不能为空")
+                          @PathVariable("ids") Long[] ids) {
+
+        // 获取当前登录用户的企业ID
+        Long customerId = LoginHelper.getLoginUser().getCustomerId();
+
+        // 验证所有消息通知是否都属于当前用户的企业
+        for (Long id : ids) {
+            CustomerMessageVo customerMessageVo = customerMessageService.queryById(id);
+            if (customerMessageVo == null) {
+                return R.fail("消息通知ID " + id + " 不存在");
+            }
+            if (!customerId.equals(customerMessageVo.getCustomerId())) {
+                return R.fail("无权删除消息通知ID " + id);
+            }
+        }
+        return toAjax(customerMessageService.deleteWithValidByIds(List.of(ids), true));
+    }
+}

+ 77 - 0
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/domain/CustomerMessage.java

@@ -0,0 +1,77 @@
+package org.dromara.customer.domain;
+
+import org.dromara.common.tenant.core.TenantEntity;
+import com.baomidou.mybatisplus.annotation.*;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.io.Serial;
+
+/**
+ * 客户消息对象 customer_message
+ *
+ * @author LionLi
+ * @date 2026-04-15
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("customer_message")
+public class CustomerMessage extends TenantEntity {
+
+    @Serial
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键ID
+     */
+    @TableId(value = "id")
+    private Long id;
+
+    /**
+     * 客户ID
+     */
+    private Long customerId;
+
+    /**
+     * 联系人ID
+     */
+    private Long userId;
+
+    /**
+     * 客户编号
+     */
+    private String customerNo;
+
+    /**
+     * 消息标题
+     */
+    private String title;
+
+    /**
+     * 消息内容
+     */
+    private String content;
+
+    /**
+     * 阅读状态:0未读 1已读
+     */
+    private String readStatus;
+
+    /**
+     * 状态(0启用 1禁用)
+     */
+    private String status;
+
+    /**
+     * 删除标志(0代表存在 2代表删除)
+     */
+    @TableLogic
+    private String delFlag;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+
+}

+ 69 - 0
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/domain/bo/CustomerMessageBo.java

@@ -0,0 +1,69 @@
+package org.dromara.customer.domain.bo;
+
+import org.dromara.customer.domain.CustomerMessage;
+import org.dromara.common.mybatis.core.domain.BaseEntity;
+import org.dromara.common.core.validate.AddGroup;
+import org.dromara.common.core.validate.EditGroup;
+import io.github.linpeilie.annotations.AutoMapper;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import jakarta.validation.constraints.*;
+
+/**
+ * 客户消息业务对象 customer_message
+ *
+ * @author LionLi
+ * @date 2026-04-15
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@AutoMapper(target = CustomerMessage.class, reverseConvertGenerate = false)
+public class CustomerMessageBo extends BaseEntity {
+
+    /**
+     * 主键ID
+     */
+    private Long id;
+
+    /**
+     * 客户ID
+     */
+    private Long customerId;
+
+    /**
+     * 联系人ID
+     */
+    private Long userId;
+
+    /**
+     * 客户编号
+     */
+    private String customerNo;
+
+    /**
+     * 消息标题
+     */
+    private String title;
+
+    /**
+     * 消息内容
+     */
+    private String content;
+
+    /**
+     * 阅读状态:0未读 1已读
+     */
+    private String readStatus;
+
+    /**
+     * 状态(0启用 1禁用)
+     */
+    private String status;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+
+}

+ 4 - 0
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/domain/vo/CustomerInfoVo.java

@@ -1,5 +1,6 @@
 package org.dromara.customer.domain.vo;
 
+import java.math.BigDecimal;
 import java.util.Date;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
@@ -232,6 +233,9 @@ public class CustomerInfoVo implements Serializable {
     @ExcelProperty(value = "备注")
     private String remark;
 
+    /*部门额度*/
+    private BigDecimal deptCredit;
+
     private CustomerBusinessInfoVo customerBusinessInfoVo;
 
     private CustomerSalesInfoVo customerSalesInfoVo;

+ 69 - 0
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/domain/vo/CustomerMessageVo.java

@@ -0,0 +1,69 @@
+package org.dromara.customer.domain.vo;
+
+import org.dromara.customer.domain.CustomerMessage;
+import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
+import cn.idev.excel.annotation.ExcelProperty;
+import org.dromara.common.excel.annotation.ExcelDictFormat;
+import org.dromara.common.excel.convert.ExcelDictConvert;
+import io.github.linpeilie.annotations.AutoMapper;
+import lombok.Data;
+
+import java.io.Serial;
+import java.io.Serializable;
+import java.util.Date;
+
+
+/**
+ * 客户消息视图对象 customer_message
+ *
+ * @author LionLi
+ * @date 2026-04-15
+ */
+@Data
+@ExcelIgnoreUnannotated
+@AutoMapper(target = CustomerMessage.class)
+public class CustomerMessageVo implements Serializable {
+
+    @Serial
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键ID
+     */
+    @ExcelProperty(value = "主键ID")
+    private Long id;
+
+    /**
+     * 客户ID
+     */
+    @ExcelProperty(value = "客户ID")
+    private Long customerId;
+
+    /**
+     * 消息标题
+     */
+    @ExcelProperty(value = "消息标题")
+    private String title;
+
+    /**
+     * 消息内容
+     */
+    @ExcelProperty(value = "消息内容")
+    private String content;
+
+    /**
+     * 阅读状态:0未读 1已读
+     */
+    @ExcelProperty(value = "阅读状态:0未读 1已读")
+    private String readStatus;
+
+    /**
+     * 备注
+     */
+    @ExcelProperty(value = "备注")
+    private String remark;
+
+    private Date createTime;
+
+
+}

+ 15 - 0
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/mapper/CustomerMessageMapper.java

@@ -0,0 +1,15 @@
+package org.dromara.customer.mapper;
+
+import org.dromara.customer.domain.CustomerMessage;
+import org.dromara.customer.domain.vo.CustomerMessageVo;
+import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
+
+/**
+ * 客户消息Mapper接口
+ *
+ * @author LionLi
+ * @date 2026-04-15
+ */
+public interface CustomerMessageMapper extends BaseMapperPlus<CustomerMessage, CustomerMessageVo> {
+
+}

+ 70 - 0
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/service/ICustomerMessageService.java

@@ -0,0 +1,70 @@
+package org.dromara.customer.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.dromara.common.mybatis.core.page.PageQuery;
+import org.dromara.common.mybatis.core.page.TableDataInfo;
+import org.dromara.customer.domain.CustomerMessage;
+import org.dromara.customer.domain.bo.CustomerMessageBo;
+import org.dromara.customer.domain.vo.CustomerMessageVo;
+
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * 客户消息Service接口
+ *
+ * @author LionLi
+ * @date 2026-04-15
+ */
+public interface ICustomerMessageService extends IService<CustomerMessage> {
+
+    /**
+     * 查询客户消息
+     *
+     * @param id 主键
+     * @return 客户消息
+     */
+    CustomerMessageVo queryById(Long id);
+
+    /**
+     * 分页查询客户消息列表
+     *
+     * @param bo        查询条件
+     * @param pageQuery 分页参数
+     * @return 客户消息分页列表
+     */
+    TableDataInfo<CustomerMessageVo> queryPageList(CustomerMessageBo bo, PageQuery pageQuery);
+
+    /**
+     * 查询符合条件的客户消息列表
+     *
+     * @param bo 查询条件
+     * @return 客户消息列表
+     */
+    List<CustomerMessageVo> queryList(CustomerMessageBo bo);
+
+    /**
+     * 新增客户消息
+     *
+     * @param bo 客户消息
+     * @return 是否新增成功
+     */
+    Boolean insertByBo(CustomerMessageBo bo);
+
+    /**
+     * 修改客户消息
+     *
+     * @param bo 客户消息
+     * @return 是否修改成功
+     */
+    Boolean updateByBo(CustomerMessageBo bo);
+
+    /**
+     * 校验并批量删除客户消息信息
+     *
+     * @param ids     待删除的主键集合
+     * @param isValid 是否进行有效性校验
+     * @return 是否删除成功
+     */
+    Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
+}

+ 16 - 1
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/service/impl/CustomerInfoServiceImpl.java

@@ -181,7 +181,22 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
                 .collect(Collectors.toList())
                 : Collections.emptyList()
         );
-
+        Long userId = LoginHelper.getLoginUser().getUserId();
+        // 2. 使用 Optional 和 Stream 查找并处理
+        if (Objects.nonNull(userId)) { // 或者使用 userId != null
+            Optional<CustomerContact> optionalContact = contactEntities.stream()
+                .filter(contactEntity -> Objects.equals(contactEntity.getUserId(), userId))
+                .findFirst();
+
+            // 3. 只有当找到匹配的 contact 时,才执行后续逻辑
+            optionalContact.ifPresent(contact -> {
+                CustomerDeptVo customerDeptVo = customerDeptMapper.selectVoById(contact.getDeptId());
+                // 建议增加对 customerDeptVo 的非空判断,防止 selectVoById 返回 null
+                if (customerDeptVo != null) {
+                    vo.setDeptCredit(customerDeptVo.getResidueYearlyBudget());
+                }
+            });
+        }
         return vo;
     }
 

+ 140 - 0
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/service/impl/CustomerMessageServiceImpl.java

@@ -0,0 +1,140 @@
+package org.dromara.customer.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.dromara.common.core.utils.MapstructUtils;
+import org.dromara.common.core.utils.StringUtils;
+import org.dromara.common.mybatis.core.page.PageQuery;
+import org.dromara.common.mybatis.core.page.TableDataInfo;
+import org.dromara.customer.domain.CustomerMessage;
+import org.dromara.customer.domain.bo.CustomerMessageBo;
+import org.dromara.customer.domain.vo.CustomerMessageVo;
+import org.dromara.customer.mapper.CustomerMessageMapper;
+import org.dromara.customer.service.ICustomerMessageService;
+import org.springframework.stereotype.Service;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 客户消息Service业务层处理
+ *
+ * @author LionLi
+ * @date 2026-04-15
+ */
+@Slf4j
+@RequiredArgsConstructor
+@Service
+public class CustomerMessageServiceImpl extends ServiceImpl<CustomerMessageMapper, CustomerMessage> implements ICustomerMessageService {
+
+    private final CustomerMessageMapper baseMapper;
+
+    /**
+     * 查询客户消息
+     *
+     * @param id 主键
+     * @return 客户消息
+     */
+    @Override
+    public CustomerMessageVo queryById(Long id) {
+        return baseMapper.selectVoById(id);
+    }
+
+    /**
+     * 分页查询客户消息列表
+     *
+     * @param bo        查询条件
+     * @param pageQuery 分页参数
+     * @return 客户消息分页列表
+     */
+    @Override
+    public TableDataInfo<CustomerMessageVo> queryPageList(CustomerMessageBo bo, PageQuery pageQuery) {
+        LambdaQueryWrapper<CustomerMessage> lqw = buildQueryWrapper(bo);
+        Page<CustomerMessageVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
+        return TableDataInfo.build(result);
+    }
+
+    /**
+     * 查询符合条件的客户消息列表
+     *
+     * @param bo 查询条件
+     * @return 客户消息列表
+     */
+    @Override
+    public List<CustomerMessageVo> queryList(CustomerMessageBo bo) {
+        LambdaQueryWrapper<CustomerMessage> lqw = buildQueryWrapper(bo);
+        return baseMapper.selectVoList(lqw);
+    }
+
+    private LambdaQueryWrapper<CustomerMessage> buildQueryWrapper(CustomerMessageBo bo) {
+        Map<String, Object> params = bo.getParams();
+        LambdaQueryWrapper<CustomerMessage> lqw = Wrappers.lambdaQuery();
+        lqw.orderByAsc(CustomerMessage::getId);
+        lqw.eq(bo.getCustomerId() != null, CustomerMessage::getCustomerId, bo.getCustomerId());
+        lqw.eq(bo.getUserId() != null, CustomerMessage::getUserId, bo.getUserId());
+        lqw.eq(StringUtils.isNotBlank(bo.getCustomerNo()), CustomerMessage::getCustomerNo, bo.getCustomerNo());
+        lqw.eq(StringUtils.isNotBlank(bo.getTitle()), CustomerMessage::getTitle, bo.getTitle());
+        lqw.eq(StringUtils.isNotBlank(bo.getContent()), CustomerMessage::getContent, bo.getContent());
+        lqw.eq(StringUtils.isNotBlank(bo.getReadStatus()), CustomerMessage::getReadStatus, bo.getReadStatus());
+        lqw.eq(StringUtils.isNotBlank(bo.getStatus()), CustomerMessage::getStatus, bo.getStatus());
+        lqw.eq(StringUtils.isNotBlank(bo.getPlatformCode()), CustomerMessage::getPlatformCode, bo.getPlatformCode());
+        return lqw;
+    }
+
+    /**
+     * 新增客户消息
+     *
+     * @param bo 客户消息
+     * @return 是否新增成功
+     */
+    @Override
+    public Boolean insertByBo(CustomerMessageBo bo) {
+        CustomerMessage add = MapstructUtils.convert(bo, CustomerMessage.class);
+        validEntityBeforeSave(add);
+        boolean flag = baseMapper.insert(add) > 0;
+        if (flag) {
+            bo.setId(add.getId());
+        }
+        return flag;
+    }
+
+    /**
+     * 修改客户消息
+     *
+     * @param bo 客户消息
+     * @return 是否修改成功
+     */
+    @Override
+    public Boolean updateByBo(CustomerMessageBo bo) {
+        CustomerMessage update = MapstructUtils.convert(bo, CustomerMessage.class);
+        validEntityBeforeSave(update);
+        return baseMapper.updateById(update) > 0;
+    }
+
+    /**
+     * 保存前的数据校验
+     */
+    private void validEntityBeforeSave(CustomerMessage entity) {
+        //TODO 做一些数据校验,如唯一约束
+    }
+
+    /**
+     * 校验并批量删除客户消息信息
+     *
+     * @param ids     待删除的主键集合
+     * @param isValid 是否进行有效性校验
+     * @return 是否删除成功
+     */
+    @Override
+    public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
+        if (isValid) {
+            //TODO 做一些业务上的校验,判断是否需要校验
+        }
+        return baseMapper.deleteByIds(ids) > 0;
+    }
+}

+ 7 - 0
ruoyi-modules/ruoyi-customer/src/main/resources/mapper/customer/CustomerMessageMapper.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.dromara.customer.mapper.CustomerMessageMapper">
+
+</mapper>