master
you hang 5 months ago committed by youhang
parent 9789bdbfde
commit 77c9f862cb
  1. 2
      src/main/java/com/teaching/backend/common/CommonConstant.java
  2. 2
      src/main/java/com/teaching/backend/common/CommonResult.java
  3. 7
      src/main/java/com/teaching/backend/common/ErrorCode.java
  4. 2
      src/main/java/com/teaching/backend/common/IErrorCode.java
  5. 6
      src/main/java/com/teaching/backend/common/PageRequest.java
  6. 2
      src/main/java/com/teaching/backend/common/ResultCode.java
  7. 2
      src/main/java/com/teaching/backend/component/RestAuthenticationEntryPoint.java
  8. 2
      src/main/java/com/teaching/backend/component/RestfulAccessDeniedHandler.java
  9. 11
      src/main/java/com/teaching/backend/controller/FavourInformation/FavourInformationController.java
  10. 132
      src/main/java/com/teaching/backend/controller/WordController2.java
  11. 1
      src/main/java/com/teaching/backend/controller/favour/SeCourseFavourController.java
  12. 2
      src/main/java/com/teaching/backend/controller/favour/SeKnowFavourController.java
  13. 4
      src/main/java/com/teaching/backend/controller/favour/SeResourceFavourController.java
  14. 51
      src/main/java/com/teaching/backend/controller/know/KnowController.java
  15. 43
      src/main/java/com/teaching/backend/controller/resource/ResourceController.java
  16. 18
      src/main/java/com/teaching/backend/controller/thumb/SeCourseThumbController.java
  17. 5
      src/main/java/com/teaching/backend/controller/thumb/SeKnowThumbController.java
  18. 5
      src/main/java/com/teaching/backend/controller/thumb/SeResourceThumbController.java
  19. 8
      src/main/java/com/teaching/backend/controller/umsAdmin/UmsAdminController.java
  20. 2
      src/main/java/com/teaching/backend/exception/ApiException.java
  21. 2
      src/main/java/com/teaching/backend/exception/Asserts.java
  22. 2
      src/main/java/com/teaching/backend/mapper/resource/CourseResourcesMapper.java
  23. 2
      src/main/java/com/teaching/backend/mapper/resource/ResourcesRelationshipMapper.java
  24. 6
      src/main/java/com/teaching/backend/model/dto/favour/courseFavour/CourseFavourQueryRequest.java
  25. 4
      src/main/java/com/teaching/backend/model/dto/favour/resourceFavour/ResourceFavourAddRequest.java
  26. 6
      src/main/java/com/teaching/backend/model/dto/thumb/knowthumb/KnowThumbAddRequest.java
  27. 8
      src/main/java/com/teaching/backend/model/dto/thumb/resourcethumb/ResourceThumbAddRequest.java
  28. 2
      src/main/java/com/teaching/backend/model/entity/favour/SeCourseFavour.java
  29. 7
      src/main/java/com/teaching/backend/model/entity/favour/SeKnowFavour.java
  30. 6
      src/main/java/com/teaching/backend/model/entity/favour/SeResourceFavour.java
  31. 2
      src/main/java/com/teaching/backend/model/entity/thumb/SeCourseThumb.java
  32. 8
      src/main/java/com/teaching/backend/model/entity/thumb/SeKnowThumb.java
  33. 8
      src/main/java/com/teaching/backend/model/entity/thumb/SeResourceThumb.java
  34. 3
      src/main/java/com/teaching/backend/service/favour/SeKnowFavourService.java
  35. 3
      src/main/java/com/teaching/backend/service/favour/SeResourceFavourService.java
  36. 6
      src/main/java/com/teaching/backend/service/impl/CourseResourcesServiceImpl.java
  37. 4
      src/main/java/com/teaching/backend/service/impl/ResourcesRelationshipServiceImpl.java
  38. 8
      src/main/java/com/teaching/backend/service/impl/favour/SeKnowFavourServiceImpl.java
  39. 32
      src/main/java/com/teaching/backend/service/impl/favour/SeResourceFavourServiceImpl.java
  40. 27
      src/main/java/com/teaching/backend/service/impl/thumb/SeCourseThumbServiceImpl.java
  41. 10
      src/main/java/com/teaching/backend/service/impl/thumb/SeKnowThumbServiceImpl.java
  42. 20
      src/main/java/com/teaching/backend/service/impl/thumb/SeResourceThumbServiceImpl.java
  43. 2
      src/main/java/com/teaching/backend/service/resource/CourseResourcesService.java
  44. 2
      src/main/java/com/teaching/backend/service/resource/ResourcesRelationshipService.java
  45. 8
      src/main/java/com/teaching/backend/service/thumb/SeCourseThumbService.java
  46. 6
      src/main/java/com/teaching/backend/service/thumb/SeKnowThumbService.java
  47. 3
      src/main/java/com/teaching/backend/service/thumb/SeResourceThumbService.java
  48. 89
      src/main/java/com/teaching/backend/utils/ParamOutAspect.java
  49. 71
      src/main/java/com/teaching/backend/utils/WordUtil.java
  50. 0
      src/main/java/com/teaching/backend/utils/textceshi.java
  51. 5
      src/main/resources/application.properties
  52. 43
      src/main/resources/application.yml
  53. 76
      src/main/resources/static/hello.html
  54. 56
      src/main/resources/static/hello2.html
  55. 0
      src/main/resources/static/hello3.html
  56. 3
      src/main/resources/static/plugins/axios/axios.min.js
  57. 0
      src/main/resources/static/plugins/element-ui/fonts/element-icons.ttf
  58. 0
      src/main/resources/static/plugins/element-ui/fonts/element-icons.woff
  59. 1
      src/main/resources/static/plugins/element-ui/index.css
  60. 1
      src/main/resources/static/plugins/element-ui/index.js
  61. 11965
      src/main/resources/static/plugins/vue/vue.js
  62. BIN
      src/main/resources/word_template/ceshi.docx
  63. BIN
      src/main/resources/word_template/ceshi2.docx
  64. BIN
      src/main/resources/word_template/ceshi3.docx

@ -1,4 +1,4 @@
package com.teaching.backend.api;
package com.teaching.backend.common;
public interface CommonConstant {

@ -1,4 +1,4 @@
package com.teaching.backend.api;
package com.teaching.backend.common;
/**
* @auther macrozheng

@ -28,6 +28,13 @@ public enum ErrorCode {
FORBIDDEN_ERROR(40300, "禁止访问"),
PARAMS_ILLEGAL(42000, "请求参数违法"),
PARAMS_NULL(4001,"参数为空"),
PARAMS_USER_NOTEXISTS(4002,"用户不存在"),
PARAMS_RESOURCE_NOTEXISTS(4003,"资源不存在"),
PARAMS_COURSE_NOTEXISTS(4004,"课程不存在"),
SYSTEM_ERROR(50000, "系统内部异常"),
OPERATION_ERROR(50001, "操作失败");

@ -1,4 +1,4 @@
package com.teaching.backend.api;
package com.teaching.backend.common;
/**
* @auther macrozheng

@ -2,12 +2,16 @@ package com.teaching.backend.common;
import com.teaching.backend.constant.CommonConstant;
import lombok.Data;
import lombok.*;
/**
* 分页请求
*/
@Data
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public class PageRequest {
/**

@ -1,4 +1,4 @@
package com.teaching.backend.api;
package com.teaching.backend.common;
/**
* @auther macrozheng

@ -1,7 +1,7 @@
package com.teaching.backend.component;
import cn.hutool.json.JSONUtil;
import com.teaching.backend.api.CommonResult;
import com.teaching.backend.common.CommonResult;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.AuthenticationEntryPoint;

@ -1,7 +1,7 @@
package com.teaching.backend.component;
import cn.hutool.json.JSONUtil;
import com.teaching.backend.api.CommonResult;
import com.teaching.backend.common.CommonResult;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.web.access.AccessDeniedHandler;

@ -1,24 +1,15 @@
package com.teaching.backend.controller.FavourInformation;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.teaching.backend.common.BaseResponse;
import com.teaching.backend.common.ErrorCode;
import com.teaching.backend.common.PageRequest;
import com.teaching.backend.common.ResultUtils;
import com.teaching.backend.exception.BusinessException;
import com.teaching.backend.model.dto.favour.resourceFavour.ResourceFavourAddRequest;
import com.teaching.backend.model.entity.CourseResources;
import com.teaching.backend.model.entity.favour.SeCourseFavour;
import com.teaching.backend.model.entity.favour.SeResourceFavour;
import com.teaching.backend.service.CourseResourcesService;
import com.teaching.backend.service.favour.SeResourceFavourService;
import org.apache.commons.lang3.StringUtils;
import com.teaching.backend.service.resource.CourseResourcesService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;
/**
* ClassName: Get

@ -1,132 +0,0 @@
package com.teaching.backend.controller;
import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import com.aliyun.oss.model.GetObjectRequest;
import com.aliyun.oss.model.OSSObject;
import com.teaching.backend.utils.WordUtil;
import org.apache.poi.openxml4j.opc.OPCPackage;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.apache.poi.xwpf.usermodel.XWPFParagraph;
import org.apache.poi.xwpf.usermodel.XWPFRun;
import org.apache.poi.xwpf.usermodel.XWPFTable;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.util.ResourceUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.util.*;
@RestController
public class WordController2 {
@Value("${aliyun.oss.endpoint}")
private String endpoint;
@Value("${aliyun.oss.accessKeyId}")
private String accessKeyId;
@Value("${aliyun.oss.accessKeySecret}")
private String accessKeySecret;
@Value("${aliyun.oss.bucketName}")
private String bucketName;
@Value("${filename}")
private String templateFileName; // 模板文件名
@PostMapping("/Word/get")
public ResponseEntity<byte[]> createWord(@RequestParam("outputPath") String outputPath) {
String filename = "generatedWord.docx";
OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
InputStream templateStream = null;
//获取模版
OSSObject ossObject = ossClient.getObject(new GetObjectRequest(bucketName, templateFileName));
templateStream = ossObject.getObjectContent();
WordUtil wordUtil = new WordUtil();
wordUtil.setTemplateInputStream(templateStream); // 设置模板文件输入流
Map<String, Object> dataMap = new HashMap<>();
dataMap.put("username1", "姜钧瀚");
dataMap.put("img", "src/main/resources/static/3823.png");
// 设置 Word 生成的输出目录
wordUtil.setOutputDir(outputPath);
String generatedFilePath = wordUtil.createWord(dataMap);
if (generatedFilePath.equals("操作失败")) {
System.out.println("操作失败");
return ResponseEntity.badRequest().body("操作失败".getBytes());
}
File file = new File(generatedFilePath);
byte[] fileContent;
try {
fileContent = Files.readAllBytes(file.toPath());
} catch (IOException e) {
e.printStackTrace();
return ResponseEntity.badRequest().body("文件读取失败".getBytes());
}
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
headers.setContentDispositionFormData("attachment", filename);
//返回文件内容
return new ResponseEntity<>(fileContent, headers, HttpStatus.OK);
}
@PostMapping("/Word/get2")
private void downWord(HttpServletResponse response) throws IOException {
// 读取模板文件并创建XWPFDocument对象
File rootFile = new File(ResourceUtils.getURL("classpath:").getPath());
File templateFile = new File(rootFile, "/word_template/ceshi2.docx");
try (FileInputStream fileInputStream = new FileInputStream(templateFile)) {
XWPFDocument word = new XWPFDocument(fileInputStream);
// 填充数据等后续处理代码
Map<String, String> params = new HashMap<>();
params.put("username", "姜钧瀚");
//处理正文
List<XWPFParagraph> paragraphs = word.getParagraphs();
for (XWPFParagraph paragraph : paragraphs) {
List<XWPFRun> runs = paragraph.getRuns();
for (XWPFRun run : runs) {
String text = run.getText(0);
for (String key : params.keySet()) {
if (text.contains(key)) {
run.setText(text.replaceAll(key, params.get(key)), 0);
}
}
}
}
// 导出Word
String fileName = "123123123.docx";
response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
word.write(response.getOutputStream());
}
}
}

@ -98,6 +98,7 @@ public class SeCourseFavourController {
*/
@PostMapping("/list/page")
public BaseResponse<Page<CourseFavourDetailVO>> listPostByPage(@RequestBody CourseFavourQueryRequest courseFavourQueryRequest) {
System.out.println(courseFavourQueryRequest);
long current = courseFavourQueryRequest.getCurrent();
long size = courseFavourQueryRequest.getPageSize();
String userId = courseFavourQueryRequest.getUserId();

@ -40,7 +40,7 @@ public class SeKnowFavourController {
if (StringUtils.isAnyBlank(knowFavourAddRequest.getCourseId(), knowFavourAddRequest.getKnowId(), knowFavourAddRequest.getUserId())) {
throw new BusinessException(ErrorCode.PARAMS_ERROR);
}
return seKnowFavourService.doKnowFavour(knowFavourAddRequest.getCourseId(), knowFavourAddRequest.getKnowId(), knowFavourAddRequest.getUserId());
return seKnowFavourService.doKnowFavour( knowFavourAddRequest.getKnowId(), knowFavourAddRequest.getUserId());
}

@ -41,11 +41,11 @@ public class SeResourceFavourController {
@PostMapping("/add")
// 加上 HttpServletRequest request 在一个fitter里面进行鉴权操作
public BaseResponse<Boolean> doFavour(@RequestBody ResourceFavourAddRequest resourceFavourAddRequest) {
if (StringUtils.isAnyBlank(resourceFavourAddRequest.getCourseId(),resourceFavourAddRequest.getUserId())) {
if (StringUtils.isAnyBlank(resourceFavourAddRequest.getUserId())) {
throw new BusinessException(ErrorCode.PARAMS_ERROR);
}
return seResourceFavourService.doResourceFavour(resourceFavourAddRequest.getCourseId(), resourceFavourAddRequest.getResourceId(), resourceFavourAddRequest.getUserId());
return seResourceFavourService.doResourceFavour(resourceFavourAddRequest.getResourceId(), resourceFavourAddRequest.getUserId());
}

@ -1,51 +0,0 @@
package com.teaching.backend.controller.know;
import com.teaching.backend.common.BaseResponse;
import com.teaching.backend.common.ErrorCode;
import com.teaching.backend.common.ResultUtils;
import com.teaching.backend.exception.BusinessException;
import com.teaching.backend.model.dto.know.KnowAddRequest;
import com.teaching.backend.service.know.KnowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Author:youhang
* @Date:2024-06-17-11:57
* @Description:
*/
@RestController
@RequestMapping("/konw")
public class KnowController {
@Autowired
private KnowService knowService;
/**
* 知识点添加
*
*/
@PostMapping("/add")
// 加上 HttpServletRequest request 在一个fitter里面进行鉴权操作
public BaseResponse<Boolean> doFavour(@RequestBody KnowAddRequest knowAddRequest) {
// todo 字段判空 合法
// todo 字段是否存在
Boolean result = knowService.add(knowAddRequest);
if(!result) {
throw new BusinessException(ErrorCode.SYSTEM_ERROR);
}
return ResultUtils.success(result);
}
}

@ -1,20 +1,13 @@
package com.teaching.backend.controller;
package com.teaching.backend.controller.resource;
import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.teaching.backend.common.BaseResponse;
import com.teaching.backend.common.ErrorCode;
import com.teaching.backend.common.ResultUtils;
import com.teaching.backend.model.entity.CourseResources;
import com.teaching.backend.service.CourseResourcesService;
import com.teaching.backend.service.resource.CourseResourcesService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
@ -25,8 +18,6 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.nio.file.Paths;
import java.util.Date;
import java.util.UUID;
/**
@ -39,7 +30,7 @@ import java.util.UUID;
* @Version 1.0
*/
@RestController
public class CommonController {
public class ResourceController {
@Resource
@ -60,9 +51,7 @@ public class CommonController {
@PostMapping("/upload")
public BaseResponse<String> upload(MultipartFile file) throws IOException {
// if (file.getSize() > (10)) {
// return ResultUtils.error(690,"内容太大啦!");
// }
OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
@ -92,8 +81,6 @@ public class CommonController {
ossClient.putObject(bucketName, subDir + fileName, file.getInputStream());
// String objectUrl = ossClient.generatePresignedUrl(bucketName, subDir + fileName, new Date(System.currentTimeMillis() + 3600 * 1000)).toString();
String objectUrl = "https://" + bucketName + "." + endpoint + "/" + subDir + fileName;
Integer type=Filetype;
courseResourcesService.updateFile(type, fileName, objectUrl); // 更新文件路径为OSS生成的URL
@ -115,28 +102,6 @@ public class CommonController {
return ResultUtils.success("成功");
}
@GetMapping("/get/record")
public BaseResponse<Page<CourseResources>> pageBaseResponse(@RequestParam Integer type, Integer page,Integer pageSize){
Page<CourseResources> pageInfo=new Page<>(page,pageSize);
LambdaQueryWrapper<CourseResources> lambdaQueryWrapper=new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(type!=null,CourseResources::getType,type);
courseResourcesService.page(pageInfo, lambdaQueryWrapper);
return ResultUtils.success(pageInfo);
}
}

@ -38,9 +38,6 @@ public class SeCourseThumbController {
@PostMapping("/")
// HttpServletRequest request 在一个fitter里面进行鉴权操作
public BaseResponse<Boolean> doThumb(@RequestBody CourseThumbAddRequest courseThumbAddRequest) {
if (StringUtils.isAnyBlank(courseThumbAddRequest.getCourseId(), courseThumbAddRequest.getUserId())) {
throw new BusinessException(ErrorCode.PARAMS_ERROR);
}
return seCourseThumbService.doCourseThumb(courseThumbAddRequest.getCourseId(), courseThumbAddRequest.getUserId());
@ -64,20 +61,5 @@ public class SeCourseThumbController {
}
/**
* 课程下资源和知识点点赞总数
*
* @param courseThumbAllRequest
* @return result 课程下资源和知识点点赞总数
*/
@PostMapping("/countAll")
// todo 后期加上 HttpServletRequest request 在一个fitter里面进行鉴权操作
public BaseResponse<Long> courseCount(@RequestBody CourseThumbAllRequest courseThumbAllRequest) {
if (StringUtils.isAnyBlank(courseThumbAllRequest.getCourseId())) {
throw new BusinessException(ErrorCode.PARAMS_ERROR, "请求参数不能为空");
}
return seCourseThumbService.courseCount(courseThumbAllRequest.getCourseId());
}
}

@ -37,10 +37,7 @@ public class SeKnowThumbController {
@PostMapping("/add")
// 加上 HttpServletRequest request 在一个fitter里面进行鉴权操作
public BaseResponse<Boolean> doThumb(@RequestBody KnowThumbAddRequest knowThumbAddRequest) {
if (StringUtils.isAnyBlank(knowThumbAddRequest.getCourseId(), knowThumbAddRequest.getKnowId(), knowThumbAddRequest.getUserId())) {
throw new BusinessException(ErrorCode.PARAMS_ERROR);
}
return seKnowThumbService.doKnowThumb(knowThumbAddRequest.getCourseId(), knowThumbAddRequest.getKnowId(), knowThumbAddRequest.getUserId());
return seKnowThumbService.doKnowThumb(knowThumbAddRequest.getKnowId(), knowThumbAddRequest.getUserId());
}

@ -37,10 +37,7 @@ public class SeResourceThumbController {
@PostMapping("/add")
// 加上 HttpServletRequest request 在一个fitter里面进行鉴权操作
public BaseResponse<Boolean> doThumb(@RequestBody ResourceThumbAddRequest resourceThumbAddRequest) {
if (StringUtils.isAnyBlank(resourceThumbAddRequest.getCourseId(), resourceThumbAddRequest.getResourceId(), resourceThumbAddRequest.getUserId())) {
throw new BusinessException(ErrorCode.PARAMS_ERROR);
}
return seResourceThumbService.doResourceThumb(resourceThumbAddRequest.getCourseId(), resourceThumbAddRequest.getResourceId(), resourceThumbAddRequest.getUserId());
return seResourceThumbService.doResourceThumb( resourceThumbAddRequest.getResourceId(), resourceThumbAddRequest.getUserId());
}

@ -1,16 +1,12 @@
package com.teaching.backend.controller.umsAdmin;
import cn.hutool.core.collection.CollUtil;
import com.teaching.backend.api.CommonResult;
import com.teaching.backend.common.CommonResult;
import com.teaching.backend.common.BaseResponse;
import com.teaching.backend.common.ErrorCode;
import com.teaching.backend.common.ResultUtils;
import com.teaching.backend.exception.BusinessException;
import com.teaching.backend.model.dto.UmsAdminParam;
import com.teaching.backend.model.dto.UpdateAdminPasswordParam;
import com.teaching.backend.model.dto.courses.CoursesDTO;
import com.teaching.backend.model.dto.umsAdmin.UmsStudentAndTeacherDTO;
import com.teaching.backend.model.entity.courses.Courses;
import com.teaching.backend.model.entity.umsAdmin.UmsAdmin;
import com.teaching.backend.model.entity.umsAdmin.UmsRole;
import com.teaching.backend.model.vo.courses.TeacherInfVO;
@ -19,10 +15,8 @@ import com.teaching.backend.service.umsAdmin.UmsRoleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;

@ -1,7 +1,7 @@
package com.teaching.backend.exception;
import com.teaching.backend.api.IErrorCode;
import com.teaching.backend.common.IErrorCode;
/**
* 自定义API异常

@ -1,7 +1,7 @@
package com.teaching.backend.exception;
import com.teaching.backend.api.IErrorCode;
import com.teaching.backend.common.IErrorCode;
/**
* 断言处理类用于抛出各种API异常

@ -1,4 +1,4 @@
package com.teaching.backend.mapper;
package com.teaching.backend.mapper.resource;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.teaching.backend.model.entity.CourseResources;

@ -1,4 +1,4 @@
package com.teaching.backend.mapper;
package com.teaching.backend.mapper.resource;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.teaching.backend.model.entity.ResourceRelationship;

@ -2,7 +2,7 @@ package com.teaching.backend.model.dto.favour.courseFavour;
import com.teaching.backend.common.PageRequest;
import com.teaching.backend.constant.CommonConstant;
import lombok.Data;
import lombok.*;
import java.io.Serializable;
@ -10,6 +10,9 @@ import java.io.Serializable;
* 课程点赞请求
*/
@Data
@Getter
@Setter
@ToString(callSuper = true)
public class CourseFavourQueryRequest extends PageRequest implements Serializable {
/**
@ -19,4 +22,5 @@ public class CourseFavourQueryRequest extends PageRequest implements Serializabl
private static final long serialVersionUID = 1L;
}

@ -10,10 +10,6 @@ import java.io.Serializable;
@Data
public class ResourceFavourAddRequest implements Serializable {
/**
* 课程 id
*/
private String courseId;
/**
* 知识点 id

@ -10,15 +10,11 @@ import java.io.Serializable;
@Data
public class KnowThumbAddRequest implements Serializable {
/**
* 课程 id
*/
private String courseId;
/**
* 知识点 id
*/
private String knowId;
private Integer knowId;
/**
* user id

@ -10,15 +10,11 @@ import java.io.Serializable;
@Data
public class ResourceThumbAddRequest implements Serializable {
/**
* 课程 id
*/
private String courseId;
/**
* 知识点 id
* 资源 id
*/
private String resourceId;
private Integer resourceId;
/**
* user id

@ -17,7 +17,7 @@ public class SeCourseFavour implements Serializable {
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
@TableId(type = IdType.AUTO)
private Long id;
/**

@ -17,13 +17,10 @@ public class SeKnowFavour implements Serializable {
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
@TableId(type = IdType.AUTO)
private Long id;
/**
* 课程 id
*/
private String courseId;
/**
* 创建知识点 id

@ -17,13 +17,9 @@ public class SeResourceFavour implements Serializable {
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
@TableId(type = IdType.AUTO)
private Long id;
/**
* 课程 id
*/
private String courseId;
/**
* 创建知识点 id

@ -18,7 +18,7 @@ public class SeCourseThumb implements Serializable {
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
@TableId(type = IdType.AUTO)
private Long id;
/**

@ -17,18 +17,14 @@ public class SeKnowThumb implements Serializable {
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
@TableId(type = IdType.AUTO)
private Long id;
/**
* 课程 id
*/
private String courseId;
/**
* 创建知识点 id
*/
private String knowId;
private Integer knowId;
/**
* 创建用户 id

@ -17,18 +17,14 @@ public class SeResourceThumb implements Serializable {
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
@TableId(type = IdType.AUTO)
private Long id;
/**
* 课程 id
*/
private String courseId;
/**
* 创建知识点 id
*/
private String resourceId;
private Integer resourceId;
/**
* 创建用户 id

@ -14,10 +14,9 @@ public interface SeKnowFavourService extends IService<SeKnowFavour> {
/**
* 收藏
*
* @param courseId
* @param userId
* @return
*/
BaseResponse<Boolean> doKnowFavour(String courseId, String resourceId, String userId);
BaseResponse<Boolean> doKnowFavour(String resourceId, String userId);
}

@ -16,11 +16,10 @@ public interface SeResourceFavourService extends IService<SeResourceFavour> {
/**
* 收藏
*
* @param courseId
* @param userId
* @return
*/
BaseResponse<Boolean> doResourceFavour(String courseId, Integer resourceId, String userId);
BaseResponse<Boolean> doResourceFavour( Integer resourceId, String userId);

@ -7,11 +7,11 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.teaching.backend.mapper.CourseResourcesMapper;
import com.teaching.backend.mapper.resource.CourseResourcesMapper;
import com.teaching.backend.model.entity.CourseResources;
import com.teaching.backend.model.entity.ResourceRelationship;
import com.teaching.backend.service.CourseResourcesService;
import com.teaching.backend.service.ResourcesRelationshipService;
import com.teaching.backend.service.resource.CourseResourcesService;
import com.teaching.backend.service.resource.ResourcesRelationshipService;
import org.apache.commons.io.FileUtils;
import org.springframework.stereotype.Service;

@ -1,9 +1,9 @@
package com.teaching.backend.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.teaching.backend.mapper.ResourcesRelationshipMapper;
import com.teaching.backend.mapper.resource.ResourcesRelationshipMapper;
import com.teaching.backend.model.entity.ResourceRelationship;
import com.teaching.backend.service.ResourcesRelationshipService;
import com.teaching.backend.service.resource.ResourcesRelationshipService;
import org.springframework.stereotype.Service;
/**

@ -30,20 +30,14 @@ public class SeKnowFavourServiceImpl extends ServiceImpl<SeKnowFavourMapper, SeK
CoursesMapper coursesMapper;
@Override
public BaseResponse<Boolean> doKnowFavour(String courseId, String knowId, String userId) {
public BaseResponse<Boolean> doKnowFavour( String knowId, String userId) {
// todo 判断知识点id是否存在
//从数据库中校验是否存在courseid
Courses courses = coursesMapper.selectById(courseId);
boolean result = false;
if(courses == null){
return ResultUtils.error(ErrorCode.NOT_FOUND_ERROR,"课程不存在");
}
// 先查询数据库记录,该用户是否收藏
SeKnowFavour seKnowFavour = new SeKnowFavour();
seKnowFavour.setKnowId(knowId);
seKnowFavour.setUserId(userId);
seKnowFavour.setCourseId(courseId);
QueryWrapper<SeKnowFavour> favourQueryWrapper = new QueryWrapper<>(seKnowFavour);
SeKnowFavour oldSeKnowFavour = this.getOne(favourQueryWrapper);
//已收藏

@ -9,10 +9,13 @@ import com.teaching.backend.common.ResultUtils;
import com.teaching.backend.exception.BusinessException;
import com.teaching.backend.mapper.courses.CoursesMapper;
import com.teaching.backend.mapper.favour.SeResourceFavourMapper;
import com.teaching.backend.mapper.resource.CourseResourcesMapper;
import com.teaching.backend.mapper.umsAdmin.UmsAdminMapper;
import com.teaching.backend.model.entity.CourseResources;
import com.teaching.backend.model.entity.courses.Courses;
import com.teaching.backend.model.entity.favour.SeResourceFavour;
import com.teaching.backend.service.CourseResourcesService;
import com.teaching.backend.model.entity.umsAdmin.UmsAdmin;
import com.teaching.backend.service.resource.CourseResourcesService;
import com.teaching.backend.service.favour.SeResourceFavourService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -38,23 +41,26 @@ public class SeResourceFavourServiceImpl extends ServiceImpl<SeResourceFavourMap
@Autowired
private CourseResourcesService courseResourcesService;
@Autowired
private UmsAdminMapper umsAdminMapper;
@Autowired
private CourseResourcesMapper courseResourcesMapper;
@Override
public BaseResponse<Boolean> doResourceFavour(String courseId, Integer resourceId, String userId) {
public BaseResponse<Boolean> doResourceFavour(Integer resourceId, String userId) {
//从数据库中校验是否存在courseid
Courses courses = coursesMapper.selectById(courseId);
boolean result = false;
if(courses == null){
return ResultUtils.error(ErrorCode.NOT_FOUND_ERROR,"课程不存在");
}
// todo 从数据库中校验是否存在resourceid
CourseResources courseResources = courseResourcesMapper.selectById(resourceId);
if(courseResources == null){
throw new BusinessException(ErrorCode.PARAMS_RESOURCE_NOTEXISTS);
}
// 先查询数据库记录,该用户是否收藏
SeResourceFavour seResourceFavour = new SeResourceFavour();
seResourceFavour.setResourceId(resourceId);
seResourceFavour.setUserId(userId);
seResourceFavour.setCourseId(courseId);
QueryWrapper<SeResourceFavour> thumbQueryWrapper = new QueryWrapper<>(seResourceFavour);
SeResourceFavour oldSeResourceFavour = this.getOne(thumbQueryWrapper);
//已收藏
@ -86,13 +92,13 @@ public class SeResourceFavourServiceImpl extends ServiceImpl<SeResourceFavourMap
@Override
public Page<CourseResources> listCourseFavourByPage(String userId, Integer type, Integer page, Integer pageSize) {
UmsAdmin umsAdmin = umsAdminMapper.selectById(userId);
if(umsAdmin == null){
throw new BusinessException(ErrorCode.PARAMS_USER_NOTEXISTS);
}
QueryWrapper<SeResourceFavour> resourceQueryWrapper = new QueryWrapper<>();
resourceQueryWrapper.eq("user_id",userId);
List<Integer> ids = this.list(resourceQueryWrapper).stream().map(SeResourceFavour::getResourceId).collect(Collectors.toList());
return courseResourcesService.getresourceRecords(type,ids,page,pageSize);
}
}

@ -49,7 +49,7 @@ public class SeCourseThumbServiceImpl extends ServiceImpl<SeCourseThumbMapper, S
Courses courses = coursesMapper.selectById(courseId);
boolean result = false;
if(courses == null){
return ResultUtils.error(ErrorCode.NOT_FOUND_ERROR,"课程不存在");
return ResultUtils.error(ErrorCode.PARAMS_COURSE_NOTEXISTS);
}
// 先查询数据库记录,该用户是否点赞
@ -91,7 +91,7 @@ public class SeCourseThumbServiceImpl extends ServiceImpl<SeCourseThumbMapper, S
//从数据库中校验是否存在courseid
Courses courses = coursesMapper.selectById(courseId);
if(courses == null){
return ResultUtils.error(ErrorCode.NOT_FOUND_ERROR,"课程不存在");
return ResultUtils.error(ErrorCode.PARAMS_COURSE_NOTEXISTS);
}
QueryWrapper<SeCourseThumb> thumbQueryWrapper = new QueryWrapper<>();
@ -104,28 +104,5 @@ public class SeCourseThumbServiceImpl extends ServiceImpl<SeCourseThumbMapper, S
}
}
@Override
public BaseResponse<Long> courseCount(String courseId) {
//从数据库中校验是否存在courseid
Courses courses = coursesMapper.selectById(courseId);
if(courses == null){
return ResultUtils.error(ErrorCode.NOT_FOUND_ERROR,"课程不存在");
}
QueryWrapper<SeResourceThumb> ResourceQueryWrapper = new QueryWrapper<>();
ResourceQueryWrapper.eq("course_id", courseId);
long result1 = seResourceThumbService.count(ResourceQueryWrapper);
QueryWrapper<SeKnowThumb> KnowQueryWrapper = new QueryWrapper<>();
KnowQueryWrapper.eq("course_id", courseId);
long result2 = seKnowThumbService.count(KnowQueryWrapper);
long result = result1 + result2;
if (result == 0) {
throw new BusinessException(ErrorCode.SYSTEM_ERROR, "查询参数不存在");
} else {
return ResultUtils.success(result);
}
}
}

@ -28,19 +28,13 @@ public class SeKnowThumbServiceImpl extends ServiceImpl<SeKnowThumbMapper, SeKno
@Autowired
CoursesMapper coursesMapper;
@Override
public BaseResponse<Boolean> doKnowThumb(String courseId, String knowId, String userId) {
// todo 查询知识点
//从数据库中校验是否存在courseid
Courses courses = coursesMapper.selectById(courseId);
public BaseResponse<Boolean> doKnowThumb(Integer knowId, String userId) {
boolean result = false;
if(courses == null){
return ResultUtils.error(ErrorCode.NOT_FOUND_ERROR,"课程不存在");
}
// todo 查询知识点
// 先查询数据库记录,该用户是否点赞
SeKnowThumb seKnowThumb = new SeKnowThumb();
seKnowThumb.setKnowId(knowId);
seKnowThumb.setUserId(userId);
seKnowThumb.setCourseId(courseId);
QueryWrapper<SeKnowThumb> thumbQueryWrapper = new QueryWrapper<>(seKnowThumb);
SeKnowThumb oldSeKnowThumb = this.getOne(thumbQueryWrapper);
//已点赞

@ -7,10 +7,13 @@ import com.teaching.backend.common.ErrorCode;
import com.teaching.backend.common.ResultUtils;
import com.teaching.backend.exception.BusinessException;
import com.teaching.backend.mapper.courses.CoursesMapper;
import com.teaching.backend.mapper.resource.CourseResourcesMapper;
import com.teaching.backend.mapper.thumb.SeResourceThumbMapper;
import com.teaching.backend.model.entity.CourseResources;
import com.teaching.backend.model.entity.courses.Courses;
import com.teaching.backend.model.entity.thumb.SeResourceThumb;
import com.teaching.backend.service.thumb.SeResourceThumbService;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -29,21 +32,22 @@ public class SeResourceThumbServiceImpl extends ServiceImpl<SeResourceThumbMappe
@Autowired
CoursesMapper coursesMapper;
@Override
public BaseResponse<Boolean> doResourceThumb(String courseId, String resourceId, String userId) {
//从数据库中校验是否存在courseid
Courses courses = coursesMapper.selectById(courseId);
@Autowired
private CourseResourcesMapper courseResourcesMapper;
@Override
public BaseResponse<Boolean> doResourceThumb(Integer resourceId, String userId) {
boolean result = false;
if(courses == null){
return ResultUtils.error(ErrorCode.NOT_FOUND_ERROR,"课程不存在");
//查询是否有资源
CourseResources courseResources = courseResourcesMapper.selectById(resourceId);
if(courseResources == null){
throw new BusinessException(ErrorCode.PARAMS_RESOURCE_NOTEXISTS);
}
// 先查询数据库记录,该用户是否点赞
SeResourceThumb seResourceThumb = new SeResourceThumb();
seResourceThumb.setResourceId(resourceId);
seResourceThumb.setUserId(userId);
seResourceThumb.setCourseId(courseId);
QueryWrapper<SeResourceThumb> thumbQueryWrapper = new QueryWrapper<>(seResourceThumb);
SeResourceThumb oldSeResourceThumb = this.getOne(thumbQueryWrapper);

@ -1,4 +1,4 @@
package com.teaching.backend.service;
package com.teaching.backend.service.resource;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;

@ -1,4 +1,4 @@
package com.teaching.backend.service;
package com.teaching.backend.service.resource;
import com.baomidou.mybatisplus.extension.service.IService;
import com.teaching.backend.model.entity.ResourceRelationship;

@ -30,12 +30,4 @@ public interface SeCourseThumbService extends IService<SeCourseThumb> {
BaseResponse<Long> thumbCount(String courseId);
/**
* 课程下资源和知识点的点赞总数
*
* @param courseId
* @return
*/
BaseResponse<Long> courseCount(String courseId);
}

@ -3,6 +3,7 @@ package com.teaching.backend.service.thumb;
import com.baomidou.mybatisplus.extension.service.IService;
import com.teaching.backend.common.BaseResponse;
import com.teaching.backend.model.entity.thumb.SeKnowThumb;
import io.swagger.models.auth.In;
/**
* @Author:youhang
@ -14,10 +15,9 @@ public interface SeKnowThumbService extends IService<SeKnowThumb> {
/**
* 点赞
*
* @param courseId
* @param userId
* @return
*/
BaseResponse<Boolean> doKnowThumb(String courseId, String resourceId, String userId);
BaseResponse<Boolean> doKnowThumb(Integer knowId, String userId);
}

@ -14,10 +14,9 @@ public interface SeResourceThumbService extends IService<SeResourceThumb> {
/**
* 点赞
*
* @param courseId
* @param userId
* @return
*/
BaseResponse<Boolean> doResourceThumb(String courseId, String resourceId, String userId);
BaseResponse<Boolean> doResourceThumb(Integer resourceId, String userId);
}

@ -1,9 +1,80 @@
package com.teaching.backend.utils;
/**
* @Author:youhang
* @Date:2024-06-17-23:15
* @Description:
*/
public class ParamOutAspect {
}
//package com.teaching.backend.utils;
//
///**
// * @Author:youhang
// * @Date:2024-06-17-23:15
// * @Description:
// */
//
//
//
//import cn.hutool.json.JSONObject;
//import cn.hutool.json.JSONUtil;
//import com.teaching.backend.common.ErrorCode;
//import com.teaching.backend.exception.BusinessException;
//import org.aspectj.lang.JoinPoint;
//import org.aspectj.lang.annotation.Aspect;
//import org.aspectj.lang.annotation.Before;
//import org.aspectj.lang.reflect.MethodSignature;
//import org.springframework.core.LocalVariableTableParameterNameDiscoverer;
//import org.springframework.stereotype.Component;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.lang.reflect.Method;
//import java.util.Arrays;
//import java.util.List;
//import java.util.stream.Collectors;
//
//
//@Component
//@Aspect
//public class ParamOutAspect {
//
//
// //对包下所有的controller结尾的类的所有方法增强
// private final String executeExpr = "execution(public * com.teaching.backend.controller..*.*(..))";
//
// @Before(executeExpr)
// public void processLog(JoinPoint joinPoint) {
// Method method = ((MethodSignature) joinPoint.getSignature()).getMethod();
// //获取方法名称
// String methodName = method.getName();
// //获取参数名称
// LocalVariableTableParameterNameDiscoverer paramNames = new LocalVariableTableParameterNameDiscoverer();
// String[] params = paramNames.getParameterNames(method);
//
//
// //获取参数f
// Object[] args = joinPoint.getArgs();
// //过滤掉request和response,不能序列化
// List<Object> filteredArgs = Arrays.stream(args)
// .filter(arg -> (!(arg instanceof HttpServletRequest) && !(arg instanceof HttpServletResponse))).collect(Collectors.toList());
// final Object[] array = filteredArgs.stream().toArray();
//
// for (int i = 0; i < array.length; i++) {
// System.out.println(array[i]);
// String jsonStr = JSONUtil.toJsonStr(array[i]);
// System.out.println(jsonStr);
// Class<?> myClass = array[i].getClass(); // 获取类的 Class 对象
// System.out.println("class "+myClass);
// JSONObject entries = JSONUtil.parseObj(jsonStr);
// System.out.println(entries);
// // 遍历JSONObject的属性
// entries.forEach((key, value) -> {
// if(value == null || "".equals(value)){
// //可以设置为空的字段
// if(key.equals( "sortField")||key.equals( "sortOrder")){
// }else{
// throw new BusinessException(ErrorCode.PARAMS_NULL);
// }
//
// }
// System.out.println(key + ": " + value);
// });
// }
// }
// }
//
//
//

@ -1,71 +0,0 @@
package com.teaching.backend.utils;
import freemarker.template.Configuration;
import freemarker.template.Template;
import freemarker.template.TemplateException;
import lombok.Data;
import java.io.*;
import java.util.Map;
import java.util.Random;
/**
* @Author:youhang
* @Date:2024-05-30-18:20
* @Description:
*/
@Data
public class WordUtil {
private Configuration configuration = null;
private String baseDir;
private String templateFile;
private String outputDir;
private InputStream templateInputStream; // 模板文件输入流
public WordUtil() {
configuration = new Configuration();
configuration.setDefaultEncoding("UTF-8");
}
public void setTemplateInputStream(InputStream templateStream) {
this.templateInputStream = templateStream;
}
public String createWord(Map<String,Object> dataMap) {
configuration.setClassForTemplateLoading(this.getClass(), "");
Template t = null;
try {
t = new Template(templateFile, new InputStreamReader(templateInputStream, "UTF-8"), configuration);
} catch (IOException e) {
e.printStackTrace();
}
Random random = new Random();
File outFile = new File(outputDir + random.nextInt(200) + ".docx");
Writer out = null;
try {
out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile)));
t.process(dataMap, out);
return outFile.getPath();
} catch (TemplateException | IOException e) {
e.printStackTrace();
} finally {
if (out != null) {
try {
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return "文档生成失败";
}
}

@ -1,5 +0,0 @@
aliyun.oss.endpoint=oss-cn-wuhan-lr.aliyuncs.com
aliyun.oss.accessKeyId=LTAI5tFkdu3y5WddxbjgaG2F
aliyun.oss.accessKeySecret=1xUchxUTlmUBoTV5JQIrKsVjSkmsLF
aliyun.oss.bucketName=ceshi132132
filename=123.ftl

@ -44,23 +44,30 @@ knife4j:
secure:
ignored:
urls:
#- /swagger-ui/
- /**
# - /swagger-resources/**
# - /**/v2/api-docs
# - /**/*.html
# - /**/*.js
# - /**/*.css
# - /**/*.png
# - /**/*.map
# - /favicon.ico
# - /actuator/**
# - /druid/**
# - /user/**
# - /user/login
# - /user/register
# - /user/info
# - /user/logout
# - /minio/upload
- /swagger-ui/
# - /**
- /swagger-resources/**
- /**/v2/api-docs
- /**/*.html
- /**/*.js
- /**/*.css
- /**/*.png
- /**/*.map
- /favicon.ico
- /actuator/**
- /druid/**
- /user/**
- /user/login
- /user/register
- /user/info
- /user/logout
- /minio/upload
aliyun:
oss:
endpoint: oss-cn-wuhan-lr.aliyuncs.com
accessKeyId: LTAI5tFkdu3y5WddxbjgaG2F
accessKeySecret: 1xUchxUTlmUBoTV5JQIrKsVjSkmsLF
bucketName: ceshi132132

@ -1,76 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>文件上传下载示例</title>
</head>
<body>
<div id="app">
<h1>文件上传</h1>
<form @submit.prevent="upload" enctype="multipart/form-data">
<input type="file" name="file">
<button type="submit">上传文件</button>
</form>
<h1>文件下载</h1>
<button @click="download">点击下载文件</button>
</div>
<!-- 开发环境版本,包含了有帮助的命令行警告 -->
<script src="../../plugins/vue/vue.js"></script>
<!-- 引入组件库 -->
<script src="../../plugins/element-ui/index.js"></script>
<!-- 引入axios -->
<script src="../../plugins/axios/axios.min.js"></script>
<script>
new Vue({
el: '#app',
data: {
fileName: ''
},
methods: {
download() {
axios.get('/download?fileName=' + this.fileName, { responseType: 'blob' })
.then(response => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', this.fileName);
document.body.appendChild(link);
link.click();
window.URL.revokeObjectURL(url);
})
.catch(error => {
console.error("出错了", error);
});
},
upload(event) {
let formData = new FormData();
formData.append('file', event.target.elements.file.files[0]);
axios.post('/upload', formData, {
headers: {
'Content-Type': 'multipart/form-data'
}
})
.then(response => {
console.log("上传成功,文件名为:" + response.data.data);
this.fileName = response.data.data;
})
.catch(error => {
console.error('上传失败', error);
});
}
}
});
</script>
</body>
</html>

@ -1,56 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>视频上传和下载</title>
</head>
<body>
<div id="app2">
<input type="file" ref="fileInput" @change="handleFileChange">
<button @click="uploadFile">上传</button>
</div>
<!-- 开发环境版本,包含了有帮助的命令行警告 -->
<script src="../../plugins/vue/vue.js"></script>
<!-- 引入组件库 -->
<script src="../../plugins/element-ui/index.js"></script>
<!-- 引入axios -->
<script src="../../plugins/axios/axios.min.js"></script>
<script>
new Vue({
el: '#app',
data: {
asd: []
},
methods: {
fetchList() {
const params = {
resourceIdList: [4], // 传递资源ID列表
type: 1 // 资源类型
};
axios.get('/Favour/get', {
params: params
})
.then(response => {
this.asd = response.data.records; // 直接赋值给 asd
console.log( this.asd )
})
.catch(error => {
console.error("出错了", error);
});
},
},
mounted() {
this.fetchList(); // 在组件挂载后立即调用fetchList方法获取资源记录
}
});
</script>
</body>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save