20200601-zlp-1

完善评分评价
This commit is contained in:
paidaxing444
2020-06-01 15:05:20 +08:00
parent ca14b6f89e
commit aa7779ef6d
8 changed files with 264 additions and 66 deletions

View File

@ -1,6 +1,9 @@
package com.ruoyi.project.benyi.service.impl;
import java.util.Date;
import java.util.List;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@ -68,14 +71,35 @@ public class ByTrainVideoFeedbackController extends BaseController
return AjaxResult.success(byTrainVideoFeedbackService.selectByTrainVideoFeedbackById(id));
}
// /**
// * 获取培训视频评价反馈详细信息
// */
// @PreAuthorize("@ss.hasPermi('benyi:feedback:query')"+ "||@ss.hasPermi('benyi:video:query')")
// @GetMapping(value = "/video/{vid}")
// public AjaxResult getInfoByVideo(@PathVariable("vid") Long vid)
// {
//
// ByTrainVideoFeedback byTrainVideoFeedback=new ByTrainVideoFeedback();
// byTrainVideoFeedback.setCreateuserid(SecurityUtils.getLoginUser().getUser().getUserId());
// byTrainVideoFeedback.setVideoid(vid);
// List<ByTrainVideoFeedback> list=byTrainVideoFeedbackService.selectByTrainVideoFeedbackList(byTrainVideoFeedback);
// if(list!=null&&list.size()>0){
// return AjaxResult.success(list.get(0));
// }else{
// return AjaxResult.success(null);
// }
// }
/**
* 新增培训视频评价反馈
*/
@PreAuthorize("@ss.hasPermi('benyi:feedback:add')")
@PreAuthorize("@ss.hasPermi('benyi:feedback_score:add')")
@Log(title = "培训视频评价反馈", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ByTrainVideoFeedback byTrainVideoFeedback)
{
byTrainVideoFeedback.setCreateuserid(SecurityUtils.getLoginUser().getUser().getUserId());
byTrainVideoFeedback.setCreatetime(new Date());
return toAjax(byTrainVideoFeedbackService.insertByTrainVideoFeedback(byTrainVideoFeedback));
}

View File

@ -1,6 +1,11 @@
package com.ruoyi.project.benyi.controller;
import java.util.Date;
import java.util.List;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.project.benyi.domain.ByTrainVideoFeedback;
import com.ruoyi.project.benyi.service.IByTrainVideoFeedbackService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@ -22,24 +27,24 @@ import com.ruoyi.framework.web.page.TableDataInfo;
/**
* 培训视频评分Controller
*
*
* @author tsbz
* @date 2020-06-01
*/
@RestController
@RequestMapping("/benyi/score")
public class ByTrainVideoScoreController extends BaseController
{
public class ByTrainVideoScoreController extends BaseController {
@Autowired
private IByTrainVideoScoreService byTrainVideoScoreService;
@Autowired
private IByTrainVideoFeedbackService byTrainVideoFeedbackService;
/**
* 查询培训视频评分列表
*/
@PreAuthorize("@ss.hasPermi('benyi:score:list')")
@GetMapping("/list")
public TableDataInfo list(ByTrainVideoScore byTrainVideoScore)
{
public TableDataInfo list(ByTrainVideoScore byTrainVideoScore) {
startPage();
List<ByTrainVideoScore> list = byTrainVideoScoreService.selectByTrainVideoScoreList(byTrainVideoScore);
return getDataTable(list);
@ -51,8 +56,7 @@ public class ByTrainVideoScoreController extends BaseController
@PreAuthorize("@ss.hasPermi('benyi:score:export')")
@Log(title = "培训视频评分", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(ByTrainVideoScore byTrainVideoScore)
{
public AjaxResult export(ByTrainVideoScore byTrainVideoScore) {
List<ByTrainVideoScore> list = byTrainVideoScoreService.selectByTrainVideoScoreList(byTrainVideoScore);
ExcelUtil<ByTrainVideoScore> util = new ExcelUtil<ByTrainVideoScore>(ByTrainVideoScore.class);
return util.exportExcel(list, "score");
@ -63,19 +67,48 @@ public class ByTrainVideoScoreController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('benyi:score:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(byTrainVideoScoreService.selectByTrainVideoScoreById(id));
}
/**
* 获取培训视频评分详细信息
*/
@PreAuthorize("@ss.hasPermi('benyi:score:query')" + "||@ss.hasPermi('benyi:video:query')")
@GetMapping(value = "/video/{vid}")
public AjaxResult ByVideo(@PathVariable("vid") Long vid) {
AjaxResult ajax = AjaxResult.success();
ByTrainVideoScore byTrainVideoScore = new ByTrainVideoScore();
byTrainVideoScore.setCreateuserid(SecurityUtils.getLoginUser().getUser().getUserId());
byTrainVideoScore.setVideoid(vid);
List<ByTrainVideoScore> list = byTrainVideoScoreService.selectByTrainVideoScoreList(byTrainVideoScore);
if (list != null && list.size() > 0) {
ajax.put("score", list.get(0).getScore());
} else {
return AjaxResult.success(null);
}
ByTrainVideoFeedback byTrainVideoFeedback = new ByTrainVideoFeedback();
byTrainVideoFeedback.setCreateuserid(SecurityUtils.getLoginUser().getUser().getUserId());
byTrainVideoFeedback.setVideoid(vid);
List<ByTrainVideoFeedback> list2 = byTrainVideoFeedbackService.selectByTrainVideoFeedbackList(byTrainVideoFeedback);
if (list2 != null && list2.size() > 0) {
ajax.put("content", list2.get(0).getContent());
} else {
return AjaxResult.success(null);
}
return ajax;
}
/**
* 新增培训视频评分
*/
@PreAuthorize("@ss.hasPermi('benyi:score:add')")
@PreAuthorize("@ss.hasPermi('benyi:feedback_score:add')")
@Log(title = "培训视频评分", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ByTrainVideoScore byTrainVideoScore)
{
public AjaxResult add(@RequestBody ByTrainVideoScore byTrainVideoScore) {
byTrainVideoScore.setCreateuserid(SecurityUtils.getLoginUser().getUser().getUserId());
byTrainVideoScore.setCreatetime(new Date());
return toAjax(byTrainVideoScoreService.insertByTrainVideoScore(byTrainVideoScore));
}
@ -85,8 +118,7 @@ public class ByTrainVideoScoreController extends BaseController
@PreAuthorize("@ss.hasPermi('benyi:score:edit')")
@Log(title = "培训视频评分", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ByTrainVideoScore byTrainVideoScore)
{
public AjaxResult edit(@RequestBody ByTrainVideoScore byTrainVideoScore) {
return toAjax(byTrainVideoScoreService.updateByTrainVideoScore(byTrainVideoScore));
}
@ -95,9 +127,8 @@ public class ByTrainVideoScoreController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('benyi:score:remove')")
@Log(title = "培训视频评分", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(byTrainVideoScoreService.deleteByTrainVideoScoreByIds(ids));
}
}

View File

@ -10,26 +10,39 @@ import java.util.Date;
/**
* 培训视频评价反馈对象 by_train_video_feedback
*
*
* @author tsbz
* @date 2020-06-01
*/
public class ByTrainVideoFeedback extends BaseEntity
{
public class ByTrainVideoFeedback extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 编号 */
/**
* 编号
*/
private Long id;
/** 视频id */
/**
* 视频id
*/
@Excel(name = "视频id")
private Long videoid;
/** 反馈意见建议 */
/**
* 讲师id
*/
@Excel(name = "讲师id")
private Long lecturerid;
/**
* 反馈意见建议
*/
@Excel(name = "反馈意见建议")
private String content;
/** 创建人 */
/**
* 创建人
*/
@Excel(name = "创建人")
private Long createuserid;
@ -40,42 +53,46 @@ public class ByTrainVideoFeedback extends BaseEntity
private Date createtime;
public void setId(Long id)
{
public void setId(Long id) {
this.id = id;
}
public Long getId()
{
public Long getId() {
return id;
}
public void setVideoid(Long videoid)
{
public void setVideoid(Long videoid) {
this.videoid = videoid;
}
public Long getVideoid()
{
public Long getVideoid() {
return videoid;
}
public void setContent(String content)
{
public void setLecturerid(Long lecturerid) {
this.lecturerid = lecturerid;
}
public Long getLecturerid() {
return lecturerid;
}
public void setContent(String content) {
this.content = content;
}
public String getContent()
{
public String getContent() {
return content;
}
public void setCreateuserid(Long createuserid)
{
public void setCreateuserid(Long createuserid) {
this.createuserid = createuserid;
}
public Long getCreateuserid()
{
public Long getCreateuserid() {
return createuserid;
}
public void setCreatetime(Date createtime) {
this.createtime = createtime;
}
@ -86,12 +103,13 @@ public class ByTrainVideoFeedback extends BaseEntity
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("videoid", getVideoid())
.append("content", getContent())
.append("createuserid", getCreateuserid())
.append("createtime", getCreatetime())
.toString();
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("videoid", getVideoid())
.append("lecturerid", getLecturerid())
.append("content", getContent())
.append("createuserid", getCreateuserid())
.append("createtime", getCreatetime())
.toString();
}
}

View File

@ -7,19 +7,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="ByTrainVideoFeedback" id="ByTrainVideoFeedbackResult">
<result property="id" column="id" />
<result property="videoid" column="videoid" />
<result property="lecturerid" column="lecturerid" />
<result property="content" column="content" />
<result property="createuserid" column="createuserid" />
<result property="createtime" column="createtime" />
</resultMap>
<sql id="selectByTrainVideoFeedbackVo">
select id, videoid, content, createuserid, createtime from by_train_video_feedback
select id, videoid, lecturerid, content, createuserid, createtime from by_train_video_feedback
</sql>
<select id="selectByTrainVideoFeedbackList" parameterType="ByTrainVideoFeedback" resultMap="ByTrainVideoFeedbackResult">
<include refid="selectByTrainVideoFeedbackVo"/>
<where>
<if test="videoid != null "> and videoid = #{videoid}</if>
<if test="lecturerid != null "> and lecturerid = #{lecturerid}</if>
<if test="content != null and content != ''"> and content = #{content}</if>
<if test="createuserid != null "> and createuserid = #{createuserid}</if>
<if test="createtime != null "> and createtime = #{createtime}</if>
@ -36,6 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null ">id,</if>
<if test="videoid != null ">videoid,</if>
<if test="lecturerid != null ">lecturerid,</if>
<if test="content != null and content != ''">content,</if>
<if test="createuserid != null ">createuserid,</if>
<if test="createtime != null ">createtime,</if>
@ -43,6 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null ">#{id},</if>
<if test="videoid != null ">#{videoid},</if>
<if test="lecturerid != null ">#{lecturerid},</if>
<if test="content != null and content != ''">#{content},</if>
<if test="createuserid != null ">#{createuserid},</if>
<if test="createtime != null ">#{createtime},</if>
@ -53,6 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update by_train_video_feedback
<trim prefix="SET" suffixOverrides=",">
<if test="videoid != null ">videoid = #{videoid},</if>
<if test="lecturerid != null ">lecturerid = #{lecturerid},</if>
<if test="content != null and content != ''">content = #{content},</if>
<if test="createuserid != null ">createuserid = #{createuserid},</if>
<if test="createtime != null ">createtime = #{createtime},</if>