运维学堂-课程收藏模块
This commit is contained in:
parent
a292fb80fe
commit
7c961676b2
@ -0,0 +1,115 @@
|
||||
package com.inspur.web.controller.operations;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.inspur.operations.domain.CourseCollect;
|
||||
import com.inspur.operations.service.ICourseCollectService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.inspur.common.annotation.Log;
|
||||
import com.inspur.common.core.controller.BaseController;
|
||||
import com.inspur.common.core.domain.AjaxResult;
|
||||
import com.inspur.common.enums.BusinessType;
|
||||
import com.inspur.common.utils.poi.ExcelUtil;
|
||||
import com.inspur.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 课程收藏Controller
|
||||
*
|
||||
* @author inspur
|
||||
* @date 2024-04-28
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/operations/collect")
|
||||
public class CourseCollectController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ICourseCollectService courseCollectService;
|
||||
|
||||
/**
|
||||
* 查询课程收藏列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('operations:collect:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(CourseCollect courseCollect)
|
||||
{
|
||||
startPage();
|
||||
List<CourseCollect> list = courseCollectService.selectCourseCollectList(courseCollect);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出课程收藏列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('operations:collect:export')")
|
||||
@Log(title = "课程收藏", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, CourseCollect courseCollect)
|
||||
{
|
||||
List<CourseCollect> list = courseCollectService.selectCourseCollectList(courseCollect);
|
||||
ExcelUtil<CourseCollect> util = new ExcelUtil<CourseCollect>(CourseCollect.class);
|
||||
util.exportExcel(response, list, "课程收藏数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取课程收藏详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('operations:collect:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") String id)
|
||||
{
|
||||
return success(courseCollectService.selectCourseCollectById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增课程收藏
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('operations:collect:add')")
|
||||
@Log(title = "课程收藏", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody CourseCollect courseCollect)
|
||||
{
|
||||
return toAjax(courseCollectService.insertCourseCollect(courseCollect));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改课程收藏
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('operations:collect:edit')")
|
||||
@Log(title = "课程收藏", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody CourseCollect courseCollect)
|
||||
{
|
||||
return toAjax(courseCollectService.updateCourseCollect(courseCollect));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除课程收藏
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('operations:collect:remove')")
|
||||
@Log(title = "课程收藏", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable String[] ids)
|
||||
{
|
||||
return toAjax(courseCollectService.deleteCourseCollectByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 课程收藏/取消收藏
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('operations:collect:star')")
|
||||
@Log(title = "课程收藏/取消收藏", businessType = BusinessType.OTHER)
|
||||
@PostMapping("/star")
|
||||
public AjaxResult star(@RequestBody CourseCollect courseCollect){
|
||||
return courseCollectService.star(courseCollect);
|
||||
}
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
package com.inspur.operations.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.inspur.common.annotation.Excel;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* 课程收藏对象 course_collect
|
||||
*
|
||||
* @author inspur
|
||||
* @date 2024-04-28
|
||||
*/
|
||||
@Data
|
||||
public class CourseCollect {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 课程id
|
||||
*/
|
||||
private String courseId;
|
||||
|
||||
/**
|
||||
* 课程名称
|
||||
*/
|
||||
@Excel(name = "课程名称")
|
||||
private String courseName;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 用户名称
|
||||
*/
|
||||
@Excel(name = "用户名称")
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 收藏时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "上传时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date collectTime;
|
||||
|
||||
/**
|
||||
* 课程类型:0 在线课程,1 视频课程,2 培训资料
|
||||
*/
|
||||
private String courseType;
|
||||
|
||||
/**
|
||||
* 课程类型:0 在线课程,1 视频课程,2 培训资料
|
||||
*/
|
||||
@Excel(name = "课程类型")
|
||||
private String courseTypeName;
|
||||
|
||||
/**
|
||||
* 0:收藏,1:取消收藏
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 课程ids
|
||||
*/
|
||||
private List<String> courseIds;
|
||||
}
|
@ -66,4 +66,6 @@ public class CourseDocumentInfo extends BaseEntity {
|
||||
*/
|
||||
@Excel(name = "状态",dictType = "sys_normal_disable")
|
||||
private String status;
|
||||
|
||||
private String starId;
|
||||
}
|
||||
|
@ -82,4 +82,9 @@ public class CourseOnlineInfo extends BaseEntity {
|
||||
*/
|
||||
@Excel(name = "状态",dictType = "sys_normal_disable")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 收藏表id
|
||||
*/
|
||||
private String starId;
|
||||
}
|
||||
|
@ -74,4 +74,6 @@ public class CourseVideoInfo extends BaseEntity {
|
||||
*/
|
||||
@Excel(name = "状态",dictType = "sys_normal_disable")
|
||||
private String status;
|
||||
|
||||
private String starId;
|
||||
}
|
||||
|
@ -0,0 +1,66 @@
|
||||
package com.inspur.operations.mapper;
|
||||
|
||||
import com.inspur.operations.domain.CourseCollect;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 课程收藏Mapper接口
|
||||
*
|
||||
* @author inspur
|
||||
* @date 2024-04-28
|
||||
*/
|
||||
public interface CourseCollectMapper
|
||||
{
|
||||
/**
|
||||
* 查询课程收藏
|
||||
*
|
||||
* @param id 课程收藏主键
|
||||
* @return 课程收藏
|
||||
*/
|
||||
public CourseCollect selectCourseCollectById(String id);
|
||||
|
||||
/**
|
||||
* 查询课程收藏列表
|
||||
*
|
||||
* @param courseCollect 课程收藏
|
||||
* @return 课程收藏集合
|
||||
*/
|
||||
public List<CourseCollect> selectCourseCollectList(CourseCollect courseCollect);
|
||||
|
||||
/**
|
||||
* 新增课程收藏
|
||||
*
|
||||
* @param courseCollect 课程收藏
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertCourseCollect(CourseCollect courseCollect);
|
||||
|
||||
/**
|
||||
* 修改课程收藏
|
||||
*
|
||||
* @param courseCollect 课程收藏
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateCourseCollect(CourseCollect courseCollect);
|
||||
|
||||
/**
|
||||
* 删除课程收藏
|
||||
*
|
||||
* @param id 课程收藏主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCourseCollectById(String id);
|
||||
|
||||
/**
|
||||
* 批量删除课程收藏
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCourseCollectByIds(String[] ids);
|
||||
|
||||
|
||||
String checkIsExistStar(@Param("courseId") String courseId, @Param("userId") Long userId);
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
package com.inspur.operations.service;
|
||||
|
||||
import com.inspur.common.core.domain.AjaxResult;
|
||||
import com.inspur.operations.domain.CourseCollect;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 课程收藏Service接口
|
||||
*
|
||||
* @author inspur
|
||||
* @date 2024-04-28
|
||||
*/
|
||||
public interface ICourseCollectService
|
||||
{
|
||||
/**
|
||||
* 查询课程收藏
|
||||
*
|
||||
* @param id 课程收藏主键
|
||||
* @return 课程收藏
|
||||
*/
|
||||
CourseCollect selectCourseCollectById(String id);
|
||||
|
||||
/**
|
||||
* 查询课程收藏列表
|
||||
*
|
||||
* @param courseCollect 课程收藏
|
||||
* @return 课程收藏集合
|
||||
*/
|
||||
List<CourseCollect> selectCourseCollectList(CourseCollect courseCollect);
|
||||
|
||||
/**
|
||||
* 新增课程收藏
|
||||
*
|
||||
* @param courseCollect 课程收藏
|
||||
* @return 结果
|
||||
*/
|
||||
int insertCourseCollect(CourseCollect courseCollect);
|
||||
|
||||
/**
|
||||
* 修改课程收藏
|
||||
*
|
||||
* @param courseCollect 课程收藏
|
||||
* @return 结果
|
||||
*/
|
||||
int updateCourseCollect(CourseCollect courseCollect);
|
||||
|
||||
/**
|
||||
* 批量删除课程收藏
|
||||
*
|
||||
* @param ids 需要删除的课程收藏主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteCourseCollectByIds(String[] ids);
|
||||
|
||||
/**
|
||||
* 删除课程收藏信息
|
||||
*
|
||||
* @param id 课程收藏主键
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteCourseCollectById(String id);
|
||||
|
||||
/**
|
||||
* 判断是否存在
|
||||
*
|
||||
* @Author xusd
|
||||
* @Date 9:16 2024/4/29
|
||||
* @param courseId 课程id
|
||||
* @return String 课程收藏表id
|
||||
*/
|
||||
String checkIsExistStar(String courseId);
|
||||
|
||||
/**
|
||||
* 课程收藏/取消收藏
|
||||
*/
|
||||
AjaxResult star(CourseCollect courseCollect);
|
||||
}
|
@ -0,0 +1,138 @@
|
||||
package com.inspur.operations.service.impl;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.inspur.common.core.domain.AjaxResult;
|
||||
import com.inspur.common.utils.SecurityUtils;
|
||||
import com.inspur.common.utils.StringUtils;
|
||||
import com.inspur.common.utils.uuid.IdUtils;
|
||||
import com.inspur.operations.domain.CourseCollect;
|
||||
import com.inspur.operations.mapper.CourseCollectMapper;
|
||||
import com.inspur.operations.service.ICourseCollectService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 课程收藏Service业务层处理
|
||||
*
|
||||
* @author inspur
|
||||
* @date 2024-04-28
|
||||
*/
|
||||
@Service
|
||||
public class CourseCollectServiceImpl implements ICourseCollectService {
|
||||
@Autowired
|
||||
private CourseCollectMapper courseCollectMapper;
|
||||
|
||||
/**
|
||||
* 查询课程收藏
|
||||
*
|
||||
* @param id 课程收藏主键
|
||||
* @return 课程收藏
|
||||
*/
|
||||
@Override
|
||||
public CourseCollect selectCourseCollectById(String id) {
|
||||
return courseCollectMapper.selectCourseCollectById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询课程收藏列表
|
||||
*
|
||||
* @param courseCollect 课程收藏
|
||||
* @return 课程收藏
|
||||
*/
|
||||
@Override
|
||||
public List<CourseCollect> selectCourseCollectList(CourseCollect courseCollect) {
|
||||
courseCollect.setUserId(SecurityUtils.getUserId());
|
||||
return courseCollectMapper.selectCourseCollectList(courseCollect);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增课程收藏
|
||||
*
|
||||
* @param courseCollect 课程收藏
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertCourseCollect(CourseCollect courseCollect) {
|
||||
courseCollect.setId(IdUtils.fastSimpleUUID());
|
||||
courseCollect.setUserId(SecurityUtils.getUserId());
|
||||
courseCollect.setCollectTime(new Date());
|
||||
return courseCollectMapper.insertCourseCollect(courseCollect);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改课程收藏
|
||||
*
|
||||
* @param courseCollect 课程收藏
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateCourseCollect(CourseCollect courseCollect) {
|
||||
return courseCollectMapper.updateCourseCollect(courseCollect);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除课程收藏
|
||||
*
|
||||
* @param ids 需要删除的课程收藏主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteCourseCollectByIds(String[] ids) {
|
||||
return courseCollectMapper.deleteCourseCollectByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除课程收藏信息
|
||||
*
|
||||
* @param id 课程收藏主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteCourseCollectById(String id) {
|
||||
return courseCollectMapper.deleteCourseCollectById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否存在
|
||||
*
|
||||
* @param courseId 课程id
|
||||
* @return int
|
||||
* @Author xusd
|
||||
* @Date 9:16 2024/4/29
|
||||
*/
|
||||
@Override
|
||||
public String checkIsExistStar(String courseId) {
|
||||
return courseCollectMapper.checkIsExistStar(courseId, SecurityUtils.getUserId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 课程收藏/取消收藏
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult star(CourseCollect courseCollect) {
|
||||
if (!"0".equals(courseCollect.getType()) && !"1".equals(courseCollect.getType())) {
|
||||
return AjaxResult.error("参数异常");
|
||||
} else {
|
||||
String id = checkIsExistStar(courseCollect.getCourseId());
|
||||
//收藏
|
||||
if ("0".equals(courseCollect.getType())) {
|
||||
if (StringUtils.isNotEmpty(id)){
|
||||
return AjaxResult.error("课程已收藏,请勿重复收藏");
|
||||
}else {
|
||||
this.insertCourseCollect(courseCollect);
|
||||
return AjaxResult.success("收藏成功");
|
||||
}
|
||||
} else {
|
||||
if (StringUtils.isNotEmpty(id)){
|
||||
this.deleteCourseCollectById(id);
|
||||
return AjaxResult.success("取消收藏成功");
|
||||
}else {
|
||||
return AjaxResult.error("课程未收藏,请勿先收藏");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -2,14 +2,20 @@ package com.inspur.operations.service.impl;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.inspur.common.utils.DateUtils;
|
||||
import com.inspur.common.utils.SecurityUtils;
|
||||
import com.inspur.common.utils.StringUtils;
|
||||
import com.inspur.common.utils.file.FileTypeUtils;
|
||||
import com.inspur.common.utils.uuid.IdUtils;
|
||||
import com.inspur.operations.domain.CourseCollect;
|
||||
import com.inspur.operations.domain.CourseDocumentInfo;
|
||||
import com.inspur.operations.domain.CourseVideoInfo;
|
||||
import com.inspur.operations.mapper.CourseDocumentInfoMapper;
|
||||
import com.inspur.operations.service.ICourseCollectService;
|
||||
import com.inspur.operations.service.ICourseDocumentInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -26,6 +32,9 @@ public class CourseDocumentInfoServiceImpl implements ICourseDocumentInfoService
|
||||
@Autowired
|
||||
private CourseDocumentInfoMapper courseDocumentInfoMapper;
|
||||
|
||||
@Autowired
|
||||
private ICourseCollectService courseCollectService;
|
||||
|
||||
/**
|
||||
* 查询课程培训资料
|
||||
*
|
||||
@ -47,7 +56,17 @@ public class CourseDocumentInfoServiceImpl implements ICourseDocumentInfoService
|
||||
@Override
|
||||
public List<CourseDocumentInfo> selectCourseDocumentInfoList(CourseDocumentInfo courseDocumentInfo)
|
||||
{
|
||||
return courseDocumentInfoMapper.selectCourseDocumentInfoList(courseDocumentInfo);
|
||||
List<CourseDocumentInfo> list = courseDocumentInfoMapper.selectCourseDocumentInfoList(courseDocumentInfo);
|
||||
//设置starId前端判断显示收藏按钮使用
|
||||
if (StringUtils.isNotEmpty(list)){
|
||||
List<String> courseIds = list.stream().map(CourseDocumentInfo::getDocId).collect(Collectors.toList());
|
||||
CourseCollect courseCollect = new CourseCollect();
|
||||
courseCollect.setCourseIds(courseIds);
|
||||
List<CourseCollect> courseCollectList = courseCollectService.selectCourseCollectList(courseCollect);
|
||||
Map<String, String> courseCollectMap = courseCollectList.stream().collect(Collectors.toMap(CourseCollect::getCourseId, CourseCollect::getId));
|
||||
list.forEach(item-> item.setStarId(courseCollectMap.get(item.getDocId())));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,11 +1,17 @@
|
||||
package com.inspur.operations.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.inspur.common.utils.DateUtils;
|
||||
import com.inspur.common.utils.SecurityUtils;
|
||||
import com.inspur.common.utils.StringUtils;
|
||||
import com.inspur.common.utils.uuid.IdUtils;
|
||||
import com.inspur.operations.domain.CourseCollect;
|
||||
import com.inspur.operations.domain.CourseOnlineInfo;
|
||||
import com.inspur.operations.mapper.CourseOnlineInfoMapper;
|
||||
import com.inspur.operations.service.ICourseCollectService;
|
||||
import com.inspur.operations.service.ICourseOnlineInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -22,6 +28,9 @@ public class CourseOnlineInfoServiceImpl implements ICourseOnlineInfoService
|
||||
@Autowired
|
||||
private CourseOnlineInfoMapper courseOnlineInfoMapper;
|
||||
|
||||
@Autowired
|
||||
private ICourseCollectService courseCollectService;
|
||||
|
||||
/**
|
||||
* 查询在线课程信息
|
||||
*
|
||||
@ -43,7 +52,17 @@ public class CourseOnlineInfoServiceImpl implements ICourseOnlineInfoService
|
||||
@Override
|
||||
public List<CourseOnlineInfo> selectCourseOnlineInfoList(CourseOnlineInfo courseOnlineInfo)
|
||||
{
|
||||
return courseOnlineInfoMapper.selectCourseOnlineInfoList(courseOnlineInfo);
|
||||
List<CourseOnlineInfo> list = courseOnlineInfoMapper.selectCourseOnlineInfoList(courseOnlineInfo);
|
||||
//设置starId前端判断显示收藏按钮使用
|
||||
if (StringUtils.isNotEmpty(list)){
|
||||
List<String> classIds = list.stream().map(CourseOnlineInfo::getClassId).collect(Collectors.toList());
|
||||
CourseCollect courseCollect = new CourseCollect();
|
||||
courseCollect.setCourseIds(classIds);
|
||||
List<CourseCollect> courseCollectList = courseCollectService.selectCourseCollectList(courseCollect);
|
||||
Map<String, String> courseCollectMap = courseCollectList.stream().collect(Collectors.toMap(CourseCollect::getCourseId, CourseCollect::getId));
|
||||
list.forEach(item-> item.setStarId(courseCollectMap.get(item.getClassId())));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,11 +1,18 @@
|
||||
package com.inspur.operations.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.inspur.common.utils.DateUtils;
|
||||
import com.inspur.common.utils.SecurityUtils;
|
||||
import com.inspur.common.utils.StringUtils;
|
||||
import com.inspur.common.utils.uuid.IdUtils;
|
||||
import com.inspur.operations.domain.CourseCollect;
|
||||
import com.inspur.operations.domain.CourseOnlineInfo;
|
||||
import com.inspur.operations.domain.CourseVideoInfo;
|
||||
import com.inspur.operations.mapper.CourseVideoInfoMapper;
|
||||
import com.inspur.operations.service.ICourseCollectService;
|
||||
import com.inspur.operations.service.ICourseVideoInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -22,6 +29,9 @@ public class CourseVideoInfoServiceImpl implements ICourseVideoInfoService
|
||||
@Autowired
|
||||
private CourseVideoInfoMapper courseVideoInfoMapper;
|
||||
|
||||
@Autowired
|
||||
private ICourseCollectService courseCollectService;
|
||||
|
||||
/**
|
||||
* 查询视频课程信息
|
||||
*
|
||||
@ -43,7 +53,17 @@ public class CourseVideoInfoServiceImpl implements ICourseVideoInfoService
|
||||
@Override
|
||||
public List<CourseVideoInfo> selectCourseVideoInfoList(CourseVideoInfo courseVideoInfo)
|
||||
{
|
||||
return courseVideoInfoMapper.selectCourseVideoInfoList(courseVideoInfo);
|
||||
List<CourseVideoInfo> list = courseVideoInfoMapper.selectCourseVideoInfoList(courseVideoInfo);
|
||||
//设置starId前端判断显示收藏按钮使用
|
||||
if (StringUtils.isNotEmpty(list)){
|
||||
List<String> courseIds = list.stream().map(CourseVideoInfo::getCourseId).collect(Collectors.toList());
|
||||
CourseCollect courseCollect = new CourseCollect();
|
||||
courseCollect.setCourseIds(courseIds);
|
||||
List<CourseCollect> courseCollectList = courseCollectService.selectCourseCollectList(courseCollect);
|
||||
Map<String, String> courseCollectMap = courseCollectList.stream().collect(Collectors.toMap(CourseCollect::getCourseId, CourseCollect::getId));
|
||||
list.forEach(item-> item.setStarId(courseCollectMap.get(item.getCourseId())));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -0,0 +1,141 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.inspur.operations.mapper.CourseCollectMapper">
|
||||
|
||||
<resultMap type="com.inspur.operations.domain.CourseCollect" id="CourseCollectResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="courseId" column="course_id" />
|
||||
<result property="userId" column="user_id" />
|
||||
<result property="collectTime" column="collect_time" />
|
||||
<result property="courseType" column="course_type" />
|
||||
<result property="courseName" column="class_name" />
|
||||
<result property="userName" column="nick_name" />
|
||||
<result property="courseTypeName" column="course_type_name" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectCourseCollectVo">
|
||||
SELECT
|
||||
a.id,
|
||||
a.course_id,
|
||||
a.user_id,
|
||||
a.course_type,
|
||||
a.collect_time,
|
||||
a.class_name,
|
||||
su.nick_name,
|
||||
CASE
|
||||
WHEN a.course_type = '0' THEN
|
||||
'在线课程'
|
||||
WHEN a.course_type = '1' THEN
|
||||
'视频课程'
|
||||
WHEN a.course_type = '2' THEN
|
||||
'培训资料' ELSE ''
|
||||
END AS course_type_name
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
cc.id,
|
||||
cc.course_id,
|
||||
cc.user_id,
|
||||
cc.course_type,
|
||||
cc.collect_time,
|
||||
coi.class_name
|
||||
FROM
|
||||
course_collect AS cc
|
||||
JOIN course_online_info AS coi ON cc.course_id = coi.class_id and cc.course_type = '0' UNION ALL
|
||||
SELECT
|
||||
cc.id,
|
||||
cc.course_id,
|
||||
cc.user_id,
|
||||
cc.course_type,
|
||||
cc.collect_time,
|
||||
cvi.course_name
|
||||
FROM
|
||||
course_collect AS cc
|
||||
JOIN course_video_info AS cvi ON cc.course_id = cvi.course_id and cc.course_type = '1' UNION ALL
|
||||
SELECT
|
||||
cc.id,
|
||||
cc.course_id,
|
||||
cc.user_id,
|
||||
cc.course_type,
|
||||
cc.collect_time,
|
||||
cdi.doc_name
|
||||
FROM
|
||||
course_collect AS cc
|
||||
JOIN course_document_info AS cdi ON cc.course_id = cdi.doc_id and cc.course_type = '2'
|
||||
) AS a
|
||||
LEFT JOIN sys_user AS su ON a.user_id = su.user_id
|
||||
</sql>
|
||||
|
||||
<select id="selectCourseCollectList" parameterType="com.inspur.operations.domain.CourseCollect" resultMap="CourseCollectResult">
|
||||
<include refid="selectCourseCollectVo"/>
|
||||
<where>
|
||||
<if test="courseType != null and courseType != ''"> and a.course_type = #{courseType}</if>
|
||||
<if test="userId != null"> and a.user_id = #{userId}</if>
|
||||
<if test="courseIds != null and courseIds.size() > 0">
|
||||
and a.course_id in
|
||||
<foreach collection="courseIds" open="(" close=")" separator="," item="courseId" index="index">
|
||||
#{courseId}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
order by a.collect_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectCourseCollectById" parameterType="String" resultMap="CourseCollectResult">
|
||||
<include refid="selectCourseCollectVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="checkIsExistStar" resultType="java.lang.String">
|
||||
SELECT
|
||||
id
|
||||
FROM
|
||||
course_collect
|
||||
WHERE
|
||||
course_id = #{courseId}
|
||||
AND user_id = #{userId}
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<insert id="insertCourseCollect" parameterType="com.inspur.operations.domain.CourseCollect">
|
||||
insert into course_collect
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="courseId != null">course_id,</if>
|
||||
<if test="userId != null">user_id,</if>
|
||||
<if test="collectTime != null">collect_time,</if>
|
||||
<if test="courseType != null">course_type,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="courseId != null">#{courseId},</if>
|
||||
<if test="userId != null">#{userId},</if>
|
||||
<if test="collectTime != null">#{collectTime},</if>
|
||||
<if test="courseType != null">#{courseType},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateCourseCollect" parameterType="com.inspur.operations.domain.CourseCollect">
|
||||
update course_collect
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="courseId != null">course_id = #{courseId},</if>
|
||||
<if test="userId != null">user_id = #{userId},</if>
|
||||
<if test="collectTime != null">collect_time = #{collectTime},</if>
|
||||
<if test="courseType != null">course_type = #{courseType},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteCourseCollectById" parameterType="String">
|
||||
delete from course_collect where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteCourseCollectByIds" parameterType="String">
|
||||
delete from course_collect where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
53
inspur-ui/src/api/operations/collect.js
Normal file
53
inspur-ui/src/api/operations/collect.js
Normal file
@ -0,0 +1,53 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询课程收藏列表
|
||||
export function listCollect(query) {
|
||||
return request({
|
||||
url: '/operations/collect/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询课程收藏详细
|
||||
export function getCollect(id) {
|
||||
return request({
|
||||
url: '/operations/collect/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增课程收藏
|
||||
export function addCollect(data) {
|
||||
return request({
|
||||
url: '/operations/collect',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改课程收藏
|
||||
export function updateCollect(data) {
|
||||
return request({
|
||||
url: '/operations/collect',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除课程收藏
|
||||
export function delCollect(id) {
|
||||
return request({
|
||||
url: '/operations/collect/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 收藏/取消收藏
|
||||
export function star(data) {
|
||||
return request({
|
||||
url: '/operations/collect/star',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
273
inspur-ui/src/views/operations/collect/index.vue
Normal file
273
inspur-ui/src/views/operations/collect/index.vue
Normal file
@ -0,0 +1,273 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="课程类型" prop="courseType">
|
||||
<el-select v-model="queryParams.courseType" placeholder="请选择课程类型" clearable>
|
||||
<el-option
|
||||
v-for="dict in courseTypeList"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<!-- <el-col :span="1.5">-->
|
||||
<!-- <el-button-->
|
||||
<!-- type="primary"-->
|
||||
<!-- plain-->
|
||||
<!-- icon="el-icon-plus"-->
|
||||
<!-- size="mini"-->
|
||||
<!-- @click="handleAdd"-->
|
||||
<!-- v-hasPermi="['operations:collect:add']"-->
|
||||
<!-- >新增</el-button>-->
|
||||
<!-- </el-col>-->
|
||||
<!-- <el-col :span="1.5">-->
|
||||
<!-- <el-button-->
|
||||
<!-- type="success"-->
|
||||
<!-- plain-->
|
||||
<!-- icon="el-icon-edit"-->
|
||||
<!-- size="mini"-->
|
||||
<!-- :disabled="single"-->
|
||||
<!-- @click="handleUpdate"-->
|
||||
<!-- v-hasPermi="['operations:collect:edit']"-->
|
||||
<!-- >修改</el-button>-->
|
||||
<!-- </el-col>-->
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-star-on"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['operations:collect:remove']"
|
||||
>取消收藏</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['operations:collect:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="collectList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="课程名称" align="center" prop="courseName" />
|
||||
<el-table-column label="用户名称" align="center" prop="userName" />
|
||||
<el-table-column label="收藏时间" align="center" prop="collectTime" width="180"/>
|
||||
<el-table-column label="课程类型" align="center" prop="courseTypeName" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<!-- <el-button-->
|
||||
<!-- size="mini"-->
|
||||
<!-- type="text"-->
|
||||
<!-- icon="el-icon-edit"-->
|
||||
<!-- @click="handleUpdate(scope.row)"-->
|
||||
<!-- v-hasPermi="['operations:collect:edit']"-->
|
||||
<!-- >修改</el-button>-->
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-star-on"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['operations:collect:remove']"
|
||||
>取消收藏</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改课程收藏对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="收藏时间" prop="collectTime">
|
||||
<el-date-picker clearable
|
||||
v-model="form.collectTime"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择收藏时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listCollect, getCollect, delCollect, addCollect, updateCollect } from "@/api/operations/collect";
|
||||
|
||||
export default {
|
||||
name: "Collect",
|
||||
data() {
|
||||
return {
|
||||
courseTypeList:[
|
||||
{
|
||||
label:"在线课程",
|
||||
value:"0"
|
||||
},
|
||||
{
|
||||
label:"视频课程",
|
||||
value:"1"
|
||||
},
|
||||
{
|
||||
label:"培训资料",
|
||||
value:"2"
|
||||
}
|
||||
],
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 课程收藏表格数据
|
||||
collectList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
courseId: null,
|
||||
collectTime: null,
|
||||
courseType: null
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询课程收藏列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listCollect(this.queryParams).then(response => {
|
||||
this.collectList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
courseId: null,
|
||||
userId: null,
|
||||
collectTime: null,
|
||||
courseType: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加课程收藏";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id || this.ids
|
||||
getCollect(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改课程收藏";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
updateCollect(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addCollect(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 取消收藏按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$modal.confirm('是否确认取消收藏课程收藏编号为"' + ids + '"的数据项?').then(function() {
|
||||
return delCollect(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("取消收藏成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('operations/collect/export', {
|
||||
...this.queryParams
|
||||
}, `collect_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
@ -125,6 +125,20 @@
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['operations:courseOnline:remove']"
|
||||
>删除</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-star-off"
|
||||
@click="handleStar(scope.row)"
|
||||
v-if="scope.row.status === '0' && scope.row.starId == null"
|
||||
>收藏</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-star-on"
|
||||
@click="handleUnStar(scope.row)"
|
||||
v-if="scope.row.status === '0' && scope.row.starId != null"
|
||||
>已收藏</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="primary"
|
||||
@ -208,6 +222,7 @@
|
||||
|
||||
<script>
|
||||
import { listCourseOnline, getCourseOnline, delCourseOnline, addCourseOnline, updateCourseOnline,changeStatus } from "@/api/operations/courseOnline";
|
||||
import { star } from "@/api/operations/collect";
|
||||
|
||||
export default {
|
||||
name: "CourseOnline",
|
||||
@ -266,6 +281,34 @@ export default {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
//取消收藏
|
||||
handleUnStar(row){
|
||||
this.loading = true;
|
||||
const data = {
|
||||
courseId : row.classId,
|
||||
courseType : "0",
|
||||
type : "1"
|
||||
}
|
||||
star(data).then((res)=>{
|
||||
this.$modal.msgSuccess(res.msg);
|
||||
this.getList()
|
||||
this.loading = false;
|
||||
})
|
||||
},
|
||||
//收藏
|
||||
handleStar(row){
|
||||
this.loading = true;
|
||||
const data = {
|
||||
courseId : row.classId,
|
||||
courseType : "0",
|
||||
type : "0"
|
||||
}
|
||||
star(data).then((res)=>{
|
||||
this.$modal.msgSuccess(res.msg);
|
||||
this.getList()
|
||||
this.loading = false;
|
||||
})
|
||||
},
|
||||
handleStart(row){
|
||||
this.loading = true;
|
||||
const form = {
|
||||
|
@ -112,6 +112,20 @@
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['operations:courseVideo:remove']"
|
||||
>删除</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-star-off"
|
||||
@click="handleStar(scope.row)"
|
||||
v-if="scope.row.status === '0' && scope.row.starId == null"
|
||||
>收藏</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-star-on"
|
||||
@click="handleUnStar(scope.row)"
|
||||
v-if="scope.row.status === '0' && scope.row.starId != null"
|
||||
>已收藏</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="primary"
|
||||
@ -192,6 +206,7 @@
|
||||
|
||||
<script>
|
||||
import { listCourseVideo, getCourseVideo, delCourseVideo, addCourseVideo, updateCourseVideo,changeStatus } from "@/api/operations/courseVideo";
|
||||
import { star } from "@/api/operations/collect";
|
||||
|
||||
export default {
|
||||
name: "CourseVideo",
|
||||
@ -250,6 +265,34 @@ export default {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
//取消收藏
|
||||
handleUnStar(row){
|
||||
this.loading = true;
|
||||
const data = {
|
||||
courseId : row.courseId,
|
||||
courseType : "1",
|
||||
type : "1"
|
||||
}
|
||||
star(data).then((res)=>{
|
||||
this.$modal.msgSuccess(res.msg);
|
||||
this.getList()
|
||||
this.loading = false;
|
||||
})
|
||||
},
|
||||
//收藏
|
||||
handleStar(row){
|
||||
this.loading = true;
|
||||
const data = {
|
||||
courseId : row.courseId,
|
||||
courseType : "1",
|
||||
type : "0"
|
||||
}
|
||||
star(data).then((res)=>{
|
||||
this.$modal.msgSuccess(res.msg);
|
||||
this.getList()
|
||||
this.loading = false;
|
||||
})
|
||||
},
|
||||
handleStart(row){
|
||||
this.loading = true;
|
||||
const form = {
|
||||
|
@ -114,6 +114,20 @@
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['operations:document:remove']"
|
||||
>删除</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-star-off"
|
||||
@click="handleStar(scope.row)"
|
||||
v-if="scope.row.status === '0' && scope.row.starId == null"
|
||||
>收藏</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-star-on"
|
||||
@click="handleUnStar(scope.row)"
|
||||
v-if="scope.row.status === '0' && scope.row.starId != null"
|
||||
>已收藏</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="primary"
|
||||
@ -292,6 +306,7 @@
|
||||
import { listDocument, getDocument, delDocument, addDocument, updateDocument,changeStatus } from "@/api/operations/document";
|
||||
import { getToken } from '@/utils/auth'
|
||||
import { downFileThree } from "@/api/sftp/sftp";
|
||||
import { star } from "@/api/operations/collect";
|
||||
|
||||
export default {
|
||||
name: "Document",
|
||||
@ -362,6 +377,34 @@ export default {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
//取消收藏
|
||||
handleUnStar(row){
|
||||
this.loading = true;
|
||||
const data = {
|
||||
courseId : row.docId,
|
||||
courseType : "2",
|
||||
type : "1"
|
||||
}
|
||||
star(data).then((res)=>{
|
||||
this.$modal.msgSuccess(res.msg);
|
||||
this.getList()
|
||||
this.loading = false;
|
||||
})
|
||||
},
|
||||
//收藏
|
||||
handleStar(row){
|
||||
this.loading = true;
|
||||
const data = {
|
||||
courseId : row.docId,
|
||||
courseType : "2",
|
||||
type : "0"
|
||||
}
|
||||
star(data).then((res)=>{
|
||||
this.$modal.msgSuccess(res.msg);
|
||||
this.getList()
|
||||
this.loading = false;
|
||||
})
|
||||
},
|
||||
handleStart(row){
|
||||
this.loading = true;
|
||||
const form = {
|
||||
|
Loading…
Reference in New Issue
Block a user