From b6b82502e079768d9c3b145b5125fb2b0930d756 Mon Sep 17 00:00:00 2001
From: khy <2908249413@qq.com>
Date: Mon, 28 Oct 2024 10:22:38 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BC=9A=E5=91=98=E5=8D=8F=E8=AE=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/api/member/memberagree/index.ts | 21 ++++
.../src/views/member/memberagree/index.vue | 96 +++++++++++++++++++
.../src/views/member/memberconfig/index.vue | 1 -
.../member/enums/ErrorCodeConstants.java | 1 +
.../PaidMemberAgreeController.java | 62 ++++++++++++
.../vo/PaidMemberAgreePageReqVO.java | 25 +++++
.../memberagree/vo/PaidMemberAgreeRespVO.java | 27 ++++++
.../vo/PaidMemberAgreeSaveReqVO.java | 18 ++++
.../AppPaidMemberAgreeController.java | 40 ++++++++
.../app/user/vo/AppMemberUserInfoRespVO.java | 6 +-
.../memberagree/PaidMemberAgreeConvert.java | 19 ++++
.../memberagree/PaidMemberAgreeDO.java | 36 +++++++
.../memberagree/PaidMemberAgreeMapper.java | 27 ++++++
.../memberagree/PaidMemberAgreeService.java | 59 ++++++++++++
.../PaidMemberAgreeServiceImpl.java | 96 +++++++++++++++++++
15 files changed, 531 insertions(+), 3 deletions(-)
create mode 100644 yudao-admin-vue3/src/api/member/memberagree/index.ts
create mode 100644 yudao-admin-vue3/src/views/member/memberagree/index.vue
create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberagree/PaidMemberAgreeController.java
create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberagree/vo/PaidMemberAgreePageReqVO.java
create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberagree/vo/PaidMemberAgreeRespVO.java
create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberagree/vo/PaidMemberAgreeSaveReqVO.java
create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/memberagree/AppPaidMemberAgreeController.java
create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/memberagree/PaidMemberAgreeConvert.java
create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/memberagree/PaidMemberAgreeDO.java
create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/memberagree/PaidMemberAgreeMapper.java
create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/memberagree/PaidMemberAgreeService.java
create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/memberagree/PaidMemberAgreeServiceImpl.java
diff --git a/yudao-admin-vue3/src/api/member/memberagree/index.ts b/yudao-admin-vue3/src/api/member/memberagree/index.ts
new file mode 100644
index 0000000..d56fcfd
--- /dev/null
+++ b/yudao-admin-vue3/src/api/member/memberagree/index.ts
@@ -0,0 +1,21 @@
+import request from '@/config/axios'
+
+// 会员协议 VO
+export interface PaidMemberAgreeVO {
+ id: number // 编号
+ content: string // 内容
+}
+
+// 会员协议 API
+export const PaidMemberAgreeApi = {
+ // 查询会员协议
+ getPaidMemberAgree: async () => {
+ return await request.get({ url: `/member/paid-member-agree/get`})
+ },
+
+
+ // 保存会员协议
+ savePaidMemberAgree: async (data: PaidMemberAgreeVO) => {
+ return await request.put({ url: `/member/paid-member-agree/save`, data })
+ }
+}
diff --git a/yudao-admin-vue3/src/views/member/memberagree/index.vue b/yudao-admin-vue3/src/views/member/memberagree/index.vue
new file mode 100644
index 0000000..f46a011
--- /dev/null
+++ b/yudao-admin-vue3/src/views/member/memberagree/index.vue
@@ -0,0 +1,96 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 保存
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/yudao-admin-vue3/src/views/member/memberconfig/index.vue b/yudao-admin-vue3/src/views/member/memberconfig/index.vue
index 16055ec..8fa831b 100644
--- a/yudao-admin-vue3/src/views/member/memberconfig/index.vue
+++ b/yudao-admin-vue3/src/views/member/memberconfig/index.vue
@@ -102,7 +102,6 @@ watch(
if (!newVal) {
formData.value.paidMemberPrice = false; // 当 openPaidMember 变为 false 时,重置 paidMemberPriceStatus
}
- // 注意:这里不需要处理 newVal 为 true 的情况,因为表单项会根据 v-if 指令的条件渲染
},
{ immediate: true } // 立即执行一次观察者回调,以确保初始状态正确
);
diff --git a/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/enums/ErrorCodeConstants.java b/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/enums/ErrorCodeConstants.java
index efcd957..cc4ddd2 100644
--- a/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/enums/ErrorCodeConstants.java
+++ b/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/enums/ErrorCodeConstants.java
@@ -72,6 +72,7 @@ public interface ErrorCodeConstants {
ErrorCode PAID_MEMBER_USER_NOT_OPEN = new ErrorCode(1_004_024_000, "会员未开通");
ErrorCode PAID_MEMBER_USER_PASSED = new ErrorCode(1_004_025_000, "会员已过期");
ErrorCode PAID_MEMBER_CONFIG_NOT_EXISTS = new ErrorCode(1_004_026_000, "付费会员配置不存在");
+ ErrorCode PAID_MEMBER_AGREE_NOT_EXISTS = new ErrorCode(1_004_027_000, "会员协议不存在");
}
diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberagree/PaidMemberAgreeController.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberagree/PaidMemberAgreeController.java
new file mode 100644
index 0000000..f02b1bf
--- /dev/null
+++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberagree/PaidMemberAgreeController.java
@@ -0,0 +1,62 @@
+package cn.iocoder.yudao.module.member.controller.admin.memberagree;
+
+import org.springframework.web.bind.annotation.*;
+import javax.annotation.Resource;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.security.access.prepost.PreAuthorize;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.Operation;
+
+import javax.validation.constraints.*;
+import javax.validation.*;
+import javax.servlet.http.*;
+import java.util.*;
+import java.io.IOException;
+
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.common.pojo.CommonResult;
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
+import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
+
+import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
+
+import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
+import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
+
+import cn.iocoder.yudao.module.member.controller.admin.memberagree.vo.*;
+import cn.iocoder.yudao.module.member.dal.dataobject.memberagree.PaidMemberAgreeDO;
+import cn.iocoder.yudao.module.member.service.memberagree.PaidMemberAgreeService;
+
+@Tag(name = "管理后台 - 会员协议")
+@RestController
+@RequestMapping("/member/paid-member-agree")
+@Validated
+public class PaidMemberAgreeController {
+
+ @Resource
+ private PaidMemberAgreeService paidMemberAgreeService;
+
+
+ @PutMapping("/save")
+ @Operation(summary = "更新会员协议")
+ @PreAuthorize("@ss.hasPermission('member:paid-member-agree:update')")
+ public CommonResult savePaidMemberAgree(@Valid @RequestBody PaidMemberAgreeSaveReqVO updateReqVO) {
+ paidMemberAgreeService.saveAgree(updateReqVO);
+ return success(true);
+ }
+
+
+
+ @GetMapping("/get")
+ @Operation(summary = "获得会员协议")
+ @PreAuthorize("@ss.hasPermission('member:paid-member-agree:query')")
+ public CommonResult getPaidMemberAgree() {
+ PaidMemberAgreeDO paidMemberAgree = paidMemberAgreeService.getAgree();
+ return success(BeanUtils.toBean(paidMemberAgree, PaidMemberAgreeRespVO.class));
+ }
+
+
+
+}
\ No newline at end of file
diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberagree/vo/PaidMemberAgreePageReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberagree/vo/PaidMemberAgreePageReqVO.java
new file mode 100644
index 0000000..1f1aed2
--- /dev/null
+++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberagree/vo/PaidMemberAgreePageReqVO.java
@@ -0,0 +1,25 @@
+package cn.iocoder.yudao.module.member.controller.admin.memberagree.vo;
+
+import lombok.*;
+import java.util.*;
+import io.swagger.v3.oas.annotations.media.Schema;
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import org.springframework.format.annotation.DateTimeFormat;
+import java.time.LocalDateTime;
+
+import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
+
+@Schema(description = "管理后台 - 会员协议分页 Request VO")
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+public class PaidMemberAgreePageReqVO extends PageParam {
+
+ @Schema(description = "内容")
+ private String content;
+
+ @Schema(description = "创建时间")
+ @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+ private LocalDateTime[] createTime;
+
+}
\ No newline at end of file
diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberagree/vo/PaidMemberAgreeRespVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberagree/vo/PaidMemberAgreeRespVO.java
new file mode 100644
index 0000000..db2a71f
--- /dev/null
+++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberagree/vo/PaidMemberAgreeRespVO.java
@@ -0,0 +1,27 @@
+package cn.iocoder.yudao.module.member.controller.admin.memberagree.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.*;
+import java.util.*;
+import org.springframework.format.annotation.DateTimeFormat;
+import java.time.LocalDateTime;
+import com.alibaba.excel.annotation.*;
+
+@Schema(description = "管理后台 - 会员协议 Response VO")
+@Data
+@ExcelIgnoreUnannotated
+public class PaidMemberAgreeRespVO {
+
+ @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "22863")
+ @ExcelProperty("编号")
+ private Integer id;
+
+ @Schema(description = "内容")
+ @ExcelProperty("内容")
+ private String content;
+
+ @Schema(description = "创建时间")
+ @ExcelProperty("创建时间")
+ private LocalDateTime createTime;
+
+}
\ No newline at end of file
diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberagree/vo/PaidMemberAgreeSaveReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberagree/vo/PaidMemberAgreeSaveReqVO.java
new file mode 100644
index 0000000..5aa8fa7
--- /dev/null
+++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberagree/vo/PaidMemberAgreeSaveReqVO.java
@@ -0,0 +1,18 @@
+package cn.iocoder.yudao.module.member.controller.admin.memberagree.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.*;
+import java.util.*;
+import javax.validation.constraints.*;
+
+@Schema(description = "管理后台 - 会员协议新增/修改 Request VO")
+@Data
+public class PaidMemberAgreeSaveReqVO {
+
+ @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "22863")
+ private Integer id;
+
+ @Schema(description = "内容")
+ private String content;
+
+}
\ No newline at end of file
diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/memberagree/AppPaidMemberAgreeController.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/memberagree/AppPaidMemberAgreeController.java
new file mode 100644
index 0000000..b2c5a2c
--- /dev/null
+++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/memberagree/AppPaidMemberAgreeController.java
@@ -0,0 +1,40 @@
+package cn.iocoder.yudao.module.member.controller.app.memberagree;
+
+import cn.iocoder.yudao.framework.common.pojo.CommonResult;
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
+import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
+import cn.iocoder.yudao.module.member.controller.admin.memberagree.vo.PaidMemberAgreeRespVO;
+import cn.iocoder.yudao.module.member.dal.dataobject.memberagree.PaidMemberAgreeDO;
+import cn.iocoder.yudao.module.member.service.memberagree.PaidMemberAgreeService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+
+import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
+
+@Tag(name = "用户 APP - 用户付费会员协议")
+@RestController
+@RequestMapping("/member/paid-member-agree")
+@Validated
+@Slf4j
+public class AppPaidMemberAgreeController {
+
+ @Resource
+ private PaidMemberAgreeService paidMemberAgreeService;
+
+ @GetMapping("/get")
+ @Operation(summary = "获得会员协议")
+ @PreAuthenticated
+ public CommonResult getPaidMemberAgree() {
+ PaidMemberAgreeDO paidMemberAgree = paidMemberAgreeService.getAgree();
+ return success(BeanUtils.toBean(paidMemberAgree, PaidMemberAgreeRespVO.class));
+ }
+}
+
diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/vo/AppMemberUserInfoRespVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/vo/AppMemberUserInfoRespVO.java
index ea22be3..53dce9b 100644
--- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/vo/AppMemberUserInfoRespVO.java
+++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/vo/AppMemberUserInfoRespVO.java
@@ -6,6 +6,8 @@ import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
+import java.time.LocalDateTime;
+
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "用户 APP - 用户个人信息 Response VO")
@@ -47,9 +49,9 @@ public class AppMemberUserInfoRespVO {
@Schema(description = "会员名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "季卡")
private String cardName;
- @Schema(description = "会员名称", requiredMode = Schema.RequiredMode.REQUIRED)
+ @Schema(description = "过期时间", requiredMode = Schema.RequiredMode.REQUIRED)
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
- private String cardExpirationTime;
+ private LocalDateTime cardExpirationTime;
@Schema(description = "用户 App - 会员等级")
@Data
diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/memberagree/PaidMemberAgreeConvert.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/memberagree/PaidMemberAgreeConvert.java
new file mode 100644
index 0000000..882fe0a
--- /dev/null
+++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/memberagree/PaidMemberAgreeConvert.java
@@ -0,0 +1,19 @@
+package cn.iocoder.yudao.module.member.convert.memberagree;
+
+import cn.iocoder.yudao.module.member.controller.admin.memberagree.vo.PaidMemberAgreeSaveReqVO;
+import cn.iocoder.yudao.module.member.dal.dataobject.memberagree.PaidMemberAgreeDO;
+import org.mapstruct.Mapper;
+import org.mapstruct.factory.Mappers;
+
+/**
+ * 付费会员协议 Convert
+ *
+ */
+@Mapper
+public interface PaidMemberAgreeConvert {
+
+ PaidMemberAgreeConvert INSTANCE = Mappers.getMapper(PaidMemberAgreeConvert.class);
+
+ PaidMemberAgreeDO convert(PaidMemberAgreeSaveReqVO bean);
+}
+
diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/memberagree/PaidMemberAgreeDO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/memberagree/PaidMemberAgreeDO.java
new file mode 100644
index 0000000..c63211f
--- /dev/null
+++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/memberagree/PaidMemberAgreeDO.java
@@ -0,0 +1,36 @@
+package cn.iocoder.yudao.module.member.dal.dataobject.memberagree;
+
+import lombok.*;
+import java.util.*;
+import java.time.LocalDateTime;
+import java.time.LocalDateTime;
+import java.time.LocalDateTime;
+import com.baomidou.mybatisplus.annotation.*;
+import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
+
+/**
+ * 会员协议 DO
+ *
+ * @author 管理员
+ */
+@TableName("paid_member_agree")
+@KeySequence("paid_member_agree_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class PaidMemberAgreeDO extends BaseDO {
+
+ /**
+ * 编号
+ */
+ @TableId
+ private Integer id;
+ /**
+ * 内容
+ */
+ private String content;
+
+}
\ No newline at end of file
diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/memberagree/PaidMemberAgreeMapper.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/memberagree/PaidMemberAgreeMapper.java
new file mode 100644
index 0000000..568a18e
--- /dev/null
+++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/memberagree/PaidMemberAgreeMapper.java
@@ -0,0 +1,27 @@
+package cn.iocoder.yudao.module.member.dal.mysql.memberagree;
+
+import java.util.*;
+
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
+import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
+import cn.iocoder.yudao.module.member.dal.dataobject.memberagree.PaidMemberAgreeDO;
+import org.apache.ibatis.annotations.Mapper;
+import cn.iocoder.yudao.module.member.controller.admin.memberagree.vo.*;
+
+/**
+ * 会员协议 Mapper
+ *
+ * @author 管理员
+ */
+@Mapper
+public interface PaidMemberAgreeMapper extends BaseMapperX {
+
+ default PageResult selectPage(PaidMemberAgreePageReqVO reqVO) {
+ return selectPage(reqVO, new LambdaQueryWrapperX()
+ .eqIfPresent(PaidMemberAgreeDO::getContent, reqVO.getContent())
+ .betweenIfPresent(PaidMemberAgreeDO::getCreateTime, reqVO.getCreateTime())
+ .orderByDesc(PaidMemberAgreeDO::getId));
+ }
+
+}
\ No newline at end of file
diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/memberagree/PaidMemberAgreeService.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/memberagree/PaidMemberAgreeService.java
new file mode 100644
index 0000000..a8d40c5
--- /dev/null
+++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/memberagree/PaidMemberAgreeService.java
@@ -0,0 +1,59 @@
+package cn.iocoder.yudao.module.member.service.memberagree;
+
+import java.util.*;
+import javax.validation.*;
+import cn.iocoder.yudao.module.member.controller.admin.memberagree.vo.*;
+import cn.iocoder.yudao.module.member.dal.dataobject.memberagree.PaidMemberAgreeDO;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+
+/**
+ * 会员协议 Service 接口
+ *
+ * @author 管理员
+ */
+public interface PaidMemberAgreeService {
+
+ /**
+ * 创建会员协议
+ *
+ * @param createReqVO 创建信息
+ * @return 编号
+ */
+ Integer createPaidMemberAgree(@Valid PaidMemberAgreeSaveReqVO createReqVO);
+
+ /**
+ * 更新会员协议
+ *
+ * @param updateReqVO 更新信息
+ */
+ void updatePaidMemberAgree(@Valid PaidMemberAgreeSaveReqVO updateReqVO);
+
+ /**
+ * 删除会员协议
+ *
+ * @param id 编号
+ */
+ void deletePaidMemberAgree(Integer id);
+
+ /**
+ * 获得会员协议
+ *
+ * @param id 编号
+ * @return 会员协议
+ */
+ PaidMemberAgreeDO getPaidMemberAgree(Integer id);
+
+ /**
+ * 获得会员协议分页
+ *
+ * @param pageReqVO 分页查询
+ * @return 会员协议分页
+ */
+ PageResult getPaidMemberAgreePage(PaidMemberAgreePageReqVO pageReqVO);
+
+ PaidMemberAgreeDO getAgree();
+
+ void saveAgree(@Valid PaidMemberAgreeSaveReqVO saveReqVO);
+
+}
\ No newline at end of file
diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/memberagree/PaidMemberAgreeServiceImpl.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/memberagree/PaidMemberAgreeServiceImpl.java
new file mode 100644
index 0000000..65d20c0
--- /dev/null
+++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/memberagree/PaidMemberAgreeServiceImpl.java
@@ -0,0 +1,96 @@
+package cn.iocoder.yudao.module.member.service.memberagree;
+
+import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
+import cn.iocoder.yudao.module.member.convert.memberagree.PaidMemberAgreeConvert;
+import cn.iocoder.yudao.module.member.convert.memberconfig.PaidMemberConfigConvert;
+import cn.iocoder.yudao.module.member.dal.dataobject.memberconfig.PaidMemberConfigDO;
+import org.springframework.stereotype.Service;
+import javax.annotation.Resource;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.*;
+import cn.iocoder.yudao.module.member.controller.admin.memberagree.vo.*;
+import cn.iocoder.yudao.module.member.dal.dataobject.memberagree.PaidMemberAgreeDO;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
+
+import cn.iocoder.yudao.module.member.dal.mysql.memberagree.PaidMemberAgreeMapper;
+
+import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
+import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.*;
+
+/**
+ * 会员协议 Service 实现类
+ *
+ * @author 管理员
+ */
+@Service
+@Validated
+public class PaidMemberAgreeServiceImpl implements PaidMemberAgreeService {
+
+ @Resource
+ private PaidMemberAgreeMapper paidMemberAgreeMapper;
+
+ @Override
+ public Integer createPaidMemberAgree(PaidMemberAgreeSaveReqVO createReqVO) {
+ // 插入
+ PaidMemberAgreeDO paidMemberAgree = BeanUtils.toBean(createReqVO, PaidMemberAgreeDO.class);
+ paidMemberAgreeMapper.insert(paidMemberAgree);
+ // 返回
+ return paidMemberAgree.getId();
+ }
+
+ @Override
+ public void updatePaidMemberAgree(PaidMemberAgreeSaveReqVO updateReqVO) {
+ // 校验存在
+ validatePaidMemberAgreeExists(updateReqVO.getId());
+ // 更新
+ PaidMemberAgreeDO updateObj = BeanUtils.toBean(updateReqVO, PaidMemberAgreeDO.class);
+ paidMemberAgreeMapper.updateById(updateObj);
+ }
+
+ @Override
+ public void deletePaidMemberAgree(Integer id) {
+ // 校验存在
+ validatePaidMemberAgreeExists(id);
+ // 删除
+ paidMemberAgreeMapper.deleteById(id);
+ }
+
+ private void validatePaidMemberAgreeExists(Integer id) {
+ if (paidMemberAgreeMapper.selectById(id) == null) {
+ throw exception(PAID_MEMBER_AGREE_NOT_EXISTS);
+ }
+ }
+
+ @Override
+ public PaidMemberAgreeDO getPaidMemberAgree(Integer id) {
+ return paidMemberAgreeMapper.selectById(id);
+ }
+
+ @Override
+ public PageResult getPaidMemberAgreePage(PaidMemberAgreePageReqVO pageReqVO) {
+ return paidMemberAgreeMapper.selectPage(pageReqVO);
+ }
+
+ @Override
+ public PaidMemberAgreeDO getAgree() {
+ List list = paidMemberAgreeMapper.selectList();
+ return CollectionUtils.getFirst(list);
+ }
+
+ @Override
+ public void saveAgree(PaidMemberAgreeSaveReqVO saveReqVO) {
+ //存在,则更新
+ PaidMemberAgreeDO paidMemberAgreeDO = getAgree();
+ if(paidMemberAgreeDO != null){
+ paidMemberAgreeMapper.updateById(PaidMemberAgreeConvert.INSTANCE.convert(saveReqVO).setId(paidMemberAgreeDO.getId()));
+ return;
+ }
+ //不存在,则进行插入
+ paidMemberAgreeMapper.insert(PaidMemberAgreeConvert.INSTANCE.convert(saveReqVO));
+ }
+
+}
\ No newline at end of file