2 Commits ce39efc087 ... a25e732503

Author SHA1 Message Date
  lzy a25e732503 'lzy' 4 days ago
  lzy 035171aadb 'lzy' 5 days ago

File diff suppressed because it is too large
+ 311 - 311
.idea/dataSources/fd176a36-ef08-4a83-8661-b49f428c6381.xml


+ 44 - 43
.idea/workspace.xml

@@ -5,15 +5,17 @@
   </component>
   </component>
   <component name="ChangeListManager">
   <component name="ChangeListManager">
     <list default="true" id="faf8ad68-547d-4fc6-8492-a7e674cf8f17" name="Changes" comment="'lzy'">
     <list default="true" id="faf8ad68-547d-4fc6-8492-a7e674cf8f17" name="Changes" comment="'lzy'">
-      <change afterPath="$PROJECT_DIR$/.idea/dataSources.xml" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/.idea/mybatisx/templates.xml" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/Marketplace/src/main/java/com/dt/child/controller/VideoController.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Marketplace/src/main/java/com/dt/dto/AddVideoDto.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/.idea/dataSources/fd176a36-ef08-4a83-8661-b49f428c6381.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/dataSources/fd176a36-ef08-4a83-8661-b49f428c6381.xml" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/Marketplace/src/main/java/com/dt/child/controller/ChildController.java" beforeDir="false" afterPath="$PROJECT_DIR$/Marketplace/src/main/java/com/dt/child/controller/ChildController.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/Marketplace/src/main/java/com/dt/intercepter/AuthIntercepter.java" beforeDir="false" afterPath="$PROJECT_DIR$/Marketplace/src/main/java/com/dt/intercepter/AuthIntercepter.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Marketplace/src/main/java/com/dt/child/controller/VideoController.java" beforeDir="false" afterPath="$PROJECT_DIR$/Marketplace/src/main/java/com/dt/child/controller/VideoController.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Marketplace/src/main/java/com/dt/common/domain/Video.java" beforeDir="false" afterPath="$PROJECT_DIR$/Marketplace/src/main/java/com/dt/common/domain/Video.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Marketplace/src/main/java/com/dt/common/mapper/VideoMapper.java" beforeDir="false" afterPath="$PROJECT_DIR$/Marketplace/src/main/java/com/dt/common/mapper/VideoMapper.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Marketplace/src/main/java/com/dt/common/service/VideoService.java" beforeDir="false" afterPath="$PROJECT_DIR$/Marketplace/src/main/java/com/dt/common/service/VideoService.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Marketplace/src/main/java/com/dt/common/service/impl/ChildServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/Marketplace/src/main/java/com/dt/common/service/impl/ChildServiceImpl.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Marketplace/src/main/java/com/dt/common/service/impl/VideoServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/Marketplace/src/main/java/com/dt/common/service/impl/VideoServiceImpl.java" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/Marketplace/src/main/java/com/dt/oss/OSSService.java" beforeDir="false" afterPath="$PROJECT_DIR$/Marketplace/src/main/java/com/dt/oss/OSSService.java" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/Marketplace/src/main/java/com/dt/oss/OSSService.java" beforeDir="false" afterPath="$PROJECT_DIR$/Marketplace/src/main/java/com/dt/oss/OSSService.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/Marketplace/src/main/java/com/dt/oss/controller/OSSController.java" beforeDir="false" afterPath="$PROJECT_DIR$/Marketplace/src/main/java/com/dt/oss/controller/OSSController.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/Marketplace/src/main/resources/application.yml" beforeDir="false" afterPath="$PROJECT_DIR$/Marketplace/src/main/resources/application.yml" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Marketplace/src/main/resources/mapper/VideoMapper.xml" beforeDir="false" afterPath="$PROJECT_DIR$/Marketplace/src/main/resources/mapper/VideoMapper.xml" afterDir="false" />
     </list>
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -48,33 +50,36 @@
     <option name="hideEmptyMiddlePackages" value="true" />
     <option name="hideEmptyMiddlePackages" value="true" />
     <option name="showLibraryContents" value="true" />
     <option name="showLibraryContents" value="true" />
   </component>
   </component>
-  <component name="PropertiesComponent"><![CDATA[{
-  "keyToString": {
-    "RequestMappingsPanelOrder0": "0",
-    "RequestMappingsPanelOrder1": "1",
-    "RequestMappingsPanelWidth0": "75",
-    "RequestMappingsPanelWidth1": "75",
-    "RunOnceActivity.OpenProjectViewOnStart": "true",
-    "RunOnceActivity.ShowReadmeOnStart": "true",
-    "SHARE_PROJECT_CONFIGURATION_FILES": "true",
-    "WebServerToolWindowFactoryState": "false",
-    "last_opened_file_path": "D:/Program Files/nodejs/npm.cmd",
-    "node.js.detected.package.eslint": "true",
-    "node.js.detected.package.tslint": "true",
-    "node.js.selected.package.eslint": "(autodetect)",
-    "node.js.selected.package.tslint": "(autodetect)",
-    "nodejs_interpreter_path": "D:/Program Files/nodejs/npm.cmd",
-    "nodejs_package_manager_path": "npm",
-    "settings.editor.selected.configurable": "MavenSettings",
-    "spring.configuration.checksum": "675e31b94580e2642405e2f8586d112e",
-    "vue.rearranger.settings.migration": "true"
+  <component name="PropertiesComponent">{
+  &quot;keyToString&quot;: {
+    &quot;RequestMappingsPanelOrder0&quot;: &quot;0&quot;,
+    &quot;RequestMappingsPanelOrder1&quot;: &quot;1&quot;,
+    &quot;RequestMappingsPanelWidth0&quot;: &quot;75&quot;,
+    &quot;RequestMappingsPanelWidth1&quot;: &quot;75&quot;,
+    &quot;RunOnceActivity.OpenProjectViewOnStart&quot;: &quot;true&quot;,
+    &quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
+    &quot;SHARE_PROJECT_CONFIGURATION_FILES&quot;: &quot;true&quot;,
+    &quot;WebServerToolWindowFactoryState&quot;: &quot;false&quot;,
+    &quot;last_opened_file_path&quot;: &quot;D:/Program Files/nodejs/npm.cmd&quot;,
+    &quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
+    &quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
+    &quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
+    &quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
+    &quot;nodejs_interpreter_path&quot;: &quot;D:/Program Files/nodejs/npm.cmd&quot;,
+    &quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
+    &quot;settings.editor.selected.configurable&quot;: &quot;MavenSettings&quot;,
+    &quot;spring.configuration.checksum&quot;: &quot;675e31b94580e2642405e2f8586d112e&quot;,
+    &quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
   },
   },
-  "keyToStringList": {
-    "DatabaseDriversLRU": [
-      "mysql"
+  &quot;keyToStringList&quot;: {
+    &quot;DatabaseDriversLRU&quot;: [
+      &quot;mysql&quot;
     ]
     ]
   }
   }
-}]]></component>
+}</component>
+  <component name="ReactorSettings">
+    <option name="notificationShown" value="true" />
+  </component>
   <component name="RunManager">
   <component name="RunManager">
     <configuration name="MarketplaceApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" temporary="true" nameIsGenerated="true">
     <configuration name="MarketplaceApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" temporary="true" nameIsGenerated="true">
       <module name="Marketplace" />
       <module name="Marketplace" />
@@ -118,7 +123,14 @@
       <option name="project" value="LOCAL" />
       <option name="project" value="LOCAL" />
       <updated>1751457214913</updated>
       <updated>1751457214913</updated>
     </task>
     </task>
-    <option name="localTasksCounter" value="3" />
+    <task id="LOCAL-00003" summary="'lzy'">
+      <created>1751471341881</created>
+      <option name="number" value="00003" />
+      <option name="presentableId" value="LOCAL-00003" />
+      <option name="project" value="LOCAL" />
+      <updated>1751471341881</updated>
+    </task>
+    <option name="localTasksCounter" value="4" />
     <servers />
     <servers />
   </component>
   </component>
   <component name="TypeScriptGeneratedFilesManager">
   <component name="TypeScriptGeneratedFilesManager">
@@ -128,15 +140,4 @@
     <MESSAGE value="'lzy'" />
     <MESSAGE value="'lzy'" />
     <option name="LAST_COMMIT_MESSAGE" value="'lzy'" />
     <option name="LAST_COMMIT_MESSAGE" value="'lzy'" />
   </component>
   </component>
-  <component name="XDebuggerManager">
-    <breakpoint-manager>
-      <breakpoints>
-        <line-breakpoint enabled="true" type="java-line">
-          <url>file://$PROJECT_DIR$/Marketplace/src/main/java/com/dt/intercepter/AuthIntercepter.java</url>
-          <line>51</line>
-          <option name="timeStamp" value="1" />
-        </line-breakpoint>
-      </breakpoints>
-    </breakpoint-manager>
-  </component>
 </project>
 </project>

+ 17 - 3
Marketplace/src/main/java/com/dt/child/controller/VideoController.java

@@ -1,10 +1,16 @@
 package com.dt.child.controller;
 package com.dt.child.controller;
 
 
 import com.dt.common.service.VideoService;
 import com.dt.common.service.VideoService;
+import com.dt.config.NonLoginRequired;
+import com.dt.dto.AddVideoDto;
+import com.dt.vo.Result;
+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.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.bind.annotation.RestController;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
+import javax.validation.Valid;
 
 
 @RequestMapping("video")
 @RequestMapping("video")
 @RestController
 @RestController
@@ -13,9 +19,17 @@ public class VideoController {
     @Resource
     @Resource
     private VideoService videoService;
     private VideoService videoService;
 
 
-
-
-
+//  添加视频
+    @PostMapping("addVideo")
+    public Result addVideo(@RequestBody @Valid AddVideoDto addVideoDto){
+        return videoService.addVideo(addVideoDto);
+    }
+//    查询所有视频
+    @PostMapping("selVideo")
+    public Result selVideo(){
+        return videoService.selVideo();
+    }
+//
 
 
 
 
 
 

+ 9 - 1
Marketplace/src/main/java/com/dt/common/domain/Video.java

@@ -26,6 +26,11 @@ public class Video implements Serializable {
     private String title;
     private String title;
 
 
     /**
     /**
+     * 图片
+     */
+    private String img;
+
+    /**
      * 路径
      * 路径
      */
      */
     private String url;
     private String url;
@@ -53,7 +58,7 @@ public class Video implements Serializable {
     /**
     /**
      * 是否精选视频
      * 是否精选视频
      */
      */
-    private String isFeatured;
+    private Integer isFeatured;
 
 
     @TableField(exist = false)
     @TableField(exist = false)
     private static final long serialVersionUID = 1L;
     private static final long serialVersionUID = 1L;
@@ -72,6 +77,7 @@ public class Video implements Serializable {
         Video other = (Video) that;
         Video other = (Video) that;
         return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
         return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
             && (this.getTitle() == null ? other.getTitle() == null : this.getTitle().equals(other.getTitle()))
             && (this.getTitle() == null ? other.getTitle() == null : this.getTitle().equals(other.getTitle()))
+            && (this.getImg() == null ? other.getImg() == null : this.getImg().equals(other.getImg()))
             && (this.getUrl() == null ? other.getUrl() == null : this.getUrl().equals(other.getUrl()))
             && (this.getUrl() == null ? other.getUrl() == null : this.getUrl().equals(other.getUrl()))
             && (this.getViewCount() == null ? other.getViewCount() == null : this.getViewCount().equals(other.getViewCount()))
             && (this.getViewCount() == null ? other.getViewCount() == null : this.getViewCount().equals(other.getViewCount()))
             && (this.getLikeCount() == null ? other.getLikeCount() == null : this.getLikeCount().equals(other.getLikeCount()))
             && (this.getLikeCount() == null ? other.getLikeCount() == null : this.getLikeCount().equals(other.getLikeCount()))
@@ -86,6 +92,7 @@ public class Video implements Serializable {
         int result = 1;
         int result = 1;
         result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
         result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
         result = prime * result + ((getTitle() == null) ? 0 : getTitle().hashCode());
         result = prime * result + ((getTitle() == null) ? 0 : getTitle().hashCode());
+        result = prime * result + ((getImg() == null) ? 0 : getImg().hashCode());
         result = prime * result + ((getUrl() == null) ? 0 : getUrl().hashCode());
         result = prime * result + ((getUrl() == null) ? 0 : getUrl().hashCode());
         result = prime * result + ((getViewCount() == null) ? 0 : getViewCount().hashCode());
         result = prime * result + ((getViewCount() == null) ? 0 : getViewCount().hashCode());
         result = prime * result + ((getLikeCount() == null) ? 0 : getLikeCount().hashCode());
         result = prime * result + ((getLikeCount() == null) ? 0 : getLikeCount().hashCode());
@@ -103,6 +110,7 @@ public class Video implements Serializable {
         sb.append("Hash = ").append(hashCode());
         sb.append("Hash = ").append(hashCode());
         sb.append(", id=").append(id);
         sb.append(", id=").append(id);
         sb.append(", title=").append(title);
         sb.append(", title=").append(title);
+        sb.append(", img=").append(img);
         sb.append(", url=").append(url);
         sb.append(", url=").append(url);
         sb.append(", viewCount=").append(viewCount);
         sb.append(", viewCount=").append(viewCount);
         sb.append(", likeCount=").append(likeCount);
         sb.append(", likeCount=").append(likeCount);

+ 1 - 1
Marketplace/src/main/java/com/dt/common/mapper/VideoMapper.java

@@ -6,7 +6,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 /**
 /**
 * @author lzy
 * @author lzy
 * @description 针对表【video(视频表)】的数据库操作Mapper
 * @description 针对表【video(视频表)】的数据库操作Mapper
-* @createDate 2025-07-02 21:21:57
+* @createDate 2025-07-03 08:31:55
 * @Entity com.dt.common.domain.Video
 * @Entity com.dt.common.domain.Video
 */
 */
 public interface VideoMapper extends BaseMapper<Video> {
 public interface VideoMapper extends BaseMapper<Video> {

+ 13 - 1
Marketplace/src/main/java/com/dt/common/service/VideoService.java

@@ -2,12 +2,24 @@ package com.dt.common.service;
 
 
 import com.dt.common.domain.Video;
 import com.dt.common.domain.Video;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.dt.dto.AddVideoDto;
+import com.dt.vo.Result;
 
 
 /**
 /**
 * @author lzy
 * @author lzy
 * @description 针对表【video(视频表)】的数据库操作Service
 * @description 针对表【video(视频表)】的数据库操作Service
-* @createDate 2025-07-02 21:21:57
+* @createDate 2025-07-03 08:31:55
 */
 */
 public interface VideoService extends IService<Video> {
 public interface VideoService extends IService<Video> {
 
 
+//    添加视频
+    Result addVideo(AddVideoDto addVideoDto);
+
+
+//    查询视频
+    Result selVideo();
+
+//    查询精选视频
+
+
 }
 }

+ 1 - 0
Marketplace/src/main/java/com/dt/common/service/impl/ChildServiceImpl.java

@@ -65,6 +65,7 @@ public class ChildServiceImpl extends ServiceImpl<ChildMapper, Child>
 
 
 //    查询幼儿
 //    查询幼儿
     @Override
     @Override
+    @Transactional
     public Result selChild(Long userId) {
     public Result selChild(Long userId) {
         try {
         try {
             List<ParentChild> parentChildren = parentChildMapper.selectList(new LambdaQueryWrapper<ParentChild>().eq(ParentChild::getParentId, userId));
             List<ParentChild> parentChildren = parentChildMapper.selectList(new LambdaQueryWrapper<ParentChild>().eq(ParentChild::getParentId, userId));

+ 36 - 1
Marketplace/src/main/java/com/dt/common/service/impl/VideoServiceImpl.java

@@ -1,20 +1,55 @@
 package com.dt.common.service.impl;
 package com.dt.common.service.impl;
 
 
+import cn.hutool.core.util.IdUtil;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.dt.common.domain.Video;
 import com.dt.common.domain.Video;
 import com.dt.common.service.VideoService;
 import com.dt.common.service.VideoService;
 import com.dt.common.mapper.VideoMapper;
 import com.dt.common.mapper.VideoMapper;
+import com.dt.dto.AddVideoDto;
+import com.dt.vo.Result;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
 
 
 /**
 /**
 * @author lzy
 * @author lzy
 * @description 针对表【video(视频表)】的数据库操作Service实现
 * @description 针对表【video(视频表)】的数据库操作Service实现
-* @createDate 2025-07-02 21:21:57
+* @createDate 2025-07-03 08:31:55
 */
 */
 @Service
 @Service
 public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video>
 public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video>
     implements VideoService{
     implements VideoService{
 
 
+//    添加视频
+    @Override
+    @Transactional
+    public Result addVideo(AddVideoDto addVideoDto) {
+        Video video = new Video();
+        video.setId(IdUtil.getSnowflake().nextId());
+        video.setImg(addVideoDto.getImg());
+        video.setTitle(addVideoDto.getTitle());
+        video.setUrl(addVideoDto.getUrl());
+        video.setViewCount(0);
+        video.setLikeCount(0);
+        video.setCommentCount(0);
+        video.setFavoritesCount(0);
+        video.setIsFeatured(addVideoDto.getIsFeatured());
+
+        int insert = this.baseMapper.insert(video);
+        if (insert > 0){
+            return Result.ok(video, "添加成功");
+        }
+        return  Result.Err(null, "添加失败");
+    }
+//  查询所有视频
+    @Override
+    public Result selVideo() {
+        List<Video> videos = this.baseMapper.selectList(null);
+        return Result.ok(videos, "查询成功");
+    }
+
+
 }
 }
 
 
 
 

+ 63 - 0
Marketplace/src/main/java/com/dt/dto/AddVideoDto.java

@@ -0,0 +1,63 @@
+package com.dt.dto;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
+@Data
+public class AddVideoDto {
+
+
+
+
+    /**
+     * 标签
+     */
+    @NotBlank(message = "标题不能为空")
+    private String title;
+
+    /**
+     * 图片
+     */
+    @NotNull(message = "图片不能为空")
+    private String img;
+
+    /**
+     * 路径
+     */
+    @NotBlank(message = "路径不能为空")
+    private String url;
+
+    /**
+     * 观看数量
+     */
+    @NotNull(message = "观看数量不能为空")
+    private Integer viewCount;
+
+    /**
+     * 点赞数量
+     */
+    @NotNull(message = "点赞数量不能为空")
+    private Integer likeCount;
+
+    /**
+     * 品论数量
+     */
+    @NotNull(message = "品论数量不能为空")
+    private Integer commentCount;
+
+    /**
+     * 收藏数量
+     */
+    @NotNull(message = "收藏数量不能为空")
+    private Integer favoritesCount;
+
+    /**
+     * 是否精选视频
+     */
+    @NotNull(message = "是否精选视频不能为空")
+    private Integer isFeatured;
+
+
+}

+ 21 - 20
Marketplace/src/main/java/com/dt/oss/OSSService.java

@@ -7,10 +7,12 @@ import org.springframework.stereotype.Service;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartFile;
 
 
 import java.io.IOException;
 import java.io.IOException;
+import java.util.Arrays;
 import java.util.Date;
 import java.util.Date;
 import java.util.UUID;
 import java.util.UUID;
 
 
 @Service
 @Service
+
 public class OSSService {
 public class OSSService {
 
 
     @Value("${oss.endpoint}")
     @Value("${oss.endpoint}")
@@ -60,6 +62,15 @@ public class OSSService {
             ossClient.shutdown();
             ossClient.shutdown();
         }
         }
     }
     }
+    // 允许的图片文件类型
+    private static final String[] ALLOWED_IMAGE_TYPES = {
+            "image/jpeg", "image/png", "image/gif", "image/webp"
+    };
+
+    // 允许的图片文件扩展名
+    private static final String[] ALLOWED_IMAGE_EXTENSIONS = {
+            ".jpg", ".jpeg", ".png", ".gif", ".webp"
+    };
 
 
     /**
     /**
      * 验证文件类型是否为允许的类型
      * 验证文件类型是否为允许的类型
@@ -71,31 +82,21 @@ public class OSSService {
         String originalFilename = file.getOriginalFilename();
         String originalFilename = file.getOriginalFilename();
         String fileExtension = originalFilename.substring(originalFilename.lastIndexOf(".")).toLowerCase();
         String fileExtension = originalFilename.substring(originalFilename.lastIndexOf(".")).toLowerCase();
 
 
-        // 检查文件扩展名
-        boolean validExtension = false;
-        for (String ext : ALLOWED_VIDEO_EXTENSIONS) {
-            if (fileExtension.equals(ext)) {
-                validExtension = true;
-                break;
-            }
-        }
+        // 检查是否为允许的视频或图片扩展名
+        boolean isValidExtension = Arrays.stream(ALLOWED_VIDEO_EXTENSIONS)
+                .anyMatch(ext -> ext.equals(fileExtension)) ||
+                Arrays.stream(ALLOWED_IMAGE_EXTENSIONS)
+                        .anyMatch(ext -> ext.equals(fileExtension));
 
 
-        // 检查MIME类型
-        boolean validContentType = false;
-        if (contentType != null) {
-            for (String type : ALLOWED_VIDEO_TYPES) {
-                if (contentType.equals(type)) {
-                    validContentType = true;
-                    break;
-                }
-            }
-        }
+        // 检查是否为允许的 MIME 类型
+        boolean isValidContentType = contentType != null &&
+                (Arrays.stream(ALLOWED_VIDEO_TYPES).anyMatch(type -> type.equals(contentType)) ||
+                        Arrays.stream(ALLOWED_IMAGE_TYPES).anyMatch(type -> type.equals(contentType)));
 
 
-        if (!validExtension || !validContentType) {
+        if (!isValidExtension || !isValidContentType) {
             throw new IOException("不支持的文件类型");
             throw new IOException("不支持的文件类型");
         }
         }
     }
     }
-
     /**
     /**
      * 生成唯一的文件名
      * 生成唯一的文件名
      * @param fileExtension 文件扩展名
      * @param fileExtension 文件扩展名

+ 4 - 3
Marketplace/src/main/resources/mapper/VideoMapper.xml

@@ -7,6 +7,7 @@
     <resultMap id="BaseResultMap" type="com.dt.common.domain.Video">
     <resultMap id="BaseResultMap" type="com.dt.common.domain.Video">
             <id property="id" column="id" jdbcType="BIGINT"/>
             <id property="id" column="id" jdbcType="BIGINT"/>
             <result property="title" column="title" jdbcType="VARCHAR"/>
             <result property="title" column="title" jdbcType="VARCHAR"/>
+            <result property="img" column="img" jdbcType="VARCHAR"/>
             <result property="url" column="url" jdbcType="VARCHAR"/>
             <result property="url" column="url" jdbcType="VARCHAR"/>
             <result property="viewCount" column="view_count" jdbcType="INTEGER"/>
             <result property="viewCount" column="view_count" jdbcType="INTEGER"/>
             <result property="likeCount" column="like_count" jdbcType="INTEGER"/>
             <result property="likeCount" column="like_count" jdbcType="INTEGER"/>
@@ -16,8 +17,8 @@
     </resultMap>
     </resultMap>
 
 
     <sql id="Base_Column_List">
     <sql id="Base_Column_List">
-        id,title,url,
-        view_count,like_count,comment_count,
-        favorites_count,is_featured
+        id,title,img,
+        url,view_count,like_count,
+        comment_count,favorites_count,is_featured
     </sql>
     </sql>
 </mapper>
 </mapper>

Some files were not shown because too many files changed in this diff