完成了Web端课程模块

This commit is contained in:
2025-06-24 09:18:01 +08:00
parent 746ac2c6bd
commit 7ca23bc987
63 changed files with 1297 additions and 478 deletions

View File

@ -0,0 +1,10 @@
package com.greenorange.promotion.annotation;
/**
* 所有待校验的枚举都应实现此接口,
* 并通过 getValue() 返回其对应的校验字符串。
*/
public interface BaseEnum {
/** 返回该枚举常量对应的校验值 */
String getValue();
}

View File

@ -0,0 +1,18 @@
package com.greenorange.promotion.annotation;
import jakarta.validation.Constraint;
import jakarta.validation.Payload;
import java.lang.annotation.*;
@Documented
@Constraint(validatedBy = EnumValueValidator.class)
@Target({ ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
public @interface EnumValue {
String message() default "无效的枚举值";
Class<?>[] groups() default {};
Class<? extends Payload>[] payload() default {};
/** 要校验的枚举类,必须实现 BaseEnum */
Class<? extends BaseEnum> enumClass();
}

View File

@ -0,0 +1,28 @@
package com.greenorange.promotion.annotation;
import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* 初始化时从 enumClass 拿到所有常量的 getValue()
* 然后在 isValid 中判断传入值是否包含于其中。
*/
public class EnumValueValidator implements ConstraintValidator<EnumValue, String> {
private Set<String> validValues;
@Override
public void initialize(EnumValue annotation) {
Class<? extends BaseEnum> enumClass = annotation.enumClass();
validValues = Stream.of(enumClass.getEnumConstants())
.map(BaseEnum::getValue)
.collect(Collectors.toSet());
}
@Override
public boolean isValid(String value, ConstraintValidatorContext context) {
return validValues.contains(value);
}
}

View File

@ -1,20 +0,0 @@
package com.greenorange.promotion.annotation;
import com.greenorange.promotion.model.enums.FileUploadBizEnum;
import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;
// 枚举校验器
public class FileEnumValidator implements ConstraintValidator<FileEnumValue, String> {
@Override
public void initialize(FileEnumValue constraintAnnotation) {
}
@Override
public boolean isValid(String value, ConstraintValidatorContext context) {
return FileUploadBizEnum.getEnumByValue(value) != null;
}
}

View File

@ -1,20 +0,0 @@
package com.greenorange.promotion.annotation;
import jakarta.validation.Constraint;
import jakarta.validation.Payload;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
// 自定义校验注解
@Constraint(validatedBy = FileEnumValidator.class)
@Target({ ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
public @interface FileEnumValue {
String message() default "文件业务类型错误"; // 错误信息
Class<?>[] groups() default {}; // 组别
Class<? extends Payload>[] payload() default {}; // 负载
Class<? extends Enum<?>> enumClass(); // 枚举类类型
}

View File

@ -1,18 +0,0 @@
package com.greenorange.promotion.annotation;
import com.greenorange.promotion.model.enums.ProjectStatusEnum;
import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;
public class ProjectStatusEnumValidator implements ConstraintValidator<ProjectStatusEnumValue, String> {
@Override
public void initialize(ProjectStatusEnumValue constraintAnnotation) {
}
@Override
public boolean isValid(String value, ConstraintValidatorContext context) {
return ProjectStatusEnum.getEnumByValue(value) != null;
}
}

View File

@ -1,22 +0,0 @@
package com.greenorange.promotion.annotation;
import jakarta.validation.Constraint;
import jakarta.validation.Payload;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
// 自定义校验注解
@Constraint(validatedBy = ProjectStatusEnumValidator.class)
@Target({ ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
public @interface ProjectStatusEnumValue {
String message() default "项目状态错误"; // 错误信息
Class<?>[] groups() default {}; // 组别
Class<? extends Payload>[] payload() default {}; // 负载
Class<? extends Enum<?>> enumClass(); // 枚举类类型
}

View File

@ -1,22 +0,0 @@
package com.greenorange.promotion.annotation;
import com.greenorange.promotion.model.enums.UserRoleEnum;
import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;
// 枚举校验器
public class UserEnumValidator implements ConstraintValidator<UserEnumValue, String> {
@Override
public void initialize(UserEnumValue constraintAnnotation) {
}
@Override
public boolean isValid(String value, ConstraintValidatorContext context) {
return UserRoleEnum.getEnumByValue(value) != null;
}
}

View File

@ -1,20 +0,0 @@
package com.greenorange.promotion.annotation;
import jakarta.validation.Constraint;
import jakarta.validation.Payload;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
// 自定义校验注解
@Constraint(validatedBy = UserEnumValidator.class)
@Target({ ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
public @interface UserEnumValue {
String message() default "无效的用户角色"; // 错误信息
Class<?>[] groups() default {}; // 组别
Class<? extends Payload>[] payload() default {}; // 负载
Class<? extends Enum<?>> enumClass(); // 枚举类类型
}

View File

@ -1,18 +0,0 @@
package com.greenorange.promotion.annotation;
import com.greenorange.promotion.model.enums.WithdrawStatusEnum;
import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;
public class WithdrawStatusEnumValidator implements ConstraintValidator<WithdrawStatusEnumValue, String> {
@Override
public void initialize(WithdrawStatusEnumValue constraintAnnotation) {
}
@Override
public boolean isValid(String value, ConstraintValidatorContext context) {
return WithdrawStatusEnum.getEnumByValue(value) != null;
}
}

View File

@ -1,21 +0,0 @@
package com.greenorange.promotion.annotation;
import jakarta.validation.Constraint;
import jakarta.validation.Payload;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
// 自定义校验注解
@Constraint(validatedBy = WithdrawStatusEnumValidator.class)
@Target({ ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
public @interface WithdrawStatusEnumValue {
String message() default "提现状态错误"; // 错误信息
Class<?>[] groups() default {}; // 组别
Class<? extends Payload>[] payload() default {}; // 负载
Class<? extends Enum<?>> enumClass(); // 枚举类类型
}

View File

@ -2,8 +2,6 @@ package com.greenorange.promotion.constant;
/**
* 正则表达式常量
*
* @author <a href="https://xuande-hk.gitee.io">玄德</a>
*/
@SuppressWarnings("all")
public interface RegexConstant {

View File

@ -0,0 +1,145 @@
package com.greenorange.promotion.controller.course;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.greenorange.promotion.annotation.RequiresPermission;
import com.greenorange.promotion.annotation.SysLog;
import com.greenorange.promotion.common.BaseResponse;
import com.greenorange.promotion.common.ResultUtils;
import com.greenorange.promotion.constant.UserConstant;
import com.greenorange.promotion.model.dto.CommonBatchRequest;
import com.greenorange.promotion.model.dto.CommonRequest;
import com.greenorange.promotion.model.dto.courseChapter.CourseChapterAddRequest;
import com.greenorange.promotion.model.dto.courseChapter.CourseChapterQueryRequest;
import com.greenorange.promotion.model.dto.courseChapter.CourseChapterUpdateRequest;
import com.greenorange.promotion.model.entity.CourseChapter;
import com.greenorange.promotion.model.vo.courseChapter.CourseChapterVO;
import com.greenorange.promotion.service.common.CommonService;
import com.greenorange.promotion.service.course.CourseChapterService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 课程章节 控制器
*/
@RestController
@RequestMapping("courseChapter")
@Slf4j
@Tag(name = "课程章节模块")
public class CourseChapterController {
@Resource
private CourseChapterService courseChapterService;
@Resource
private CommonService commonService;
/**
* web端管理员添加课程章节
* @param courseChapterAddRequest 课程章节添加请求体
* @return 是否添加成功
*/
@PostMapping("add")
@Operation(summary = "web端管理员添加课程章节", description = "参数课程章节添加请求体权限管理员方法名addCourseChapter")
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
@SysLog(title = "课程章节管理", content = "web端管理员添加课程章节")
public BaseResponse<Long> addCourseChapter(@Valid @RequestBody CourseChapterAddRequest courseChapterAddRequest) {
CourseChapter courseChapter = commonService.copyProperties(courseChapterAddRequest, CourseChapter.class);
courseChapterService.save(courseChapter);
return ResultUtils.success(courseChapter.getId());
}
/**
* web端管理员根据id修改课程章节信息
* @param courseChapterUpdateRequest 课程章节更新请求体
* @return 是否更新成功
*/
@PostMapping("update")
@Operation(summary = "web端管理员根据id修改课程章节", description = "参数课程章节更新请求体权限管理员方法名updateCourseChapter")
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
@SysLog(title = "课程章节管理", content = "web端管理员根据id修改课程章节信息")
public BaseResponse<Boolean> updateCourseChapter(@Valid @RequestBody CourseChapterUpdateRequest courseChapterUpdateRequest) {
CourseChapter courseChapter = commonService.copyProperties(courseChapterUpdateRequest, CourseChapter.class);
courseChapterService.updateById(courseChapter);
return ResultUtils.success(true);
}
/**
* web端管理员根据id删除课程章节
* @param commonRequest 课程章节删除请求体
* @return 是否删除成功
*/
@PostMapping("delete")
@Operation(summary = "web端管理员根据id删除课程章节", description = "参数课程章节删除请求体权限管理员方法名delCourseChapter")
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
@SysLog(title = "课程章节管理", content = "web端管理员根据id删除课程章节")
public BaseResponse<Boolean> delCourseChapter(@Valid @RequestBody CommonRequest commonRequest) {
Long id = commonRequest.getId();
courseChapterService.removeById(id);
return ResultUtils.success(true);
}
/**
* web端管理员批量删除课程章节
* @param commonBatchRequest 课程章节批量删除请求体
* @return 是否删除成功
*/
@PostMapping("delBatch")
@Operation(summary = "web端管理员批量删除课程章节", description = "参数课程章节批量删除请求体权限管理员方法名delBatchCourseChapter")
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
@SysLog(title = "课程章节管理", content = "web端管理员批量删除课程章节")
public BaseResponse<Boolean> delBatchCourseChapter(@Valid @RequestBody CommonBatchRequest commonBatchRequest) {
List<Long> ids = commonBatchRequest.getIds();
courseChapterService.removeByIds(ids);
return ResultUtils.success(true);
}
/**
* web端管理员根据id查询课程章节
* @param commonRequest 课程章节查询请求体
* @return 课程章节信息
*/
@PostMapping("queryById")
@Operation(summary = "web端管理员根据id查询课程章节", description = "参数课程章节查询请求体权限管理员方法名queryCourseChapterById")
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
@SysLog(title = "课程章节管理", content = "web端管理员根据id查询课程章节")
public BaseResponse<CourseChapterVO> queryCourseChapterById(@Valid @RequestBody CommonRequest commonRequest) {
Long id = commonRequest.getId();
CourseChapter courseChapter = courseChapterService.getById(id);
CourseChapterVO courseChapterVO = commonService.copyProperties(courseChapter, CourseChapterVO.class);
return ResultUtils.success(courseChapterVO);
}
/**
* Web端管理员分页查询课程章节
* @param courseChapterQueryRequest 课程章节查询请求体
* @return 课程章节列表
*/
@PostMapping("page")
@Operation(summary = "Web端管理员分页查询课程章节", description = "参数课程章节查询请求体权限管理员方法名listCourseChapterByPage")
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
@SysLog(title = "课程章节管理", content = "Web端管理员分页查询课程章节")
public BaseResponse<Page<CourseChapterVO>> listCourseChapterByPage(@Valid @RequestBody CourseChapterQueryRequest courseChapterQueryRequest) {
long current = courseChapterQueryRequest.getCurrent();
long pageSize = courseChapterQueryRequest.getPageSize();
QueryWrapper<CourseChapter> queryWrapper = courseChapterService.getQueryWrapper(courseChapterQueryRequest);
Page<CourseChapter> page = courseChapterService.page(new Page<>(current, pageSize), queryWrapper);
List<CourseChapter> courseChapterList = page.getRecords();
List<CourseChapterVO> courseChapterVOList = commonService.convertList(courseChapterList, CourseChapterVO.class);
Page<CourseChapterVO> voPage = new Page<>(current, pageSize);
voPage.setRecords(courseChapterVOList);
voPage.setPages(page.getPages());
voPage.setTotal(page.getTotal());
return ResultUtils.success(voPage);
}
}

View File

@ -0,0 +1,160 @@
package com.greenorange.promotion.controller.course;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.greenorange.promotion.annotation.RequiresPermission;
import com.greenorange.promotion.annotation.SysLog;
import com.greenorange.promotion.common.BaseResponse;
import com.greenorange.promotion.common.ResultUtils;
import com.greenorange.promotion.constant.UserConstant;
import com.greenorange.promotion.model.dto.CommonBatchRequest;
import com.greenorange.promotion.model.dto.CommonRequest;
import com.greenorange.promotion.model.dto.course.CourseAddRequest;
import com.greenorange.promotion.model.dto.course.CourseQueryRequest;
import com.greenorange.promotion.model.dto.course.CourseUpdateRequest;
import com.greenorange.promotion.model.entity.Course;
import com.greenorange.promotion.model.entity.CourseChapter;
import com.greenorange.promotion.model.vo.course.CourseVO;
import com.greenorange.promotion.service.common.CommonService;
import com.greenorange.promotion.service.course.CourseChapterService;
import com.greenorange.promotion.service.course.CourseService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 课程 控制器
*/
@RestController
@RequestMapping("course")
@Slf4j
@Tag(name = "课程模块")
public class CourseController {
@Resource
private CourseService courseService;
@Resource
private CommonService commonService;
@Resource
private CourseChapterService courseChapterService;
/**
* web端管理员添加课程
* @param courseAddRequest 课程添加请求体
* @return 是否添加成功
*/
@PostMapping("add")
@Operation(summary = "web端管理员添加课程", description = "参数课程添加请求体权限管理员方法名addCourse")
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
@SysLog(title = "课程管理", content = "web端管理员添加课程")
public BaseResponse<Long> addCourse(@Valid @RequestBody CourseAddRequest courseAddRequest) {
Course course = commonService.copyProperties(courseAddRequest, Course.class);
courseService.save(course);
return ResultUtils.success(course.getId());
}
/**
* web端管理员根据id修改课程信息
* @param courseUpdateRequest 课程更新请求体
* @return 是否更新成功
*/
@PostMapping("update")
@Operation(summary = "web端管理员根据id修改课程", description = "参数课程更新请求体权限管理员方法名updateCourse")
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
@SysLog(title = "课程管理", content = "web端管理员根据id修改课程信息")
public BaseResponse<Boolean> updateCourse(@Valid @RequestBody CourseUpdateRequest courseUpdateRequest) {
Course course = commonService.copyProperties(courseUpdateRequest, Course.class);
courseService.updateById(course);
return ResultUtils.success(true);
}
/**
* web端管理员根据id删除课程
* @param commonRequest 课程删除请求体
* @return 是否删除成功
*/
@PostMapping("delete")
@Operation(summary = "web端管理员根据id删除课程", description = "参数课程删除请求体权限管理员方法名delCourse")
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
@SysLog(title = "课程管理", content = "web端管理员根据id删除课程")
public BaseResponse<Boolean> delCourse(@Valid @RequestBody CommonRequest commonRequest) {
Long id = commonRequest.getId();
courseService.removeById(id);
// 删除课程下的所有章节
LambdaQueryWrapper<CourseChapter> lambdaQueryWrapper = commonService.buildQueryWrapperByField(CourseChapter::getCourseId, id, courseChapterService);
courseChapterService.remove(lambdaQueryWrapper);
return ResultUtils.success(true);
}
/**
* web端管理员批量删除课程
* @param commonBatchRequest 课程批量删除请求体
* @return 是否删除成功
*/
@PostMapping("delBatch")
@Operation(summary = "web端管理员批量删除课程", description = "参数课程批量删除请求体权限管理员方法名delBatchCourse")
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
@SysLog(title = "课程管理", content = "web端管理员批量删除课程")
public BaseResponse<Boolean> delBatchCourse(@Valid @RequestBody CommonBatchRequest commonBatchRequest) {
List<Long> ids = commonBatchRequest.getIds();
courseService.removeByIds(ids);
// 批量删除课程下的所有章节
LambdaQueryWrapper<CourseChapter> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.in(CourseChapter::getCourseId, ids);
courseChapterService.remove(lambdaQueryWrapper);
return ResultUtils.success(true);
}
/**
* web端管理员根据id查询课程
* @param commonRequest 课程查询请求体
* @return 课程信息
*/
@PostMapping("queryById")
@Operation(summary = "web端管理员根据id查询课程", description = "参数课程查询请求体权限管理员方法名queryCourseById")
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
@SysLog(title = "课程管理", content = "web端管理员根据id查询课程")
public BaseResponse<CourseVO> queryCourseById(@Valid @RequestBody CommonRequest commonRequest) {
Long id = commonRequest.getId();
Course course = courseService.getById(id);
CourseVO courseVO = commonService.copyProperties(course, CourseVO.class);
return ResultUtils.success(courseVO);
}
/**
* Web端管理员分页查询课程
* @param courseQueryRequest 课程查询请求体
* @return 课程列表
*/
@PostMapping("page")
@Operation(summary = "Web端管理员分页查询课程", description = "参数课程查询请求体权限管理员方法名listCourseByPage")
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
@SysLog(title = "课程管理", content = "Web端管理员分页查询课程")
public BaseResponse<Page<CourseVO>> listCourseByPage(@Valid @RequestBody CourseQueryRequest courseQueryRequest) {
long current = courseQueryRequest.getCurrent();
long pageSize = courseQueryRequest.getPageSize();
QueryWrapper<Course> queryWrapper = courseService.getQueryWrapper(courseQueryRequest);
Page<Course> page = courseService.page(new Page<>(current, pageSize), queryWrapper);
List<Course> courseList = page.getRecords();
List<CourseVO> courseVOList = commonService.convertList(courseList, CourseVO.class);
Page<CourseVO> voPage = new Page<>(current, pageSize);
voPage.setRecords(courseVOList);
voPage.setPages(page.getPages());
voPage.setTotal(page.getTotal());
return ResultUtils.success(voPage);
}
}

View File

@ -50,16 +50,29 @@ public class GlobalExceptionHandler {
// 处理参数绑定失败的异常
@ExceptionHandler(MethodArgumentNotValidException.class)
public BaseResponse<?> handleMethodArgumentNotValidException(MethodArgumentNotValidException e) {
StringBuilder errors = new StringBuilder();
// 按字段名排序,确保每次返回的顺序一致
e.getBindingResult().getFieldErrors().stream()
.sorted(Comparator.comparing(FieldError::getField)) // 按字段名排序
.forEach(fieldError -> errors.append("参数: ")
.append(fieldError.getField())
.append(" | 错误: ")
.append(fieldError.getDefaultMessage())
.append("; "));
return ResultUtils.error(ErrorCode.PARAMS_ERROR, errors.toString());
// StringBuilder errors = new StringBuilder();
// // 按字段名排序,确保每次返回的顺序一致
// e.getBindingResult().getFieldErrors().stream()
// .sorted(Comparator.comparing(FieldError::getField)) // 按字段名排序
// .forEach(fieldError -> errors.append("参数: ")
// .append(fieldError.getField())
// .append(" | 错误: ")
// .append(fieldError.getDefaultMessage())
// .append("; "));
// return ResultUtils.error(ErrorCode.PARAMS_ERROR, errors.toString());
// 从所有 FieldError 里,排序后取第一个
FieldError firstError = e.getBindingResult()
.getFieldErrors().stream().min(Comparator.comparing(FieldError::getField))
.orElse(null);
// 直接取它的 defaultMessage即注解里配置的 message
String msg = (firstError != null)
? firstError.getDefaultMessage()
: "参数校验失败";
// 返回时只带 msg不再拼前缀或字段名
return ResultUtils.error(ErrorCode.PARAMS_ERROR, msg);
}

View File

@ -15,9 +15,9 @@ import java.util.*;
public class Generator {
// 数据源配置
private static final String DATASOURCE_URL = "jdbc:mysql://1.94.237.210:3306/qingcheng?serverTimezone=Asia/Shanghai";
private static final String DATASOURCE_URL = "jdbc:mysql://27.30.77.229:3306/qingcheng_dev?serverTimezone=Asia/Shanghai";
private static final String USERNAME = "qingcheng";
private static final String PASSWORD = "Qc@123456";
private static final String PASSWORD = "Qc@8ls2jf";
// 输出路径
private static final String OUTPUT_PATH = System.getProperty("user.dir");
@ -27,13 +27,13 @@ public class Generator {
// 作者
private static final String AUTHOR = "chenxinzhi";
// 表注释
private static final String TABLE_COMMENT = "用户账户";
private static final String TABLE_COMMENT = "课程章节";
// 实体类名
private static final String ENTITY_NAME = "UserAccount";
private static final String ENTITY_NAME = "CourseChapter";
// 表名
private static final String TABLE_NAME = "user_account";
private static final String TABLE_NAME = "course_chapter";
// 实体类属性名
private static final String ENTITY_NAME_LOWER = "userAccount";
private static final String ENTITY_NAME_LOWER = "courseChapter";
// 父包名
private static final String PARENT_PATH = "com.greenorange.promotion";

View File

@ -5,8 +5,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @author 35880
* @description 针对表【course_chapter】的数据库操作Mapper
* @createDate 2025-06-23 18:07:34
* @description 针对表【course_chapter(课程章节表)】的数据库操作Mapper
* @createDate 2025-06-23 18:30:28
* @Entity com.greenorange.promotion.model.entity.CourseChapter
*/
public interface CourseChapterMapper extends BaseMapper<CourseChapter> {

View File

@ -5,8 +5,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @author 35880
* @description 针对表【course】的数据库操作Mapper
* @createDate 2025-06-23 17:06:12
* @description 针对表【course(课程表)】的数据库操作Mapper
* @createDate 2025-06-23 18:29:49
* @Entity com.greenorange.promotion.model.entity.Course
*/
public interface CourseMapper extends BaseMapper<Course> {

View File

@ -5,8 +5,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @author 35880
* @description 针对表【course_order】的数据库操作Mapper
* @createDate 2025-06-23 18:08:14
* @description 针对表【course_order(课程订单表)】的数据库操作Mapper
* @createDate 2025-06-23 18:31:13
* @Entity com.greenorange.promotion.model.entity.CourseOrder
*/
public interface CourseOrderMapper extends BaseMapper<CourseOrder> {

View File

@ -5,8 +5,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @author 35880
* @description 针对表【promo_record】的数据库操作Mapper
* @createDate 2025-06-23 18:09:37
* @description 针对表【promo_record(推广记录表)】的数据库操作Mapper
* @createDate 2025-06-23 18:31:45
* @Entity com.greenorange.promotion.model.entity.PromoRecord
*/
public interface PromoRecordMapper extends BaseMapper<PromoRecord> {

View File

@ -5,8 +5,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @author 35880
* @description 针对表【rake_reward】的数据库操作Mapper
* @createDate 2025-06-23 18:09:57
* @description 针对表【rake_reward(课程抽成记录表)】的数据库操作Mapper
* @createDate 2025-06-23 18:32:46
* @Entity com.greenorange.promotion.model.entity.RakeReward
*/
public interface RakeRewardMapper extends BaseMapper<RakeReward> {

View File

@ -0,0 +1,99 @@
package com.greenorange.promotion.model.dto.course;
import com.greenorange.promotion.annotation.EnumValue;
import com.greenorange.promotion.model.enums.CourseTypeEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.DecimalMin;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
import java.math.BigDecimal;
import java.io.Serial;
import java.io.Serializable;
/**
* 课程添加请求体
*/
@Data
@Schema(description = "课程添加请求体", requiredProperties = {
"name",
"type",
"detail",
"promoCodeDesc",
"image",
"originPrice",
"discountPrice",
"firstLevelRate",
"secondLevelRate",
})
public class CourseAddRequest implements Serializable {
/**
* 课程名称
*/
@NotBlank(message = "课程名称不能为空")
@Schema(description = "课程名称", example = "数据分析工程师训练营")
private String name;
/**
* 课程类别[考公考研,自媒体,财经]
*/
@NotBlank(message = "课程类别不能为空")
@EnumValue(enumClass = CourseTypeEnum.class)
@Schema(description = "课程类别[考公考研,自媒体,财经]", example = "自媒体")
private String type;
/**
* 课程概述(富文本)
*/
@NotBlank(message = "课程概述(富文本)不能为空")
@Schema(description = "课程概述(富文本)", example = "富文本")
private String detail;
/**
* 推广码说明(富文本)
*/
@NotBlank(message = "推广码说明(富文本)不能为空")
@Schema(description = "推广码说明(富文本)", example = "富文本")
private String promoCodeDesc;
/**
* 课程图片URL
*/
@NotBlank(message = "课程图片URL不能为空")
@Schema(description = "课程图片URL", example = "324IEHJDE")
private String image;
/**
* 课程原价
*/
@DecimalMin(value = "0", message = "课程原价不能小于0")
@Schema(description = "课程原价", example = "3499")
private BigDecimal originPrice;
/**
* 折扣价格
*/
@DecimalMin(value = "0", message = "折扣价格不能小于0")
@Schema(description = "折扣价格", example = "2499")
private BigDecimal discountPrice;
/**
* 一级佣金比例(%
*/
@DecimalMin(value = "0", message = "一级佣金比例不能小于0")
@Schema(description = "一级佣金比例(%", example = "10")
private BigDecimal firstLevelRate;
/**
* 二级佣金比例(%
*/
@DecimalMin(value = "0", message = "二级佣金比例不能小于0")
@Schema(description = "二级佣金比例(%", example = "5")
private BigDecimal secondLevelRate;
@Serial
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,41 @@
package com.greenorange.promotion.model.dto.course;
import com.greenorange.promotion.annotation.EnumValue;
import com.greenorange.promotion.model.enums.CourseTypeEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Min;
import lombok.Data;
import java.math.BigDecimal;
import java.io.Serial;
import java.io.Serializable;
import com.greenorange.promotion.common.PageRequest;
/**
* 课程查询请求体,继承自分页请求 PageRequest
*/
@Data
@Schema(description = "课程查询请求体", requiredProperties = {"current", "pageSize"})
public class CourseQueryRequest extends PageRequest implements Serializable {
/**
* 课程名称
*/
@NotBlank(message = "课程名称不能为空")
@Schema(description = "课程名称", example = "数据分析工程师训练营")
private String name;
/**
* 课程类别[考公考研,自媒体,财经]
*/
@NotBlank(message = "课程类别不能为空")
@EnumValue(enumClass = CourseTypeEnum.class)
@Schema(description = "课程类别[考公考研,自媒体,财经]", example = "自媒体")
private String type;
@Serial
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,115 @@
package com.greenorange.promotion.model.dto.course;
import com.greenorange.promotion.annotation.EnumValue;
import com.greenorange.promotion.model.enums.CourseTypeEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.DecimalMin;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Min;
import lombok.Data;
import java.math.BigDecimal;
import java.io.Serial;
import java.io.Serializable;
/**
* 课程更新请求体
*/
@Data
@Schema(description = "课程更新请求体", requiredProperties = {
"id",
"name",
"type",
"detail",
"promoCodeDesc",
"image",
"originPrice",
"discountPrice",
"orderCount",
"firstLevelRate",
"secondLevelRate",
})
public class CourseUpdateRequest implements Serializable {
/**
* 课程ID
*/
@Min(value = 1L, message = "课程ID ID不能小于1")
@Schema(description = "课程ID", example = "1")
private Long id;
/**
* 课程名称
*/
@NotBlank(message = "课程名称不能为空")
@Schema(description = "课程名称", example = "数据分析工程师训练营")
private String name;
/**
* 课程类别[考公考研,自媒体,财经]
*/
@NotBlank(message = "课程类别不能为空")
@EnumValue(enumClass = CourseTypeEnum.class)
@Schema(description = "课程类别[考公考研,自媒体,财经]", example = "自媒体")
private String type;
/**
* 课程概述(富文本)
*/
@NotBlank(message = "课程概述(富文本)不能为空")
@Schema(description = "课程概述(富文本)", example = "富文本")
private String detail;
/**
* 推广码说明(富文本)
*/
@NotBlank(message = "推广码说明(富文本)不能为空")
@Schema(description = "推广码说明(富文本)", example = "富文本")
private String promoCodeDesc;
/**
* 课程图片URL
*/
@NotBlank(message = "课程图片URL不能为空")
@Schema(description = "课程图片URL", example = "324IEHJDE")
private String image;
/**
* 课程原价
*/
@DecimalMin(value = "0.0", message = "课程原价不能小于0")
@Schema(description = "课程原价", example = "3499")
private BigDecimal originPrice;
/**
* 折扣价格
*/
@DecimalMin(value = "0.0", message = "折扣价格不能小于0")
@Schema(description = "折扣价格", example = "2499")
private BigDecimal discountPrice;
/**
* 已下单人数
*/
@Schema(description = "已下单人数", example = "100")
private Integer orderCount;
/**
* 一级佣金比例(%
*/
@DecimalMin(value = "0.0", message = "一级佣金比例不能小于0")
@Schema(description = "一级佣金比例(%", example = "10")
private BigDecimal firstLevelRate;
/**
* 二级佣金比例(%
*/
@DecimalMin(value = "0.0", message = "二级佣金比例不能小于0")
@Schema(description = "二级佣金比例(%", example = "5")
private BigDecimal secondLevelRate;
@Serial
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,67 @@
package com.greenorange.promotion.model.dto.courseChapter;
import com.greenorange.promotion.annotation.EnumValue;
import com.greenorange.promotion.model.enums.PreviewPermissionEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Min;
import lombok.Data;
import java.math.BigDecimal;
import java.io.Serial;
import java.io.Serializable;
/**
* 课程章节添加请求体
*/
@Data
@Schema(description = "课程章节添加请求体", requiredProperties = {
"name",
"duration",
"permissions",
"videoView",
"courseId",
})
public class CourseChapterAddRequest implements Serializable {
/**
* 章节名称
*/
@NotBlank(message = "章节名称不能为空")
@Schema(description = "章节名称", example = "企业经营管理者为什么必须懂财务?")
private String name;
/**
* 章节时长(单位:秒)
*/
@Min(value = 0L, message = "章节时长不能小于0")
@Schema(description = "章节时长", example = "600")
private Long duration;
/**
* 试看权限
*/
@NotBlank(message = "试看权限不能为空")
@EnumValue(enumClass = PreviewPermissionEnum.class)
@Schema(description = "试看权限", example = "全集试看")
private String permissions;
/**
* 视频文件 view 值
*/
@NotBlank(message = "视频文件 view 值不能为空")
@Schema(description = "视频文件 view 值", example = "3E29KDS9")
private String videoView;
/**
* 所属课程ID
*/
@Min(value = 1L, message = "所属课程ID ID不能小于1")
@Schema(description = "所属课程ID", example = "1")
private Long courseId;
@Serial
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,41 @@
package com.greenorange.promotion.model.dto.courseChapter;
import com.greenorange.promotion.annotation.EnumValue;
import com.greenorange.promotion.model.enums.PreviewPermissionEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Min;
import lombok.Data;
import java.math.BigDecimal;
import java.io.Serial;
import java.io.Serializable;
import com.greenorange.promotion.common.PageRequest;
/**
* 课程章节查询请求体,继承自分页请求 PageRequest
*/
@Data
@Schema(description = "课程章节查询请求体", requiredProperties = {"current", "pageSize"})
public class CourseChapterQueryRequest extends PageRequest implements Serializable {
/**
* 章节名称
*/
@NotBlank(message = "章节名称不能为空")
@Schema(description = "章节名称", example = "企业经营管理者为什么必须懂财务?")
private String name;
/**
* 试看权限
*/
@NotBlank(message = "试看权限不能为空")
@EnumValue(enumClass = PreviewPermissionEnum.class)
@Schema(description = "试看权限", example = "全集试看")
private String permissions;
@Serial
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,74 @@
package com.greenorange.promotion.model.dto.courseChapter;
import com.greenorange.promotion.annotation.EnumValue;
import com.greenorange.promotion.model.enums.PreviewPermissionEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Min;
import lombok.Data;
import java.math.BigDecimal;
import java.io.Serial;
import java.io.Serializable;
/**
* 课程章节更新请求体
*/
@Data
@Schema(description = "课程章节更新请求体", requiredProperties = {
"id",
"name",
"duration",
"permissions",
"videoView",
"courseId",
})
public class CourseChapterUpdateRequest implements Serializable {
/**
* 章节ID
*/
@Min(value = 1L, message = "章节ID ID不能小于1")
@Schema(description = "章节ID", example = "1")
private Long id;
/**
* 章节名称
*/
@NotBlank(message = "章节名称不能为空")
@Schema(description = "章节名称", example = "企业经营管理者为什么必须懂财务?")
private String name;
/**
* 章节时长(单位:秒)
*/
@Min(value = 0L, message = "章节时长不能小于0")
@Schema(description = "章节时长", example = "600")
private Long duration;
/**
* 试看权限
*/
@NotBlank(message = "试看权限不能为空")
@EnumValue(enumClass = PreviewPermissionEnum.class)
@Schema(description = "试看权限", example = "全集试看")
private String permissions;
/**
* 视频文件 view 值
*/
@NotBlank(message = "视频文件 view 值不能为空")
@Schema(description = "视频文件 view 值", example = "3E29KDS9")
private String videoView;
/**
* 所属课程ID
*/
@Min(value = 1L, message = "所属课程ID ID不能小于1")
@Schema(description = "所属课程ID", example = "1")
private Long courseId;
@Serial
private static final long serialVersionUID = 1L;
}

View File

@ -1,13 +1,10 @@
package com.greenorange.promotion.model.dto.fileInfo;
import com.greenorange.promotion.annotation.FileEnumValue;
import com.greenorange.promotion.annotation.EnumValue;
import com.greenorange.promotion.model.enums.FileUploadBizEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serial;
import java.io.Serializable;
@ -55,7 +52,7 @@ public class FileInfoAddRequest implements Serializable {
/**
* 文件业务类型[头像(avatar)|项目(project)|富文本(richText)|默认(default))]
*/
@FileEnumValue(enumClass = FileUploadBizEnum.class)
@EnumValue(enumClass = FileUploadBizEnum.class)
@Schema(description = "文件业务类型[头像(avatar)|项目(project)|富文本(richText)|默认(default))]", example = "avatar")
private String biz;

View File

@ -1,36 +0,0 @@
package com.greenorange.promotion.model.dto.fileInfo;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Min;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import com.greenorange.promotion.common.PageRequest;
/**
* 文件查询请求体,继承自分页请求 PageRequest
*/
@Data
@Schema(description = "文件查询请求体", requiredProperties = {"current", "pageSize"})
public class FileInfoQueryRequest extends PageRequest implements Serializable {
/**
* 文件ID
*/
@Min(value = 1L, message = "文件ID ID不能小于1")
@Schema(description = "文件ID", example = "1")
private Long id;
/**
* 文件view值
*/
@Schema(description = "文件view值", example = "3E8U2AM8")
private String fileView;
@Serial
private static final long serialVersionUID = 1L;
}

View File

@ -1,79 +0,0 @@
package com.greenorange.promotion.model.dto.fileInfo;
import com.greenorange.promotion.annotation.FileEnumValue;
import com.greenorange.promotion.model.enums.FileUploadBizEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Min;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
/**
* 文件更新请求体
*/
@Data
@Schema(description = "文件更新请求体", requiredProperties = {
"id",
"name",
"type",
"size",
"fileView",
"biz",
})
public class FileInfoUpdateRequest implements Serializable {
/**
* 文件ID
*/
@Min(value = 1L, message = "文件ID ID不能小于1")
@Schema(description = "文件ID", example = "1")
private Long id;
/**
* 文件名
*/
@NotBlank(message = "文件名不能为空")
@Schema(description = "文件名", example = "file.png")
private String name;
/**
* 文件类型
*/
@NotBlank(message = "文件类型不能为空")
@Schema(description = "文件类型", example = "png")
private String type;
/**
* 文件大小(KB)
*/
@Min(value = 1L, message = "文件大小 ID不能小于1")
@Schema(description = "文件大小", example = "3000")
private Double size;
/**
* 文件view值
*/
@NotBlank(message = "文件view值不能为空")
@Schema(description = "文件view值", example = "3E8U2AM8")
private String fileView;
/**
* 文件业务类型[头像(avatar)|项目(project)|富文本(richText)|默认(default))]
*/
@FileEnumValue(enumClass = FileUploadBizEnum.class)
@Schema(description = "文件业务类型[头像(avatar)|项目(project)|富文本(richText)|默认(default))]", example = "default")
private String biz;
/**
* 文件hash值
*/
@NotBlank(message = "文件hash值不能为空")
@Schema(description = "文件hash值", example = "3E8U2AM8")
private String hashValue;
@Serial
private static final long serialVersionUID = 1L;
}

View File

@ -1,6 +1,6 @@
package com.greenorange.promotion.model.dto.fileInfo;
import com.greenorange.promotion.annotation.FileEnumValue;
import com.greenorange.promotion.annotation.EnumValue;
import com.greenorange.promotion.model.enums.FileUploadBizEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@ -15,7 +15,7 @@ public class UploadFileRequest implements Serializable {
/**
* 文件业务类型[头像(avatar)|项目(project)|富文本(richText)|默认(default))]
*/
@FileEnumValue(enumClass = FileUploadBizEnum.class)
@EnumValue(enumClass = FileUploadBizEnum.class)
@Schema(description = "文件业务类型[头像(avatar)|项目(project)|富文本(richText)|默认(default))]", example = "default")
private String biz;

View File

@ -1,21 +1,14 @@
package com.greenorange.promotion.model.dto.project;
import com.greenorange.promotion.annotation.ProjectStatusEnumValue;
import com.greenorange.promotion.model.dto.projectDetail.ProjectDetailAddRequest;
import com.greenorange.promotion.model.dto.projectDetail.ProjectDetailUpdateRequest;
import com.greenorange.promotion.model.dto.projectNotification.ProjectNotificationAddRequest;
import com.greenorange.promotion.model.entity.ProjectNotification;
import com.greenorange.promotion.annotation.EnumValue;
import com.greenorange.promotion.model.enums.ProjectStatusEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
/**
* 项目添加请求体
@ -66,7 +59,7 @@ public class ProjectAddRequest implements Serializable {
/**
* 项目状态[项目运行(running)|人数已满(full)|项目暂停(paused)]
*/
@ProjectStatusEnumValue(enumClass = ProjectStatusEnum.class)
@EnumValue(enumClass = ProjectStatusEnum.class)
@Schema(description = "项目状态[项目运行(running)|人数已满(full)|项目暂停(paused)]", example = "running")
private String projectStatus;

View File

@ -1,6 +1,6 @@
package com.greenorange.promotion.model.dto.project;
import com.greenorange.promotion.annotation.ProjectStatusEnumValue;
import com.greenorange.promotion.annotation.EnumValue;
import com.greenorange.promotion.model.enums.ProjectStatusEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Min;
@ -27,7 +27,7 @@ public class ProjectStatusUpdateRequest implements Serializable {
/**
* 项目状态[项目运行(running)|人数已满(full)|项目暂停(paused)]
*/
@ProjectStatusEnumValue(enumClass = ProjectStatusEnum.class)
@EnumValue(enumClass = ProjectStatusEnum.class)
@Schema(description = "项目状态[项目运行(running)|人数已满(full)|项目暂停(paused)]", example = "running")
private String projectStatus;

View File

@ -2,6 +2,8 @@ package com.greenorange.promotion.model.dto.project;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.greenorange.promotion.annotation.EnumValue;
import com.greenorange.promotion.model.enums.ProjectStatusEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.DecimalMin;
import jakarta.validation.constraints.NotBlank;
@ -103,6 +105,7 @@ public class ProjectUpdateRequest implements Serializable {
/**
* 项目状态[项目运行(running)|人数已满(full)|项目暂停(paused)]
*/
@EnumValue(enumClass = ProjectStatusEnum.class)
@Schema(description = "项目状态[项目运行(running)|人数已满(full)|项目暂停(paused)]", example = "running")
private String projectStatus;

View File

@ -1,10 +1,7 @@
package com.greenorange.promotion.model.dto.userInfo;
import com.greenorange.promotion.annotation.UserEnumValue;
import com.greenorange.promotion.model.enums.UserRoleEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.Data;
@ -16,7 +13,7 @@ import java.io.Serializable;
*/
@Data
@Schema(description = "用户添加请求体", requiredProperties = {"nickName", "userAvatar", "phoneNumber",
"userAccount", "userPassword", "userRole"})
"userAccount", "userPassword"})
public class UserInfoAddRequest implements Serializable {
/**

View File

@ -1,7 +1,5 @@
package com.greenorange.promotion.model.dto.userInfo;
import com.greenorange.promotion.annotation.UserEnumValue;
import com.greenorange.promotion.model.enums.UserRoleEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
@ -16,8 +14,8 @@ import java.io.Serializable;
* 用户更新请求体
*/
@Data
@Schema(description = "用户更新请求体", requiredProperties = {"id", "nickName", "userAvatar", "phoneNumber",
"userAccount", "userPassword", "userRole"})
@Schema(description = "用户更新请求体", requiredProperties = {"id", "nickName", "userAvatar",
"userAccount", "userPassword"})
public class UserInfoUpdateRequest implements Serializable {
/**
@ -42,13 +40,6 @@ public class UserInfoUpdateRequest implements Serializable {
@Schema(description = "用户头像URL", example = "3E8U2AM8")
private String userAvatar;
/**
* 手机号
*/
@NotBlank(message = "手机号不能为空")
@Schema(description = "手机号", example = "15888610253")
private String phoneNumber;
/**
* 账号
*/
@ -65,25 +56,6 @@ public class UserInfoUpdateRequest implements Serializable {
@Schema(description = "密码(建议加密存储)", example = "qingcheng")
private String userPassword;
/**
* 邀请码
*/
@Schema(description = "邀请码", example = "666999")
private String invitationCode;
/**
* 用户角色
*/
@UserEnumValue(enumClass = UserRoleEnum.class)
@Schema(description = "用户角色", example = "user")
private String userRole;
/**
* 上级用户id
*/
@Schema(description = "上级用户id", example = "1")
private Long parentUserId;
@Serial
private static final long serialVersionUID = 1L;

View File

@ -1,10 +1,6 @@
package com.greenorange.promotion.model.dto.withdrawalApply;
import com.greenorange.promotion.annotation.WithdrawStatusEnumValue;
import com.greenorange.promotion.model.enums.WithdrawStatusEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Min;
import lombok.Data;
import java.math.BigDecimal;
@ -16,9 +12,7 @@ import java.io.Serializable;
*/
@Data
@Schema(description = "提现申请记录添加请求体", requiredProperties = {
"withdrawnAmount",
"withdrawalStatus",
"userId",
"withdrawnAmount"
})
public class WithdrawalApplyAddRequest implements Serializable {

View File

@ -1,12 +1,9 @@
package com.greenorange.promotion.model.dto.withdrawalApply;
import com.greenorange.promotion.annotation.WithdrawStatusEnumValue;
import com.greenorange.promotion.annotation.EnumValue;
import com.greenorange.promotion.model.enums.WithdrawStatusEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Min;
import lombok.Data;
import java.math.BigDecimal;
import java.io.Serial;
import java.io.Serializable;
@ -22,6 +19,7 @@ public class WithdrawalApplyQueryRequest extends PageRequest implements Serializ
/**
* 提现状态[提现中(processing)|提现成功(success)|提现失败(failed)]
*/
@EnumValue(enumClass = WithdrawStatusEnum.class)
@Schema(description = "提现状态[提现中(processing)|提现成功(success)|提现失败(failed)]", example = "processing")
private String withdrawalStatus;

View File

@ -1,9 +1,8 @@
package com.greenorange.promotion.model.dto.withdrawalApply;
import com.greenorange.promotion.annotation.WithdrawStatusEnumValue;
import com.greenorange.promotion.annotation.EnumValue;
import com.greenorange.promotion.model.enums.WithdrawStatusEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Min;
import lombok.Data;
import java.math.BigDecimal;
@ -17,9 +16,7 @@ import java.io.Serializable;
@Data
@Schema(description = "提现申请记录更新请求体", requiredProperties = {
"id",
"withdrawnAmount",
"withdrawalStatus",
"userId",
"withdrawalStatus"
})
public class WithdrawalApplyUpdateRequest implements Serializable {
@ -30,26 +27,13 @@ public class WithdrawalApplyUpdateRequest implements Serializable {
@Schema(description = "提现申请ID", example = "1")
private Long id;
/**
* 提现金额
*/
@Schema(description = "提现金额", example = "1.00")
private BigDecimal withdrawnAmount;
/**
* 提现状态[提现中(processing)|提现成功(success)|提现失败(failed)]
*/
@WithdrawStatusEnumValue(enumClass = WithdrawStatusEnum.class)
@EnumValue(enumClass = WithdrawStatusEnum.class)
@Schema(description = "提现状态[提现中(processing)|提现成功(success)|提现失败(failed)]", example = "processing")
private String withdrawalStatus;
/**
* 用户ID
*/
@Min(value = 1L, message = "用户ID ID不能小于1")
@Schema(description = "用户ID", example = "1")
private Long userId;
@Serial
private static final long serialVersionUID = 1L;

View File

@ -10,65 +10,65 @@ import java.util.Date;
import lombok.Data;
/**
*
* 课程表
* @TableName course
*/
@TableName(value ="course")
@Data
public class Course implements Serializable {
/**
*
* 课程ID
*/
@TableId
@TableId(type = IdType.AUTO)
private Long id;
/**
*
* 课程名称
*/
private String name;
/**
*
* 课程类别[考公考研,自媒体,财经]
*/
private String type;
/**
*
* 课程概述(富文本)
*/
private String detail;
/**
*
* 推广码说明(富文本)
*/
private String promoCodeDesc;
/**
*
* 课程图片URL
*/
private String image;
/**
*
* 课程原价
*/
private BigDecimal originPrice;
/**
*
* 折扣价格
*/
private BigDecimal discountPrice;
/**
*
* 已下单人数
*/
private Integer orderCount;
/**
*
* 一级佣金比例(%
*/
private BigDecimal firstLevelRate;
/**
*
* 二级佣金比例(%
*/
private BigDecimal secondLevelRate;

View File

@ -9,40 +9,40 @@ import java.util.Date;
import lombok.Data;
/**
*
* 课程章节表
* @TableName course_chapter
*/
@TableName(value ="course_chapter")
@Data
public class CourseChapter implements Serializable {
/**
*
* 章节ID
*/
@TableId
@TableId(type = IdType.AUTO)
private Long id;
/**
*
* 章节名称
*/
private String name;
/**
*
* 章节时长(格式可自定义,如"00:10:00"
*/
private String duration;
/**
*
* 试看权限
*/
private Object permissions;
/**
*
* 视频文件 view 值
*/
private String videoView;
/**
*
* 所属课程ID
*/
private Long courseId;

View File

@ -10,65 +10,65 @@ import java.util.Date;
import lombok.Data;
/**
*
* 课程订单表
* @TableName course_order
*/
@TableName(value ="course_order")
@Data
public class CourseOrder implements Serializable {
/**
*
* 订单ID
*/
@TableId
@TableId(type = IdType.AUTO)
private Long id;
/**
*
* 订单号
*/
private String orderNumber;
/**
*
* 课程ID
*/
private Long courseId;
/**
*
* 课程名称
*/
private String name;
/**
*
* 课程类别
*/
private String type;
/**
*
* 课程封面图片URL
*/
private String image;
/**
*
* 课程原价
*/
private BigDecimal originPrice;
/**
*
* 实际成交价格
*/
private BigDecimal discountPrice;
/**
*
* 订单总金额
*/
private BigDecimal totalAmount;
/**
*
* 支付交易号
*/
private String transactionNumber;
/**
*
* 订单状态
*/
private Object orderStatus;

View File

@ -10,55 +10,55 @@ import java.util.Date;
import lombok.Data;
/**
*
* 推广记录表
* @TableName promo_record
*/
@TableName(value ="promo_record")
@Data
public class PromoRecord implements Serializable {
/**
*
* 推广记录ID
*/
@TableId
@TableId(type = IdType.AUTO)
private Long id;
/**
*
* 被推广课程ID
*/
private Long courseId;
/**
*
* 下级用户ID
*/
private Long subUserId;
/**
*
* 下级用户昵称
*/
private String nickName;
/**
*
* 下级用户手机号
*/
private String phone;
/**
*
* 下级带给上级的收益
*/
private BigDecimal benefits;
/**
*
* 绑定时间(字符串格式)
*/
private String bindTime;
/**
*
* 推广类型
*/
private Object promoType;
/**
*
* 推广人上级用户ID
*/
private Long userId;

View File

@ -10,85 +10,85 @@ import java.util.Date;
import lombok.Data;
/**
*
* 课程抽成记录表
* @TableName rake_reward
*/
@TableName(value ="rake_reward")
@Data
public class RakeReward implements Serializable {
/**
*
* 抽成记录ID
*/
@TableId
@TableId(type = IdType.AUTO)
private Long id;
/**
*
* 课程ID
*/
private Long courseId;
/**
*
* 课程名称
*/
private String name;
/**
*
* 课程类别
*/
private String type;
/**
*
* 课程图片URL
*/
private String image;
/**
*
* 一级佣金比例(%
*/
private BigDecimal firstLevelRate;
/**
*
* 二级佣金比例(%
*/
private BigDecimal secondLevelRate;
/**
*
* 订单ID
*/
private Long orderId;
/**
*
* 下单用户ID
*/
private Long userId;
/**
*
* 下单用户昵称
*/
private String nickName;
/**
*
* 订单金额
*/
private BigDecimal totalAmount;
/**
*
* 订单创建日期
*/
private Date orderCreateTime;
/**
*
* 对应推广记录ID
*/
private Long promoId;
/**
*
* 推广类型
*/
private Object promoType;
/**
*
* 抽成补贴金额
*/
private BigDecimal reward;

View File

@ -0,0 +1,58 @@
package com.greenorange.promotion.model.enums;
import com.greenorange.promotion.annotation.BaseEnum;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
/**
* 课程类型枚举
*/
@Getter
public enum CourseTypeEnum implements BaseEnum {
KAOGONGKAOYAN("考公考研"),
ZIMEITI("自媒体"),
CAIJING("财经");
private final String value;
CourseTypeEnum(String value) {
this.value = value;
}
/**
* BaseEnum 要求的方法:返回枚举对应的校验值
*/
@Override
public String getValue() {
return this.value;
}
/**
* 获取所有枚举值列表
*/
public static List<String> getValues() {
return Arrays.stream(values())
.map(CourseTypeEnum::getValue)
.collect(Collectors.toList());
}
/**
* 根据值获取对应的枚举对象
*/
public static CourseTypeEnum getEnumByValue(String value) {
if (StringUtils.isBlank(value)) {
return null;
}
for (CourseTypeEnum type : CourseTypeEnum.values()) {
if (type.value.equals(value)) {
return type;
}
}
return null;
}
}

View File

@ -1,5 +1,6 @@
package com.greenorange.promotion.model.enums;
import com.greenorange.promotion.annotation.BaseEnum;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;
@ -11,7 +12,7 @@ import java.util.stream.Collectors;
* 文件上传业务类型枚举
*/
@Getter
public enum FileUploadBizEnum {
public enum FileUploadBizEnum implements BaseEnum {
AVATAR("用户头像", "avatar"),
PROJECT("项目", "project"),
@ -26,6 +27,14 @@ public enum FileUploadBizEnum {
this.value = value;
}
/**
* BaseEnum 要求的方法:返回这个枚举的“校验值”
*/
@Override
public String getValue() {
return this.value;
}
/**
* 获取值列表
*/

View File

@ -0,0 +1,59 @@
package com.greenorange.promotion.model.enums;
import com.greenorange.promotion.annotation.BaseEnum;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
/**
* 试看权限枚举
*/
@Getter
public enum PreviewPermissionEnum implements BaseEnum {
FULL_VIEW("全集试看"),
PART_VIEW("部分试看"),
CLOSED("关闭"),
OPEN("开启");
private final String value;
PreviewPermissionEnum(String value) {
this.value = value;
}
/**
* BaseEnum 要求的方法:返回枚举对应的校验值
*/
@Override
public String getValue() {
return this.value;
}
/**
* 获取所有枚举值列表
*/
public static List<String> getValues() {
return Arrays.stream(values())
.map(PreviewPermissionEnum::getValue)
.collect(Collectors.toList());
}
/**
* 根据值获取对应的枚举对象
*/
public static PreviewPermissionEnum getEnumByValue(String value) {
if (StringUtils.isBlank(value)) {
return null;
}
for (PreviewPermissionEnum permission : PreviewPermissionEnum.values()) {
if (permission.value.equals(value)) {
return permission;
}
}
return null;
}
}

View File

@ -1,5 +1,6 @@
package com.greenorange.promotion.model.enums;
import com.greenorange.promotion.annotation.BaseEnum;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;
@ -11,7 +12,7 @@ import java.util.stream.Collectors;
* 项目状态枚举
*/
@Getter
public enum ProjectStatusEnum {
public enum ProjectStatusEnum implements BaseEnum {
RUNNING("项目运行", "running"),
FULL("人数已满", "full"),
@ -25,6 +26,14 @@ public enum ProjectStatusEnum {
this.value = value;
}
/**
* BaseEnum 要求的方法:返回这个枚举的“校验值”
*/
@Override
public String getValue() {
return this.value;
}
/**
* 获取值列表
*/

View File

@ -1,5 +1,6 @@
package com.greenorange.promotion.model.enums;
import com.greenorange.promotion.annotation.BaseEnum;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;
@ -12,7 +13,7 @@ import java.util.stream.Collectors;
* 用户角色枚举
*/
@Getter
public enum UserRoleEnum {
public enum UserRoleEnum implements BaseEnum {
USER("用户", "user"),
ADMIN("管理员", "admin"),
@ -29,6 +30,14 @@ public enum UserRoleEnum {
this.value = value;
}
/**
* BaseEnum 要求的方法:返回这个枚举的“校验值”
*/
@Override
public String getValue() {
return this.value;
}
/**
* 获取值列表
*/

View File

@ -1,5 +1,6 @@
package com.greenorange.promotion.model.enums;
import com.greenorange.promotion.annotation.BaseEnum;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;
@ -11,7 +12,7 @@ import java.util.stream.Collectors;
* 提现状态枚举
*/
@Getter
public enum WithdrawStatusEnum {
public enum WithdrawStatusEnum implements BaseEnum {
PROCESSING("提现中", "processing"),
SUCCESS("提现成功", "success"),
@ -26,6 +27,14 @@ public enum WithdrawStatusEnum {
this.value = value;
}
/**
* BaseEnum 要求的方法:返回这个枚举的“校验值”
*/
@Override
public String getValue() {
return this.value;
}
/**
* 获取所有状态的值列表
*/

View File

@ -0,0 +1,86 @@
package com.greenorange.promotion.model.vo.course;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 课程 视图对象
*/
@Data
@Schema(description = "课程 视图对象")
public class CourseVO implements Serializable {
/**
* 课程ID
*/
@Schema(description = "课程ID", example = "1")
private Long id;
/**
* 课程名称
*/
@Schema(description = "课程名称", example = "数据分析工程师训练营")
private String name;
/**
* 课程类别[考公考研,自媒体,财经]
*/
@Schema(description = "课程类别[考公考研,自媒体,财经]", example = "自媒体")
private String type;
/**
* 课程概述(富文本)
*/
@Schema(description = "课程概述(富文本)", example = "富文本")
private String detail;
/**
* 推广码说明(富文本)
*/
@Schema(description = "推广码说明(富文本)", example = "富文本")
private String promoCodeDesc;
/**
* 课程图片URL
*/
@Schema(description = "课程图片URL", example = "324IEHJDE")
private String image;
/**
* 课程原价
*/
@Schema(description = "课程原价", example = "3499")
private BigDecimal originPrice;
/**
* 折扣价格
*/
@Schema(description = "折扣价格", example = "2499")
private BigDecimal discountPrice;
/**
* 已下单人数
*/
@Schema(description = "已下单人数", example = "100")
private Integer orderCount;
/**
* 一级佣金比例(%
*/
@Schema(description = "一级佣金比例(%", example = "10")
private BigDecimal firstLevelRate;
/**
* 二级佣金比例(%
*/
@Schema(description = "二级佣金比例(%", example = "5")
private BigDecimal secondLevelRate;
@Serial
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,58 @@
package com.greenorange.promotion.model.vo.courseChapter;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 课程章节 视图对象
*/
@Data
@Schema(description = "课程章节 视图对象")
public class CourseChapterVO implements Serializable {
/**
* 课程章节ID
*/
@Schema(description = "课程章节ID", example = "1")
private Long id;
/**
* 章节名称
*/
@Schema(description = "章节名称", example = "企业经营管理者为什么必须懂财务?")
private String name;
/**
* 章节时长(单位:秒)
*/
@Schema(description = "章节时长", example = "600")
private Long duration;
/**
* 试看权限
*/
@Schema(description = "试看权限", example = "全集试看")
private String permissions;
/**
* 视频文件 view 值
*/
@Schema(description = "视频文件 view 值", example = "3E29KDS9")
private String videoView;
/**
* 所属课程ID
*/
@Schema(description = "所属课程ID", example = "所属课程ID ID不能小于1")
private Long courseId;
@Serial
private static final long serialVersionUID = 1L;
}

View File

@ -1,13 +1,20 @@
package com.greenorange.promotion.service.course;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.greenorange.promotion.model.dto.courseChapter.CourseChapterQueryRequest;
import com.greenorange.promotion.model.entity.CourseChapter;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author 35880
* @description 针对表【course_chapter】的数据库操作Service
* @createDate 2025-06-23 18:07:34
* @description 针对表【course_chapter(课程章节表)】的数据库操作Service
* @createDate 2025-06-23 18:30:28
*/
public interface CourseChapterService extends IService<CourseChapter> {
/**
* 获取查询条件
*/
QueryWrapper<CourseChapter> getQueryWrapper(CourseChapterQueryRequest courseChapterQueryRequest);
}

View File

@ -5,8 +5,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author 35880
* @description 针对表【course_order】的数据库操作Service
* @createDate 2025-06-23 18:08:14
* @description 针对表【course_order(课程订单表)】的数据库操作Service
* @createDate 2025-06-23 18:31:13
*/
public interface CourseOrderService extends IService<CourseOrder> {

View File

@ -1,13 +1,20 @@
package com.greenorange.promotion.service.course;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.greenorange.promotion.model.dto.course.CourseQueryRequest;
import com.greenorange.promotion.model.entity.Course;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author 35880
* @description 针对表【course】的数据库操作Service
* @createDate 2025-06-23 17:06:12
* @description 针对表【course(课程表)】的数据库操作Service
* @createDate 2025-06-23 18:29:49
*/
public interface CourseService extends IService<Course> {
/**
* 获取查询条件
*/
QueryWrapper<Course> getQueryWrapper(CourseQueryRequest courseQueryRequest);
}

View File

@ -5,8 +5,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author 35880
* @description 针对表【promo_record】的数据库操作Service
* @createDate 2025-06-23 18:09:37
* @description 针对表【promo_record(推广记录表)】的数据库操作Service
* @createDate 2025-06-23 18:31:45
*/
public interface PromoRecordService extends IService<PromoRecord> {

View File

@ -5,8 +5,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author 35880
* @description 针对表【rake_reward】的数据库操作Service
* @createDate 2025-06-23 18:09:57
* @description 针对表【rake_reward(课程抽成记录表)】的数据库操作Service
* @createDate 2025-06-23 18:32:46
*/
public interface RakeRewardService extends IService<RakeReward> {

View File

@ -1,20 +1,40 @@
package com.greenorange.promotion.service.course.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.greenorange.promotion.constant.CommonConstant;
import com.greenorange.promotion.model.dto.courseChapter.CourseChapterQueryRequest;
import com.greenorange.promotion.model.entity.CourseChapter;
import com.greenorange.promotion.service.course.CourseChapterService;
import com.greenorange.promotion.mapper.CourseChapterMapper;
import com.greenorange.promotion.utils.SqlUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
/**
* @author 35880
* @description 针对表【course_chapter】的数据库操作Service实现
* @createDate 2025-06-23 18:07:34
* @description 针对表【course_chapter(课程章节表)】的数据库操作Service实现
* @createDate 2025-06-23 18:30:28
*/
@Service
public class CourseChapterServiceImpl extends ServiceImpl<CourseChapterMapper, CourseChapter>
implements CourseChapterService{
/**
* 获取查询条件
*/
@Override
public QueryWrapper<CourseChapter> getQueryWrapper(CourseChapterQueryRequest courseChapterQueryRequest) {
String name = courseChapterQueryRequest.getName();
String permissions = courseChapterQueryRequest.getPermissions();
String sortField = courseChapterQueryRequest.getSortField();
String sortOrder = courseChapterQueryRequest.getSortOrder();
QueryWrapper<CourseChapter> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(StringUtils.isNotBlank(name), "name", name);
queryWrapper.eq(StringUtils.isNotBlank(permissions), "permissions", permissions);
queryWrapper.orderBy(SqlUtils.validSortField(sortField), sortOrder.equals(CommonConstant.SORT_ORDER_ASC), sortField);
return queryWrapper;
}
}

View File

@ -8,8 +8,8 @@ import org.springframework.stereotype.Service;
/**
* @author 35880
* @description 针对表【course_order】的数据库操作Service实现
* @createDate 2025-06-23 18:08:14
* @description 针对表【course_order(课程订单表)】的数据库操作Service实现
* @createDate 2025-06-23 18:31:13
*/
@Service
public class CourseOrderServiceImpl extends ServiceImpl<CourseOrderMapper, CourseOrder>

View File

@ -1,20 +1,41 @@
package com.greenorange.promotion.service.course.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.greenorange.promotion.constant.CommonConstant;
import com.greenorange.promotion.model.dto.course.CourseQueryRequest;
import com.greenorange.promotion.model.entity.Course;
import com.greenorange.promotion.service.course.CourseService;
import com.greenorange.promotion.mapper.CourseMapper;
import com.greenorange.promotion.utils.SqlUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
/**
* @author 35880
* @description 针对表【course】的数据库操作Service实现
* @createDate 2025-06-23 17:06:12
* @description 针对表【course(课程表)】的数据库操作Service实现
* @createDate 2025-06-23 18:29:49
*/
@Service
public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course>
implements CourseService{
/**
* 获取查询条件
*/
@Override
public QueryWrapper<Course> getQueryWrapper(CourseQueryRequest courseQueryRequest) {
String name = courseQueryRequest.getName();
String type = courseQueryRequest.getType();
String sortField = courseQueryRequest.getSortField();
String sortOrder = courseQueryRequest.getSortOrder();
QueryWrapper<Course> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(StringUtils.isNotBlank(name), "name", name);
queryWrapper.eq(StringUtils.isNotBlank(type), "type", type);
queryWrapper.orderBy(SqlUtils.validSortField(sortField), sortOrder.equals(CommonConstant.SORT_ORDER_ASC), sortField);
return queryWrapper;
}
}

View File

@ -8,8 +8,8 @@ import org.springframework.stereotype.Service;
/**
* @author 35880
* @description 针对表【promo_record】的数据库操作Service实现
* @createDate 2025-06-23 18:09:37
* @description 针对表【promo_record(推广记录表)】的数据库操作Service实现
* @createDate 2025-06-23 18:31:45
*/
@Service
public class PromoRecordServiceImpl extends ServiceImpl<PromoRecordMapper, PromoRecord>

View File

@ -8,8 +8,8 @@ import org.springframework.stereotype.Service;
/**
* @author 35880
* @description 针对表【rake_reward】的数据库操作Service实现
* @createDate 2025-06-23 18:09:57
* @description 针对表【rake_reward(课程抽成记录表)】的数据库操作Service实现
* @createDate 2025-06-23 18:32:46
*/
@Service
public class RakeRewardServiceImpl extends ServiceImpl<RakeRewardMapper, RakeReward>

View File

@ -42,10 +42,6 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project>
private CommonService commonService;
@Resource
private ProjectService projectService;
@Resource
private ProjectCommissionService projectCommissionService;
@ -89,7 +85,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project>
}
projectPriceMap.put(projectId, projectPrice);
}
List<Project> projectList = commonService.findByFieldEqTargetField(Project::getIsShelves, 1, projectService);
List<Project> projectList = commonService.findByFieldEqTargetField(Project::getIsShelves, 1, this);
for (Project project : projectList) {
BigDecimal projectPrice = projectPriceMap.get(project.getId());
project.setProjectPrice(projectPrice == null ? BigDecimal.ZERO : projectPrice);
@ -104,7 +100,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project>
@Override
public ProjectVO queryProjectById(CommonRequest commonRequest) {
Long id = commonRequest.getId();
Project project = projectService.getById(id);
Project project = this.getById(id);
ThrowUtils.throwIf(project == null, ErrorCode.OPERATION_ERROR, "当前项目不存在");
return commonService.copyProperties(project, ProjectVO.class);
}