!14 存储桶改为private

* 后台 使用许可页面
* 优化:移除API访问地址配置
* 后台、pc、h5 删除无用配置
* docker部署优化
* 2.0 networkMode=bridge
* changelog
* 学员端权限为空报错
* h5 我的页面请求优化
* 缓存查询
* 后台 学员列表报错、线上课-上架时间字段优化
* 后台、pc、h5 使用签名地址
* 学员端接口修改
* 后台、pc 使用签名地址
* 后台 使用签名地址
* 上传接口
* 上传接口
* 系统配置
* 线上课封面
* bucket由public改为private
* 资源相关表实体及对象修改
* 统一数据库脚本
This commit is contained in:
白书科技
2025-05-22 07:23:06 +00:00
parent c206fa4bf2
commit 12daa31ab9
134 changed files with 10054 additions and 1231 deletions

View File

@@ -21,7 +21,6 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
@@ -40,7 +39,7 @@ public class Course implements Serializable {
private String title;
/** 课程封面 */
private String thumb;
private Integer thumb;
/** 课程价格(分) */
private Integer charge;
@@ -61,12 +60,16 @@ public class Course implements Serializable {
@JsonProperty("is_show")
private Integer isShow;
@JsonProperty("published_at")
private Date publishedAt;
@JsonProperty("created_at")
private Date createdAt;
@JsonProperty("sort_at")
private Date sortAt;
/** 其它规则[课程设置] */
private String extra;
/** 管理员ID */
@JsonProperty("admin_id")
private Integer adminId;
@@ -74,7 +77,111 @@ public class Course implements Serializable {
@JsonIgnore private Date deletedAt;
@Serial
@TableField(exist = false)
private static final long serialVersionUID = 1L;
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
Course other = (Course) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getTitle() == null
? other.getTitle() == null
: this.getTitle().equals(other.getTitle()))
&& (this.getThumb() == null
? other.getThumb() == null
: this.getThumb().equals(other.getThumb()))
&& (this.getCharge() == null
? other.getCharge() == null
: this.getCharge().equals(other.getCharge()))
&& (this.getClassHour() == null
? other.getClassHour() == null
: this.getClassHour().equals(other.getClassHour()))
&& (this.getIsShow() == null
? other.getIsShow() == null
: this.getIsShow().equals(other.getIsShow()))
&& (this.getIsRequired() == null
? other.getIsRequired() == null
: this.getIsRequired().equals(other.getIsRequired()))
&& (this.getCreatedAt() == null
? other.getCreatedAt() == null
: this.getCreatedAt().equals(other.getCreatedAt()))
&& (this.getSortAt() == null
? other.getSortAt() == null
: this.getSortAt().equals(other.getSortAt()))
&& (this.getUpdatedAt() == null
? other.getUpdatedAt() == null
: this.getUpdatedAt().equals(other.getUpdatedAt()))
&& (this.getDeletedAt() == null
? other.getDeletedAt() == null
: this.getDeletedAt().equals(other.getDeletedAt()))
&& (this.getShortDesc() == null
? other.getShortDesc() == null
: this.getShortDesc().equals(other.getShortDesc()))
&& (this.getSortAt() == null
? other.getSortAt() == null
: this.getSortAt().equals(other.getSortAt()))
&& (this.getExtra() == null
? other.getExtra() == null
: this.getExtra().equals(other.getExtra()))
&& (this.getAdminId() == null
? other.getAdminId() == null
: this.getAdminId().equals(other.getAdminId()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getTitle() == null) ? 0 : getTitle().hashCode());
result = prime * result + ((getThumb() == null) ? 0 : getThumb().hashCode());
result = prime * result + ((getCharge() == null) ? 0 : getCharge().hashCode());
result = prime * result + ((getShortDesc() == null) ? 0 : getShortDesc().hashCode());
result = prime * result + ((getClassHour() == null) ? 0 : getClassHour().hashCode());
result = prime * result + ((getIsShow() == null) ? 0 : getIsShow().hashCode());
result = prime * result + ((getIsRequired() == null) ? 0 : getIsRequired().hashCode());
result = prime * result + ((getCreatedAt() == null) ? 0 : getCreatedAt().hashCode());
result = prime * result + ((getSortAt() == null) ? 0 : getSortAt().hashCode());
result = prime * result + ((getUpdatedAt() == null) ? 0 : getUpdatedAt().hashCode());
result = prime * result + ((getDeletedAt() == null) ? 0 : getDeletedAt().hashCode());
result = prime * result + ((getSortAt() == null) ? 0 : getSortAt().hashCode());
result = prime * result + ((getExtra() == null) ? 0 : getExtra().hashCode());
result = prime * result + ((getAdminId() == null) ? 0 : getAdminId().hashCode());
return result;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", title=").append(title);
sb.append(", thumb=").append(thumb);
sb.append(", charge=").append(charge);
sb.append(", shortDesc=").append(shortDesc);
sb.append(", classHour=").append(classHour);
sb.append(", isShow=").append(isShow);
sb.append(", isRequired=").append(isRequired);
sb.append(", createdAt=").append(createdAt);
sb.append(", sortAt=").append(sortAt);
sb.append(", updatedAt=").append(updatedAt);
sb.append(", deletedAt=").append(deletedAt);
sb.append(", sortAt=").append(sortAt);
sb.append(", extra=").append(extra);
sb.append(", adminId=").append(adminId);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}

View File

@@ -24,17 +24,22 @@ import java.io.Serializable;
import lombok.Data;
/**
* @TableName course_department
* @TableName course_department_user
*/
@TableName(value = "course_department")
@Data
public class CourseDepartment implements Serializable {
@TableName(value = "course_department_user")
public class CourseDepartmentUser implements Serializable {
/** 任务ID */
@TableId(type = IdType.NONE)
@JsonProperty("course_id")
private Integer courseId;
@JsonProperty("dep_id")
private Integer depId;
/** 指派范围ID */
@JsonProperty("range_id")
private Integer rangeId;
/** 指派范围类型[0:部门,1:学员] */
private Integer type;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
@@ -50,13 +55,16 @@ public class CourseDepartment implements Serializable {
if (getClass() != that.getClass()) {
return false;
}
CourseDepartment other = (CourseDepartment) that;
CourseDepartmentUser other = (CourseDepartmentUser) that;
return (this.getCourseId() == null
? other.getCourseId() == null
: this.getCourseId().equals(other.getCourseId()))
&& (this.getDepId() == null
? other.getDepId() == null
: this.getDepId().equals(other.getDepId()));
&& (this.getRangeId() == null
? other.getRangeId() == null
: this.getRangeId().equals(other.getRangeId()))
&& (this.getType() == null
? other.getType() == null
: this.getType().equals(other.getType()));
}
@Override
@@ -64,7 +72,8 @@ public class CourseDepartment implements Serializable {
final int prime = 31;
int result = 1;
result = prime * result + ((getCourseId() == null) ? 0 : getCourseId().hashCode());
result = prime * result + ((getDepId() == null) ? 0 : getDepId().hashCode());
result = prime * result + ((getRangeId() == null) ? 0 : getRangeId().hashCode());
result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
return result;
}
@@ -75,7 +84,8 @@ public class CourseDepartment implements Serializable {
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", courseId=").append(courseId);
sb.append(", depId=").append(depId);
sb.append(", rangeId=").append(rangeId);
sb.append(", type=").append(type);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();

View File

@@ -61,6 +61,9 @@ public class CourseHour implements Serializable {
/** */
@JsonIgnore private Date createdAt;
/** 删除标志[0:存在,1:删除] */
private Integer deleted;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
@@ -100,7 +103,10 @@ public class CourseHour implements Serializable {
: this.getDuration().equals(other.getDuration()))
&& (this.getCreatedAt() == null
? other.getCreatedAt() == null
: this.getCreatedAt().equals(other.getCreatedAt()));
: this.getCreatedAt().equals(other.getCreatedAt()))
&& (this.getDeleted() == null
? other.getDeleted() == null
: this.getDeleted().equals(other.getDeleted()));
}
@Override
@@ -116,6 +122,7 @@ public class CourseHour implements Serializable {
result = prime * result + ((getRid() == null) ? 0 : getRid().hashCode());
result = prime * result + ((getDuration() == null) ? 0 : getDuration().hashCode());
result = prime * result + ((getCreatedAt() == null) ? 0 : getCreatedAt().hashCode());
result = prime * result + ((getDeleted() == null) ? 0 : getDeleted().hashCode());
return result;
}
@@ -134,6 +141,7 @@ public class CourseHour implements Serializable {
sb.append(", rid=").append(rid);
sb.append(", duration=").append(duration);
sb.append(", createdAt=").append(createdAt);
sb.append(", deleted=").append(deleted);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();

View File

@@ -54,12 +54,12 @@ public class UserLearnDurationRecord implements Serializable {
private Date endAt;
/** */
@JsonProperty("course_id")
private Integer courseId;
@JsonProperty("from_id")
private String fromId;
/** */
@JsonProperty("hour_id")
private Integer hourId;
@JsonProperty("from_scene")
private String fromScene;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
@@ -92,12 +92,12 @@ public class UserLearnDurationRecord implements Serializable {
&& (this.getEndAt() == null
? other.getEndAt() == null
: this.getEndAt().equals(other.getEndAt()))
&& (this.getCourseId() == null
? other.getCourseId() == null
: this.getCourseId().equals(other.getCourseId()))
&& (this.getHourId() == null
? other.getHourId() == null
: this.getHourId().equals(other.getHourId()));
&& (this.getFromId() == null
? other.getFromId() == null
: this.getFromId().equals(other.getFromId()))
&& (this.getFromScene() == null
? other.getFromScene() == null
: this.getFromScene().equals(other.getFromScene()));
}
@Override
@@ -110,8 +110,8 @@ public class UserLearnDurationRecord implements Serializable {
result = prime * result + ((getDuration() == null) ? 0 : getDuration().hashCode());
result = prime * result + ((getStartAt() == null) ? 0 : getStartAt().hashCode());
result = prime * result + ((getEndAt() == null) ? 0 : getEndAt().hashCode());
result = prime * result + ((getCourseId() == null) ? 0 : getCourseId().hashCode());
result = prime * result + ((getHourId() == null) ? 0 : getHourId().hashCode());
result = prime * result + ((getFromId() == null) ? 0 : getFromId().hashCode());
result = prime * result + ((getFromScene() == null) ? 0 : getFromScene().hashCode());
return result;
}
@@ -127,8 +127,8 @@ public class UserLearnDurationRecord implements Serializable {
sb.append(", duration=").append(duration);
sb.append(", startAt=").append(startAt);
sb.append(", endAt=").append(endAt);
sb.append(", courseId=").append(courseId);
sb.append(", hourId=").append(hourId);
sb.append(", fromId=").append(fromId);
sb.append(", fromScene=").append(fromScene);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();

View File

@@ -17,12 +17,12 @@ package xyz.playedu.course.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import xyz.playedu.course.domain.CourseDepartment;
import xyz.playedu.course.domain.CourseDepartmentUser;
/**
* @author tengteng
* @description 针对表course_department的数据库操作Mapper
* @description 针对表course_department_user的数据库操作Mapper
* @createDate 2023-02-24 14:53:52
*/
@Mapper
public interface CourseDepartmentMapper extends BaseMapper<CourseDepartment> {}
public interface CourseDepartmentUserMapper extends BaseMapper<CourseDepartmentUser> {}

View File

@@ -17,14 +17,14 @@ package xyz.playedu.course.service;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
import xyz.playedu.course.domain.CourseDepartment;
import xyz.playedu.course.domain.CourseDepartmentUser;
/**
* @author tengteng
* @description 针对表course_department的数据库操作Service
* @description 针对表course_department_user的数据库操作Service
* @createDate 2023-02-24 14:53:52
*/
public interface CourseDepartmentService extends IService<CourseDepartment> {
public interface CourseDepartmentUserService extends IService<CourseDepartmentUser> {
List<Integer> getCourseIdsByDepIds(List<Integer> depIds);

View File

@@ -16,7 +16,6 @@
package xyz.playedu.course.service;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.Date;
import java.util.List;
import java.util.Map;
import xyz.playedu.common.exception.NotFoundException;
@@ -35,7 +34,7 @@ public interface CourseService extends IService<Course> {
Course createWithCategoryIdsAndDepIds(
String title,
String thumb,
Integer thumb,
String shortDesc,
Integer isRequired,
Integer isShow,
@@ -46,11 +45,11 @@ public interface CourseService extends IService<Course> {
void updateWithCategoryIdsAndDepIds(
Course course,
String title,
String thumb,
Integer thumb,
String shortDesc,
Integer isRequired,
Integer isShow,
Date publishedAt,
String sortAt,
Integer[] categoryIds,
Integer[] depIds);

View File

@@ -24,7 +24,7 @@ import xyz.playedu.course.domain.UserLearnDurationRecord;
* @createDate 2023-03-20 16:41:12
*/
public interface UserLearnDurationRecordService extends IService<UserLearnDurationRecord> {
void store(Integer userId, Integer courseId, Integer hourId, Long startTime, Long endTime);
void store(Integer userId, String fromId, String fromScene, Long startTime, Long endTime);
void remove(Integer userId);
}

View File

@@ -18,30 +18,30 @@ package xyz.playedu.course.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List;
import org.springframework.stereotype.Service;
import xyz.playedu.course.domain.CourseDepartment;
import xyz.playedu.course.mapper.CourseDepartmentMapper;
import xyz.playedu.course.service.CourseDepartmentService;
import xyz.playedu.course.domain.CourseDepartmentUser;
import xyz.playedu.course.mapper.CourseDepartmentUserMapper;
import xyz.playedu.course.service.CourseDepartmentUserService;
/**
* @author tengteng
* @description 针对表course_department的数据库操作Service实现
* @description 针对表course_department_user的数据库操作Service实现
* @createDate 2023-02-24 14:53:52
*/
@Service
public class CourseDepartmentServiceImpl
extends ServiceImpl<CourseDepartmentMapper, CourseDepartment>
implements CourseDepartmentService {
public class CourseDepartmentUserServiceImpl
extends ServiceImpl<CourseDepartmentUserMapper, CourseDepartmentUser>
implements CourseDepartmentUserService {
@Override
public List<Integer> getCourseIdsByDepIds(List<Integer> depIds) {
return list(query().getWrapper().in("dep_id", depIds)).stream()
.map(CourseDepartment::getCourseId)
return list(query().getWrapper().in("range_id", depIds)).stream()
.map(CourseDepartmentUser::getCourseId)
.toList();
}
@Override
public List<Integer> getDepIdsByCourseId(Integer courseId) {
return list(query().getWrapper().eq("course_id", courseId)).stream()
.map(CourseDepartment::getDepId)
.map(CourseDepartmentUser::getRangeId)
.toList();
}
@@ -52,8 +52,8 @@ public class CourseDepartmentServiceImpl
@Override
public List<Integer> getCourseIdsByDepId(Integer depId) {
return list(query().getWrapper().eq("dep_id", depId)).stream()
.map(CourseDepartment::getCourseId)
return list(query().getWrapper().eq("range_id", depId)).stream()
.map(CourseDepartmentUser::getCourseId)
.toList();
}
}

View File

@@ -15,6 +15,7 @@
*/
package xyz.playedu.course.service.impl;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.*;
import java.util.stream.Collectors;
@@ -28,10 +29,10 @@ import xyz.playedu.common.types.paginate.PaginationResult;
import xyz.playedu.common.util.StringUtil;
import xyz.playedu.course.domain.Course;
import xyz.playedu.course.domain.CourseCategory;
import xyz.playedu.course.domain.CourseDepartment;
import xyz.playedu.course.domain.CourseDepartmentUser;
import xyz.playedu.course.mapper.CourseMapper;
import xyz.playedu.course.service.CourseCategoryService;
import xyz.playedu.course.service.CourseDepartmentService;
import xyz.playedu.course.service.CourseDepartmentUserService;
import xyz.playedu.course.service.CourseService;
/**
@@ -42,7 +43,7 @@ import xyz.playedu.course.service.CourseService;
@Service
public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> implements CourseService {
@Autowired private CourseDepartmentService courseDepartmentService;
@Autowired private CourseDepartmentUserService courseDepartmentUserService;
@Autowired private CourseCategoryService courseCategoryService;
@@ -62,7 +63,7 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> impleme
@Transactional
public Course createWithCategoryIdsAndDepIds(
String title,
String thumb,
Integer thumb,
String shortDesc,
Integer isRequired,
Integer isShow,
@@ -76,7 +77,7 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> impleme
course.setShortDesc(shortDesc);
course.setIsShow(isShow);
course.setIsRequired(isRequired);
course.setPublishedAt(new Date());
course.setSortAt(new Date());
course.setCreatedAt(new Date());
course.setUpdatedAt(new Date());
course.setAdminId(adminId);
@@ -94,23 +95,23 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> impleme
if (depIds == null || depIds.length == 0) {
return;
}
List<CourseDepartment> courseDepartments = new ArrayList<>();
List<CourseDepartmentUser> courseDepartmentUsers = new ArrayList<>();
for (int i = 0; i < depIds.length; i++) {
Integer tmpDepId = depIds[i];
courseDepartments.add(
new CourseDepartment() {
courseDepartmentUsers.add(
new CourseDepartmentUser() {
{
setCourseId(course.getId());
setDepId(tmpDepId);
setRangeId(tmpDepId);
}
});
}
courseDepartmentService.saveBatch(courseDepartments);
courseDepartmentUserService.saveBatch(courseDepartmentUsers);
}
@Override
public void resetRelateDepartments(Course course, Integer[] depIds) {
courseDepartmentService.removeByCourseId(course.getId());
courseDepartmentUserService.removeByCourseId(course.getId());
relateDepartments(course, depIds);
}
@@ -144,11 +145,11 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> impleme
public void updateWithCategoryIdsAndDepIds(
Course course,
String title,
String thumb,
Integer thumb,
String shortDesc,
Integer isRequired,
Integer isShow,
Date publishedAt,
String sortAt,
Integer[] categoryIds,
Integer[] depIds) {
Course newCourse = new Course();
@@ -159,8 +160,8 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> impleme
newCourse.setIsRequired(isRequired);
newCourse.setShortDesc(shortDesc);
if (null != publishedAt) {
newCourse.setPublishedAt(publishedAt);
if (StringUtil.isNotEmpty(sortAt)) {
newCourse.setSortAt(DateUtil.parseDate(sortAt));
}
updateById(newCourse);
@@ -180,7 +181,7 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> impleme
@Override
public List<Integer> getDepIdsByCourseId(Integer courseId) {
return courseDepartmentService.getDepIdsByCourseId(courseId);
return courseDepartmentUserService.getDepIdsByCourseId(courseId);
}
@Override
@@ -231,7 +232,7 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> impleme
return new ArrayList<>();
}
// 获取部门课程ID
List<Integer> courseIds = courseDepartmentService.getCourseIdsByDepIds(depIds);
List<Integer> courseIds = courseDepartmentUserService.getCourseIdsByDepIds(depIds);
if (StringUtil.isEmpty(courseIds)) {
return new ArrayList<>();
}
@@ -258,7 +259,7 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> impleme
return new ArrayList<>();
}
// 获取部门课程ID
List<Integer> courseIds = courseDepartmentService.getCourseIdsByDepIds(depIds);
List<Integer> courseIds = courseDepartmentUserService.getCourseIdsByDepIds(depIds);
if (StringUtil.isEmpty(courseIds)) {
return new ArrayList<>();
}
@@ -289,19 +290,21 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> impleme
if (courseIds == null || courseIds.size() == 0) {
return null;
}
Map<Integer, List<CourseDepartment>> data =
courseDepartmentService
Map<Integer, List<CourseDepartmentUser>> data =
courseDepartmentUserService
.list(
courseDepartmentService
courseDepartmentUserService
.query()
.getWrapper()
.in("course_id", courseIds))
.stream()
.collect(Collectors.groupingBy(CourseDepartment::getCourseId));
.collect(Collectors.groupingBy(CourseDepartmentUser::getCourseId));
Map<Integer, List<Integer>> result = new HashMap<>();
data.forEach(
(courseId, records) -> {
result.put(courseId, records.stream().map(CourseDepartment::getDepId).toList());
result.put(
courseId,
records.stream().map(CourseDepartmentUser::getRangeId).toList());
});
return result;
}

View File

@@ -37,15 +37,15 @@ public class UserLearnDurationRecordServiceImpl
@Override
@SneakyThrows
public void store(
Integer userId, Integer courseId, Integer hourId, Long startTime, Long endTime) {
Integer userId, String fromId, String fromScene, Long startTime, Long endTime) {
// 处理日期
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
String date = simpleDateFormat.format(new Date(endTime));
UserLearnDurationRecord record = new UserLearnDurationRecord();
record.setUserId(userId);
record.setCourseId(courseId);
record.setHourId(hourId);
record.setFromId(fromId);
record.setFromScene(fromScene);
record.setStartAt(new Date(startTime));
record.setEndAt(new Date(endTime));
record.setDuration((int) (endTime - startTime));

View File

@@ -2,14 +2,15 @@
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="xyz.playedu.course.mapper.CourseDepartmentMapper">
<mapper namespace="xyz.playedu.course.mapper.CourseDepartmentUserMapper">
<resultMap id="BaseResultMap" type="xyz.playedu.course.domain.CourseDepartment">
<result property="courseId" column="course_id" jdbcType="INTEGER"/>
<result property="depId" column="dep_id" jdbcType="INTEGER"/>
<resultMap id="BaseResultMap" type="xyz.playedu.course.domain.CourseDepartmentUser">
<result property="courseId" column="course_id" jdbcType="INTEGER"/>
<result property="rangeId" column="range_id" jdbcType="INTEGER"/>
<result property="type" column="type" jdbcType="INTEGER"/>
</resultMap>
<sql id="Base_Column_List">
course_id,dep_id
course_id,range_id,type
</sql>
</mapper>

View File

@@ -5,25 +5,27 @@
<mapper namespace="xyz.playedu.course.mapper.CourseMapper">
<resultMap id="BaseResultMap" type="xyz.playedu.course.domain.Course">
<id property="id" column="id" jdbcType="INTEGER"/>
<result property="title" column="title" jdbcType="VARCHAR"/>
<result property="thumb" column="thumb" jdbcType="VARCHAR"/>
<result property="shortDesc" column="short_desc" jdbcType="VARCHAR"/>
<result property="charge" column="charge" jdbcType="INTEGER"/>
<result property="classHour" column="class_hour" jdbcType="INTEGER"/>
<result property="isShow" column="is_show" jdbcType="TINYINT"/>
<result property="isRequired" column="is_required" jdbcType="TINYINT"/>
<result property="publishedAt" column="published_at" jdbcType="TIMESTAMP"/>
<result property="createdAt" column="created_at" jdbcType="TIMESTAMP"/>
<result property="updatedAt" column="updated_at" jdbcType="TIMESTAMP"/>
<result property="deletedAt" column="deleted_at" jdbcType="TIMESTAMP"/>
<id property="id" column="id" jdbcType="INTEGER"/>
<result property="title" column="title" jdbcType="VARCHAR"/>
<result property="thumb" column="thumb" jdbcType="VARCHAR"/>
<result property="shortDesc" column="short_desc" jdbcType="VARCHAR"/>
<result property="charge" column="charge" jdbcType="INTEGER"/>
<result property="classHour" column="class_hour" jdbcType="INTEGER"/>
<result property="isShow" column="is_show" jdbcType="TINYINT"/>
<result property="isRequired" column="is_required" jdbcType="TINYINT"/>
<result property="createdAt" column="created_at" jdbcType="TIMESTAMP"/>
<result property="sortAt" column="sort_at" jdbcType="TIMESTAMP"/>
<result property="updatedAt" column="updated_at" jdbcType="TIMESTAMP"/>
<result property="deletedAt" column="deleted_at" jdbcType="TIMESTAMP"/>
<result property="extra" column="extra" jdbcType="VARCHAR"/>
<result property="adminId" column="admin_id" jdbcType="INTEGER"/>
</resultMap>
<sql id="Base_Column_List">
id,title,thumb,short_desc,
charge,class_hour,is_show,
is_required,published_at,created_at,updated_at,
deleted_at
is_required,created_at,updated_at,sort_at,
deleted_at,extra,admin_id
</sql>
<select id="paginate" resultType="xyz.playedu.course.domain.Course">
@@ -32,10 +34,10 @@
<if test="depIds != null and !depIds.isEmpty()">
<choose>
<when test="depIds.get(0) == 0">
LEFT JOIN `course_department` ON `course_department`.`course_id` = `courses`.`id`
LEFT JOIN `course_department_user` ON `course_department_user`.`course_id` = `courses`.`id`
</when>
<otherwise>
INNER JOIN `course_department` ON `course_department`.`course_id` = `courses`.`id`
INNER JOIN `course_department_user` ON `course_department_user`.`course_id` = `courses`.`id`
</otherwise>
</choose>
</if>
@@ -54,10 +56,10 @@
<if test="depIds != null and !depIds.isEmpty()">
<choose>
<when test="depIds.get(0) == 0">
AND `course_department`.`course_id` IS NULL
AND `course_department_user`.`course_id` IS NULL
</when>
<otherwise>
AND `course_department`.`dep_id` IN (<foreach collection="depIds" item="tmpId" separator=",">
AND `course_department_user`.`range_id` IN (<foreach collection="depIds" item="tmpId" separator=",">
#{tmpId}</foreach>)
</otherwise>
</choose>
@@ -127,10 +129,10 @@
<if test="depIds != null and !depIds.isEmpty()">
<choose>
<when test="depIds.get(0) == 0">
LEFT JOIN `course_department` ON `course_department`.`course_id` = `courses`.`id`
LEFT JOIN `course_department_user` ON `course_department_user`.`course_id` = `courses`.`id`
</when>
<otherwise>
INNER JOIN `course_department` ON `course_department`.`course_id` = `courses`.`id`
INNER JOIN `course_department_user` ON `course_department_user`.`course_id` = `courses`.`id`
</otherwise>
</choose>
</if>
@@ -149,10 +151,10 @@
<if test="depIds != null and !depIds.isEmpty()">
<choose>
<when test="depIds.get(0) == 0">
AND `course_department`.`course_id` IS NULL
AND `course_department_user`.`course_id` IS NULL
</when>
<otherwise>
AND `course_department`.`dep_id` IN (<foreach collection="depIds" item="tmpId" separator=",">
AND `course_department_user`.`range_id` IN (<foreach collection="depIds" item="tmpId" separator=",">
#{tmpId}</foreach>)
</otherwise>
</choose>
@@ -185,11 +187,11 @@
<select id="openCoursesAndShow" resultType="xyz.playedu.course.domain.Course">
SELECT `courses`.*
FROM `courses`
LEFT JOIN `course_department` ON `course_department`.`course_id` = `courses`.`id`
LEFT JOIN `course_department_user` ON `course_department_user`.`course_id` = `courses`.`id`
<if test="categoryIds != null and !categoryIds.isEmpty()">
INNER JOIN `resource_course_category` ON `resource_course_category`.`course_id` = `courses`.`id`
</if>
WHERE `course_department`.`course_id` IS NULL
WHERE `course_department_user`.`course_id` IS NULL
AND `courses`.`is_show` = 1
<if test="categoryIds != null and !categoryIds.isEmpty()">
AND `resource_course_category`.`category_id` IN (<foreach collection="categoryIds" item="tmpId"