学员课程附件列表查询、下载日志记录

This commit is contained in:
wsw 2023-07-29 13:41:47 +08:00
parent ae13fa0201
commit 277332d410
12 changed files with 532 additions and 28 deletions

View File

@ -31,3 +31,15 @@ CREATE TABLE `course_attachment` (
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `course_id` (`course_id`) KEY `course_id` (`course_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE `course_attachment_download_log` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL DEFAULT '0' COMMENT '学员ID',
`course_id` int(11) NOT NULL DEFAULT '0' COMMENT '课程ID',
`title` varchar(255) NOT NULL DEFAULT '' COMMENT '课程标题',
`courser_attachment_id` int(11) NOT NULL DEFAULT '0' COMMENT '课程附件id',
`rid` int(11) NOT NULL DEFAULT '0' COMMENT '资源id',
`ip` varchar(45) NOT NULL DEFAULT '' COMMENT '下载ip',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

View File

@ -0,0 +1,70 @@
/*
* Copyright (C) 2023 杭州白书科技有限公司
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package xyz.playedu.api.controller.backend;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import xyz.playedu.api.annotation.Log;
import xyz.playedu.api.constant.BusinessType;
import xyz.playedu.api.domain.*;
import xyz.playedu.api.service.*;
import xyz.playedu.api.types.JsonResponse;
import xyz.playedu.api.types.paginate.CourseAttachmentDownloadLogPaginateFiler;
import xyz.playedu.api.types.paginate.PaginationResult;
import java.util.*;
@RestController
@Slf4j
@RequestMapping("/backend/v1/course/attachment/download/log")
public class CourseAttachmentDownloadLogController {
@Autowired private CourseAttachmentDownloadLogService courseAttachmentDownloadLogService;
@GetMapping("/index")
@Log(title = "学员下载课件记录-列表", businessType = BusinessType.GET)
public JsonResponse index(@RequestParam HashMap<String, Object> params) {
Integer page = MapUtils.getInteger(params, "page", 1);
Integer size = MapUtils.getInteger(params, "size", 10);
String sortField = MapUtils.getString(params, "sort_field");
String sortAlgo = MapUtils.getString(params, "sort_algo");
Integer userId = MapUtils.getInteger(params, "user_id");
Integer courseId = MapUtils.getInteger(params, "course_id");
String title = MapUtils.getString(params, "title");
Integer courserAttachmentId = MapUtils.getInteger(params, "courser_attachment_id");
Integer rid = MapUtils.getInteger(params, "rid");
CourseAttachmentDownloadLogPaginateFiler filter = new CourseAttachmentDownloadLogPaginateFiler();
filter.setUserId(userId);
filter.setCourseId(courseId);
filter.setTitle(title);
filter.setCourserAttachmentId(courserAttachmentId);
filter.setRid(rid);
filter.setSortField(sortField);
filter.setSortAlgo(sortAlgo);
PaginationResult<CourseAttachmentDownloadLog> result = courseAttachmentDownloadLogService.paginate(page, size, filter);
HashMap<String, Object> data = new HashMap<>();
data.put("data", result.getData());
data.put("total", result.getTotal());
return JsonResponse.data(data);
}
}

View File

@ -201,7 +201,7 @@ public class CourseController {
} }
// 课程附件 // 课程附件
if (req.getAttachments().size() > 0) { if (null != req.getAttachments() && req.getAttachments().size() > 0) {
List<CourseAttachment> insertAttachments = new ArrayList<>(); List<CourseAttachment> insertAttachments = new ArrayList<>();
final Integer[] sort = {0}; final Integer[] sort = {0};
for (CourseRequest.AttachmentItem attachmentItem : req.getAttachments()) { for (CourseRequest.AttachmentItem attachmentItem : req.getAttachments()) {
@ -235,11 +235,13 @@ public class CourseController {
List<CourseChapter> chapters = chapterService.getChaptersByCourseId(course.getId()); List<CourseChapter> chapters = chapterService.getChaptersByCourseId(course.getId());
List<CourseHour> hours = hourService.getHoursByCourseId(course.getId()); List<CourseHour> hours = hourService.getHoursByCourseId(course.getId());
List<CourseAttachment> attachments = attachmentService.getAttachmentsByCourseId(course.getId()); List<CourseAttachment> attachments = attachmentService.getAttachmentsByCourseId(course.getId());
Map<Integer,String> resourceMap = resourceService.chunks(attachments.stream().map(CourseAttachment::getRid).toList()) if(null != attachments && attachments.size() > 0){
.stream().collect(Collectors.toMap(Resource::getId, Resource::getUrl)); Map<Integer,String> resourceMap = resourceService.chunks(attachments.stream().map(CourseAttachment::getRid).toList())
attachments.forEach(courseAttachment -> { .stream().collect(Collectors.toMap(Resource::getId, Resource::getUrl));
courseAttachment.setUrl(resourceMap.get(courseAttachment.getRid())); attachments.forEach(courseAttachment -> {
}); courseAttachment.setUrl(resourceMap.get(courseAttachment.getRid()));
});
}
HashMap<String, Object> data = new HashMap<>(); HashMap<String, Object> data = new HashMap<>();
data.put("course", course); data.put("course", course);

View File

@ -0,0 +1,60 @@
/*
* Copyright (C) 2023 杭州白书科技有限公司
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package xyz.playedu.api.controller.frontend;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import xyz.playedu.api.FCtx;
import xyz.playedu.api.domain.*;
import xyz.playedu.api.exception.NotFoundException;
import xyz.playedu.api.service.*;
import xyz.playedu.api.types.JsonResponse;
import xyz.playedu.api.util.IpUtil;
import java.util.Date;
@RestController
@Slf4j
@RequestMapping("/api/v1/course/{courseId}/attachment/{attachmentId}/resource")
public class CourseAttachmentDownloadLogController {
@Autowired private CourseService courseService;
@Autowired private CourseAttachmentDownloadLogService courseAttachmentDownloadLogService;
@PostMapping("/{id}")
public JsonResponse store(@PathVariable(name = "courseId") Integer courseId,
@PathVariable(name = "attachmentId") Integer attachmentId,
@PathVariable(name = "id") Integer id) throws NotFoundException {
Course course = courseService.findOrFail(courseId);
CourseAttachmentDownloadLog courseAttachmentDownloadLog =
new CourseAttachmentDownloadLog() {
{
setUserId(FCtx.getId());
setCourseId(course.getId());
setTitle(course.getTitle());
setCourserAttachmentId(attachmentId);
setRid(id);
setIp(IpUtil.getIpAddress());
setCreatedAt(new Date());
}
};
courseAttachmentDownloadLogService.save(courseAttachmentDownloadLog);
return JsonResponse.success();
}
}

View File

@ -22,10 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import xyz.playedu.api.FCtx; import xyz.playedu.api.FCtx;
import xyz.playedu.api.constant.BackendConstant; import xyz.playedu.api.domain.*;
import xyz.playedu.api.domain.Course;
import xyz.playedu.api.domain.CourseHour;
import xyz.playedu.api.domain.UserCourseHourRecord;
import xyz.playedu.api.service.*; import xyz.playedu.api.service.*;
import xyz.playedu.api.types.JsonResponse; import xyz.playedu.api.types.JsonResponse;
import xyz.playedu.api.types.paginate.CoursePaginateFiler; import xyz.playedu.api.types.paginate.CoursePaginateFiler;
@ -33,6 +30,7 @@ import xyz.playedu.api.types.paginate.PaginationResult;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -50,6 +48,10 @@ public class CourseController {
@Autowired private CourseHourService hourService; @Autowired private CourseHourService hourService;
@Autowired private CourseAttachmentService attachmentService;
@Autowired private ResourceService resourceService;
@Autowired private UserCourseRecordService userCourseRecordService; @Autowired private UserCourseRecordService userCourseRecordService;
@Autowired private UserCourseHourRecordService userCourseHourRecordService; @Autowired private UserCourseHourRecordService userCourseHourRecordService;
@ -76,30 +78,24 @@ public class CourseController {
List<CourseHour> courseHours = hourService.getHoursByCourseId(course.getId()); List<CourseHour> courseHours = hourService.getHoursByCourseId(course.getId());
List<CourseAttachment> attachments = attachmentService.getAttachmentsByCourseId(course.getId());
if(null != attachments && attachments.size() > 0){
Map<Integer,String> resourceMap = resourceService.chunks(attachments.stream().map(CourseAttachment::getRid).toList())
.stream().collect(Collectors.toMap(Resource::getId, Resource::getUrl));
attachments.forEach(courseAttachment -> {
courseAttachment.setUrl(resourceMap.get(courseAttachment.getRid()));
});
}
HashMap<String, Object> data = new HashMap<>(); HashMap<String, Object> data = new HashMap<>();
data.put("course", course); data.put("course", course);
data.put("chapters", chapterService.getChaptersByCourseId(course.getId())); data.put("chapters", chapterService.getChaptersByCourseId(course.getId()));
data.put( data.put("hours", courseHours.stream().collect(Collectors.groupingBy(CourseHour::getChapterId)));
"hours",
courseHours.stream()
.filter(
courseHour ->
BackendConstant.RESOURCE_TYPE_VIDEO.equals(
courseHour.getType()))
.collect(Collectors.groupingBy(CourseHour::getChapterId)));
data.put("learn_record", userCourseRecordService.find(FCtx.getId(), course.getId())); data.put("learn_record", userCourseRecordService.find(FCtx.getId(), course.getId()));
data.put( data.put("learn_hour_records",
"learn_hour_records",
userCourseHourRecordService.getRecords(FCtx.getId(), course.getId()).stream() userCourseHourRecordService.getRecords(FCtx.getId(), course.getId()).stream()
.collect(Collectors.toMap(UserCourseHourRecord::getHourId, e -> e))); .collect(Collectors.toMap(UserCourseHourRecord::getHourId, e -> e)));
data.put( data.put("attachments", attachments);
"attachments",
courseHours.stream()
.filter(
courseHour ->
BackendConstant.RESOURCE_TYPE_ATTACHMENT.contains(
courseHour.getType()))
.collect(Collectors.groupingBy(CourseHour::getChapterId)));
return JsonResponse.data(data); return JsonResponse.data(data);
} }
} }

View File

@ -54,6 +54,7 @@ public class CourseAttachment implements Serializable {
private Integer rid; private Integer rid;
/** 资源url */ /** 资源url */
@TableField(exist = false)
private String url; private String url;
/** */ /** */

View File

@ -0,0 +1,134 @@
/*
* Copyright (C) 2023 杭州白书科技有限公司
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package xyz.playedu.api.domain;
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.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @TableName course_attachment_download_log
*/
@TableName(value = "course_attachment_download_log")
@Data
public class CourseAttachmentDownloadLog implements Serializable {
/** */
@TableId(type = IdType.AUTO)
private Long id;
/** 学员ID */
@JsonProperty("user_id")
private Integer userId;
/** 课程ID */
@JsonProperty("course_id")
private Integer courseId;
/** 标题 */
private String title;
/** 课程附件ID */
@JsonProperty("courser_attachment_id")
private Integer courserAttachmentId;
/** 资源ID */
private Integer rid;
/** IP */
private String ip;
@JsonProperty("created_at")
private Date createdAt;
@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;
}
CourseAttachmentDownloadLog other = (CourseAttachmentDownloadLog) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getUserId() == null
? other.getUserId() == null
: this.getUserId().equals(other.getUserId()))
&& (this.getCourseId() == null
? other.getCourseId() == null
: this.getCourseId().equals(other.getCourseId()))
&& (this.getTitle() == null
? other.getTitle() == null
: this.getTitle().equals(other.getTitle()))
&& (this.getCourserAttachmentId() == null
? other.getCourserAttachmentId() == null
: this.getCourserAttachmentId().equals(other.getCourserAttachmentId()))
&& (this.getRid() == null
? other.getRid() == null
: this.getRid().equals(other.getRid()))
&& (this.getIp() == null
? other.getIp() == null
: this.getIp().equals(other.getIp()))
&& (this.getCreatedAt() == null
? other.getCreatedAt() == null
: this.getCreatedAt().equals(other.getCreatedAt()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
result = prime * result + ((getCourseId() == null) ? 0 : getCourseId().hashCode());
result = prime * result + ((getTitle() == null) ? 0 : getTitle().hashCode());
result = prime * result + ((getCourserAttachmentId() == null) ? 0 : getCourserAttachmentId().hashCode());
result = prime * result + ((getRid() == null) ? 0 : getRid().hashCode());
result = prime * result + ((getIp() == null) ? 0 : getIp().hashCode());
result = prime * result + ((getCreatedAt() == null) ? 0 : getCreatedAt().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(", userId=").append(userId);
sb.append(", courseId=").append(courseId);
sb.append(", title=").append(title);
sb.append(", courserAttachmentId=").append(courserAttachmentId);
sb.append(", rid=").append(rid);
sb.append(", ip=").append(ip);
sb.append(", createdAt=").append(createdAt);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}

View File

@ -0,0 +1,31 @@
/*
* Copyright (C) 2023 杭州白书科技有限公司
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package xyz.playedu.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import xyz.playedu.api.domain.CourseAttachmentDownloadLog;
import xyz.playedu.api.types.paginate.CourseAttachmentDownloadLogPaginateFiler;
import java.util.List;
@Mapper
public interface CourseAttachmentDownloadLogMapper extends BaseMapper<CourseAttachmentDownloadLog> {
List<CourseAttachmentDownloadLog> paginate(CourseAttachmentDownloadLogPaginateFiler filer);
Long paginateCount(CourseAttachmentDownloadLogPaginateFiler filer);
}

View File

@ -0,0 +1,29 @@
/*
* Copyright (C) 2023 杭州白书科技有限公司
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package xyz.playedu.api.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.stereotype.Service;
import xyz.playedu.api.domain.CourseAttachmentDownloadLog;
import xyz.playedu.api.types.paginate.CourseAttachmentDownloadLogPaginateFiler;
import xyz.playedu.api.types.paginate.PaginationResult;
@Service
public interface CourseAttachmentDownloadLogService extends IService<CourseAttachmentDownloadLog> {
PaginationResult<CourseAttachmentDownloadLog> paginate(int page, int size, CourseAttachmentDownloadLogPaginateFiler filter);
}

View File

@ -0,0 +1,40 @@
/*
* Copyright (C) 2023 杭州白书科技有限公司
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package xyz.playedu.api.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import xyz.playedu.api.domain.CourseAttachmentDownloadLog;
import xyz.playedu.api.mapper.CourseAttachmentDownloadLogMapper;
import xyz.playedu.api.service.CourseAttachmentDownloadLogService;
import xyz.playedu.api.types.paginate.CourseAttachmentDownloadLogPaginateFiler;
import xyz.playedu.api.types.paginate.PaginationResult;
@Service
public class CourseAttachmentDownloadLogServiceImpl extends ServiceImpl<CourseAttachmentDownloadLogMapper, CourseAttachmentDownloadLog>
implements CourseAttachmentDownloadLogService {
@Override
public PaginationResult<CourseAttachmentDownloadLog> paginate(int page, int size, CourseAttachmentDownloadLogPaginateFiler filter) {
filter.setPageStart((page - 1) * size);
filter.setPageSize(size);
PaginationResult<CourseAttachmentDownloadLog> pageResult = new PaginationResult<>();
pageResult.setData(getBaseMapper().paginate(filter));
pageResult.setTotal(getBaseMapper().paginateCount(filter));
return pageResult;
}
}

View File

@ -0,0 +1,40 @@
/*
* Copyright (C) 2023 杭州白书科技有限公司
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package xyz.playedu.api.types.paginate;
import lombok.Data;
@Data
public class CourseAttachmentDownloadLogPaginateFiler {
private Integer userId;
private Integer courseId;
private String title;
private Integer courserAttachmentId;
private Integer rid;
private String sortField;
private String sortAlgo;
private Integer pageStart;
private Integer pageSize;
}

View File

@ -0,0 +1,89 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="xyz.playedu.api.mapper.CourseAttachmentDownloadLogMapper">
<resultMap id="BaseResultMap" type="xyz.playedu.api.domain.CourseAttachmentDownloadLog">
<id property="id" column="id" jdbcType="BIGINT"/>
<result property="userId" column="user_id" jdbcType="INTEGER"/>
<result property="courseId" column="course_id" jdbcType="INTEGER"/>
<result property="title" column="title" jdbcType="VARCHAR"/>
<result property="courserAttachmentId" column="courser_attachment_id" jdbcType="INTEGER"/>
<result property="rid" column="rid" jdbcType="INTEGER"/>
<result property="ip" column="ip" jdbcType="VARCHAR"/>
<result property="createdAt" column="created_at" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id,user_id,course_id,title,
courser_attachment_id,rid,
ip,created_at
</sql>
<select id="paginate" resultType="xyz.playedu.api.domain.CourseAttachmentDownloadLog">
SELECT `course_attachment_download_log`.*
FROM `course_attachment_download_log`
<where>
<if test="userId != null">
AND `course_attachment_download_log`.`user_id` = #{userId}
</if>
<if test="courseId != null">
AND `course_attachment_download_log`.`course_id` = #{courseId}
</if>
<if test="title != null and title != ''">
AND `course_attachment_download_log`.`title` LIKE concat('%',#{title},'%')
</if>
<if test="courserAttachmentId != null">
AND `course_attachment_download_log`.`courser_attachment_id` = #{courserAttachmentId}
</if>
<if test="rid != null">
AND `course_attachment_download_log`.`rid` = #{rid}
</if>
</where>
<if test="sortAlgo == 'asc'">
<choose>
<when test="sortField == 'created_at'">
ORDER BY `course_attachment_download_log`.`created_at` ASC
</when>
<otherwise>
ORDER BY `course_attachment_download_log`.`id` ASC
</otherwise>
</choose>
</if>
<if test="sortAlgo != 'asc'">
<choose>
<when test="sortField == 'created_at'">
ORDER BY `course_attachment_download_log`.`created_at` DESC
</when>
<otherwise>
ORDER BY `course_attachment_download_log`.`id` DESC
</otherwise>
</choose>
</if>
LIMIT #{pageStart}, #{pageSize};
</select>
<select id="paginateCount" resultType="java.lang.Long">
SELECT count(1)
FROM `course_attachment_download_log`
<where>
<if test="userId != null">
AND `course_attachment_download_log`.`user_id` = #{userId}
</if>
<if test="courseId != null">
AND `course_attachment_download_log`.`course_id` = #{courseId}
</if>
<if test="title != null and title != ''">
AND `course_attachment_download_log`.`title` LIKE concat('%',#{title},'%')
</if>
<if test="courserAttachmentId != null">
AND `course_attachment_download_log`.`courser_attachment_id` = #{courserAttachmentId}
</if>
<if test="rid != null">
AND `course_attachment_download_log`.`rid` = #{rid}
</if>
</where>
</select>
</mapper>