付费会员权益模块
This commit is contained in:
parent
07f352c820
commit
2d9889af9f
@ -0,0 +1,44 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
// 付费会员权益 VO
|
||||
export interface PaidMemberBenefitVO {
|
||||
id: number // 编号
|
||||
name: string // 名称
|
||||
iconUrl: string // 图标地址
|
||||
intro: string // 描述
|
||||
status: boolean // 状态:(默认)0隐藏 1显示
|
||||
sort: number // 排序
|
||||
}
|
||||
|
||||
// 付费会员权益 API
|
||||
export const PaidMemberBenefitApi = {
|
||||
// 查询付费会员权益分页
|
||||
getPaidMemberBenefitPage: async (params: any) => {
|
||||
return await request.get({ url: `/paidmemberbenefit/paid-member-benefit/page`, params })
|
||||
},
|
||||
|
||||
// 查询付费会员权益详情
|
||||
getPaidMemberBenefit: async (id: number) => {
|
||||
return await request.get({ url: `/paidmemberbenefit/paid-member-benefit/get?id=` + id })
|
||||
},
|
||||
|
||||
// 新增付费会员权益
|
||||
createPaidMemberBenefit: async (data: PaidMemberBenefitVO) => {
|
||||
return await request.post({ url: `/paidmemberbenefit/paid-member-benefit/create`, data })
|
||||
},
|
||||
|
||||
// 修改付费会员权益
|
||||
updatePaidMemberBenefit: async (data: PaidMemberBenefitVO) => {
|
||||
return await request.put({ url: `/paidmemberbenefit/paid-member-benefit/update`, data })
|
||||
},
|
||||
|
||||
// 删除付费会员权益
|
||||
deletePaidMemberBenefit: async (id: number) => {
|
||||
return await request.delete({ url: `/paidmemberbenefit/paid-member-benefit/delete?id=` + id })
|
||||
},
|
||||
|
||||
// 导出付费会员权益 Excel
|
||||
exportPaidMemberBenefit: async (params) => {
|
||||
return await request.download({ url: `/paidmemberbenefit/paid-member-benefit/export-excel`, params })
|
||||
},
|
||||
}
|
@ -0,0 +1,117 @@
|
||||
<template>
|
||||
<Dialog :title="dialogTitle" v-model="dialogVisible">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
label-width="100px"
|
||||
v-loading="formLoading"
|
||||
>
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input v-model="formData.name" placeholder="请输入名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="图标地址" prop="iconUrl">
|
||||
<el-input v-model="formData.iconUrl" placeholder="请输入图标地址" />
|
||||
</el-form-item>
|
||||
<el-form-item label="描述" prop="intro">
|
||||
<el-input v-model="formData.intro" placeholder="请输入描述" />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-radio-group v-model="formData.status">
|
||||
<el-radio label="1">请选择字典生成</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="排序" prop="sort">
|
||||
<el-input v-model="formData.sort" placeholder="请输入排序" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { PaidMemberBenefitApi, PaidMemberBenefitVO } from '@/api/mall/promotion/memberbenefit'
|
||||
|
||||
/** 付费会员权益 表单 */
|
||||
defineOptions({ name: 'PaidMemberBenefitForm' })
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const dialogTitle = ref('') // 弹窗的标题
|
||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||
const formData = ref({
|
||||
id: undefined,
|
||||
name: undefined,
|
||||
iconUrl: undefined,
|
||||
intro: undefined,
|
||||
status: undefined,
|
||||
sort: undefined,
|
||||
})
|
||||
const formRules = reactive({
|
||||
name: [{ required: true, message: '名称不能为空', trigger: 'blur' }],
|
||||
iconUrl: [{ required: true, message: '图标地址不能为空', trigger: 'blur' }],
|
||||
status: [{ required: true, message: '状态', trigger: 'blur' }],
|
||||
sort: [{ required: true, message: '排序不能为空', trigger: 'blur' }],
|
||||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (type: string, id?: number) => {
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = t('action.' + type)
|
||||
formType.value = type
|
||||
resetForm()
|
||||
// 修改时,设置数据
|
||||
if (id) {
|
||||
formLoading.value = true
|
||||
try {
|
||||
formData.value = await PaidMemberBenefitApi.getPaidMemberBenefit(id)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||
|
||||
/** 提交表单 */
|
||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||
const submitForm = async () => {
|
||||
// 校验表单
|
||||
await formRef.value.validate()
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = formData.value as unknown as PaidMemberBenefitVO
|
||||
if (formType.value === 'create') {
|
||||
await PaidMemberBenefitApi.createPaidMemberBenefit(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await PaidMemberBenefitApi.updatePaidMemberBenefit(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
dialogVisible.value = false
|
||||
// 发送操作成功的事件
|
||||
emit('success')
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
id: undefined,
|
||||
name: undefined,
|
||||
iconUrl: undefined,
|
||||
intro: undefined,
|
||||
status: undefined,
|
||||
sort: undefined,
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
</script>
|
@ -0,0 +1,232 @@
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form
|
||||
class="-mb-15px"
|
||||
:model="queryParams"
|
||||
ref="queryFormRef"
|
||||
:inline="true"
|
||||
label-width="68px"
|
||||
>
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input
|
||||
v-model="queryParams.name"
|
||||
placeholder="请输入名称"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="图标地址" prop="iconUrl">
|
||||
<el-input
|
||||
v-model="queryParams.iconUrl"
|
||||
placeholder="请输入图标地址"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item> -->
|
||||
<!-- <el-form-item label="描述" prop="intro">
|
||||
<el-input
|
||||
v-model="queryParams.intro"
|
||||
placeholder="请输入描述"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select
|
||||
v-model="queryParams.status"
|
||||
placeholder="请选择状态"
|
||||
clearable
|
||||
class="!w-240px"
|
||||
>
|
||||
<el-option label="请选择字典生成" value="" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="排序" prop="sort">
|
||||
<el-input
|
||||
v-model="queryParams.sort"
|
||||
placeholder="请输入排序"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-date-picker
|
||||
v-model="queryParams.createTime"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
type="daterange"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
||||
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
@click="openForm('create')"
|
||||
v-hasPermi="['paidmemberbenefit:paid-member-benefit:create']"
|
||||
>
|
||||
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
||||
</el-button>
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
@click="handleExport"
|
||||
:loading="exportLoading"
|
||||
v-hasPermi="['paidmemberbenefit:paid-member-benefit:export']"
|
||||
>
|
||||
<Icon icon="ep:download" class="mr-5px" /> 导出
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</ContentWrap>
|
||||
|
||||
<!-- 列表 -->
|
||||
<ContentWrap>
|
||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
||||
<el-table-column label=" 编号" align="center" prop="id" />
|
||||
<el-table-column label="名称" align="center" prop="name" />
|
||||
<el-table-column label="图标地址" align="center" prop="iconUrl" />
|
||||
<el-table-column label="描述" align="center" prop="intro" />
|
||||
<el-table-column label="状态" align="center" prop="status" />
|
||||
<el-table-column label="排序" align="center" prop="sort" />
|
||||
<el-table-column
|
||||
label="创建时间"
|
||||
align="center"
|
||||
prop="createTime"
|
||||
:formatter="dateFormatter"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column label="操作" align="center">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
@click="openForm('update', scope.row.id)"
|
||||
v-hasPermi="['paidmemberbenefit:paid-member-benefit:update']"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="danger"
|
||||
@click="handleDelete(scope.row.id)"
|
||||
v-hasPermi="['paidmemberbenefit:paid-member-benefit:delete']"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<Pagination
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNo"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</ContentWrap>
|
||||
|
||||
<!-- 表单弹窗:添加/修改 -->
|
||||
<PaidMemberBenefitForm ref="formRef" @success="getList" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import download from '@/utils/download'
|
||||
import { PaidMemberBenefitApi, PaidMemberBenefitVO } from '@/api/mall/promotion/memberbenefit'
|
||||
import PaidMemberBenefitForm from './PaidMemberBenefitForm.vue'
|
||||
|
||||
/** 付费会员权益 列表 */
|
||||
defineOptions({ name: 'PaidMemberBenefit' })
|
||||
|
||||
const message = useMessage() // 消息弹窗
|
||||
const { t } = useI18n() // 国际化
|
||||
|
||||
const loading = ref(true) // 列表的加载中
|
||||
const list = ref<PaidMemberBenefitVO[]>([]) // 列表的数据
|
||||
const total = ref(0) // 列表的总页数
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
name: undefined,
|
||||
iconUrl: undefined,
|
||||
intro: undefined,
|
||||
status: undefined,
|
||||
sort: undefined,
|
||||
createTime: [],
|
||||
})
|
||||
const queryFormRef = ref() // 搜索的表单
|
||||
const exportLoading = ref(false) // 导出的加载中
|
||||
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await PaidMemberBenefitApi.getPaidMemberBenefitPage(queryParams)
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.pageNo = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value.resetFields()
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/** 添加/修改操作 */
|
||||
const formRef = ref()
|
||||
const openForm = (type: string, id?: number) => {
|
||||
formRef.value.open(type, id)
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (id: number) => {
|
||||
try {
|
||||
// 删除的二次确认
|
||||
await message.delConfirm()
|
||||
// 发起删除
|
||||
await PaidMemberBenefitApi.deletePaidMemberBenefit(id)
|
||||
message.success(t('common.delSuccess'))
|
||||
// 刷新列表
|
||||
await getList()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = async () => {
|
||||
try {
|
||||
// 导出的二次确认
|
||||
await message.exportConfirm()
|
||||
// 发起导出
|
||||
exportLoading.value = true
|
||||
const data = await PaidMemberBenefitApi.exportPaidMemberBenefit(queryParams)
|
||||
download.excel(data, '付费会员权益.xls')
|
||||
} catch {
|
||||
} finally {
|
||||
exportLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 初始化 **/
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
</script>
|
@ -50,7 +50,8 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode LEVEL_HAS_USER = new ErrorCode(1_004_011_005, "用户等级下存在用户,无法删除");
|
||||
|
||||
ErrorCode EXPERIENCE_BIZ_NOT_SUPPORT = new ErrorCode(1_004_011_201, "用户经验业务类型不支持");
|
||||
|
||||
ErrorCode PAID_MEMBER_BENEFIT_NOT_EXISTS = new ErrorCode(1_004_011_202, "付费会员权益不存在");
|
||||
ErrorCode PAID_MEMBER_BENEFIT_LEVEL_RELATION_NOT_EXISTS = new ErrorCode(1_004_011_202, "会员权益和等级关系不存在");
|
||||
//========== 用户分组 1-004-012-000 ==========
|
||||
ErrorCode GROUP_NOT_EXISTS = new ErrorCode(1_004_012_000, "用户分组不存在");
|
||||
ErrorCode GROUP_HAS_USER = new ErrorCode(1_004_012_001, "用户分组下存在用户,无法删除");
|
||||
|
@ -0,0 +1,97 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.memberbenefit;
|
||||
|
||||
import cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo.PaidMemberBenefitPageReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo.PaidMemberBenefitRespVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo.PaidMemberBenefitSaveReqVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.memberbenefit.PaidMemberBenefitDO;
|
||||
import cn.iocoder.yudao.module.member.service.memberbenefit.PaidMemberBenefitService;
|
||||
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.*;
|
||||
|
||||
|
||||
@Tag(name = "管理后台 - 付费会员权益")
|
||||
@RestController
|
||||
@RequestMapping("/paidmemberbenefit/paid-member-benefit")
|
||||
@Validated
|
||||
public class PaidMemberBenefitController {
|
||||
|
||||
@Resource
|
||||
private PaidMemberBenefitService paidMemberBenefitService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建付费会员权益")
|
||||
@PreAuthorize("@ss.hasPermission('paidmemberbenefit:paid-member-benefit:create')")
|
||||
public CommonResult<Long> createPaidMemberBenefit(@Valid @RequestBody PaidMemberBenefitSaveReqVO createReqVO) {
|
||||
return success(paidMemberBenefitService.createPaidMemberBenefit(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新付费会员权益")
|
||||
@PreAuthorize("@ss.hasPermission('paidmemberbenefit:paid-member-benefit:update')")
|
||||
public CommonResult<Boolean> updatePaidMemberBenefit(@Valid @RequestBody PaidMemberBenefitSaveReqVO updateReqVO) {
|
||||
paidMemberBenefitService.updatePaidMemberBenefit(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除付费会员权益")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('paidmemberbenefit:paid-member-benefit:delete')")
|
||||
public CommonResult<Boolean> deletePaidMemberBenefit(@RequestParam("id") Long id) {
|
||||
paidMemberBenefitService.deletePaidMemberBenefit(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得付费会员权益")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('paidmemberbenefit:paid-member-benefit:query')")
|
||||
public CommonResult<PaidMemberBenefitRespVO> getPaidMemberBenefit(@RequestParam("id") Long id) {
|
||||
PaidMemberBenefitDO paidMemberBenefit = paidMemberBenefitService.getPaidMemberBenefit(id);
|
||||
return success(BeanUtils.toBean(paidMemberBenefit, PaidMemberBenefitRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得付费会员权益分页")
|
||||
@PreAuthorize("@ss.hasPermission('paidmemberbenefit:paid-member-benefit:query')")
|
||||
public CommonResult<PageResult<PaidMemberBenefitRespVO>> getPaidMemberBenefitPage(@Valid PaidMemberBenefitPageReqVO pageReqVO) {
|
||||
PageResult<PaidMemberBenefitDO> pageResult = paidMemberBenefitService.getPaidMemberBenefitPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, PaidMemberBenefitRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出付费会员权益 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('paidmemberbenefit:paid-member-benefit:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportPaidMemberBenefitExcel(@Valid PaidMemberBenefitPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<PaidMemberBenefitDO> list = paidMemberBenefitService.getPaidMemberBenefitPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "付费会员权益.xls", "数据", PaidMemberBenefitRespVO.class,
|
||||
BeanUtils.toBean(list, PaidMemberBenefitRespVO.class));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.memberbenefit.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 MemberBenefitLevelRelationPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "会员等级编号", example = "234")
|
||||
private Long memberLevelId;
|
||||
|
||||
@Schema(description = "会员权益编号", example = "8416")
|
||||
private Long memberBenefitId;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
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 MemberBenefitLevelRelationRespVO {
|
||||
|
||||
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "30308")
|
||||
@ExcelProperty("编号")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "会员等级编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "234")
|
||||
@ExcelProperty("会员等级编号")
|
||||
private Long memberLevelId;
|
||||
|
||||
@Schema(description = "会员权益编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "8416")
|
||||
@ExcelProperty("会员权益编号")
|
||||
private Long memberBenefitId;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.memberbenefit.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 MemberBenefitLevelRelationSaveReqVO {
|
||||
|
||||
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "30308")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "会员等级编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "234")
|
||||
@NotNull(message = "会员等级编号不能为空")
|
||||
private Long memberLevelId;
|
||||
|
||||
@Schema(description = "会员权益编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "8416")
|
||||
@NotNull(message = "会员权益编号不能为空")
|
||||
private Long memberBenefitId;
|
||||
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.memberbenefit.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 PaidMemberBenefitPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "名称", example = "王五")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "图标地址", example = "https://www.iocoder.cn")
|
||||
private String iconUrl;
|
||||
|
||||
@Schema(description = "描述")
|
||||
private String intro;
|
||||
|
||||
@Schema(description = "状态:(默认)0隐藏 1显示", example = "1")
|
||||
private Boolean status;
|
||||
|
||||
@Schema(description = "排序")
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
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 PaidMemberBenefitRespVO {
|
||||
|
||||
@Schema(description = " 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "29131")
|
||||
@ExcelProperty(" 编号")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
|
||||
@ExcelProperty("名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "图标地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn")
|
||||
@ExcelProperty("图标地址")
|
||||
private String iconUrl;
|
||||
|
||||
@Schema(description = "描述")
|
||||
@ExcelProperty("描述")
|
||||
private String intro;
|
||||
|
||||
@Schema(description = "状态:(默认)0隐藏 1显示", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@ExcelProperty("状态:(默认)0隐藏 1显示")
|
||||
private Boolean status;
|
||||
|
||||
@Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("排序")
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.memberbenefit.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 PaidMemberBenefitSaveReqVO {
|
||||
|
||||
@Schema(description = " 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "29131")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
|
||||
@NotEmpty(message = "名称不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "图标地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn")
|
||||
@NotEmpty(message = "图标地址不能为空")
|
||||
private String iconUrl;
|
||||
|
||||
@Schema(description = "描述")
|
||||
private String intro;
|
||||
|
||||
@Schema(description = "状态:(默认)0隐藏 1显示", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "状态:(默认)0隐藏 1显示不能为空")
|
||||
private Boolean status;
|
||||
|
||||
@Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "排序不能为空")
|
||||
private Integer sort;
|
||||
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package cn.iocoder.yudao.module.member.dal.dataobject.memberbenefit;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
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_benefit")
|
||||
@KeySequence("paid_member_benefit_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PaidMemberBenefitDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 图标地址
|
||||
*/
|
||||
private String iconUrl;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String intro;
|
||||
/**
|
||||
* 状态:(默认)0隐藏 1显示
|
||||
*/
|
||||
private Boolean status;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package cn.iocoder.yudao.module.member.dal.dataobject.memberbenefitlevelrelation;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
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_benefit_level_relation")
|
||||
@KeySequence("paid_member_benefit_level_relation_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class MemberBenefitLevelRelationDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 会员等级编号
|
||||
*/
|
||||
private Long memberLevelId;
|
||||
/**
|
||||
* 会员权益编号
|
||||
*/
|
||||
private Long memberBenefitId;
|
||||
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package cn.iocoder.yudao.module.member.dal.mysql.memberbenefit;
|
||||
|
||||
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.controller.admin.memberbenefit.vo.PaidMemberBenefitPageReqVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.memberbenefit.PaidMemberBenefitDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 付费会员权益 Mapper
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Mapper
|
||||
public interface PaidMemberBenefitMapper extends BaseMapperX<PaidMemberBenefitDO> {
|
||||
|
||||
default PageResult<PaidMemberBenefitDO> selectPage(PaidMemberBenefitPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<PaidMemberBenefitDO>()
|
||||
.likeIfPresent(PaidMemberBenefitDO::getName, reqVO.getName())
|
||||
.eqIfPresent(PaidMemberBenefitDO::getIconUrl, reqVO.getIconUrl())
|
||||
.eqIfPresent(PaidMemberBenefitDO::getIntro, reqVO.getIntro())
|
||||
.eqIfPresent(PaidMemberBenefitDO::getStatus, reqVO.getStatus())
|
||||
.eqIfPresent(PaidMemberBenefitDO::getSort, reqVO.getSort())
|
||||
.betweenIfPresent(PaidMemberBenefitDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(PaidMemberBenefitDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package cn.iocoder.yudao.module.member.dal.mysql.memberbenefitlevelrelation;
|
||||
|
||||
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.controller.admin.memberbenefit.vo.MemberBenefitLevelRelationPageReqVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.memberbenefitlevelrelation.MemberBenefitLevelRelationDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 会员权益和等级关系 Mapper
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Mapper
|
||||
public interface MemberBenefitLevelRelationMapper extends BaseMapperX<MemberBenefitLevelRelationDO> {
|
||||
|
||||
default PageResult<MemberBenefitLevelRelationDO> selectPage(MemberBenefitLevelRelationPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<MemberBenefitLevelRelationDO>()
|
||||
.eqIfPresent(MemberBenefitLevelRelationDO::getMemberLevelId, reqVO.getMemberLevelId())
|
||||
.eqIfPresent(MemberBenefitLevelRelationDO::getMemberBenefitId, reqVO.getMemberBenefitId())
|
||||
.betweenIfPresent(MemberBenefitLevelRelationDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(MemberBenefitLevelRelationDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package cn.iocoder.yudao.module.member.service.memberbenefit;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo.PaidMemberBenefitPageReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo.PaidMemberBenefitSaveReqVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.memberbenefit.PaidMemberBenefitDO;
|
||||
|
||||
/**
|
||||
* 付费会员权益 Service 接口
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
public interface PaidMemberBenefitService {
|
||||
|
||||
/**
|
||||
* 创建付费会员权益
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createPaidMemberBenefit(@Valid PaidMemberBenefitSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新付费会员权益
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updatePaidMemberBenefit(@Valid PaidMemberBenefitSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除付费会员权益
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deletePaidMemberBenefit(Long id);
|
||||
|
||||
/**
|
||||
* 获得付费会员权益
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 付费会员权益
|
||||
*/
|
||||
PaidMemberBenefitDO getPaidMemberBenefit(Long id);
|
||||
|
||||
/**
|
||||
* 获得付费会员权益分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 付费会员权益分页
|
||||
*/
|
||||
PageResult<PaidMemberBenefitDO> getPaidMemberBenefitPage(PaidMemberBenefitPageReqVO pageReqVO);
|
||||
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
package cn.iocoder.yudao.module.member.service.memberbenefit;
|
||||
|
||||
import cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo.PaidMemberBenefitPageReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo.PaidMemberBenefitSaveReqVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.memberbenefit.PaidMemberBenefitDO;
|
||||
import cn.iocoder.yudao.module.member.dal.mysql.memberbenefit.PaidMemberBenefitMapper;
|
||||
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.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.PAID_MEMBER_BENEFIT_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 付费会员权益 Service 实现类
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class PaidMemberBenefitServiceImpl implements PaidMemberBenefitService {
|
||||
|
||||
@Resource
|
||||
private PaidMemberBenefitMapper paidMemberBenefitMapper;
|
||||
|
||||
@Override
|
||||
public Long createPaidMemberBenefit(PaidMemberBenefitSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
PaidMemberBenefitDO paidMemberBenefit = BeanUtils.toBean(createReqVO, PaidMemberBenefitDO.class);
|
||||
paidMemberBenefitMapper.insert(paidMemberBenefit);
|
||||
// 返回
|
||||
return paidMemberBenefit.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePaidMemberBenefit(PaidMemberBenefitSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validatePaidMemberBenefitExists(updateReqVO.getId());
|
||||
// 更新
|
||||
PaidMemberBenefitDO updateObj = BeanUtils.toBean(updateReqVO, PaidMemberBenefitDO.class);
|
||||
paidMemberBenefitMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePaidMemberBenefit(Long id) {
|
||||
// 校验存在
|
||||
validatePaidMemberBenefitExists(id);
|
||||
// 删除
|
||||
paidMemberBenefitMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validatePaidMemberBenefitExists(Long id) {
|
||||
if (paidMemberBenefitMapper.selectById(id) == null) {
|
||||
throw exception(PAID_MEMBER_BENEFIT_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PaidMemberBenefitDO getPaidMemberBenefit(Long id) {
|
||||
return paidMemberBenefitMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<PaidMemberBenefitDO> getPaidMemberBenefitPage(PaidMemberBenefitPageReqVO pageReqVO) {
|
||||
return paidMemberBenefitMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package cn.iocoder.yudao.module.member.service.memberbenefitlevelrelation;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo.MemberBenefitLevelRelationPageReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo.MemberBenefitLevelRelationSaveReqVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.memberbenefitlevelrelation.MemberBenefitLevelRelationDO;
|
||||
|
||||
/**
|
||||
* 会员权益和等级关系 Service 接口
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
public interface MemberBenefitLevelRelationService {
|
||||
|
||||
/**
|
||||
* 创建会员权益和等级关系
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createMemberBenefitLevelRelation(@Valid MemberBenefitLevelRelationSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新会员权益和等级关系
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateMemberBenefitLevelRelation(@Valid MemberBenefitLevelRelationSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除会员权益和等级关系
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteMemberBenefitLevelRelation(Long id);
|
||||
|
||||
/**
|
||||
* 获得会员权益和等级关系
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 会员权益和等级关系
|
||||
*/
|
||||
MemberBenefitLevelRelationDO getMemberBenefitLevelRelation(Long id);
|
||||
|
||||
/**
|
||||
* 获得会员权益和等级关系分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 会员权益和等级关系分页
|
||||
*/
|
||||
PageResult<MemberBenefitLevelRelationDO> getMemberBenefitLevelRelationPage(MemberBenefitLevelRelationPageReqVO pageReqVO);
|
||||
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
package cn.iocoder.yudao.module.member.service.memberbenefitlevelrelation;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo.MemberBenefitLevelRelationPageReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo.MemberBenefitLevelRelationSaveReqVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.memberbenefitlevelrelation.MemberBenefitLevelRelationDO;
|
||||
import cn.iocoder.yudao.module.member.dal.mysql.memberbenefitlevelrelation.MemberBenefitLevelRelationMapper;
|
||||
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.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.PAID_MEMBER_BENEFIT_LEVEL_RELATION_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 会员权益和等级关系 Service 实现类
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class MemberBenefitLevelRelationServiceImpl implements MemberBenefitLevelRelationService {
|
||||
@Resource
|
||||
private MemberBenefitLevelRelationMapper memberBenefitLevelRelationMapper;
|
||||
|
||||
@Override
|
||||
public Long createMemberBenefitLevelRelation(MemberBenefitLevelRelationSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
MemberBenefitLevelRelationDO memberBenefitLevelRelation = BeanUtils.toBean(createReqVO, MemberBenefitLevelRelationDO.class);
|
||||
memberBenefitLevelRelationMapper.insert(memberBenefitLevelRelation);
|
||||
// 返回
|
||||
return memberBenefitLevelRelation.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateMemberBenefitLevelRelation(MemberBenefitLevelRelationSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateMemberBenefitLevelRelationExists(updateReqVO.getId());
|
||||
// 更新
|
||||
MemberBenefitLevelRelationDO updateObj = BeanUtils.toBean(updateReqVO, MemberBenefitLevelRelationDO.class);
|
||||
memberBenefitLevelRelationMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteMemberBenefitLevelRelation(Long id) {
|
||||
// 校验存在
|
||||
validateMemberBenefitLevelRelationExists(id);
|
||||
// 删除
|
||||
memberBenefitLevelRelationMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateMemberBenefitLevelRelationExists(Long id) {
|
||||
if (memberBenefitLevelRelationMapper.selectById(id) == null) {
|
||||
throw exception(PAID_MEMBER_BENEFIT_LEVEL_RELATION_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MemberBenefitLevelRelationDO getMemberBenefitLevelRelation(Long id) {
|
||||
return memberBenefitLevelRelationMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<MemberBenefitLevelRelationDO> getMemberBenefitLevelRelationPage(MemberBenefitLevelRelationPageReqVO pageReqVO) {
|
||||
return memberBenefitLevelRelationMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user