generated from youfool-project/youfool-prj-springboot-template
bug修复
This commit is contained in:
parent
b78eb61f5f
commit
91c94c55fe
|
|
@ -3,6 +3,7 @@ package com.chinaweal.youfool.course.config;
|
|||
import com.baomidou.mybatisplus.core.config.GlobalConfig;
|
||||
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
|
||||
import com.chinaweal.youfool.framework.springboot.mybatis.plus.CommonMetaObjectHandler;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
|
@ -11,7 +12,6 @@ import org.springframework.context.annotation.Primary;
|
|||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,45 +0,0 @@
|
|||
package com.chinaweal.youfool.course.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
import springfox.documentation.builders.PathSelectors;
|
||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||
import springfox.documentation.service.ApiInfo;
|
||||
import springfox.documentation.service.Contact;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;
|
||||
|
||||
|
||||
@Configuration
|
||||
@EnableSwagger2WebMvc
|
||||
public class SwaggerKnife4j {
|
||||
private final String applicationName = "youfool-prj-springboot-template";
|
||||
private final String description = "boot基础的后台模板";
|
||||
|
||||
@Bean("cms")
|
||||
public Docket cmsApi() {
|
||||
//添加head参数start
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
.enable(true)
|
||||
.apiInfo(apiInfo())
|
||||
.groupName("基础框架")
|
||||
.select()
|
||||
.apis(RequestHandlerSelectors.basePackage("com.chinaweal.youfool.framework.springboot.cms"))
|
||||
.paths(PathSelectors.any())
|
||||
.build();
|
||||
}
|
||||
|
||||
private ApiInfo apiInfo() {
|
||||
return new ApiInfoBuilder()
|
||||
.title(applicationName)
|
||||
.description(description)
|
||||
.termsOfServiceUrl("https://www.chinaweal.com.cn")
|
||||
.contact(new Contact("chinaweal", "https://www.chinaweal.com.cn", ""))
|
||||
.license("众望通科技")
|
||||
.licenseUrl("https://www.chinaweal.com.cn")
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -2,15 +2,16 @@ package com.chinaweal.youfool.course.controller;
|
|||
|
||||
import cn.dev33.satoken.session.SaSession;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.chinaweal.youfool.course.common.constants.SessionConstants;
|
||||
import com.chinaweal.youfool.course.entity.SysUser;
|
||||
import com.chinaweal.youfool.course.entity.UserBaseExtend;
|
||||
import com.chinaweal.youfool.course.service.SysUserService;
|
||||
import com.chinaweal.youfool.framework.springboot.common.base.BaseController;
|
||||
import com.chinaweal.youfool.framework.springboot.common.util.AssertUtils;
|
||||
import com.chinaweal.youfool.framework.springboot.common.util.RSAUtil;
|
||||
import com.chinaweal.youfool.framework.springboot.rest.BaseResultCode;
|
||||
import com.chinaweal.youfool.framework.springboot.rest.RestResult;
|
||||
import com.chinaweal.youfool.framework.springboot.rest.ResultCode;
|
||||
import com.chinaweal.youfool.framework.springboot.user.entity.UserBase;
|
||||
import com.chinaweal.youfool.course.common.constants.SessionConstants;
|
||||
import com.chinaweal.youfool.course.entity.SysUser;
|
||||
import com.chinaweal.youfool.course.service.SysUserService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
|
@ -31,7 +32,7 @@ import java.util.Set;
|
|||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/user/auth")
|
||||
public class LoginController extends BaseController {
|
||||
public class LoginController {
|
||||
|
||||
@Autowired
|
||||
private SysUserService sysUserService;
|
||||
|
|
@ -55,30 +56,30 @@ public class LoginController extends BaseController {
|
|||
password = RSAUtil.decrypt(password, privateKey);
|
||||
} catch (Exception e) {
|
||||
log.error("密码解密失败:{}", password, e);
|
||||
return RestResult.error(ResultCode.BUSINESS_LOGIC_ERROR, "密码解密失败");
|
||||
return RestResult.error(BaseResultCode.BUSINESS_LOGIC_ERROR, "密码解密失败");
|
||||
}
|
||||
}
|
||||
|
||||
// 查询用户信息
|
||||
SysUser sysUser = sysUserService.getUserByUsername(username);
|
||||
if (sysUser == null || !sysUser.getPassword().equals(password)) {
|
||||
return RestResult.error(ResultCode.BUSINESS_LOGIC_ERROR, "用户名或密码错误");
|
||||
return RestResult.error(BaseResultCode.BUSINESS_LOGIC_ERROR, "用户名或密码错误");
|
||||
}
|
||||
|
||||
// 匹配成功的话,登记登录信息
|
||||
StpUtil.login(sysUser.getUserId());
|
||||
SaSession session = StpUtil.getSession();
|
||||
// 将用户信息存储至session
|
||||
UserBase userBase = new UserBase();
|
||||
UserBaseExtend userBase = new UserBaseExtend();
|
||||
userBase.setUsername(sysUser.getUsername());
|
||||
userBase.setEmail(sysUser.getEmail());
|
||||
userBase.setAvatar(sysUser.getAvatar());
|
||||
userBase.setId(sysUser.getUserId());
|
||||
userBase.setUserId(sysUser.getUserId());
|
||||
|
||||
Set<String> permissionSet = new HashSet<>();
|
||||
permissionSet.add("admin");
|
||||
userBase.setPermission(permissionSet);
|
||||
session.set(SessionConstants.USER_KEY, userBase);
|
||||
session.set(SaSession.USER, userBase);
|
||||
|
||||
return RestResult.ok();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,9 +2,8 @@ package com.chinaweal.youfool.course.controller;
|
|||
|
||||
import cn.dev33.satoken.session.SaSession;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.chinaweal.youfool.framework.springboot.user.entity.UserBase;
|
||||
import com.chinaweal.youfool.course.common.constants.SessionConstants;
|
||||
import com.chinaweal.youfool.course.entity.SysUser;
|
||||
import com.chinaweal.youfool.course.entity.UserBaseExtend;
|
||||
import com.chinaweal.youfool.course.service.SysUserService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -165,11 +164,11 @@ public class OAuth2Controller {
|
|||
SaSession session = StpUtil.getSession();
|
||||
|
||||
// 构建用户信息
|
||||
UserBase userBase = new UserBase();
|
||||
UserBaseExtend userBase = new UserBaseExtend();
|
||||
userBase.setUsername(sysUser.getUsername());
|
||||
userBase.setEmail(sysUser.getEmail());
|
||||
userBase.setAvatarUrl(sysUser.getAvatar());
|
||||
userBase.setId(sysUser.getUserId());
|
||||
userBase.setAvatar(sysUser.getAvatar());
|
||||
userBase.setUserId(sysUser.getUserId());
|
||||
|
||||
// 设置权限
|
||||
Set<String> permissionSet = new HashSet<>();
|
||||
|
|
@ -177,6 +176,6 @@ public class OAuth2Controller {
|
|||
userBase.setPermission(permissionSet);
|
||||
|
||||
// 将用户信息存储至session
|
||||
session.set(SessionConstants.USER_KEY, userBase);
|
||||
session.set(SaSession.USER, userBase);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
package com.chinaweal.youfool.course.controller;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.chinaweal.youfool.framework.springboot.rest.RestResult;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 测试控制器
|
||||
*
|
||||
* @author lroyia
|
||||
* @since 2025/10/24
|
||||
**/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/test")
|
||||
public class TestController {
|
||||
|
||||
/**
|
||||
* 测试接口,需要登录
|
||||
*
|
||||
* @return 测试结果
|
||||
*/
|
||||
@GetMapping("/hello")
|
||||
public RestResult<String> hello() {
|
||||
return RestResult.ok("Hello, " + StpUtil.getLoginIdAsString() + "!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试管理员权限
|
||||
*
|
||||
* @return 测试结果
|
||||
*/
|
||||
@GetMapping("/admin")
|
||||
public RestResult<String> admin() {
|
||||
StpUtil.checkPermission("admin");
|
||||
return RestResult.ok("Admin access granted!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试用户权限
|
||||
*
|
||||
* @return 测试结果
|
||||
*/
|
||||
@GetMapping("/user")
|
||||
public RestResult<String> user() {
|
||||
StpUtil.checkPermission("user");
|
||||
return RestResult.ok("User access granted!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前登录信息
|
||||
*
|
||||
* @return 登录信息
|
||||
*/
|
||||
@GetMapping("/info")
|
||||
public RestResult<String> info() {
|
||||
return RestResult.ok("Current login id: " + StpUtil.getLoginIdAsString());
|
||||
}
|
||||
}
|
||||
|
|
@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
|||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.chinaweal.youfool.framework.springboot.common.util.DateUtil;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
|
|
@ -80,7 +82,8 @@ public class Course implements Serializable {
|
|||
* <p>记录创建时间,系统自动生成。</p>
|
||||
*/
|
||||
@TableField("create_time")
|
||||
@Schema(description = "创建时间", example = "2024-01-01T10:00:00")
|
||||
@Schema(description = "创建时间", example = "2024-01-01 10:00:00")
|
||||
@JsonFormat(pattern = DateUtil.DATETIME_DEFAULT_FORMAT, timezone = "GMT+8")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
|
|
@ -98,59 +101,7 @@ public class Course implements Serializable {
|
|||
* <p>记录最后更新时间,系统自动更新。</p>
|
||||
*/
|
||||
@TableField("update_time")
|
||||
@Schema(description = "更新时间", example = "2024-01-02T15:30:00")
|
||||
@Schema(description = "更新时间", example = "2024-01-02 15:30:00")
|
||||
@JsonFormat(pattern = DateUtil.DATETIME_DEFAULT_FORMAT, timezone = "GMT+8")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 无参构造函数
|
||||
*/
|
||||
public Course() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 带课程ID的构造函数
|
||||
*
|
||||
* @param id 课程ID
|
||||
*/
|
||||
public Course(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* 完整参数构造函数
|
||||
*
|
||||
* @param id 课程ID
|
||||
* @param courseDate 课程日期
|
||||
* @param courseName 课程名称
|
||||
* @param courseDesc 课程描述
|
||||
* @param createBy 创建人
|
||||
* @param createTime 创建时间
|
||||
* @param updateBy 更新人
|
||||
* @param updateTime 更新时间
|
||||
*/
|
||||
public Course(String id, LocalDate courseDate, String courseName, String courseDesc,
|
||||
String createBy, LocalDateTime createTime, String updateBy, LocalDateTime updateTime) {
|
||||
this.id = id;
|
||||
this.courseDate = courseDate;
|
||||
this.courseName = courseName;
|
||||
this.courseDesc = courseDesc;
|
||||
this.createBy = createBy;
|
||||
this.createTime = createTime;
|
||||
this.updateBy = updateBy;
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Course{" +
|
||||
"id='" + id + '\'' +
|
||||
", courseDate=" + courseDate +
|
||||
", courseName='" + courseName + '\'' +
|
||||
", courseDesc='" + courseDesc + '\'' +
|
||||
", createBy='" + createBy + '\'' +
|
||||
", createTime=" + createTime +
|
||||
", updateBy='" + updateBy + '\'' +
|
||||
", updateTime=" + updateTime +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
|||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.chinaweal.youfool.framework.springboot.common.util.DateUtil;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
|
|
@ -97,7 +99,8 @@ public class CourseAttachment implements Serializable {
|
|||
* <p>记录创建时间,系统自动生成。</p>
|
||||
*/
|
||||
@TableField("create_time")
|
||||
@Schema(description = "创建时间", example = "2024-01-01T10:00:00")
|
||||
@Schema(description = "创建时间", example = "2024-01-01 10:00:00")
|
||||
@JsonFormat(pattern = DateUtil.DATETIME_DEFAULT_FORMAT, timezone = "GMT+8")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
|
|
@ -115,66 +118,7 @@ public class CourseAttachment implements Serializable {
|
|||
* <p>记录最后更新时间,系统自动更新。</p>
|
||||
*/
|
||||
@TableField("update_time")
|
||||
@Schema(description = "更新时间", example = "2024-01-02T15:30:00")
|
||||
@Schema(description = "更新时间", example = "2024-01-02 15:30:00")
|
||||
@JsonFormat(pattern = DateUtil.DATETIME_DEFAULT_FORMAT, timezone = "GMT+8")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 无参构造函数
|
||||
*/
|
||||
public CourseAttachment() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 带附件ID的构造函数
|
||||
*
|
||||
* @param id 附件ID
|
||||
*/
|
||||
public CourseAttachment(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* 完整参数构造函数
|
||||
*
|
||||
* @param id 附件ID
|
||||
* @param courseId 课程ID
|
||||
* @param fileName 文件名称
|
||||
* @param fileFormat 文件格式
|
||||
* @param absoluteName 文件绝对路径名称
|
||||
* @param fileSize 文件大小
|
||||
* @param createBy 创建人
|
||||
* @param createTime 创建时间
|
||||
* @param updateBy 更新人
|
||||
* @param updateTime 更新时间
|
||||
*/
|
||||
public CourseAttachment(String id, String courseId, String fileName, String fileFormat,
|
||||
String absoluteName, Long fileSize, String createBy, LocalDateTime createTime,
|
||||
String updateBy, LocalDateTime updateTime) {
|
||||
this.id = id;
|
||||
this.courseId = courseId;
|
||||
this.fileName = fileName;
|
||||
this.fileFormat = fileFormat;
|
||||
this.absoluteName = absoluteName;
|
||||
this.fileSize = fileSize;
|
||||
this.createBy = createBy;
|
||||
this.createTime = createTime;
|
||||
this.updateBy = updateBy;
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CourseAttachment{" +
|
||||
"id='" + id + '\'' +
|
||||
", courseId='" + courseId + '\'' +
|
||||
", fileName='" + fileName + '\'' +
|
||||
", fileFormat='" + fileFormat + '\'' +
|
||||
", absoluteName='" + absoluteName + '\'' +
|
||||
", fileSize=" + fileSize +
|
||||
", createBy='" + createBy + '\'' +
|
||||
", createTime=" + createTime +
|
||||
", updateBy='" + updateBy + '\'' +
|
||||
", updateTime=" + updateTime +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
|||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.chinaweal.youfool.framework.springboot.common.util.DateUtil;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
|
|
@ -79,7 +81,8 @@ public class CourseComment implements Serializable {
|
|||
* <p>记录创建时间,系统自动生成。</p>
|
||||
*/
|
||||
@TableField("create_time")
|
||||
@Schema(description = "创建时间", example = "2024-01-01T10:00:00")
|
||||
@Schema(description = "创建时间", example = "2024-01-01 10:00:00")
|
||||
@JsonFormat(pattern = DateUtil.DATETIME_DEFAULT_FORMAT, timezone = "GMT+8")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
|
|
@ -97,59 +100,8 @@ public class CourseComment implements Serializable {
|
|||
* <p>记录最后更新时间,系统自动更新。</p>
|
||||
*/
|
||||
@TableField("update_time")
|
||||
@Schema(description = "更新时间", example = "2024-01-02T15:30:00")
|
||||
@Schema(description = "更新时间", example = "2024-01-02 15:30:00")
|
||||
@JsonFormat(pattern = DateUtil.DATETIME_DEFAULT_FORMAT, timezone = "GMT+8")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 无参构造函数
|
||||
*/
|
||||
public CourseComment() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 带评论ID的构造函数
|
||||
*
|
||||
* @param id 评论ID
|
||||
*/
|
||||
public CourseComment(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* 完整参数构造函数
|
||||
*
|
||||
* @param id 评论ID
|
||||
* @param courseId 课程ID
|
||||
* @param commentText 评论文本
|
||||
* @param parentId 回复ID
|
||||
* @param createBy 创建人
|
||||
* @param createTime 创建时间
|
||||
* @param updateBy 更新人
|
||||
* @param updateTime 更新时间
|
||||
*/
|
||||
public CourseComment(String id, String courseId, String commentText, String parentId,
|
||||
String createBy, LocalDateTime createTime, String updateBy, LocalDateTime updateTime) {
|
||||
this.id = id;
|
||||
this.courseId = courseId;
|
||||
this.commentText = commentText;
|
||||
this.parentId = parentId;
|
||||
this.createBy = createBy;
|
||||
this.createTime = createTime;
|
||||
this.updateBy = updateBy;
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CourseComment{" +
|
||||
"id='" + id + '\'' +
|
||||
", courseId='" + courseId + '\'' +
|
||||
", commentText='" + commentText + '\'' +
|
||||
", parentId='" + parentId + '\'' +
|
||||
", createBy='" + createBy + '\'' +
|
||||
", createTime=" + createTime +
|
||||
", updateBy='" + updateBy + '\'' +
|
||||
", updateTime=" + updateTime +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
|||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.chinaweal.youfool.framework.springboot.common.util.DateUtil;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
|
|
@ -88,7 +90,8 @@ public class CourseVideo implements Serializable {
|
|||
* <p>记录创建时间,系统自动生成。</p>
|
||||
*/
|
||||
@TableField("create_time")
|
||||
@Schema(description = "创建时间", example = "2024-01-01T10:00:00")
|
||||
@Schema(description = "创建时间", example = "2024-01-01 10:00:00")
|
||||
@JsonFormat(pattern = DateUtil.DATETIME_DEFAULT_FORMAT, timezone = "GMT+8")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
|
|
@ -106,62 +109,7 @@ public class CourseVideo implements Serializable {
|
|||
* <p>记录最后更新时间,系统自动更新。</p>
|
||||
*/
|
||||
@TableField("update_time")
|
||||
@Schema(description = "更新时间", example = "2024-01-02T15:30:00")
|
||||
@Schema(description = "更新时间", example = "2024-01-02 15:30:00")
|
||||
@JsonFormat(pattern = DateUtil.DATETIME_DEFAULT_FORMAT, timezone = "GMT+8")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 无参构造函数
|
||||
*/
|
||||
public CourseVideo() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 带视频ID的构造函数
|
||||
*
|
||||
* @param id 视频ID
|
||||
*/
|
||||
public CourseVideo(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* 完整参数构造函数
|
||||
*
|
||||
* @param id 视频ID
|
||||
* @param courseId 课程主键
|
||||
* @param sortIdx 排序索引
|
||||
* @param videoName 视频名称
|
||||
* @param attachmentId 附件ID
|
||||
* @param createBy 创建人
|
||||
* @param createTime 创建时间
|
||||
* @param updateBy 更新人
|
||||
* @param updateTime 更新时间
|
||||
*/
|
||||
public CourseVideo(String id, String courseId, Integer sortIdx, String videoName, String attachmentId,
|
||||
String createBy, LocalDateTime createTime, String updateBy, LocalDateTime updateTime) {
|
||||
this.id = id;
|
||||
this.courseId = courseId;
|
||||
this.sortIdx = sortIdx;
|
||||
this.videoName = videoName;
|
||||
this.attachmentId = attachmentId;
|
||||
this.createBy = createBy;
|
||||
this.createTime = createTime;
|
||||
this.updateBy = updateBy;
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CourseVideo{" +
|
||||
"id='" + id + '\'' +
|
||||
", courseId='" + courseId + '\'' +
|
||||
", sortIdx=" + sortIdx +
|
||||
", videoName='" + videoName + '\'' +
|
||||
", attachmentId='" + attachmentId + '\'' +
|
||||
", createBy='" + createBy + '\'' +
|
||||
", createTime=" + createTime +
|
||||
", updateBy='" + updateBy + '\'' +
|
||||
", updateTime=" + updateTime +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
@ -98,57 +98,4 @@ public class SysUser implements Serializable {
|
|||
@TableField("gitea_open_id")
|
||||
@Schema(description = "Gitea Open ID", example = "1234567890")
|
||||
private String giteaOpenId;
|
||||
|
||||
/**
|
||||
* 无参构造函数
|
||||
*/
|
||||
public SysUser() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 带用户ID的构造函数
|
||||
*
|
||||
* @param userId 用户ID
|
||||
*/
|
||||
public SysUser(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 完整参数构造函数
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param username 用户名
|
||||
* @param nickname 昵称
|
||||
* @param name 姓名
|
||||
* @param avatar 头像
|
||||
* @param email 邮箱
|
||||
* @param password 密码
|
||||
* @param giteaOpenId Gitea Open ID
|
||||
*/
|
||||
public SysUser(String userId, String username, String nickname, String name,
|
||||
String avatar, String email, String password, String giteaOpenId) {
|
||||
this.userId = userId;
|
||||
this.username = username;
|
||||
this.nickname = nickname;
|
||||
this.name = name;
|
||||
this.avatar = avatar;
|
||||
this.email = email;
|
||||
this.password = password;
|
||||
this.giteaOpenId = giteaOpenId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SysUser{" +
|
||||
"userId='" + userId + '\'' +
|
||||
", username='" + username + '\'' +
|
||||
", nickname='" + nickname + '\'' +
|
||||
", name='" + name + '\'' +
|
||||
", avatar='" + avatar + '\'' +
|
||||
", email='" + email + '\'' +
|
||||
", password='" + password + '\'' +
|
||||
", giteaOpenId='" + giteaOpenId + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
@ -6,7 +6,6 @@ import cn.dev33.satoken.stp.StpUtil;
|
|||
import com.chinaweal.youfool.framework.springboot.rest.RestResult;
|
||||
import com.chinaweal.youfool.framework.springboot.user.entity.UserBase;
|
||||
import com.chinaweal.youfool.framework.springboot.user.service.UserBaseService;
|
||||
import com.chinaweal.youfool.course.common.constants.SessionConstants;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -25,7 +24,7 @@ public class UserBaseServiceImpl implements UserBaseService {
|
|||
public UserBase getCurrentUser() {
|
||||
try {
|
||||
SaSession session = StpUtil.getSession();
|
||||
return session.get(SessionConstants.USER_KEY, null);
|
||||
return session.get(SaSession.USER, null);
|
||||
} catch (NotLoginException e) {
|
||||
UserBase userBase = new UserBase();
|
||||
userBase.setUsername("guest");
|
||||
|
|
|
|||
Loading…
Reference in New Issue