From 68b182ab510ef8d323ab8cb5f5ebc8bd108d19ca Mon Sep 17 00:00:00 2001
From: cloudroam <cloudroam>
Date: 星期四, 29 八月 2024 13:52:59 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master-v2' into master-v2
---
src/main/java/com/mzl/flower/service/point/impl/CustomerPointDetailServiceImpl.java | 76 ++++++++++++++++++++++++++++++++++++++
1 files changed, 76 insertions(+), 0 deletions(-)
diff --git a/src/main/java/com/mzl/flower/service/point/impl/CustomerPointDetailServiceImpl.java b/src/main/java/com/mzl/flower/service/point/impl/CustomerPointDetailServiceImpl.java
new file mode 100644
index 0000000..c33236b
--- /dev/null
+++ b/src/main/java/com/mzl/flower/service/point/impl/CustomerPointDetailServiceImpl.java
@@ -0,0 +1,76 @@
+package com.mzl.flower.service.point.impl;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.mzl.flower.config.exception.ValidationException;
+import com.mzl.flower.config.security.SecurityUtils;
+import com.mzl.flower.dto.request.point.CustomerPointDetailDTO;
+import com.mzl.flower.dto.request.point.CustomerPointDetailQueryDTO;
+import com.mzl.flower.dto.response.point.CustomerPointDetailVO;
+import com.mzl.flower.entity.point.CustomerPointDetail;
+import com.mzl.flower.mapper.point.CustomerPointDetailMapper;
+import com.mzl.flower.service.point.CustomerPointDetailService;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.BeanUtils;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+/**
+ * @author fanghaowei
+ * @version version2.0
+ * @className MemberServiceImpl
+ * @date 2024/8/26
+ * @description 积分记录
+ */
+@Service
+@Transactional
+@RequiredArgsConstructor
+public class CustomerPointDetailServiceImpl extends ServiceImpl<CustomerPointDetailMapper, CustomerPointDetail> implements CustomerPointDetailService {
+
+ private final CustomerPointDetailMapper customerPointDetailMapper;
+
+ @Override
+ public void save(CustomerPointDetailDTO customerPointDetailDTO) {
+ if (customerPointDetailDTO.getId() != null) {
+ throw new ValidationException("id必须为空");
+ }
+ CustomerPointDetail customerPointDetail = new CustomerPointDetail();
+ BeanUtils.copyProperties(customerPointDetailDTO, customerPointDetail);
+ customerPointDetail.create(SecurityUtils.getUserId());
+ customerPointDetailMapper.insert(customerPointDetail);
+ }
+
+ @Override
+ public void update(CustomerPointDetailDTO customerPointDetailDTO) {
+ if (customerPointDetailDTO.getId() == null || customerPointDetailDTO.getId() == 0) {
+ throw new ValidationException("id不能为空");
+ }
+ CustomerPointDetail customerPointDetail = customerPointDetailMapper.selectById(customerPointDetailDTO.getId());
+ if (customerPointDetail == null) {
+ throw new ValidationException("找不到id为" + customerPointDetail.getId() + "的积分记录");
+ }
+ BeanUtils.copyProperties(customerPointDetailDTO, customerPointDetail, "id", "createTime", "createBy", "deleted", "status");
+ customerPointDetail.update(SecurityUtils.getUserId());
+ customerPointDetailMapper.updateById(customerPointDetail);
+ }
+
+
+ @Override
+ public void delete(Long id) {
+ CustomerPointDetail customerPointDetail = customerPointDetailMapper.selectById(id);
+ if (customerPointDetail == null) {
+ throw new ValidationException("找不到id为" + id + "的积分记录");
+ }
+ customerPointDetailMapper.deleteById(id);
+
+ }
+
+ @Override
+ public Page<CustomerPointDetailVO> queryPage(CustomerPointDetailQueryDTO customerPointDetailQueryDTO, Page page) {
+ List<CustomerPointDetailVO> list = customerPointDetailMapper.queryPage(customerPointDetailQueryDTO, page);
+ page.setRecords(list);
+ return page;
+ }
+}
--
Gitblit v1.9.3