Prechádzať zdrojové kódy

新增演示视频是否公开

LinWuTai 11 mesiacov pred
rodič
commit
c9172dbd01

+ 1 - 1
lab-admin/src/main/java/com/ruoyi/asset/controller/TbDemoVideoController.java

@@ -127,7 +127,7 @@ public class TbDemoVideoController extends BaseController
             return error("视频上传失败");
         }
 
-        TbDemoVideo tbDemoVideo = new TbDemoVideo(originalFilename, contentType, byteSize, fileName);
+        TbDemoVideo tbDemoVideo = new TbDemoVideo(originalFilename, contentType, byteSize, fileName, 0);
         tbDemoVideo.setCreateBy(username);
 
         int result = tbDemoVideoService.insertTbDemoVideo(tbDemoVideo);

+ 14 - 0
lab-admin/src/main/java/com/ruoyi/asset/controller/VisitorController.java

@@ -119,4 +119,18 @@ public class VisitorController extends BaseController {
     {
         return AjaxResult.success(noticeService.selectNoticeById(noticeId));
     }
+
+    /**
+     * 公开演示视频
+     *
+     * @param tbDemoVideo
+     * @return
+     */
+    @GetMapping("/demo/video")
+    public TableDataInfo publicDemoVideo(TbDemoVideo tbDemoVideo) {
+        startPage();
+        tbDemoVideo.setIsPublic(1);
+        List<TbDemoVideo> list = demoVideoService.selectTbDemoVideoList(tbDemoVideo);
+        return getDataTable(list);
+    }
 }

+ 11 - 63
lab-admin/src/main/java/com/ruoyi/asset/domain/TbDemoVideo.java

@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 import com.ruoyi.common.annotation.Excel;
@@ -17,7 +19,9 @@ import java.util.Date;
  * @author 原动力
  * @date 2023-05-06
  */
+@EqualsAndHashCode(callSuper = true)
 @TableName("tb_demo_video")
+@Data
 public class TbDemoVideo extends BaseEntity
 {
     private static final long serialVersionUID = 1L;
@@ -48,75 +52,19 @@ public class TbDemoVideo extends BaseEntity
     @TableField("url")
     private String url;
 
+    /** 是否公开 */
+    @Excel(name = "是否公开")
+    @TableField("is_public")
+    private Integer isPublic;
+
     public TbDemoVideo() {
     }
 
-    public TbDemoVideo(String name, String type, String size, String url) {
+    public TbDemoVideo(String name, String type, String size, String url, Integer isPublic) {
         this.name = name;
         this.type = type;
         this.size = size;
         this.url = url;
-    }
-
-    public void setId(Long id)
-    {
-        this.id = id;
-    }
-
-    public Long getId() 
-    {
-        return id;
-    }
-    public void setName(String name) 
-    {
-        this.name = name;
-    }
-
-    public String getName() 
-    {
-        return name;
-    }
-    public void setType(String type) 
-    {
-        this.type = type;
-    }
-
-    public String getType() 
-    {
-        return type;
-    }
-    public void setSize(String size) 
-    {
-        this.size = size;
-    }
-
-    public String getSize() 
-    {
-        return size;
-    }
-    public void setUrl(String url) 
-    {
-        this.url = url;
-    }
-
-    public String getUrl() 
-    {
-        return url;
-    }
-
-    @Override
-    public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("id", getId())
-            .append("name", getName())
-            .append("type", getType())
-            .append("size", getSize())
-            .append("url", getUrl())
-            .append("remark", getRemark())
-            .append("createBy", getCreateBy())
-            .append("createTime", getCreateTime())
-            .append("updateBy", getUpdateBy())
-            .append("updateTime", getUpdateTime())
-            .toString();
+        this.isPublic = isPublic;
     }
 }

+ 1 - 1
lab-admin/src/main/resources/application.yml

@@ -18,7 +18,7 @@ ruoyi:
 # 开发环境配置
 server:
   # 服务器的HTTP端口,默认为8080
-  port: 16061
+  port: 81
   servlet:
     # 应用的访问路径
     context-path: /

+ 5 - 1
lab-admin/src/main/resources/mapper/asset/TbDemoVideoMapper.xml

@@ -10,6 +10,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="type"    column="type"    />
         <result property="size"    column="size"    />
         <result property="url"    column="url"    />
+        <result property="isPublic"    column="is_public"    />
         <result property="remark"    column="remark"    />
         <result property="createBy"    column="create_by"    />
         <result property="createTime"    column="create_time"    />
@@ -18,7 +19,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectTbDemoVideoVo">
-        select id, name, type, size, url, remark, create_by, create_time, update_by, update_time from tb_demo_video
+        select id, name, type, size, url, is_public, remark, create_by, create_time, update_by, update_time from tb_demo_video
     </sql>
 
     <select id="selectTbDemoVideoList" parameterType="TbDemoVideo" resultMap="TbDemoVideoResult">
@@ -42,6 +43,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="type != null and type != ''">type,</if>
             <if test="size != null and size != ''">size,</if>
             <if test="url != null and url != ''">url,</if>
+            <if test="isPublic != null">is_public,</if>
             <if test="remark != null">remark,</if>
             <if test="createBy != null">create_by,</if>
             <if test="createTime != null">create_time,</if>
@@ -53,6 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="type != null and type != ''">#{type},</if>
             <if test="size != null and size != ''">#{size},</if>
             <if test="url != null and url != ''">#{url},</if>
+            <if test="isPublic != null">#{isPublic},</if>
             <if test="remark != null">#{remark},</if>
             <if test="createBy != null">#{createBy},</if>
             <if test="createTime != null">#{createTime},</if>
@@ -68,6 +71,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="type != null and type != ''">type = #{type},</if>
             <if test="size != null and size != ''">size = #{size},</if>
             <if test="url != null and url != ''">url = #{url},</if>
+            <if test="isPublic != null">is_public = #{isPublic},</if>
             <if test="remark != null">remark = #{remark},</if>
             <if test="createBy != null">create_by = #{createBy},</if>
             <if test="createTime != null">create_time = #{createTime},</if>

+ 31 - 0
lab-ui/src/views/asset/demoVideo/index.vue

@@ -90,6 +90,18 @@
       <el-table-column label="视频类型" align="center" prop="type" />
       <el-table-column label="视频大小" align="center" prop="size" />
       <el-table-column label="视频位置" align="center" prop="url" />
+      <el-table-column label="是否公开" align="center">
+        <template slot-scope="scope">
+          <el-switch
+            v-model="scope.row.isPublic"
+            active-color="#13ce66"
+            inactive-color="#ff4949"
+            :active-value="1"
+            :inactive-value="0"
+            @change="onPublic($event,scope.row)">
+          </el-switch>
+        </template>
+      </el-table-column>
       <el-table-column label="备注" align="center" prop="remark" />
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
@@ -161,6 +173,15 @@
         <el-form-item label="视频位置" prop="url">
           <el-input v-model="form.url" placeholder="请输入视频位置" />
         </el-form-item> -->
+        <el-form-item label="是否公开" prop="isPublic">
+          <el-switch
+            v-model="form.isPublic"
+            active-color="#13ce66"
+            inactive-color="#ff4949"
+            :active-value="1"
+            :inactive-value="0">
+          </el-switch>
+        </el-form-item>
         <el-form-item label="备注" prop="remark">
           <el-input v-model="form.remark" placeholder="请输入备注" />
         </el-form-item>
@@ -260,6 +281,7 @@ export default {
         type: null,
         size: null,
         url: null,
+        isPublic: null,
         remark: null,
         createBy: null,
         createTime: null,
@@ -333,7 +355,16 @@ export default {
     onUpload() {
       this.$refs.upload.submit()
     },
+    onPublic(val, row) {
+      this.form = row
+      this.form.isPublic = val
 
+      updateDemoVideo(this.form).then(response => {
+        this.$modal.msgSuccess("修改成功");
+        this.open = false;
+        this.getList();
+      });
+    },
     // 播放视频
     onPlayer(row) {
       this.videoName = '正在播放:' + row.name

+ 1 - 1
lab-ui/vue.config.js

@@ -35,7 +35,7 @@ module.exports = {
     proxy: {
       // detail: https://cli.vuejs.org/config/#devserver-proxy
       [process.env.VUE_APP_BASE_API]: {
-        target: `http://127.0.0.1:16061`, // https://sylwt.top:8080/
+        target: `http://127.0.0.1:81`, // https://sylwt.top:8080/
         changeOrigin: true,
         pathRewrite: {
           ['^' + process.env.VUE_APP_BASE_API]: ''