我的收藏/我的错题
This commit is contained in:
parent
41cc1a34b6
commit
cd40d3dfd1
|
|
@ -32,63 +32,68 @@ public class ApiUserCollectionQuestionController extends BaseController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存收藏记录
|
* 保存收藏记录
|
||||||
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/v1/practice/collection/{id}")
|
@PostMapping("/v1/question/collection/{id}")
|
||||||
public AjaxResult answer(@PathVariable("id") Integer id) {
|
public AjaxResult answer(@PathVariable("id") Integer id) {
|
||||||
ExamUserCollectionQuestion examUserCollectionQuestion = new ExamUserCollectionQuestion();
|
ExamUserCollectionQuestion examUserCollectionQuestion = new ExamUserCollectionQuestion();
|
||||||
examUserCollectionQuestion.setExamQuestionId(id);
|
examUserCollectionQuestion.setExamQuestionId( id );
|
||||||
SysUser sysUser = sysUserService.selectUserByLoginName( JwtUtil.getLoginName() );
|
SysUser sysUser = sysUserService.selectUserByLoginName( JwtUtil.getLoginName() );
|
||||||
examUserCollectionQuestion.setVipUserId(sysUser.getUserId().intValue());
|
examUserCollectionQuestion.setVipUserId( sysUser.getUserId().intValue() );
|
||||||
examUserCollectionQuestion.setCreateBy(sysUser.getLoginName());
|
examUserCollectionQuestion.setCreateBy( sysUser.getLoginName() );
|
||||||
examUserCollectionQuestion.setCreateDate(new Date());
|
examUserCollectionQuestion.setCreateDate( new Date() );
|
||||||
examUserCollectionQuestion.setDelFlag("0");
|
examUserCollectionQuestion.setDelFlag( "0" );
|
||||||
examUserCollectionQuestion.setUpdateBy(sysUser.getLoginName());
|
examUserCollectionQuestion.setUpdateBy( sysUser.getLoginName() );
|
||||||
examUserCollectionQuestion.setUpdateDate(new Date());
|
examUserCollectionQuestion.setUpdateDate( new Date() );
|
||||||
int insert = examUserCollectionQuestionService.insertSelectiveBySelf(examUserCollectionQuestion );
|
int insert = examUserCollectionQuestionService.insertSelectiveBySelf( examUserCollectionQuestion );
|
||||||
AjaxResult success = success("插入我的收藏记录成功");
|
AjaxResult success = success( "插入我的收藏记录成功" );
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 我的收藏显示列表(分页)
|
* 我的收藏显示列表(分页)
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/v1/question/collection/page")
|
@GetMapping("/v1/question/collection/page")
|
||||||
public AjaxResult collectionPage(){
|
public AjaxResult collectionPage() {
|
||||||
ExamUserCollectionQuestion examUserCollectionQuestion=new ExamUserCollectionQuestion();
|
ExamUserCollectionQuestionVO examUserCollectionQuestion = new ExamUserCollectionQuestionVO();
|
||||||
SysUser sysUser = sysUserService.selectUserByLoginName( JwtUtil.getLoginName() );
|
SysUser sysUser = sysUserService.selectUserByLoginName( JwtUtil.getLoginName() );
|
||||||
examUserCollectionQuestion.setVipUserId(sysUser.getUserId().intValue());
|
examUserCollectionQuestion.setVipUserId( sysUser.getUserId().intValue() );
|
||||||
List<ExamUserCollectionQuestion> list = examUserCollectionQuestionService.selectExamUserCollectionQuestionPage(examUserCollectionQuestion);
|
List<ExamUserCollectionQuestionVO> list = examUserCollectionQuestionService.selectExamUserCollectionQuestionPage( examUserCollectionQuestion );
|
||||||
AjaxResult success = success("查询我的收藏成功");
|
AjaxResult success = success( "查询我的收藏成功" );
|
||||||
success.put("data", list);
|
success.put( "data", list );
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 我的收藏显示列表(不分页)
|
* 我的收藏显示列表(不分页)
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/v1/question/collection/list")
|
@GetMapping("/v1/question/collection/list")
|
||||||
public AjaxResult collectionList(){
|
public AjaxResult collectionList() {
|
||||||
ExamUserCollectionQuestion examUserCollectionQuestion=new ExamUserCollectionQuestion();
|
ExamUserCollectionQuestionVO examUserCollectionQuestion = new ExamUserCollectionQuestionVO();
|
||||||
SysUser sysUser = sysUserService.selectUserByLoginName( JwtUtil.getLoginName() );
|
SysUser sysUser = sysUserService.selectUserByLoginName( JwtUtil.getLoginName() );
|
||||||
examUserCollectionQuestion.setVipUserId(sysUser.getUserId().intValue());
|
examUserCollectionQuestion.setVipUserId( sysUser.getUserId().intValue() );
|
||||||
List<ExamUserCollectionQuestion> list = examUserCollectionQuestionService.selectExamUserCollectionQuestionPage(examUserCollectionQuestion);
|
List<ExamUserCollectionQuestionVO> list = examUserCollectionQuestionService.selectExamUserCollectionQuestionPage( examUserCollectionQuestion );
|
||||||
AjaxResult success = success("查询我的收藏成功");
|
AjaxResult success = success( "查询我的收藏成功" );
|
||||||
success.put("data", list);
|
success.put( "data", list );
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除我的收藏记录
|
* 删除我的收藏记录
|
||||||
*
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/v1/question/collection/delete/{id}")
|
@GetMapping("/v1/question/collection/delete/{id}")
|
||||||
public AjaxResult deleteCollectionQuestion(@PathVariable("id") String id) {
|
public AjaxResult deleteCollectionQuestion(@PathVariable("id") String id) {
|
||||||
examUserCollectionQuestionService.deleteById(id);
|
examUserCollectionQuestionService.deleteById( id );
|
||||||
AjaxResult success = success("删除成功");
|
AjaxResult success = success( "删除成功" );
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,21 @@ public class ApiUserErrorQuestionController extends BaseController {
|
||||||
success.put("data", list);
|
success.put("data", list);
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 查询我的错题列表(不分页)
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/v1/question/error/list")
|
||||||
|
public AjaxResult queryErrorList() {
|
||||||
|
ExamUserErrorQuestion examUserErrorQuestion = new ExamUserErrorQuestion();
|
||||||
|
SysUser sysUser = sysUserService.selectUserByLoginName( JwtUtil.getLoginName() );
|
||||||
|
examUserErrorQuestion.setVipUserId(sysUser.getUserId().intValue());
|
||||||
|
List<ExamUserErrorQuestionVO> list = examUserErrorQuestionService.selectExamUserErrorQuestionDetailList(examUserErrorQuestion);
|
||||||
|
AjaxResult success = success("查询成功");
|
||||||
|
success.put("data", list);
|
||||||
|
return success;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 查询问题详情
|
* 查询问题详情
|
||||||
*
|
*
|
||||||
|
|
@ -103,7 +117,7 @@ public class ApiUserErrorQuestionController extends BaseController {
|
||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/v1/question/error/delete/{id}")
|
@GetMapping("/v1/question/error/delete/{id}")
|
||||||
public AjaxResult deleteErrorQuestion(@PathVariable("id") String id) {
|
public AjaxResult deleteErrorQuestion(@PathVariable("id") String id) {
|
||||||
examUserErrorQuestionService.deleteById(id);
|
examUserErrorQuestionService.deleteById(id);
|
||||||
AjaxResult success = success("删除成功");
|
AjaxResult success = success("删除成功");
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
package com.ruoyi.exam.controller;
|
package com.ruoyi.exam.controller;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.ruoyi.exam.domain.ExamUserCollectionQuestionVO;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
|
|
@ -47,9 +49,9 @@ public class ExamUserCollectionQuestionController extends BaseController
|
||||||
@RequiresPermissions("exam:examUserCollectionQuestion:list")
|
@RequiresPermissions("exam:examUserCollectionQuestion:list")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo list(ExamUserCollectionQuestion examUserCollectionQuestion)
|
public TableDataInfo list(ExamUserCollectionQuestionVO examUserCollectionQuestion)
|
||||||
{
|
{
|
||||||
List<ExamUserCollectionQuestion> list = examUserCollectionQuestionService.selectExamUserCollectionQuestionPage(examUserCollectionQuestion);
|
List<ExamUserCollectionQuestionVO> list = examUserCollectionQuestionService.selectExamUserCollectionQuestionPage(examUserCollectionQuestion);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -60,10 +62,10 @@ public class ExamUserCollectionQuestionController extends BaseController
|
||||||
@RequiresPermissions("exam:examUserCollectionQuestion:export")
|
@RequiresPermissions("exam:examUserCollectionQuestion:export")
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult export(ExamUserCollectionQuestion examUserCollectionQuestion)
|
public AjaxResult export(ExamUserCollectionQuestionVO examUserCollectionQuestion)
|
||||||
{
|
{
|
||||||
List<ExamUserCollectionQuestion> list = examUserCollectionQuestionService.selectExamUserCollectionQuestionList(examUserCollectionQuestion);
|
List<ExamUserCollectionQuestionVO> list = examUserCollectionQuestionService.selectExamUserCollectionQuestionList(examUserCollectionQuestion);
|
||||||
ExcelUtil<ExamUserCollectionQuestion> util = new ExcelUtil<ExamUserCollectionQuestion>(ExamUserCollectionQuestion.class);
|
ExcelUtil<ExamUserCollectionQuestionVO> util = new ExcelUtil<ExamUserCollectionQuestionVO>(ExamUserCollectionQuestionVO.class);
|
||||||
return util.exportExcel(list, "examUserCollectionQuestion");
|
return util.exportExcel(list, "examUserCollectionQuestion");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.ruoyi.exam.domain;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 我的收藏 exam_user_error_question
|
||||||
|
*
|
||||||
|
* @author zhujj
|
||||||
|
* @date 2019-01-10
|
||||||
|
*/
|
||||||
|
public class ExamUserCollectionQuestionVO extends ExamUserCollectionQuestion {
|
||||||
|
private ExamQuestion question;
|
||||||
|
|
||||||
|
public ExamQuestion getQuestion() {
|
||||||
|
return question;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQuestion(ExamQuestion question) {
|
||||||
|
this.question = question;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -2,6 +2,8 @@ package com.ruoyi.exam.mapper;
|
||||||
|
|
||||||
import com.ruoyi.exam.domain.ExamUserCollectionQuestion;
|
import com.ruoyi.exam.domain.ExamUserCollectionQuestion;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.ruoyi.exam.domain.ExamUserCollectionQuestionVO;
|
||||||
import com.ruoyi.framework.web.base.MyMapper;
|
import com.ruoyi.framework.web.base.MyMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -19,6 +21,6 @@ public interface ExamUserCollectionQuestionMapper extends MyMapper<ExamUserColl
|
||||||
* @param examUserCollectionQuestion 我的收藏信息
|
* @param examUserCollectionQuestion 我的收藏信息
|
||||||
* @return 我的收藏集合
|
* @return 我的收藏集合
|
||||||
*/
|
*/
|
||||||
public List<ExamUserCollectionQuestion> selectExamUserCollectionQuestionList(ExamUserCollectionQuestion examUserCollectionQuestion);
|
public List<ExamUserCollectionQuestionVO> selectExamUserCollectionQuestionList(ExamUserCollectionQuestionVO examUserCollectionQuestion);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -2,6 +2,8 @@ package com.ruoyi.exam.service;
|
||||||
|
|
||||||
import com.ruoyi.exam.domain.ExamUserCollectionQuestion;
|
import com.ruoyi.exam.domain.ExamUserCollectionQuestion;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.ruoyi.exam.domain.ExamUserCollectionQuestionVO;
|
||||||
import com.ruoyi.framework.web.base.AbstractBaseService;
|
import com.ruoyi.framework.web.base.AbstractBaseService;
|
||||||
/**
|
/**
|
||||||
* 我的收藏 服务层
|
* 我的收藏 服务层
|
||||||
|
|
@ -17,14 +19,14 @@ public interface IExamUserCollectionQuestionService extends AbstractBaseService<
|
||||||
* @param examUserCollectionQuestion 我的收藏信息
|
* @param examUserCollectionQuestion 我的收藏信息
|
||||||
* @return 我的收藏集合
|
* @return 我的收藏集合
|
||||||
*/
|
*/
|
||||||
public List<ExamUserCollectionQuestion> selectExamUserCollectionQuestionPage(ExamUserCollectionQuestion examUserCollectionQuestion);
|
public List<ExamUserCollectionQuestionVO> selectExamUserCollectionQuestionPage(ExamUserCollectionQuestionVO examUserCollectionQuestion);
|
||||||
/**
|
/**
|
||||||
* 查询我的收藏列表
|
* 查询我的收藏列表
|
||||||
*
|
*
|
||||||
* @param examUserCollectionQuestion 我的收藏信息
|
* @param examUserCollectionQuestion 我的收藏信息
|
||||||
* @return 我的收藏集合
|
* @return 我的收藏集合
|
||||||
*/
|
*/
|
||||||
public List<ExamUserCollectionQuestion> selectExamUserCollectionQuestionList(ExamUserCollectionQuestion examUserCollectionQuestion);
|
public List<ExamUserCollectionQuestionVO> selectExamUserCollectionQuestionList(ExamUserCollectionQuestionVO examUserCollectionQuestion);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 插入收藏题库
|
* 插入收藏题库
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,21 @@ public interface IExamUserErrorQuestionService extends AbstractBaseService<ExamU
|
||||||
*/
|
*/
|
||||||
public List<ExamUserErrorQuestion> selectExamUserErrorQuestionList(ExamUserErrorQuestion examUserErrorQuestion);
|
public List<ExamUserErrorQuestion> selectExamUserErrorQuestionList(ExamUserErrorQuestion examUserErrorQuestion);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询我的错题详情列表
|
||||||
|
*
|
||||||
|
* @param examUserErrorQuestion 我的错题信息
|
||||||
|
* @return 我的错题集合
|
||||||
|
*/
|
||||||
List<ExamUserErrorQuestionVO> selectExamUserErrorQuestionDetailPage(ExamUserErrorQuestion examUserErrorQuestion);
|
List<ExamUserErrorQuestionVO> selectExamUserErrorQuestionDetailPage(ExamUserErrorQuestion examUserErrorQuestion);
|
||||||
|
/**
|
||||||
|
* 查询我的错题详情列表(不分页)
|
||||||
|
*
|
||||||
|
* @param examUserErrorQuestion 我的错题信息
|
||||||
|
* @return 我的错题集合
|
||||||
|
*/
|
||||||
|
List<ExamUserErrorQuestionVO> selectExamUserErrorQuestionDetailList(ExamUserErrorQuestion examUserErrorQuestion);
|
||||||
|
|
||||||
|
|
||||||
int insertError(ExamUserErrorQuestion examUserErrorQuestion);
|
int insertError(ExamUserErrorQuestion examUserErrorQuestion);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
package com.ruoyi.exam.service.impl;
|
package com.ruoyi.exam.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.ruoyi.exam.domain.ExamUserCollectionQuestionVO;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.ruoyi.exam.mapper.ExamUserCollectionQuestionMapper;
|
import com.ruoyi.exam.mapper.ExamUserCollectionQuestionMapper;
|
||||||
|
|
@ -28,7 +30,7 @@ public class ExamUserCollectionQuestionServiceImpl extends AbstractBaseServiceIm
|
||||||
* @return 我的收藏集合
|
* @return 我的收藏集合
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<ExamUserCollectionQuestion> selectExamUserCollectionQuestionList(ExamUserCollectionQuestion examUserCollectionQuestion)
|
public List<ExamUserCollectionQuestionVO> selectExamUserCollectionQuestionList(ExamUserCollectionQuestionVO examUserCollectionQuestion)
|
||||||
{
|
{
|
||||||
return examUserCollectionQuestionMapper.selectExamUserCollectionQuestionList(examUserCollectionQuestion);
|
return examUserCollectionQuestionMapper.selectExamUserCollectionQuestionList(examUserCollectionQuestion);
|
||||||
}
|
}
|
||||||
|
|
@ -45,7 +47,7 @@ public class ExamUserCollectionQuestionServiceImpl extends AbstractBaseServiceIm
|
||||||
* @return 我的收藏集合
|
* @return 我的收藏集合
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<ExamUserCollectionQuestion> selectExamUserCollectionQuestionPage(ExamUserCollectionQuestion examUserCollectionQuestion)
|
public List<ExamUserCollectionQuestionVO> selectExamUserCollectionQuestionPage(ExamUserCollectionQuestionVO examUserCollectionQuestion)
|
||||||
{
|
{
|
||||||
startPage();
|
startPage();
|
||||||
return examUserCollectionQuestionMapper.selectExamUserCollectionQuestionList(examUserCollectionQuestion);
|
return examUserCollectionQuestionMapper.selectExamUserCollectionQuestionList(examUserCollectionQuestion);
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,10 @@ public class ExamUserErrorQuestionServiceImpl extends AbstractBaseServiceImpl<Ex
|
||||||
startPage();
|
startPage();
|
||||||
return examUserErrorQuestionMapper.selectExamUserErrorQuestionDetailPage(examUserErrorQuestion);
|
return examUserErrorQuestionMapper.selectExamUserErrorQuestionDetailPage(examUserErrorQuestion);
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public List<ExamUserErrorQuestionVO> selectExamUserErrorQuestionDetailList(ExamUserErrorQuestion examUserErrorQuestion) {
|
||||||
|
return examUserErrorQuestionMapper.selectExamUserErrorQuestionDetailPage(examUserErrorQuestion);
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
public int insertError(ExamUserErrorQuestion examUserErrorQuestion) {
|
public int insertError(ExamUserErrorQuestion examUserErrorQuestion) {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.ruoyi.exam.mapper.ExamUserCollectionQuestionMapper">
|
<mapper namespace="com.ruoyi.exam.mapper.ExamUserCollectionQuestionMapper">
|
||||||
|
|
||||||
<resultMap type="ExamUserCollectionQuestion" id="ExamUserCollectionQuestionResult">
|
<resultMap type="ExamUserCollectionQuestionVO" id="ExamUserCollectionQuestionResult">
|
||||||
<result property="id" column="id" />
|
<result property="id" column="id" />
|
||||||
<result property="vipUserId" column="vip_user_id" />
|
<result property="vipUserId" column="vip_user_id" />
|
||||||
<result property="examQuestionId" column="exam_question_id" />
|
<result property="examQuestionId" column="exam_question_id" />
|
||||||
|
|
@ -14,24 +14,48 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<result property="updateDate" column="update_date" />
|
<result property="updateDate" column="update_date" />
|
||||||
<result property="remarks" column="remarks" />
|
<result property="remarks" column="remarks" />
|
||||||
<result property="delFlag" column="del_flag" />
|
<result property="delFlag" column="del_flag" />
|
||||||
|
|
||||||
|
<association property="question" javaType="com.ruoyi.exam.domain.ExamQuestion">
|
||||||
|
<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" />
|
||||||
|
</association>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectExamUserCollectionQuestionVo">
|
<sql id="selectExamUserCollectionQuestionVo">
|
||||||
id, vip_user_id, exam_question_id, create_by, create_date, update_by, update_date, remarks, del_flag </sql>
|
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>
|
||||||
|
|
||||||
<select id="selectExamUserCollectionQuestionList" parameterType="ExamUserCollectionQuestion" resultMap="ExamUserCollectionQuestionResult">
|
<select id="selectExamUserCollectionQuestionList" parameterType="ExamUserCollectionQuestionVO" resultMap="ExamUserCollectionQuestionResult">
|
||||||
select
|
select
|
||||||
<include refid="selectExamUserCollectionQuestionVo"/>
|
<include refid="selectExamUserCollectionQuestionVo"/>,
|
||||||
from exam_user_collection_question
|
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
|
||||||
|
from exam_user_collection_question eucq
|
||||||
|
INNER JOIN exam_question eq ON eq.id = eucq.exam_question_id
|
||||||
<where>
|
<where>
|
||||||
<if test="id != null "> and id = #{id}</if>
|
<if test="id != null "> and eucq.id = #{id}</if>
|
||||||
<if test="vipUserId != null "> and vip_user_id = #{vipUserId}</if>
|
<if test="vipUserId != null "> and eucq.vip_user_id = #{vipUserId}</if>
|
||||||
<if test="examQuestionId != null "> and exam_question_id = #{examQuestionId}</if>
|
<if test="examQuestionId != null "> and eucq.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>
|
<if test="delFlag != null and delFlag != '' "> and del_flag = #{delFlag}</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,140 @@
|
||||||
|
package com.ruoyi.vip.controller;
|
||||||
|
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.base.AjaxResult;
|
||||||
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.json.JSONObject;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.ruoyi.framework.jwt.JwtUtil;
|
||||||
|
import com.ruoyi.framework.shiro.service.SysPasswordService;
|
||||||
|
import com.ruoyi.framework.web.base.BaseController;
|
||||||
|
import com.ruoyi.framework.web.util.ShiroUtils;
|
||||||
|
import com.ruoyi.system.domain.SysUser;
|
||||||
|
import com.ruoyi.system.service.ISysUserService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.apache.shiro.SecurityUtils;
|
||||||
|
import org.apache.shiro.authc.AuthenticationException;
|
||||||
|
import org.apache.shiro.authc.UsernamePasswordToken;
|
||||||
|
import org.apache.shiro.subject.Subject;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户信息
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Api("用户信息管理")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/v1")
|
||||||
|
public class ApiVipUserCertificationController extends BaseController {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysUserService sysUserService;
|
||||||
|
@Autowired
|
||||||
|
private SysPasswordService passwordService;
|
||||||
|
|
||||||
|
@ApiOperation("用户登陆")
|
||||||
|
@Log(title = "用户登陆", businessType = BusinessType.EXPORT)
|
||||||
|
@RequestMapping(value = "/user/login", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
|
||||||
|
public AjaxResult login(@RequestBody SysUser user) {
|
||||||
|
AjaxResult success = success( "登陆成功" );
|
||||||
|
boolean rememberMe = false;
|
||||||
|
UsernamePasswordToken token = new UsernamePasswordToken( user.getUserName(), user.getPassword(), rememberMe );
|
||||||
|
Subject subject = SecurityUtils.getSubject();
|
||||||
|
try {
|
||||||
|
subject.login( token );
|
||||||
|
String tokenSign = JwtUtil.sign( user.getUserName(), user.getPassword() );
|
||||||
|
JSONObject json = new JSONObject();
|
||||||
|
|
||||||
|
json.put( "token", tokenSign );
|
||||||
|
SysUser sysUser = sysUserService.selectUserByLoginName( user.getUserName());
|
||||||
|
json.put( "user", sysUser );
|
||||||
|
success.put( "data", json );
|
||||||
|
return success;
|
||||||
|
} catch (AuthenticationException e) {
|
||||||
|
String msg = "用户或密码错误";
|
||||||
|
if (StringUtils.isNotEmpty( e.getMessage() )) {
|
||||||
|
msg = e.getMessage();
|
||||||
|
}
|
||||||
|
return error( msg );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/member/user/info")
|
||||||
|
public AjaxResult get() {
|
||||||
|
AjaxResult success = success( "获取用户信息成功" );
|
||||||
|
SysUser sysUser = sysUserService.selectUserByLoginName( JwtUtil.getLoginName() );
|
||||||
|
success.put( "data", sysUser );
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存用户
|
||||||
|
*/
|
||||||
|
@Log(title = "用户管理", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/user/add")
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(@RequestBody SysUser user) {
|
||||||
|
user.setSalt( ShiroUtils.randomSalt() );
|
||||||
|
user.setUserType( UserConstants.USER_VIP );
|
||||||
|
user.setPassword( passwordService.encryptPassword( user.getLoginName(), user.getPassword(), user.getSalt() ) );
|
||||||
|
return toAjax( sysUserService.insertUser( user ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存用户
|
||||||
|
*/
|
||||||
|
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/member/user/edit")
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(SysUser user) {
|
||||||
|
|
||||||
|
user.setUpdateBy( ShiroUtils.getLoginName() );
|
||||||
|
return toAjax( sysUserService.updateUser( user ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "重置密码", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/member/user/resetPwd")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult resetPwdSave(SysUser user) {
|
||||||
|
user.setSalt( ShiroUtils.randomSalt() );
|
||||||
|
user.setPassword( passwordService.encryptPassword( user.getLoginName(), user.getPassword(), user.getSalt() ) );
|
||||||
|
return toAjax( sysUserService.resetUserPwd( user ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验用户名
|
||||||
|
*/
|
||||||
|
@PostMapping("/member/user/checkLoginNameUnique")
|
||||||
|
@ResponseBody
|
||||||
|
public String checkLoginNameUnique(SysUser user) {
|
||||||
|
return sysUserService.checkLoginNameUnique( user.getLoginName() );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验手机号码
|
||||||
|
*/
|
||||||
|
@PostMapping("/member/user/checkPhoneUnique")
|
||||||
|
@ResponseBody
|
||||||
|
public String checkPhoneUnique(SysUser user) {
|
||||||
|
return sysUserService.checkPhoneUnique( user );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验email邮箱
|
||||||
|
*/
|
||||||
|
@PostMapping("/member/user/checkEmailUnique")
|
||||||
|
@ResponseBody
|
||||||
|
public String checkEmailUnique(SysUser user) {
|
||||||
|
return sysUserService.checkEmailUnique( user );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -16,6 +16,8 @@ import com.ruoyi.framework.web.util.ServletUtils;
|
||||||
import com.ruoyi.framework.web.util.ShiroUtils;
|
import com.ruoyi.framework.web.util.ShiroUtils;
|
||||||
import com.ruoyi.system.domain.SysUser;
|
import com.ruoyi.system.domain.SysUser;
|
||||||
import com.ruoyi.system.service.ISysUserService;
|
import com.ruoyi.system.service.ISysUserService;
|
||||||
|
import com.ruoyi.vip.domain.vo.VipUserCertificateVO;
|
||||||
|
import com.ruoyi.vip.service.IVipUserCertificateService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.apache.shiro.SecurityUtils;
|
import org.apache.shiro.SecurityUtils;
|
||||||
|
|
@ -34,114 +36,25 @@ import java.util.List;
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Api("用户信息管理")
|
@Api("我的证书管理")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/v1")
|
@RequestMapping("/api")
|
||||||
public class ApiVipUserController extends BaseController {
|
public class ApiVipUserController extends BaseController {
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysUserService sysUserService;
|
private ISysUserService sysUserService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysPasswordService passwordService;
|
private IVipUserCertificateService vipUserCertificateService;
|
||||||
|
@GetMapping("/v1/user/cerificate/page")
|
||||||
@ApiOperation("用户登陆")
|
|
||||||
@Log(title = "用户登陆", businessType = BusinessType.EXPORT)
|
|
||||||
@RequestMapping(value = "/user/login", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
|
|
||||||
public AjaxResult login(@RequestBody SysUser user) {
|
|
||||||
AjaxResult success = success( "登陆成功" );
|
|
||||||
boolean rememberMe = false;
|
|
||||||
UsernamePasswordToken token = new UsernamePasswordToken( user.getUserName(), user.getPassword(), rememberMe );
|
|
||||||
Subject subject = SecurityUtils.getSubject();
|
|
||||||
try {
|
|
||||||
subject.login( token );
|
|
||||||
String tokenSign = JwtUtil.sign( user.getUserName(), user.getPassword() );
|
|
||||||
JSONObject json = new JSONObject();
|
|
||||||
|
|
||||||
json.put( "token", tokenSign );
|
|
||||||
SysUser sysUser = sysUserService.selectUserByLoginName( user.getUserName());
|
|
||||||
json.put( "user", sysUser );
|
|
||||||
success.put( "data", json );
|
|
||||||
return success;
|
|
||||||
} catch (AuthenticationException e) {
|
|
||||||
String msg = "用户或密码错误";
|
|
||||||
if (StringUtils.isNotEmpty( e.getMessage() )) {
|
|
||||||
msg = e.getMessage();
|
|
||||||
}
|
|
||||||
return error( msg );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/member/user/info")
|
|
||||||
public AjaxResult get() {
|
public AjaxResult get() {
|
||||||
AjaxResult success = success( "获取用户信息成功" );
|
AjaxResult success = success( "获取我的证书成功" );
|
||||||
SysUser sysUser = sysUserService.selectUserByLoginName( JwtUtil.getLoginName() );
|
SysUser sysUser = sysUserService.selectUserByLoginName( JwtUtil.getLoginName() );
|
||||||
success.put( "data", sysUser );
|
VipUserCertificateVO certificateVO = new VipUserCertificateVO();
|
||||||
|
certificateVO.setVipUserId( sysUser.getUserId().intValue() );
|
||||||
|
List<VipUserCertificateVO> list = vipUserCertificateService.selectVipUserCertificatePage( certificateVO );
|
||||||
|
success.put( "data", list );
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增保存用户
|
|
||||||
*/
|
|
||||||
@Log(title = "用户管理", businessType = BusinessType.INSERT)
|
|
||||||
@PostMapping("/user/add")
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
@ResponseBody
|
|
||||||
public AjaxResult addSave(@RequestBody SysUser user) {
|
|
||||||
user.setSalt( ShiroUtils.randomSalt() );
|
|
||||||
user.setUserType( UserConstants.USER_VIP );
|
|
||||||
user.setPassword( passwordService.encryptPassword( user.getLoginName(), user.getPassword(), user.getSalt() ) );
|
|
||||||
return toAjax( sysUserService.insertUser( user ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改保存用户
|
|
||||||
*/
|
|
||||||
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
|
||||||
@PostMapping("/member/user/edit")
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
@ResponseBody
|
|
||||||
public AjaxResult editSave(SysUser user) {
|
|
||||||
|
|
||||||
user.setUpdateBy( ShiroUtils.getLoginName() );
|
|
||||||
return toAjax( sysUserService.updateUser( user ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Log(title = "重置密码", businessType = BusinessType.UPDATE)
|
|
||||||
@PostMapping("/member/user/resetPwd")
|
|
||||||
@ResponseBody
|
|
||||||
public AjaxResult resetPwdSave(SysUser user) {
|
|
||||||
user.setSalt( ShiroUtils.randomSalt() );
|
|
||||||
user.setPassword( passwordService.encryptPassword( user.getLoginName(), user.getPassword(), user.getSalt() ) );
|
|
||||||
return toAjax( sysUserService.resetUserPwd( user ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 校验用户名
|
|
||||||
*/
|
|
||||||
@PostMapping("/member/user//checkLoginNameUnique")
|
|
||||||
@ResponseBody
|
|
||||||
public String checkLoginNameUnique(SysUser user) {
|
|
||||||
return sysUserService.checkLoginNameUnique( user.getLoginName() );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 校验手机号码
|
|
||||||
*/
|
|
||||||
@PostMapping("/member/user//checkPhoneUnique")
|
|
||||||
@ResponseBody
|
|
||||||
public String checkPhoneUnique(SysUser user) {
|
|
||||||
return sysUserService.checkPhoneUnique( user );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 校验email邮箱
|
|
||||||
*/
|
|
||||||
@PostMapping("/member/user//checkEmailUnique")
|
|
||||||
@ResponseBody
|
|
||||||
public String checkEmailUnique(SysUser user) {
|
|
||||||
return sysUserService.checkEmailUnique( user );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue