我的错题。我的课程。
This commit is contained in:
parent
a3f8c7e4fb
commit
8cad6c0587
|
|
@ -45,7 +45,7 @@ public class ApiPracticeController extends BaseController {
|
|||
@GetMapping("/v1/practice/list")
|
||||
public AjaxResult list(ExamPractice examPractice) {
|
||||
|
||||
List<ExamPractice> list = examPracticeService.selectListFromWeb(examPractice);
|
||||
List<ExamPracticeVO> list = examPracticeService.selectListFromWeb(examPractice);
|
||||
AjaxResult success = success("查询成功");
|
||||
success.put("data", list);
|
||||
return success;
|
||||
|
|
@ -99,10 +99,11 @@ public class ApiPracticeController extends BaseController {
|
|||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/v1/practice/{userId}/error")
|
||||
public AjaxResult queryError(@PathVariable("userId") String userId) {
|
||||
@GetMapping("/v1/practice/error")
|
||||
public AjaxResult queryError() {
|
||||
ExamUserErrorQuestion examUserErrorQuestion = new ExamUserErrorQuestion();
|
||||
examUserErrorQuestion.setVipUserId(Integer.parseInt(ShiroUtils.getUserId().toString()));
|
||||
SysUser sysUser = sysUserService.selectUserByLoginName( JwtUtil.getLoginName() );
|
||||
examUserErrorQuestion.setVipUserId(sysUser.getUserId().intValue());
|
||||
List<ExamUserErrorQuestionVO> list = examUserErrorQuestionService.selectExamUserErrorQuestionDetailPage(examUserErrorQuestion);
|
||||
AjaxResult success = success("查询成功");
|
||||
success.put("data", list);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
package com.ruoyi.exam.domain;
|
||||
|
||||
/**
|
||||
* 题库练习
|
||||
*/
|
||||
public class ExamPracticeVO extends ExamPractice{
|
||||
private String trainCourseName;
|
||||
|
||||
public String getTrainCourseName() {
|
||||
return trainCourseName;
|
||||
}
|
||||
|
||||
public void setTrainCourseName(String trainCourseName) {
|
||||
this.trainCourseName = trainCourseName;
|
||||
}
|
||||
}
|
||||
|
|
@ -2,6 +2,8 @@ package com.ruoyi.exam.mapper;
|
|||
|
||||
import com.ruoyi.exam.domain.ExamPractice;
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.exam.domain.ExamPracticeVO;
|
||||
import com.ruoyi.framework.web.base.MyMapper;
|
||||
|
||||
/**
|
||||
|
|
@ -21,5 +23,10 @@ public interface ExamPracticeMapper extends MyMapper<ExamPractice>
|
|||
*/
|
||||
public List<ExamPractice> selectExamPracticeList(ExamPractice examPractice);
|
||||
|
||||
List<ExamPractice> selectListFromWeb(ExamPractice examPractice);
|
||||
/**
|
||||
* 接口查询练习题列表
|
||||
* @param examPractice
|
||||
* @return
|
||||
*/
|
||||
List<ExamPracticeVO> selectListFromWeb(ExamPractice examPractice);
|
||||
}
|
||||
|
|
@ -4,6 +4,7 @@ import com.ruoyi.exam.domain.ExamPractice;
|
|||
import java.util.List;
|
||||
|
||||
import com.ruoyi.exam.domain.ExamPracticeQuestionVO;
|
||||
import com.ruoyi.exam.domain.ExamPracticeVO;
|
||||
import com.ruoyi.framework.web.base.AbstractBaseService;
|
||||
/**
|
||||
* 练习 服务层
|
||||
|
|
@ -34,5 +35,5 @@ public interface IExamPracticeService extends AbstractBaseService<ExamPractice>
|
|||
* @param examPractice
|
||||
* @return
|
||||
*/
|
||||
List<ExamPractice> selectListFromWeb(ExamPractice examPractice);
|
||||
List<ExamPracticeVO> selectListFromWeb(ExamPractice examPractice);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,9 +35,9 @@ public class ExamPracticeServiceImpl extends AbstractBaseServiceImpl<ExamPractic
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<ExamPractice> selectListFromWeb(ExamPractice examPractice) {
|
||||
public List<ExamPracticeVO> selectListFromWeb(ExamPractice examPractice) {
|
||||
startPage();
|
||||
return examPracticeMapper.selectListFromWeb(examPractice);
|
||||
return examPracticeMapper.selectListFromWeb(examPractice);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -20,9 +20,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="remarks" column="remarks" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="ExamPracticeVO" id="ExamPracticeResultVO">
|
||||
<result property="id" column="id" />
|
||||
<result property="deptId" column="dept_id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="trainCourseId" column="train_course_id" />
|
||||
<result property="enableControlTime" column="enable_control_time" />
|
||||
<result property="startTime" column="start_time" />
|
||||
<result property="endTime" column="end_time" />
|
||||
<result property="practiceUserLimit" column="practice_user_limit" />
|
||||
<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" />
|
||||
<result property="trainCourseName" column="train_course_name" />
|
||||
</resultMap>
|
||||
<sql id="selectExamPracticeVo">
|
||||
id, dept_id, name,train_course_id,enable_control_time, start_time, end_time, practice_user_limit, create_by, create_date, update_by, update_date, remarks, del_flag </sql>
|
||||
exam_practice.id, exam_practice.dept_id, exam_practice.name,exam_practice.train_course_id,exam_practice.enable_control_time,
|
||||
exam_practice.start_time, exam_practice.end_time, exam_practice.practice_user_limit, exam_practice.create_by, exam_practice.create_date, exam_practice.update_by, exam_practice.update_date, exam_practice.remarks, exam_practice.del_flag </sql>
|
||||
|
||||
<select id="selectExamPracticeList" parameterType="ExamPractice" resultMap="ExamPracticeResult">
|
||||
select
|
||||
|
|
@ -45,27 +62,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="delFlag != null and delFlag != '' "> and del_flag = #{delFlag}</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="selectListFromWeb" parameterType="ExamPractice" resultMap="ExamPracticeResult">
|
||||
<select id="selectListFromWeb" parameterType="ExamPractice" resultMap="ExamPracticeResultVO">
|
||||
select
|
||||
<include refid="selectExamPracticeVo"/>
|
||||
from exam_practice
|
||||
<include refid="selectExamPracticeVo"/>,
|
||||
tc.name train_course_name
|
||||
from exam_practice exam_practice
|
||||
left join train_course tc on tc.id =exam_practice.train_course_id
|
||||
<where>
|
||||
<![CDATA[((enable_control_time = '1' and end_time > NOW() and start_time < NOW())
|
||||
or enable_control_time = '0') ]]>
|
||||
<if test="id != null "> and id = #{id}</if>
|
||||
<if test="deptId != null "> and dept_id = #{deptId}</if>
|
||||
<![CDATA[((exam_practice.enable_control_time = '1' and exam_practice.end_time > NOW() and exam_practice.start_time < NOW())
|
||||
or exam_practice.enable_control_time = '0') ]]>
|
||||
<if test="id != null "> and exam_practice.id = #{id}</if>
|
||||
<if test="deptId != null "> and exam_practice.dept_id = #{deptId}</if>
|
||||
<if test="trainCourseId != null "> and exam_examination.train_course_id = #{ination.trainCourseId}</if>
|
||||
<if test="name != null and name != '' "> and name = #{name}</if>
|
||||
<if test="enableControlTime != null and enableControlTime != '' "> and enable_control_time = #{enableControlTime}</if>
|
||||
<if test="startTime != null "> and start_time = #{startTime}</if>
|
||||
<if test="endTime != null "> and end_time = #{endTime}</if>
|
||||
<if test="practiceUserLimit != null and practiceUserLimit != '' "> and practice_user_limit = #{practiceUserLimit}</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>
|
||||
<if test="name != null and name != '' "> and exam_practice.name = #{name}</if>
|
||||
<if test="enableControlTime != null and enableControlTime != '' "> and exam_practice.enable_control_time = #{enableControlTime}</if>
|
||||
<if test="startTime != null "> and exam_practice.start_time = #{startTime}</if>
|
||||
<if test="endTime != null "> and exam_practice.end_time = #{endTime}</if>
|
||||
<if test="practiceUserLimit != null and practiceUserLimit != '' "> and exam_practice.practice_user_limit = #{practiceUserLimit}</if>
|
||||
<if test="createBy != null and createBy != '' "> and exam_practice.create_by = #{createBy}</if>
|
||||
<if test="createDate != null "> and exam_practice.create_date = #{createDate}</if>
|
||||
<if test="updateBy != null and updateBy != '' "> and exam_practice.update_by = #{updateBy}</if>
|
||||
<if test="updateDate != null "> and exam_practice.update_date = #{updateDate}</if>
|
||||
<if test="remarks != null and remarks != '' "> and exam_practice.remarks = #{remarks}</if>
|
||||
<if test="delFlag != null and delFlag != '' "> and exam_practice.del_flag = #{delFlag}</if>
|
||||
</where>
|
||||
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -2,10 +2,14 @@ package com.ruoyi.train.course.controller;
|
|||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.ruoyi.common.base.AjaxResult;
|
||||
import com.ruoyi.framework.jwt.JwtUtil;
|
||||
import com.ruoyi.framework.web.base.BaseController;
|
||||
import com.ruoyi.system.domain.SysUser;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
import com.ruoyi.train.course.domain.TrainCourse;
|
||||
import com.ruoyi.train.course.domain.TrainCourseCategory;
|
||||
import com.ruoyi.train.course.domain.TrainCourseSection;
|
||||
import com.ruoyi.train.course.domain.TrainCourseVO;
|
||||
import com.ruoyi.train.course.service.ITrainCourseCategoryService;
|
||||
import com.ruoyi.train.course.service.ITrainCourseSectionService;
|
||||
import com.ruoyi.train.course.service.ITrainCourseService;
|
||||
|
|
@ -32,17 +36,30 @@ public class ApiTrainCourseController extends BaseController {
|
|||
@Autowired
|
||||
private ITrainCourseSectionService trainCourseSectionService;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
/**
|
||||
* 查询课程列表
|
||||
*/
|
||||
@GetMapping("/trainCourse/list")
|
||||
public AjaxResult list( TrainCourse trainCourse) {
|
||||
List<TrainCourse> list = trainCourseService.selectTrainCoursePage( trainCourse );
|
||||
public AjaxResult list( TrainCourseVO trainCourse) {
|
||||
List<TrainCourseVO> list = trainCourseService.selectTrainCoursePage( trainCourse );
|
||||
AjaxResult success = success( "查询成功" );
|
||||
success.put( "data", list );
|
||||
return success;
|
||||
}
|
||||
/**
|
||||
* 查询课程列表
|
||||
*/
|
||||
@GetMapping("/trainCourse/myList")
|
||||
public AjaxResult myList( TrainCourseVO trainCourse) {
|
||||
SysUser sysUser = sysUserService.selectUserByLoginName( JwtUtil.getLoginName() );
|
||||
trainCourse.setUserId( sysUser.getUserId().intValue() );
|
||||
List<TrainCourseVO> list = trainCourseService.selectTrainCoursePage( trainCourse );
|
||||
AjaxResult success = success( "查询成功" );
|
||||
success.put( "data", list );
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询课程详情
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import java.util.List;
|
|||
|
||||
import com.ruoyi.train.course.domain.TrainCourse;
|
||||
import com.ruoyi.train.course.domain.TrainCourseCategory;
|
||||
import com.ruoyi.train.course.domain.TrainCourseVO;
|
||||
import com.ruoyi.train.course.service.ITrainCourseCategoryService;
|
||||
import com.ruoyi.train.course.service.ITrainCourseService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
|
|
@ -51,9 +52,9 @@ public class TrainCourseController extends BaseController
|
|||
@RequiresPermissions("train:trainCourse:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(TrainCourse trainCourse)
|
||||
public TableDataInfo list(TrainCourseVO trainCourse)
|
||||
{
|
||||
List<TrainCourse> list = trainCourseService.selectTrainCoursePage(trainCourse);
|
||||
List<TrainCourseVO> list = trainCourseService.selectTrainCoursePage(trainCourse);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
|
@ -64,10 +65,10 @@ public class TrainCourseController extends BaseController
|
|||
@RequiresPermissions("train:trainCourse:export")
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(TrainCourse trainCourse)
|
||||
public AjaxResult export(TrainCourseVO trainCourse)
|
||||
{
|
||||
List<TrainCourse> list = trainCourseService.selectTrainCourseList(trainCourse);
|
||||
ExcelUtil<TrainCourse> util = new ExcelUtil<TrainCourse>(TrainCourse.class);
|
||||
List<TrainCourseVO> list = trainCourseService.selectTrainCourseList(trainCourse);
|
||||
ExcelUtil<TrainCourseVO> util = new ExcelUtil<TrainCourseVO>(TrainCourseVO.class);
|
||||
return util.exportExcel(list, "trainCourse");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
package com.ruoyi.train.course.domain;
|
||||
|
||||
/**
|
||||
* 自定义课程
|
||||
*/
|
||||
public class TrainCourseVO extends TrainCourse{
|
||||
private Integer userId;
|
||||
|
||||
public Integer getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Integer userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@ package com.ruoyi.train.course.mapper;
|
|||
|
||||
import com.ruoyi.framework.web.base.MyMapper;
|
||||
import com.ruoyi.train.course.domain.TrainCourse;
|
||||
import com.ruoyi.train.course.domain.TrainCourseVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -21,6 +22,6 @@ public interface TrainCourseMapper extends MyMapper<TrainCourse>
|
|||
* @param trainCourse 课程信息
|
||||
* @return 课程集合
|
||||
*/
|
||||
public List<TrainCourse> selectTrainCourseList(TrainCourse trainCourse);
|
||||
public List<TrainCourseVO> selectTrainCourseList(TrainCourseVO trainCourse);
|
||||
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ package com.ruoyi.train.course.service;
|
|||
|
||||
import com.ruoyi.framework.web.base.AbstractBaseService;
|
||||
import com.ruoyi.train.course.domain.TrainCourse;
|
||||
import com.ruoyi.train.course.domain.TrainCourseVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -19,14 +20,14 @@ public interface ITrainCourseService extends AbstractBaseService<TrainCourse>
|
|||
* @param trainCourse 课程信息
|
||||
* @return 课程集合
|
||||
*/
|
||||
public List<TrainCourse> selectTrainCoursePage(TrainCourse trainCourse);
|
||||
public List<TrainCourseVO> selectTrainCoursePage(TrainCourseVO trainCourse);
|
||||
/**
|
||||
* 查询课程列表
|
||||
*
|
||||
* @param trainCourse 课程信息
|
||||
* @return 课程集合
|
||||
*/
|
||||
public List<TrainCourse> selectTrainCourseList(TrainCourse trainCourse);
|
||||
public List<TrainCourseVO> selectTrainCourseList(TrainCourseVO trainCourse);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.ruoyi.train.course.service.impl;
|
|||
|
||||
import com.ruoyi.framework.web.base.AbstractBaseServiceImpl;
|
||||
import com.ruoyi.train.course.domain.TrainCourse;
|
||||
import com.ruoyi.train.course.domain.TrainCourseVO;
|
||||
import com.ruoyi.train.course.mapper.TrainCourseMapper;
|
||||
import com.ruoyi.train.course.service.ITrainCourseService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -29,7 +30,7 @@ public class TrainCourseServiceImpl extends AbstractBaseServiceImpl<TrainCourseM
|
|||
* @return 课程集合
|
||||
*/
|
||||
@Override
|
||||
public List<TrainCourse> selectTrainCourseList(TrainCourse trainCourse)
|
||||
public List<TrainCourseVO> selectTrainCourseList(TrainCourseVO trainCourse)
|
||||
{
|
||||
return trainCourseMapper.selectTrainCourseList(trainCourse);
|
||||
}
|
||||
|
|
@ -40,7 +41,7 @@ public class TrainCourseServiceImpl extends AbstractBaseServiceImpl<TrainCourseM
|
|||
* @return 课程集合
|
||||
*/
|
||||
@Override
|
||||
public List<TrainCourse> selectTrainCoursePage(TrainCourse trainCourse)
|
||||
public List<TrainCourseVO> selectTrainCoursePage(TrainCourseVO trainCourse)
|
||||
{
|
||||
startPage();
|
||||
return trainCourseMapper.selectTrainCourseList(trainCourse);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.train.course.mapper.TrainCourseMapper">
|
||||
|
||||
<resultMap type="TrainCourse" id="TrainCourseResult">
|
||||
<resultMap type="TrainCourseVO" id="TrainCourseResultVO">
|
||||
<result property="id" column="id" />
|
||||
<result property="deptId" column="dept_id" />
|
||||
<result property="trainCourseCategoryId" column="train_course_category_id" />
|
||||
|
|
@ -22,30 +22,38 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</resultMap>
|
||||
|
||||
<sql id="selectTrainCourseVo">
|
||||
id, dept_id, train_course_category_id, name,price, cover, description, state, del_flag, create_by, create_time, update_by, update_time, remark </sql>
|
||||
train_course.id, train_course.dept_id, train_course.train_course_category_id, train_course.name,train_course.price,
|
||||
train_course.cover, train_course.description, train_course.state, train_course.del_flag, train_course.create_by,
|
||||
train_course.create_time, train_course.update_by, train_course.update_time, train_course.remark </sql>
|
||||
|
||||
<select id="selectTrainCourseList" parameterType="TrainCourse" resultMap="TrainCourseResult">
|
||||
<select id="selectTrainCourseList" parameterType="TrainCourseVO" resultMap="TrainCourseResultVO">
|
||||
select
|
||||
<include refid="selectTrainCourseVo"/>
|
||||
from train_course
|
||||
<where>
|
||||
<if test="id != null "> and id = #{id}</if>
|
||||
<if test="deptId != null "> and dept_id = #{deptId}</if>
|
||||
|
||||
<if test="userId != null ">
|
||||
left join train_course_user tcu on tcu.train_course_id =train_course.id
|
||||
</if>
|
||||
<where>
|
||||
|
||||
<if test="userId != null "> and tcu.vip_user_id = #{userId}</if>
|
||||
<if test="id != null "> and train_course.id = #{id}</if>
|
||||
<if test="deptId != null "> and train_course.dept_id = #{deptId}</if>
|
||||
<if test="trainCourseCategoryId != null ">
|
||||
and (train_course_category_id in
|
||||
and (train_course.train_course_category_id in
|
||||
(select id from train_course_category where FIND_IN_SET(#{trainCourseCategoryId},parent_ids))
|
||||
or train_course_category_id = #{trainCourseCategoryId} )
|
||||
or train_course.train_course_category_id = #{trainCourseCategoryId} )
|
||||
</if>
|
||||
<if test="name != null and name != '' "> and name = #{name}</if>
|
||||
<if test="cover != null and cover != '' "> and cover = #{cover}</if>
|
||||
<if test="description != null and description != '' "> and description = #{description}</if>
|
||||
<if test="state != null and state != '' "> and state = #{state}</if>
|
||||
<if test="delFlag != null and delFlag != '' "> and del_flag = #{delFlag}</if>
|
||||
<if test="createBy != null and createBy != '' "> and create_by = #{createBy}</if>
|
||||
<if test="createTime != null "> and create_time = #{createTime}</if>
|
||||
<if test="updateBy != null and updateBy != '' "> and update_by = #{updateBy}</if>
|
||||
<if test="updateTime != null "> and update_time = #{updateTime}</if>
|
||||
<if test="remark != null and remark != '' "> and remark = #{remark}</if>
|
||||
<if test="name != null and name != '' "> and train_course.name = #{name}</if>
|
||||
<if test="cover != null and cover != '' "> and train_course.cover = #{cover}</if>
|
||||
<if test="description != null and description != '' "> and train_course.description = #{description}</if>
|
||||
<if test="state != null and state != '' "> and train_course.state = #{state}</if>
|
||||
<if test="delFlag != null and delFlag != '' "> and train_course.del_flag = #{delFlag}</if>
|
||||
<if test="createBy != null and createBy != '' "> and train_course.create_by = #{createBy}</if>
|
||||
<if test="createTime != null "> and train_course.create_time = #{createTime}</if>
|
||||
<if test="updateBy != null and updateBy != '' "> and train_course.update_by = #{updateBy}</if>
|
||||
<if test="updateTime != null "> and train_course.update_time = #{updateTime}</if>
|
||||
<if test="remark != null and remark != '' "> and train_course.remark = #{remark}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue