You've already forked FrameTour-BE
- 添加用户通知授权记录的完整CRUD操作 - 实现授权次数的记录与消费逻辑 - 提供授权状态检查与剩余次数查询接口 - 支持按用户、模板或景区维度查询授权记录 - 新增授权统计信息接口,包括总授权数、消费数等 - 完成移动端相关请求/响应DTO定义 - 集成MyBatis Mapper实现数据持久化操作 - 添加服务层事务控制确保操作一致性
92 lines
2.6 KiB
Java
92 lines
2.6 KiB
Java
package com.ycwl.basic.mapper;
|
|
|
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
import com.ycwl.basic.model.pc.notify.entity.UserNotificationAuthorizationEntity;
|
|
import org.apache.ibatis.annotations.Mapper;
|
|
import org.apache.ibatis.annotations.Param;
|
|
|
|
import java.util.List;
|
|
|
|
/**
|
|
* 用户通知授权记录Mapper接口
|
|
*
|
|
* @Author: System
|
|
* @Date: 2024/12/28
|
|
*/
|
|
@Mapper
|
|
public interface UserNotificationAuthorizationMapper extends BaseMapper<UserNotificationAuthorizationEntity> {
|
|
|
|
/**
|
|
* 根据用户ID、模板ID和景区ID查询授权记录
|
|
*
|
|
* @param memberId 用户ID
|
|
* @param templateId 模板ID
|
|
* @param scenicId 景区ID
|
|
* @return 授权记录
|
|
*/
|
|
UserNotificationAuthorizationEntity selectByMemberAndTemplateAndScenic(
|
|
@Param("memberId") Long memberId,
|
|
@Param("templateId") String templateId,
|
|
@Param("scenicId") Long scenicId
|
|
);
|
|
|
|
/**
|
|
* 根据用户ID查询授权记录列表
|
|
*
|
|
* @param memberId 用户ID
|
|
* @return 授权记录列表
|
|
*/
|
|
List<UserNotificationAuthorizationEntity> selectByMemberId(@Param("memberId") Long memberId);
|
|
|
|
/**
|
|
* 根据用户ID和模板ID查询授权记录列表
|
|
*
|
|
* @param memberId 用户ID
|
|
* @param templateId 模板ID
|
|
* @return 授权记录列表
|
|
*/
|
|
List<UserNotificationAuthorizationEntity> selectByMemberIdAndTemplateId(
|
|
@Param("memberId") Long memberId,
|
|
@Param("templateId") String templateId
|
|
);
|
|
|
|
/**
|
|
* 根据景区ID查询授权记录列表
|
|
*
|
|
* @param scenicId 景区ID
|
|
* @return 授权记录列表
|
|
*/
|
|
List<UserNotificationAuthorizationEntity> selectByScenicId(@Param("scenicId") Long scenicId);
|
|
|
|
/**
|
|
* 增加授权次数
|
|
*
|
|
* @param id 记录ID
|
|
* @param count 增加的数量
|
|
* @return 影响行数
|
|
*/
|
|
int increaseAuthorizationCount(@Param("id") Long id, @Param("count") Integer count);
|
|
|
|
/**
|
|
* 增加消费次数
|
|
*
|
|
* @param id 记录ID
|
|
* @param count 增加的数量
|
|
* @return 影响行数
|
|
*/
|
|
int increaseConsumedCount(@Param("id") Long id, @Param("count") Integer count);
|
|
|
|
/**
|
|
* 检查用户是否还有剩余授权次数
|
|
*
|
|
* @param memberId 用户ID
|
|
* @param templateId 模板ID
|
|
* @param scenicId 景区ID
|
|
* @return 剩余授权次数
|
|
*/
|
|
Integer selectRemainingCount(
|
|
@Param("memberId") Long memberId,
|
|
@Param("templateId") String templateId,
|
|
@Param("scenicId") Long scenicId
|
|
);
|
|
} |