我的收藏/我的错题优化
This commit is contained in:
parent
732ed0eec6
commit
3fae025239
|
|
@ -10,14 +10,19 @@ import com.ruoyi.common.utils.ExcelUtil;
|
|||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.framework.shiro.service.SysPasswordService;
|
||||
import com.ruoyi.framework.web.base.BaseController;
|
||||
import com.ruoyi.framework.web.exception.user.OssException;
|
||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
||||
import com.ruoyi.framework.web.util.FileUploadUtils;
|
||||
import com.ruoyi.framework.web.util.ShiroUtils;
|
||||
import com.ruoyi.system.domain.SysOss;
|
||||
import com.ruoyi.system.domain.SysUser;
|
||||
import com.ruoyi.system.service.ISysOssService;
|
||||
import com.ruoyi.system.service.ISysPostService;
|
||||
import com.ruoyi.system.service.ISysRoleService;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
import com.ruoyi.web.controller.system.SysProfileController;
|
||||
import com.ruoyi.web.controller.system.cloud.CloudStorageService;
|
||||
import com.ruoyi.web.controller.system.cloud.OSSFactory;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
|
@ -29,6 +34,7 @@ import org.springframework.web.bind.annotation.*;
|
|||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -42,6 +48,8 @@ public class UploadFileController extends BaseController {
|
|||
|
||||
private static final Logger log = LoggerFactory.getLogger( UploadFileController.class );
|
||||
|
||||
@Autowired
|
||||
private ISysOssService sysOssService;
|
||||
/**
|
||||
* 上传文件
|
||||
*/
|
||||
|
|
@ -71,4 +79,31 @@ public class UploadFileController extends BaseController {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
*/
|
||||
/**
|
||||
* 上传文件
|
||||
*/
|
||||
@Log(title = "OSS上传文件", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/oss")
|
||||
public AjaxResult upload(@RequestParam("file") MultipartFile file, String module) throws Exception {
|
||||
if (file.isEmpty()) {
|
||||
throw new OssException( "上传文件不能为空" );
|
||||
}
|
||||
// 上传文件
|
||||
String fileName = file.getOriginalFilename();
|
||||
String suffix = fileName.substring( fileName.lastIndexOf( "." ) );
|
||||
CloudStorageService storage = OSSFactory.build();
|
||||
String url = storage.uploadSuffix( file.getBytes(), suffix );
|
||||
// 保存文件信息
|
||||
SysOss ossEntity = new SysOss();
|
||||
ossEntity.setUrl( url );
|
||||
ossEntity.setFileSuffix( suffix );
|
||||
ossEntity.setCreateBy( ShiroUtils.getLoginName() );
|
||||
ossEntity.setFileName( fileName );
|
||||
ossEntity.setCreateTime( new Date() );
|
||||
ossEntity.setService( storage.getService() );
|
||||
return toAjax( sysOssService.save( ossEntity ) ).put( "data", ossEntity.getUrl() );
|
||||
}
|
||||
}
|
||||
|
|
@ -78,7 +78,7 @@ public class ApiUserCollectionQuestionController extends BaseController {
|
|||
ExamUserCollectionQuestionVO examUserCollectionQuestion = new ExamUserCollectionQuestionVO();
|
||||
SysUser sysUser = sysUserService.selectUserByLoginName( JwtUtil.getLoginName() );
|
||||
examUserCollectionQuestion.setVipUserId( sysUser.getUserId().intValue() );
|
||||
List<ExamUserCollectionQuestionVO> list = examUserCollectionQuestionService.selectExamUserCollectionQuestionPage( examUserCollectionQuestion );
|
||||
List<ExamUserCollectionQuestionVO> list = examUserCollectionQuestionService.selectExamUserCollectionQuestionList( examUserCollectionQuestion );
|
||||
AjaxResult success = success( "查询我的收藏成功" );
|
||||
success.put( "data", list );
|
||||
return success;
|
||||
|
|
|
|||
|
|
@ -4,13 +4,13 @@ package com.ruoyi.exam.domain;
|
|||
* Created by flower on 2019/1/10.
|
||||
*/
|
||||
public class ExamUserErrorQuestionVO extends ExamUserErrorQuestion {
|
||||
private ExamQuestion question;
|
||||
private ExamQuestionVO question;
|
||||
|
||||
public ExamQuestion getQuestion() {
|
||||
public ExamQuestionVO getQuestion() {
|
||||
return question;
|
||||
}
|
||||
|
||||
public void setQuestion(ExamQuestion question) {
|
||||
public void setQuestion(ExamQuestionVO question) {
|
||||
this.question = question;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,5 +22,12 @@ public interface ExamUserCollectionQuestionMapper extends MyMapper<ExamUserColl
|
|||
* @return 我的收藏集合
|
||||
*/
|
||||
public List<ExamUserCollectionQuestionVO> selectExamUserCollectionQuestionList(ExamUserCollectionQuestionVO examUserCollectionQuestion);
|
||||
|
||||
/**
|
||||
* 查询我的收藏列表详情(包含题目选项)
|
||||
*
|
||||
* @param examUserCollectionQuestion 我的收藏信息
|
||||
* @return 我的收藏集合
|
||||
*/
|
||||
public List<ExamUserCollectionQuestionVO> selectExamUserCollectionQuestionDetailList(ExamUserCollectionQuestionVO examUserCollectionQuestion);
|
||||
|
||||
}
|
||||
|
|
@ -8,7 +8,7 @@ import com.ruoyi.framework.web.base.MyMapper;
|
|||
|
||||
/**
|
||||
* 我的错题 数据层
|
||||
*
|
||||
*
|
||||
* @author zhujj
|
||||
* @date 2019-01-10
|
||||
*/
|
||||
|
|
@ -16,12 +16,25 @@ public interface ExamUserErrorQuestionMapper extends MyMapper<ExamUserErrorQues
|
|||
{
|
||||
|
||||
/**
|
||||
* 查询我的错题列表
|
||||
*
|
||||
* @param examUserErrorQuestion 我的错题信息
|
||||
* @return 我的错题集合
|
||||
*/
|
||||
* 查询我的错题列表
|
||||
*
|
||||
* @param examUserErrorQuestion 我的错题信息
|
||||
* @return 我的错题集合
|
||||
*/
|
||||
public List<ExamUserErrorQuestion> selectExamUserErrorQuestionList(ExamUserErrorQuestion examUserErrorQuestion);
|
||||
|
||||
/**
|
||||
* 查询错题列表
|
||||
* @param examUserErrorQuestion
|
||||
* @return
|
||||
*/
|
||||
List<ExamUserErrorQuestionVO> selectExamUserErrorQuestionDetailPage(ExamUserErrorQuestion examUserErrorQuestion);
|
||||
|
||||
/**
|
||||
* 查询错题列表(包含选项)
|
||||
* @param examUserErrorQuestion
|
||||
* @return
|
||||
*/
|
||||
List<ExamUserErrorQuestionVO> selectExamUserErrorQuestionDetailList(ExamUserErrorQuestion examUserErrorQuestion);
|
||||
|
||||
}
|
||||
|
|
@ -22,24 +22,6 @@ public class ExamUserCollectionQuestionServiceImpl extends AbstractBaseServiceIm
|
|||
@Autowired
|
||||
private ExamUserCollectionQuestionMapper examUserCollectionQuestionMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 查询我的收藏列表
|
||||
*
|
||||
* @param examUserCollectionQuestion 我的收藏信息
|
||||
* @return 我的收藏集合
|
||||
*/
|
||||
@Override
|
||||
public List<ExamUserCollectionQuestionVO> selectExamUserCollectionQuestionList(ExamUserCollectionQuestionVO examUserCollectionQuestion)
|
||||
{
|
||||
return examUserCollectionQuestionMapper.selectExamUserCollectionQuestionList(examUserCollectionQuestion);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertSelectiveBySelf(ExamUserCollectionQuestion examUserCollectionQuestion) {
|
||||
return examUserCollectionQuestionMapper.insertSelective(examUserCollectionQuestion);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询我的收藏分页列表
|
||||
*
|
||||
|
|
@ -52,5 +34,23 @@ public class ExamUserCollectionQuestionServiceImpl extends AbstractBaseServiceIm
|
|||
startPage();
|
||||
return examUserCollectionQuestionMapper.selectExamUserCollectionQuestionList(examUserCollectionQuestion);
|
||||
}
|
||||
/**
|
||||
* 查询我的收藏列表(包含题目选项)
|
||||
*
|
||||
* @param examUserCollectionQuestion 我的收藏信息
|
||||
* @return 我的收藏集合
|
||||
*/
|
||||
@Override
|
||||
public List<ExamUserCollectionQuestionVO> selectExamUserCollectionQuestionList(ExamUserCollectionQuestionVO examUserCollectionQuestion)
|
||||
{
|
||||
return examUserCollectionQuestionMapper.selectExamUserCollectionQuestionDetailList(examUserCollectionQuestion);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertSelectiveBySelf(ExamUserCollectionQuestion examUserCollectionQuestion) {
|
||||
return examUserCollectionQuestionMapper.insertSelective(examUserCollectionQuestion);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ public class ExamUserErrorQuestionServiceImpl extends AbstractBaseServiceImpl<Ex
|
|||
}
|
||||
@Override
|
||||
public List<ExamUserErrorQuestionVO> selectExamUserErrorQuestionDetailList(ExamUserErrorQuestion examUserErrorQuestion) {
|
||||
return examUserErrorQuestionMapper.selectExamUserErrorQuestionDetailPage(examUserErrorQuestion);
|
||||
return examUserErrorQuestionMapper.selectExamUserErrorQuestionDetailList(examUserErrorQuestion);
|
||||
}
|
||||
@Override
|
||||
public int insertError(ExamUserErrorQuestion examUserErrorQuestion) {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="remarks" column="remarks" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
|
||||
<association property="question" javaType="com.ruoyi.exam.domain.ExamQuestion">
|
||||
<association property="question" javaType="com.ruoyi.exam.domain.ExamQuestionVO">
|
||||
<result property="id" column="eq_id" />
|
||||
<result property="title" column="eq_title" />
|
||||
<result property="answer" column="eq_answer" />
|
||||
|
|
@ -30,7 +30,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="delFlag" column="eq_del_flag" />
|
||||
</association>
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="ExamUserCollectionQuestionVO" id="ExamUserCollectionQuestionResultDetail">
|
||||
<result property="id" column="id" />
|
||||
<result property="vipUserId" column="vip_user_id" />
|
||||
<result property="examQuestionId" column="exam_question_id" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createDate" column="create_date" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateDate" column="update_date" />
|
||||
<result property="remarks" column="remarks" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
|
||||
<association property="question" javaType="com.ruoyi.exam.domain.ExamQuestionVO">
|
||||
<result property="id" column="eq_id" />
|
||||
<result property="title" column="eq_title" />
|
||||
<result property="answer" column="eq_answer" />
|
||||
<result property="type" column="eq_type" />
|
||||
<result property="label" column="eq_label" />
|
||||
<result property="categoryId" column="eq_category_id" />
|
||||
<result property="createBy" column="eq_create_by" />
|
||||
<result property="createDate" column="eq_create_date" />
|
||||
<result property="updateBy" column="eq_update_by" />
|
||||
<result property="updateDate" column="eq_update_date" />
|
||||
<result property="remarks" column="eq_remarks" />
|
||||
<result property="delFlag" column="eq_del_flag" />
|
||||
<collection property="questionItem" ofType="com.ruoyi.exam.domain.ExamQuestionItem">
|
||||
<result property="id" column="item_id" />
|
||||
<result property="content" column="item_content" />
|
||||
<result property="number" column="item_number" />
|
||||
<result property="examQuestionId" column="item_exam_question_id" />
|
||||
<result property="remarks" column="item_remarks" />
|
||||
<result property="delFlag" column="item_del_flag" />
|
||||
</collection>
|
||||
</association>
|
||||
</resultMap>
|
||||
<sql id="selectExamUserCollectionQuestionVo">
|
||||
eucq.id, eucq.vip_user_id, eucq.exam_question_id, eucq.create_by, eucq.create_date, eucq.update_by,
|
||||
eucq.update_date, eucq.remarks, eucq.del_flag </sql>
|
||||
|
|
@ -44,10 +77,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
eq.type as eq_type,
|
||||
eq.label as eq_label,
|
||||
eq.category_id as eq_category_id,
|
||||
eq.create_by as eq_create_by,
|
||||
eq.create_date as eq_create_date,
|
||||
eq.update_by as eq_update_by,
|
||||
eq.update_date as eq_update_date,
|
||||
eq.remarks as eq_remarks,
|
||||
eq.del_flag as eq_del_flag
|
||||
from exam_user_collection_question eucq
|
||||
|
|
@ -60,5 +89,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectExamUserCollectionQuestionDetailList" parameterType="ExamUserCollectionQuestionVO" resultMap="ExamUserCollectionQuestionResultDetail">
|
||||
select
|
||||
<include refid="selectExamUserCollectionQuestionVo"/>,
|
||||
eq.id as eq_id,
|
||||
eq.title as eq_title,
|
||||
eq.answer as eq_answer,
|
||||
eq.type as eq_type,
|
||||
eq.label as eq_label,
|
||||
eq.category_id as eq_category_id,
|
||||
eq.remarks as eq_remarks,
|
||||
eq.del_flag as eq_del_flag,
|
||||
eqi.id AS item_id,
|
||||
eqi.content AS item_content,
|
||||
eqi.number AS item_number,
|
||||
eqi.exam_question_id AS item_exam_question_id,
|
||||
eqi.remarks AS item_remarks
|
||||
from exam_user_collection_question eucq
|
||||
INNER JOIN exam_question eq ON eq.id = eucq.exam_question_id
|
||||
INNER JOIN exam_question_item eqi ON eqi.exam_question_id = eq.id
|
||||
<where>
|
||||
<if test="id != null "> and eucq.id = #{id}</if>
|
||||
<if test="vipUserId != null "> and eucq.vip_user_id = #{vipUserId}</if>
|
||||
<if test="examQuestionId != null "> and eucq.exam_question_id = #{examQuestionId}</if>
|
||||
<if test="delFlag != null and delFlag != '' "> and del_flag = #{delFlag}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -26,7 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="updateDate" column="update_date" />
|
||||
<result property="remarks" column="remarks" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<association property="question" javaType="com.ruoyi.exam.domain.ExamQuestion">
|
||||
<association property="question" javaType="com.ruoyi.exam.domain.ExamQuestionVO">
|
||||
<result property="id" column="eq_id" />
|
||||
<result property="title" column="eq_title" />
|
||||
<result property="answer" column="eq_answer" />
|
||||
|
|
@ -41,7 +41,39 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="delFlag" column="eq_del_flag" />
|
||||
</association>
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="ExamUserErrorQuestionVO" id="ExamUserErrorQuestionResultDetailVO">
|
||||
<result property="id" column="id" />
|
||||
<result property="vipUserId" column="vip_user_id" />
|
||||
<result property="examQuestionId" column="exam_question_id" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createDate" column="create_date" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateDate" column="update_date" />
|
||||
<result property="remarks" column="remarks" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<association property="question" javaType="com.ruoyi.exam.domain.ExamQuestionVO">
|
||||
<result property="id" column="eq_id" />
|
||||
<result property="title" column="eq_title" />
|
||||
<result property="answer" column="eq_answer" />
|
||||
<result property="type" column="eq_type" />
|
||||
<result property="label" column="eq_label" />
|
||||
<result property="categoryId" column="eq_category_id" />
|
||||
<result property="createBy" column="eq_create_by" />
|
||||
<result property="createDate" column="eq_create_date" />
|
||||
<result property="updateBy" column="eq_update_by" />
|
||||
<result property="updateDate" column="eq_update_date" />
|
||||
<result property="remarks" column="eq_remarks" />
|
||||
<result property="delFlag" column="eq_del_flag" />
|
||||
<collection property="questionItem" ofType="com.ruoyi.exam.domain.ExamQuestionItem">
|
||||
<result property="id" column="item_id" />
|
||||
<result property="content" column="item_content" />
|
||||
<result property="number" column="item_number" />
|
||||
<result property="examQuestionId" column="item_exam_question_id" />
|
||||
<result property="remarks" column="item_remarks" />
|
||||
<result property="delFlag" column="item_del_flag" />
|
||||
</collection>
|
||||
</association>
|
||||
</resultMap>
|
||||
<sql id="selectExamUserErrorQuestionVo">
|
||||
euq.id, euq.vip_user_id, euq.exam_question_id, euq.create_by, euq.create_date, euq.update_by, euq.update_date, euq.remarks, euq.del_flag </sql>
|
||||
|
||||
|
|
@ -91,5 +123,39 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectExamUserErrorQuestionDetailList" resultMap="ExamUserErrorQuestionResultDetailVO">
|
||||
select
|
||||
<include refid="selectExamUserErrorQuestionVo"/>,
|
||||
eq.id as eq_id,
|
||||
eq.title as eq_title,
|
||||
eq.answer as eq_answer,
|
||||
eq.type as eq_type,
|
||||
eq.label as eq_label,
|
||||
eq.category_id as eq_category_id,
|
||||
eq.create_by as eq_create_by,
|
||||
eq.create_date as eq_create_date,
|
||||
eq.update_by as eq_update_by,
|
||||
eq.update_date as eq_update_date,
|
||||
eq.remarks as eq_remarks,
|
||||
eq.del_flag as eq_del_flag,
|
||||
eqi.id AS item_id,
|
||||
eqi.content AS item_content,
|
||||
eqi.number AS item_number,
|
||||
eqi.exam_question_id AS item_exam_question_id,
|
||||
eqi.remarks AS item_remarks
|
||||
from exam_user_error_question euq
|
||||
INNER JOIN exam_question eq ON eq.id = euq.exam_question_id
|
||||
INNER JOIN exam_question_item eqi ON eqi.exam_question_id = eq.id
|
||||
<where>
|
||||
<if test="id != null "> and id = #{id}</if>
|
||||
<if test="vipUserId != null "> and vip_user_id = #{vipUserId}</if>
|
||||
<if test="examQuestionId != null "> and exam_question_id = #{examQuestionId}</if>
|
||||
<if test="createBy != null and createBy != '' "> and create_by = #{createBy}</if>
|
||||
<if test="createDate != null "> and create_date = #{createDate}</if>
|
||||
<if test="updateBy != null and updateBy != '' "> and update_by = #{updateBy}</if>
|
||||
<if test="updateDate != null "> and update_date = #{updateDate}</if>
|
||||
<if test="remarks != null and remarks != '' "> and remarks = #{remarks}</if>
|
||||
<if test="delFlag != null and delFlag != '' "> and del_flag = #{delFlag}</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -107,7 +107,7 @@
|
|||
//普通图片上传
|
||||
var uploadInst = upload.render({
|
||||
elem: '#test1'
|
||||
,url: '/upload/files'
|
||||
,url: '/upload/oss'
|
||||
,data:{module:"train/course"}//文件存放路径
|
||||
,before: function(obj){
|
||||
//预读本地文件示例,不支持ie8
|
||||
|
|
@ -122,7 +122,7 @@
|
|||
}
|
||||
//上传成功
|
||||
if(res.code ==200){
|
||||
$("#cover").val(res.fileName)
|
||||
$("#cover").val(res.data)
|
||||
return layer.msg('上传成功');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
<div class="layui-upload">
|
||||
<button type="button" class="layui-btn" id="test1">上传图片</button>
|
||||
<div class="layui-upload-list">
|
||||
<img class="layui-upload-img" id="demo1" th:src="@{/profile/avatar/}+*{cover}">
|
||||
<img class="layui-upload-img" id="demo1" th:src="*{cover}">
|
||||
<p id="demoText"></p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -108,7 +108,7 @@
|
|||
//普通图片上传
|
||||
var uploadInst = upload.render({
|
||||
elem: '#test1'
|
||||
,url: '/upload/files'
|
||||
,url: '/upload/oss'
|
||||
,data:{module:"train/course"}//文件存放路径
|
||||
,before: function(obj){
|
||||
//预读本地文件示例,不支持ie8
|
||||
|
|
@ -117,13 +117,14 @@
|
|||
});
|
||||
}
|
||||
,done: function(res){
|
||||
debugger;
|
||||
//如果上传失败
|
||||
if(res.code !=200){
|
||||
return layer.msg('上传失败');
|
||||
}
|
||||
//上传成功
|
||||
if(res.code ==200){
|
||||
$("#cover").val(res.fileName)
|
||||
$("#cover").val(res.data)
|
||||
return layer.msg('上传成功');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@
|
|||
var demoListView = $('#demoList')
|
||||
,uploadListIns = upload.render({
|
||||
elem: '#testList'
|
||||
,url: '/upload/files'
|
||||
,url: '/upload/oss'
|
||||
,data:{module:"train/courseware"}//文件存放路径
|
||||
,accept: 'file'
|
||||
,multiple: true
|
||||
|
|
@ -122,7 +122,7 @@
|
|||
,tds = tr.children();
|
||||
tds.eq(2).html('<span style="color: #5FB878;">上传成功</span>');
|
||||
tds.eq(3).html(''); //清空操作
|
||||
fileList.push(res.fileName);
|
||||
fileList.push(res.data);
|
||||
return delete this.files[index]; //删除文件队列已经上传成功的文件
|
||||
}
|
||||
this.error(index, upload);
|
||||
|
|
|
|||
Loading…
Reference in New Issue