From fd77d1885e993373d5373dbfcaf7bfb775d82c06 Mon Sep 17 00:00:00 2001 From: zhujj Date: Wed, 16 Jan 2019 16:30:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=91=E7=9A=84=E9=94=99=E9=A2=98=E3=80=81?= =?UTF-8?q?=E6=88=91=E7=9A=84=E6=94=B6=E8=97=8F=E3=80=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ApiPracticeController.java | 80 ++------- .../ApiUserCollectionQuestionController.java | 94 +++++++++++ .../ApiUserErrorQuestionController.java | 113 +++++++++++++ .../ExamUserCollectionQuestionController.java | 126 +++++++++++++++ .../domain/ExamUserCollectionQuestion.java | 152 ++++++++++++++++++ .../ruoyi/exam/mapper/ExamQuestionMapper.java | 36 +++++ .../ExamUserCollectionQuestionMapper.java | 24 +++ .../IExamUserCollectionQuestionService.java | 35 ++++ ...ExamUserCollectionQuestionServiceImpl.java | 54 +++++++ .../mapper/exam/ExamQuestionMapper.xml | 29 +++- .../exam/ExamUserCollectionQuestionMapper.xml | 40 +++++ 11 files changed, 711 insertions(+), 72 deletions(-) create mode 100644 ruoyi-exam/src/main/java/com/ruoyi/exam/controller/ApiUserCollectionQuestionController.java create mode 100644 ruoyi-exam/src/main/java/com/ruoyi/exam/controller/ApiUserErrorQuestionController.java create mode 100644 ruoyi-exam/src/main/java/com/ruoyi/exam/controller/ExamUserCollectionQuestionController.java create mode 100644 ruoyi-exam/src/main/java/com/ruoyi/exam/domain/ExamUserCollectionQuestion.java create mode 100644 ruoyi-exam/src/main/java/com/ruoyi/exam/mapper/ExamUserCollectionQuestionMapper.java create mode 100644 ruoyi-exam/src/main/java/com/ruoyi/exam/service/IExamUserCollectionQuestionService.java create mode 100644 ruoyi-exam/src/main/java/com/ruoyi/exam/service/impl/ExamUserCollectionQuestionServiceImpl.java create mode 100644 ruoyi-exam/src/main/resources/mapper/exam/ExamUserCollectionQuestionMapper.xml diff --git a/ruoyi-exam/src/main/java/com/ruoyi/exam/controller/ApiPracticeController.java b/ruoyi-exam/src/main/java/com/ruoyi/exam/controller/ApiPracticeController.java index dac8d1269..989c07511 100644 --- a/ruoyi-exam/src/main/java/com/ruoyi/exam/controller/ApiPracticeController.java +++ b/ruoyi-exam/src/main/java/com/ruoyi/exam/controller/ApiPracticeController.java @@ -2,10 +2,7 @@ package com.ruoyi.exam.controller; import com.ruoyi.common.base.AjaxResult; import com.ruoyi.exam.domain.*; -import com.ruoyi.exam.service.IExamPracticeQuestionService; -import com.ruoyi.exam.service.IExamPracticeService; -import com.ruoyi.exam.service.IExamQuestionService; -import com.ruoyi.exam.service.IExamUserErrorQuestionService; +import com.ruoyi.exam.service.*; import com.ruoyi.framework.jwt.JwtUtil; import com.ruoyi.framework.web.base.BaseController; import com.ruoyi.framework.web.page.TableDataInfo; @@ -22,7 +19,7 @@ import java.util.*; /** * Created by flower on 2019/1/9. */ -@Api("练习") +@Api("练习接口") @RestController @RequestMapping("/api") public class ApiPracticeController extends BaseController { @@ -30,20 +27,17 @@ public class ApiPracticeController extends BaseController { @Autowired private IExamPracticeService examPracticeService; - @Autowired - private IExamPracticeQuestionService examPracticeQuestionService; @Autowired private IExamQuestionService examQuestionService; - @Autowired - private IExamUserErrorQuestionService examUserErrorQuestionService; - - @Autowired - private ISysUserService sysUserService; - + /** + * 查询练习列表 + * @param examPractice + * @return + */ @GetMapping("/v1/practice/list") - public AjaxResult list(ExamPractice examPractice) { + public AjaxResult list(@RequestParam ExamPractice examPractice) { List list = examPracticeService.selectListFromWeb(examPractice); AjaxResult success = success("查询成功"); @@ -52,7 +46,7 @@ public class ApiPracticeController extends BaseController { } /** - * 查询练习具体的问题列表 + * 查询练习题库的问题列表 * * @param map * @return @@ -68,60 +62,4 @@ public class ApiPracticeController extends BaseController { return success; } - /** - * 保存错题记录 - * - * @param questionIds - * @return - * @description 练习时答错题就保存到错题记录中 - * 传入问题id - */ - @PostMapping("/v1/practice/answer") - public AjaxResult answer(@RequestBody List questionIds) { - for (String questionId : questionIds) { - ExamUserErrorQuestion examUserErrorQuestion = new ExamUserErrorQuestion(); - examUserErrorQuestion.setExamQuestionId(Integer.parseInt(questionId)); - SysUser sysUser = sysUserService.selectUserByLoginName( JwtUtil.getLoginName() ); - examUserErrorQuestion.setVipUserId(sysUser.getUserId().intValue()); - examUserErrorQuestion.setCreateBy(sysUser.getLoginName()); - examUserErrorQuestion.setCreateDate(new Date()); - examUserErrorQuestion.setDelFlag("0"); - examUserErrorQuestion.setUpdateBy(sysUser.getLoginName()); - examUserErrorQuestion.setUpdateDate(new Date()); - int insert = examUserErrorQuestionService.insertError( examUserErrorQuestion ); - } - AjaxResult success = success("插入错题本成功"); - return success; - } - - /** - * 查询我的错题列表 - * - * @return - */ - @GetMapping("/v1/practice/error") - public AjaxResult queryError() { - ExamUserErrorQuestion examUserErrorQuestion = new ExamUserErrorQuestion(); - SysUser sysUser = sysUserService.selectUserByLoginName( JwtUtil.getLoginName() ); - examUserErrorQuestion.setVipUserId(sysUser.getUserId().intValue()); - List list = examUserErrorQuestionService.selectExamUserErrorQuestionDetailPage(examUserErrorQuestion); - AjaxResult success = success("查询成功"); - success.put("data", list); - return success; - } - - /** - * 查询问题详情 - * - * @param id - * @return - */ - @GetMapping("/v1/practice/question/{id}") - public AjaxResult queryQuestion(@PathVariable("id") String id) { - ExamQuestionVO result = examQuestionService.selectQuestionDetail(id); - AjaxResult success = success("查询成功"); - success.put("data", result); - return success; - } - } diff --git a/ruoyi-exam/src/main/java/com/ruoyi/exam/controller/ApiUserCollectionQuestionController.java b/ruoyi-exam/src/main/java/com/ruoyi/exam/controller/ApiUserCollectionQuestionController.java new file mode 100644 index 000000000..6db2d5fa3 --- /dev/null +++ b/ruoyi-exam/src/main/java/com/ruoyi/exam/controller/ApiUserCollectionQuestionController.java @@ -0,0 +1,94 @@ +package com.ruoyi.exam.controller; + +import com.ruoyi.common.base.AjaxResult; +import com.ruoyi.exam.domain.*; +import com.ruoyi.exam.service.*; +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 io.swagger.annotations.Api; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Collections; +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** + * Created by flower on 2019/1/9. + */ +@Api("收藏接口") +@RestController +@RequestMapping("/api") +public class ApiUserCollectionQuestionController extends BaseController { + + @Autowired + private ISysUserService sysUserService; + + @Autowired + private IExamUserCollectionQuestionService examUserCollectionQuestionService; + + /** + * 保存收藏记录 + * @param id + * @return + */ + @PostMapping("/v1/practice/collection/{id}") + public AjaxResult answer(@PathVariable("id") Integer id) { + ExamUserCollectionQuestion examUserCollectionQuestion = new ExamUserCollectionQuestion(); + examUserCollectionQuestion.setExamQuestionId(id); + SysUser sysUser = sysUserService.selectUserByLoginName( JwtUtil.getLoginName() ); + examUserCollectionQuestion.setVipUserId(sysUser.getUserId().intValue()); + examUserCollectionQuestion.setCreateBy(sysUser.getLoginName()); + examUserCollectionQuestion.setCreateDate(new Date()); + examUserCollectionQuestion.setDelFlag("0"); + examUserCollectionQuestion.setUpdateBy(sysUser.getLoginName()); + examUserCollectionQuestion.setUpdateDate(new Date()); + int insert = examUserCollectionQuestionService.insertSelectiveBySelf(examUserCollectionQuestion ); + AjaxResult success = success("插入我的收藏记录成功"); + return success; + } + + /** + * 我的收藏显示列表(分页) + * @return + */ + @PostMapping("/v1/question/collection/page") + public AjaxResult collectionPage(){ + ExamUserCollectionQuestion examUserCollectionQuestion=new ExamUserCollectionQuestion(); + SysUser sysUser = sysUserService.selectUserByLoginName( JwtUtil.getLoginName() ); + examUserCollectionQuestion.setVipUserId(sysUser.getUserId().intValue()); + List list = examUserCollectionQuestionService.selectExamUserCollectionQuestionPage(examUserCollectionQuestion); + AjaxResult success = success("查询我的收藏成功"); + success.put("data", list); + return success; + } + /** + * 我的收藏显示列表(不分页) + * @return + */ + @PostMapping("/v1/question/collection/list") + public AjaxResult collectionList(){ + ExamUserCollectionQuestion examUserCollectionQuestion=new ExamUserCollectionQuestion(); + SysUser sysUser = sysUserService.selectUserByLoginName( JwtUtil.getLoginName() ); + examUserCollectionQuestion.setVipUserId(sysUser.getUserId().intValue()); + List list = examUserCollectionQuestionService.selectExamUserCollectionQuestionPage(examUserCollectionQuestion); + AjaxResult success = success("查询我的收藏成功"); + success.put("data", list); + return success; + } + /** + * 删除我的收藏记录 + * + * @param id + * @return + */ + @PostMapping("/v1/question/collection/delete/{id}") + public AjaxResult deleteCollectionQuestion(@PathVariable("id") String id) { + examUserCollectionQuestionService.deleteById(id); + AjaxResult success = success("删除成功"); + return success; + } +} diff --git a/ruoyi-exam/src/main/java/com/ruoyi/exam/controller/ApiUserErrorQuestionController.java b/ruoyi-exam/src/main/java/com/ruoyi/exam/controller/ApiUserErrorQuestionController.java new file mode 100644 index 000000000..7d09924a2 --- /dev/null +++ b/ruoyi-exam/src/main/java/com/ruoyi/exam/controller/ApiUserErrorQuestionController.java @@ -0,0 +1,113 @@ +package com.ruoyi.exam.controller; + +import com.ruoyi.common.base.AjaxResult; +import com.ruoyi.exam.domain.*; +import com.ruoyi.exam.service.*; +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 io.swagger.annotations.Api; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Collections; +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** + * Created by flower on 2019/1/9. + */ +@Api("错题接口") +@RestController +@RequestMapping("/api") +public class ApiUserErrorQuestionController extends BaseController { + + @Autowired + private IExamPracticeService examPracticeService; + + @Autowired + private IExamPracticeQuestionService examPracticeQuestionService; + + @Autowired + private IExamQuestionService examQuestionService; + + @Autowired + private IExamUserErrorQuestionService examUserErrorQuestionService; + + @Autowired + private ISysUserService sysUserService; + + @Autowired + private IExamUserCollectionQuestionService examUserCollectionQuestionService; + + /** + * 保存错题记录 + * + * @param questionIds + * @return + * @description 练习时答错题就保存到错题记录中 + * 传入问题id + */ + @PostMapping("/v1/practice/answer") + public AjaxResult answer(@RequestBody List questionIds) { + for (String questionId : questionIds) { + ExamUserErrorQuestion examUserErrorQuestion = new ExamUserErrorQuestion(); + examUserErrorQuestion.setExamQuestionId(Integer.parseInt(questionId)); + SysUser sysUser = sysUserService.selectUserByLoginName( JwtUtil.getLoginName() ); + examUserErrorQuestion.setVipUserId(sysUser.getUserId().intValue()); + examUserErrorQuestion.setCreateBy(sysUser.getLoginName()); + examUserErrorQuestion.setCreateDate(new Date()); + examUserErrorQuestion.setDelFlag("0"); + examUserErrorQuestion.setUpdateBy(sysUser.getLoginName()); + examUserErrorQuestion.setUpdateDate(new Date()); + int insert = examUserErrorQuestionService.insertError( examUserErrorQuestion ); + } + AjaxResult success = success("插入错题本成功"); + return success; + } + + /** + * 查询我的错题列表 + * + * @return + */ + @GetMapping("/v1/practice/error") + public AjaxResult queryError() { + ExamUserErrorQuestion examUserErrorQuestion = new ExamUserErrorQuestion(); + SysUser sysUser = sysUserService.selectUserByLoginName( JwtUtil.getLoginName() ); + examUserErrorQuestion.setVipUserId(sysUser.getUserId().intValue()); + List list = examUserErrorQuestionService.selectExamUserErrorQuestionDetailPage(examUserErrorQuestion); + AjaxResult success = success("查询成功"); + success.put("data", list); + return success; + } + + /** + * 查询问题详情 + * + * @param id + * @return + */ + @GetMapping("/v1/question/{id}") + public AjaxResult queryQuestion(@PathVariable("id") String id) { + ExamQuestionVO result = examQuestionService.selectQuestionDetail(id); + AjaxResult success = success("查询成功"); + success.put("data", result); + return success; + } + /** + * 删除错题记录 + * + * @param id + * @return + */ + @PostMapping("/v1/question/error/delete/{id}") + public AjaxResult deleteErrorQuestion(@PathVariable("id") String id) { + examUserErrorQuestionService.deleteById(id); + AjaxResult success = success("删除成功"); + return success; + } + +} diff --git a/ruoyi-exam/src/main/java/com/ruoyi/exam/controller/ExamUserCollectionQuestionController.java b/ruoyi-exam/src/main/java/com/ruoyi/exam/controller/ExamUserCollectionQuestionController.java new file mode 100644 index 000000000..4cbf3ca29 --- /dev/null +++ b/ruoyi-exam/src/main/java/com/ruoyi/exam/controller/ExamUserCollectionQuestionController.java @@ -0,0 +1,126 @@ +package com.ruoyi.exam.controller; + +import java.util.List; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.exam.domain.ExamUserCollectionQuestion; +import com.ruoyi.exam.service.IExamUserCollectionQuestionService; +import com.ruoyi.framework.web.base.BaseController; +import com.ruoyi.framework.web.page.TableDataInfo; +import com.ruoyi.common.base.AjaxResult; +import com.ruoyi.common.utils.ExcelUtil; + +/** + * 我的收藏 信息操作处理 + * + * @author zhujj + * @date 2019-01-16 + */ +@Controller +@RequestMapping("/exam/examUserCollectionQuestion") +public class ExamUserCollectionQuestionController extends BaseController +{ + private String prefix = "exam/examUserCollectionQuestion"; + + @Autowired + private IExamUserCollectionQuestionService examUserCollectionQuestionService; + + @RequiresPermissions("exam:examUserCollectionQuestion:view") + @GetMapping() + public String examUserCollectionQuestion() + { + return prefix + "/examUserCollectionQuestion"; + } + + /** + * 查询我的收藏列表 + */ + @RequiresPermissions("exam:examUserCollectionQuestion:list") + @PostMapping("/list") + @ResponseBody + public TableDataInfo list(ExamUserCollectionQuestion examUserCollectionQuestion) + { + List list = examUserCollectionQuestionService.selectExamUserCollectionQuestionPage(examUserCollectionQuestion); + return getDataTable(list); + } + + + /** + * 导出我的收藏列表 + */ + @RequiresPermissions("exam:examUserCollectionQuestion:export") + @PostMapping("/export") + @ResponseBody + public AjaxResult export(ExamUserCollectionQuestion examUserCollectionQuestion) + { + List list = examUserCollectionQuestionService.selectExamUserCollectionQuestionList(examUserCollectionQuestion); + ExcelUtil util = new ExcelUtil(ExamUserCollectionQuestion.class); + return util.exportExcel(list, "examUserCollectionQuestion"); + } + + /** + * 新增我的收藏 + */ + @GetMapping("/add") + public String add() + { + return prefix + "/add"; + } + + /** + * 新增保存我的收藏 + */ + @RequiresPermissions("exam:examUserCollectionQuestion:add") + @Log(title = "我的收藏", businessType = BusinessType.INSERT) + @PostMapping("/add") + @ResponseBody + public AjaxResult addSave(ExamUserCollectionQuestion examUserCollectionQuestion) + { + return toAjax(examUserCollectionQuestionService.insert(examUserCollectionQuestion)); + } + + /** + * 修改我的收藏 + */ + @GetMapping("/edit/{id}") + public String edit(@PathVariable("id") Integer id, ModelMap mmap) + { + ExamUserCollectionQuestion examUserCollectionQuestion = examUserCollectionQuestionService.selectById(id); + mmap.put("examUserCollectionQuestion", examUserCollectionQuestion); + return prefix + "/edit"; + } + + /** + * 修改保存我的收藏 + */ + @RequiresPermissions("exam:examUserCollectionQuestion:edit") + @Log(title = "我的收藏", businessType = BusinessType.UPDATE) + @PostMapping("/edit") + @ResponseBody + public AjaxResult editSave(ExamUserCollectionQuestion examUserCollectionQuestion) + { + return toAjax(examUserCollectionQuestionService.updateById(examUserCollectionQuestion)); + } + + /** + * 删除我的收藏 + */ + @RequiresPermissions("exam:examUserCollectionQuestion:remove") + @Log(title = "我的收藏", businessType = BusinessType.DELETE) + @PostMapping( "/remove") + @ResponseBody + public AjaxResult remove(String ids) + { + return toAjax(examUserCollectionQuestionService.deleteByIds(ids)); + } + +} diff --git a/ruoyi-exam/src/main/java/com/ruoyi/exam/domain/ExamUserCollectionQuestion.java b/ruoyi-exam/src/main/java/com/ruoyi/exam/domain/ExamUserCollectionQuestion.java new file mode 100644 index 000000000..83cb4268b --- /dev/null +++ b/ruoyi-exam/src/main/java/com/ruoyi/exam/domain/ExamUserCollectionQuestion.java @@ -0,0 +1,152 @@ +package com.ruoyi.exam.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.base.BaseEntity; + import javax.persistence.Id; + import java.util.Date; + +/** + * 我的收藏表 exam_user_collection_question + * + * @author zhujj + * @date 2019-01-16 + */ +public class ExamUserCollectionQuestion +{ +private static final long serialVersionUID = 1L; + + /** 练习对象 */ + @Id + private Integer id; + /** 会员代码 */ + private Integer vipUserId; + /** 练习题代码 */ + private Integer examQuestionId; + /** 创建者 */ + private String createBy; + /** 创建时间 */ + private Date createDate; + /** 更新者 */ + private String updateBy; + /** 更新时间 */ + private Date updateDate; + /** 备注信息 */ + private String remarks; + /** 删除标记 */ + private String delFlag; + + /** 设置练习对象 */ + public void setId(Integer id) + { + this.id = id; + } + + /** 获取练习对象 */ + public Integer getId() + { + return id; + } + /** 设置会员代码 */ + public void setVipUserId(Integer vipUserId) + { + this.vipUserId = vipUserId; + } + + /** 获取会员代码 */ + public Integer getVipUserId() + { + return vipUserId; + } + /** 设置练习题代码 */ + public void setExamQuestionId(Integer examQuestionId) + { + this.examQuestionId = examQuestionId; + } + + /** 获取练习题代码 */ + public Integer getExamQuestionId() + { + return examQuestionId; + } + /** 设置创建者 */ + public void setCreateBy(String createBy) + { + this.createBy = createBy; + } + + /** 获取创建者 */ + public String getCreateBy() + { + return createBy; + } + /** 设置创建时间 */ + public void setCreateDate(Date createDate) + { + this.createDate = createDate; + } + + /** 获取创建时间 */ + public Date getCreateDate() + { + return createDate; + } + /** 设置更新者 */ + public void setUpdateBy(String updateBy) + { + this.updateBy = updateBy; + } + + /** 获取更新者 */ + public String getUpdateBy() + { + return updateBy; + } + /** 设置更新时间 */ + public void setUpdateDate(Date updateDate) + { + this.updateDate = updateDate; + } + + /** 获取更新时间 */ + public Date getUpdateDate() + { + return updateDate; + } + /** 设置备注信息 */ + public void setRemarks(String remarks) + { + this.remarks = remarks; + } + + /** 获取备注信息 */ + public String getRemarks() + { + return remarks; + } + /** 设置删除标记 */ + public void setDelFlag(String delFlag) + { + this.delFlag = delFlag; + } + + /** 获取删除标记 */ + public String getDelFlag() + { + return delFlag; + } + +public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("vipUserId", getVipUserId()) + .append("examQuestionId", getExamQuestionId()) + .append("createBy", getCreateBy()) + .append("createDate", getCreateDate()) + .append("updateBy", getUpdateBy()) + .append("updateDate", getUpdateDate()) + .append("remarks", getRemarks()) + .append("delFlag", getDelFlag()) + .toString(); + } + } diff --git a/ruoyi-exam/src/main/java/com/ruoyi/exam/mapper/ExamQuestionMapper.java b/ruoyi-exam/src/main/java/com/ruoyi/exam/mapper/ExamQuestionMapper.java index e4725f7d2..5796dd226 100644 --- a/ruoyi-exam/src/main/java/com/ruoyi/exam/mapper/ExamQuestionMapper.java +++ b/ruoyi-exam/src/main/java/com/ruoyi/exam/mapper/ExamQuestionMapper.java @@ -63,11 +63,47 @@ public interface ExamQuestionMapper extends MyMapper */ public int deleteExamQuestionByIds(String[] ids); + /** + * 根据分类筛选题库 + * @param examQuestion + * @return + */ List selectListBycategory(ExamQuestion examQuestion); + /** + * 查询练习题库 + * @param map + * @return + */ List selectQuestionListByPracticeId(Map map); + + /** + * 查询问题详情 + * @param questionId + * @return + */ ExamQuestionVO selectQuestionDetail(String questionId); + /** + * 查询试卷题库 + * @param examPaperId + * @return + */ List selectQuestionListByPaperId(Integer examPaperId); + + + /** + * 查询我的错题 + * @param vipUserId + * @return + */ + List selectQuestionListByUserError(Integer vipUserId); + + /** + * 查询我的收藏 + * @param vipUserId + * @return + */ + List selectQuestionListByUserCollection(Integer vipUserId); } \ No newline at end of file diff --git a/ruoyi-exam/src/main/java/com/ruoyi/exam/mapper/ExamUserCollectionQuestionMapper.java b/ruoyi-exam/src/main/java/com/ruoyi/exam/mapper/ExamUserCollectionQuestionMapper.java new file mode 100644 index 000000000..8a39ef5d5 --- /dev/null +++ b/ruoyi-exam/src/main/java/com/ruoyi/exam/mapper/ExamUserCollectionQuestionMapper.java @@ -0,0 +1,24 @@ +package com.ruoyi.exam.mapper; + +import com.ruoyi.exam.domain.ExamUserCollectionQuestion; +import java.util.List; +import com.ruoyi.framework.web.base.MyMapper; + +/** + * 我的收藏 数据层 + * + * @author zhujj + * @date 2019-01-16 + */ +public interface ExamUserCollectionQuestionMapper extends MyMapper +{ + + /** + * 查询我的收藏列表 + * + * @param examUserCollectionQuestion 我的收藏信息 + * @return 我的收藏集合 + */ + public List selectExamUserCollectionQuestionList(ExamUserCollectionQuestion examUserCollectionQuestion); + +} \ No newline at end of file diff --git a/ruoyi-exam/src/main/java/com/ruoyi/exam/service/IExamUserCollectionQuestionService.java b/ruoyi-exam/src/main/java/com/ruoyi/exam/service/IExamUserCollectionQuestionService.java new file mode 100644 index 000000000..1391a880a --- /dev/null +++ b/ruoyi-exam/src/main/java/com/ruoyi/exam/service/IExamUserCollectionQuestionService.java @@ -0,0 +1,35 @@ +package com.ruoyi.exam.service; + +import com.ruoyi.exam.domain.ExamUserCollectionQuestion; +import java.util.List; +import com.ruoyi.framework.web.base.AbstractBaseService; +/** + * 我的收藏 服务层 + * + * @author zhujj + * @date 2019-01-16 + */ +public interface IExamUserCollectionQuestionService extends AbstractBaseService +{ + /** + * 查询我的收藏分页列表 + * + * @param examUserCollectionQuestion 我的收藏信息 + * @return 我的收藏集合 + */ + public List selectExamUserCollectionQuestionPage(ExamUserCollectionQuestion examUserCollectionQuestion); + /** + * 查询我的收藏列表 + * + * @param examUserCollectionQuestion 我的收藏信息 + * @return 我的收藏集合 + */ + public List selectExamUserCollectionQuestionList(ExamUserCollectionQuestion examUserCollectionQuestion); + + /** + * 插入收藏题库 + * @param examUserCollectionQuestion + * @return + */ + int insertSelectiveBySelf(ExamUserCollectionQuestion examUserCollectionQuestion); +} diff --git a/ruoyi-exam/src/main/java/com/ruoyi/exam/service/impl/ExamUserCollectionQuestionServiceImpl.java b/ruoyi-exam/src/main/java/com/ruoyi/exam/service/impl/ExamUserCollectionQuestionServiceImpl.java new file mode 100644 index 000000000..d53c940cb --- /dev/null +++ b/ruoyi-exam/src/main/java/com/ruoyi/exam/service/impl/ExamUserCollectionQuestionServiceImpl.java @@ -0,0 +1,54 @@ +package com.ruoyi.exam.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.exam.mapper.ExamUserCollectionQuestionMapper; +import com.ruoyi.exam.domain.ExamUserCollectionQuestion; +import com.ruoyi.exam.service.IExamUserCollectionQuestionService; +import com.ruoyi.common.support.Convert; +import com.ruoyi.framework.web.base.AbstractBaseServiceImpl; +/** + * 我的收藏 服务层实现 + * + * @author zhujj + * @date 2019-01-16 + */ +@Service +public class ExamUserCollectionQuestionServiceImpl extends AbstractBaseServiceImpl implements IExamUserCollectionQuestionService +{ + @Autowired + private ExamUserCollectionQuestionMapper examUserCollectionQuestionMapper; + + + /** + * 查询我的收藏列表 + * + * @param examUserCollectionQuestion 我的收藏信息 + * @return 我的收藏集合 + */ + @Override + public List selectExamUserCollectionQuestionList(ExamUserCollectionQuestion examUserCollectionQuestion) + { + return examUserCollectionQuestionMapper.selectExamUserCollectionQuestionList(examUserCollectionQuestion); + } + + @Override + public int insertSelectiveBySelf(ExamUserCollectionQuestion examUserCollectionQuestion) { + return examUserCollectionQuestionMapper.insertSelective(examUserCollectionQuestion); + } + + /** + * 查询我的收藏分页列表 + * + * @param examUserCollectionQuestion 我的收藏信息 + * @return 我的收藏集合 + */ + @Override + public List selectExamUserCollectionQuestionPage(ExamUserCollectionQuestion examUserCollectionQuestion) + { + startPage(); + return examUserCollectionQuestionMapper.selectExamUserCollectionQuestionList(examUserCollectionQuestion); + } + +} diff --git a/ruoyi-exam/src/main/resources/mapper/exam/ExamQuestionMapper.xml b/ruoyi-exam/src/main/resources/mapper/exam/ExamQuestionMapper.xml index 79a2724b1..724b26041 100644 --- a/ruoyi-exam/src/main/resources/mapper/exam/ExamQuestionMapper.xml +++ b/ruoyi-exam/src/main/resources/mapper/exam/ExamQuestionMapper.xml @@ -108,7 +108,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where epq.exam_practice_id = #{practiceId} order by epq.order_num - + + + select + + from exam_user_collection_question + + and id = #{id} + and vip_user_id = #{vipUserId} + and exam_question_id = #{examQuestionId} + and create_by = #{createBy} + and create_date = #{createDate} + and update_by = #{updateBy} + and update_date = #{updateDate} + and remarks = #{remarks} + and del_flag = #{delFlag} + + + + + \ No newline at end of file