ソースを参照

添加直播管理相关内容

tags/正式3.10.0
王宁 1年前
コミット
b9964f6c4b

+ 73
- 0
sapi/src/main/java/com/xhkjedu/sapi/controller/appversion/AppLiveController.java ファイルの表示

@@ -0,0 +1,73 @@
1
+package com.xhkjedu.sapi.controller.appversion;
2
+
3
+import com.github.pagehelper.PageHelper;
4
+import com.github.pagehelper.PageInfo;
5
+import com.xhkjedu.sapi.model.appversion.TAppLive;
6
+import com.xhkjedu.sapi.service.appversion.AppLiveService;
7
+import com.xhkjedu.sapi.vo.appversion.AppversionVo;
8
+import com.xhkjedu.utils.N_Utils;
9
+import com.xhkjedu.utils.PageUtil;
10
+import com.xhkjedu.vo.PageResult;
11
+import com.xhkjedu.vo.ResultVo;
12
+import org.springframework.web.bind.annotation.PostMapping;
13
+import org.springframework.web.bind.annotation.RequestBody;
14
+import org.springframework.web.bind.annotation.RequestMapping;
15
+import org.springframework.web.bind.annotation.RestController;
16
+
17
+import javax.annotation.Resource;
18
+import java.util.List;
19
+
20
+/*
21
+* @Description 直播端(教师+学生)
22
+* @Author WN
23
+* @Date 2023/7/6 10:46:45
24
+*/
25
+@RestController
26
+@RequestMapping("/applive")
27
+public class AppLiveController {
28
+    @Resource
29
+    private AppLiveService appLiveService;
30
+
31
+    @PostMapping("/add")
32
+    public ResultVo add(@RequestBody TAppLive appclient) {
33
+        N_Utils.validation(new Object[]{appclient.getVersionname(),"版本名称",2,
34
+                appclient.getVersioncode(),"版本号",2,appclient.getVersionpath(),"应用文件",2});
35
+        Integer id = appLiveService.save(appclient);
36
+        return new ResultVo(0, "保存成功",id);
37
+    }
38
+
39
+    @PostMapping("/delete")
40
+    public ResultVo delete(@RequestBody TAppLive appclient) {
41
+        N_Utils.validation(new Object[]{appclient.getVersionid(),"版本id",1});
42
+        appLiveService.deleteById(appclient.getVersionid());
43
+        return new ResultVo(0,"删除成功");
44
+    }
45
+
46
+    @PostMapping("/update")
47
+    public ResultVo update(@RequestBody TAppLive appclient) {
48
+        N_Utils.validation(new Object[]{appclient.getVersionid(),"版本id",1});
49
+        appLiveService.update(appclient);
50
+        return new ResultVo(0,"修改成功");
51
+    }
52
+
53
+    @PostMapping("/detail")
54
+    public ResultVo detail(@RequestBody TAppLive appclient) {
55
+        N_Utils.validation(new Object[]{appclient.getVersionid(),"版本id",1});
56
+        TAppLive client = appLiveService.findById(appclient.getVersionid());
57
+        return new ResultVo(0,"获取详情成功",client);
58
+    }
59
+
60
+    @PostMapping("/list")
61
+    public ResultVo list(@RequestBody TAppLive appclient) {
62
+        PageHelper.startPage(appclient.getPage(), appclient.getPageSize());
63
+        List<AppversionVo> list = appLiveService.listAll();
64
+        PageResult pageResult = PageUtil.getPageResult(new PageInfo(list));
65
+        return new ResultVo(0,"获取app版本列表成功",pageResult);
66
+    }
67
+
68
+    @PostMapping("/get_new")
69
+    public ResultVo getNew() {
70
+        TAppLive appclient = appLiveService.getNew();
71
+        return new ResultVo(0,"获取最新app版本成功",appclient);
72
+    }
73
+}

+ 38
- 0
sapi/src/main/java/com/xhkjedu/sapi/mapper/appversion/AppLiveMapper.java ファイルの表示

@@ -0,0 +1,38 @@
1
+package com.xhkjedu.sapi.mapper.appversion;
2
+
3
+import com.xhkjedu.base.TkMapper;
4
+import com.xhkjedu.sapi.model.appversion.TAppLive;
5
+import com.xhkjedu.sapi.vo.appversion.AppversionVo;
6
+import org.apache.ibatis.annotations.Param;
7
+
8
+import java.util.List;
9
+
10
+public interface AppLiveMapper extends TkMapper<TAppLive> {
11
+    /**
12
+     * 获取app版本列表
13
+     * @Param []
14
+     * @return java.util.List<com.xhkjedu.vo.appversion.AppversionVo>
15
+     **/
16
+    List<AppversionVo> listAll();
17
+
18
+    /**
19
+     * 获取最新app版本
20
+     * @Param []
21
+     * @return com.xhkjedu.model.appversion.TApppc
22
+     **/
23
+    TAppLive getNew();
24
+
25
+    /**
26
+     * 获取详情
27
+     * @Param [versionid]
28
+     * @return com.xhkjedu.model.appversion.TApppc
29
+     **/
30
+    TAppLive findById(@Param("versionid") Integer versionid);
31
+
32
+    /**
33
+     * 获取APP文件
34
+     * @Param [versionid]
35
+     * @return java.util.List<java.lang.String>
36
+     **/
37
+    List<String> listApppath(Integer versionid);
38
+}

+ 41
- 0
sapi/src/main/java/com/xhkjedu/sapi/model/appversion/TAppLive.java ファイルの表示

@@ -0,0 +1,41 @@
1
+package com.xhkjedu.sapi.model.appversion;
2
+
3
+import com.xhkjedu.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+
9
+/*
10
+* @Description 直播端
11
+* @Author WN
12
+* @Date 2023/7/6 10:31:59
13
+*/
14
+@Table(name = "t_app_live")
15
+@Data
16
+public class TAppLive extends BaseBean {
17
+    //版本表
18
+    @Id
19
+    private Integer versionid;
20
+
21
+    //构建版
22
+    private Integer versioncode;
23
+
24
+    //版本名称
25
+    private String versionname;
26
+
27
+    //大小字节
28
+    private Integer appsize;
29
+
30
+    //app路径
31
+    private String versionpath;
32
+
33
+    //创建人
34
+    private Integer createid;
35
+
36
+    //创建时间
37
+    private Integer createtime;
38
+
39
+    //版本描述
40
+    private String versioncomm;
41
+}

+ 66
- 0
sapi/src/main/java/com/xhkjedu/sapi/service/appversion/AppLiveService.java ファイルの表示

@@ -0,0 +1,66 @@
1
+package com.xhkjedu.sapi.service.appversion;
2
+
3
+import com.xhkjedu.sapi.listener.MessageSender;
4
+import com.xhkjedu.sapi.mapper.appversion.AppLiveMapper;
5
+import com.xhkjedu.sapi.model.appversion.TAppLive;
6
+import com.xhkjedu.sapi.vo.appversion.AppversionVo;
7
+import com.xhkjedu.utils.N_Utils;
8
+import org.springframework.beans.factory.annotation.Autowired;
9
+import org.springframework.stereotype.Service;
10
+
11
+import javax.annotation.Resource;
12
+import java.util.List;
13
+
14
+/**
15
+ * @author ywx
16
+ * @classname ApppcService
17
+ * @description
18
+ * @date 2021/1/26 11:21
19
+ **/
20
+@Service
21
+public class AppLiveService {
22
+    @Resource
23
+    private AppLiveMapper appLiveMapper;
24
+    @Autowired
25
+    private MessageSender messageSender;
26
+
27
+    //添加
28
+    public Integer save(TAppLive model) {
29
+        model.setCreatetime(N_Utils.getSecondTimestamp());
30
+        appLiveMapper.insertUseGeneratedKeys(model);
31
+        return model.getId();
32
+    }
33
+
34
+    //删除
35
+    public Integer deleteById(Integer versionid) {
36
+        List<String> resourceUrls = appLiveMapper.listApppath(versionid);//获取APP文件
37
+        Integer result = appLiveMapper.deleteByPrimaryKey(versionid);
38
+        if(N_Utils.isListNotEmpty(resourceUrls)){
39
+            messageSender.resourceDel(resourceUrls);//给文件服务器发送mq删除文件
40
+        }
41
+        return result;
42
+    }
43
+
44
+    //修改
45
+    public Integer update(TAppLive model) {
46
+        return appLiveMapper.updateByPrimaryKeySelective(model);
47
+    }
48
+
49
+    //获取详情
50
+    public TAppLive findById(Integer versionid) {
51
+        return appLiveMapper.findById(versionid);
52
+    }
53
+
54
+    //获取列表
55
+    public List <AppversionVo> listAll() {
56
+        return appLiveMapper.listAll();
57
+    }
58
+
59
+    /**
60
+     * 获取最新app版本
61
+     * @Param []
62
+     **/
63
+    public TAppLive getNew() {
64
+        return appLiveMapper.getNew();
65
+    }
66
+}

+ 23
- 0
sapi/src/main/resources/mapper/appversion/AppLiveMapper.xml ファイルの表示

@@ -0,0 +1,23 @@
1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.xhkjedu.sapi.mapper.appversion.AppLiveMapper">
4
+    <!--获取app版本列表-->
5
+    <select id="listAll" resultType="com.xhkjedu.sapi.vo.appversion.AppversionVo">
6
+        select v.versionid,v.versioncode,v.versionname,v.appsize,v.versionpath,v.createtime
7
+        from t_app_live v order by v.createtime desc
8
+    </select>
9
+    <!--获取最新app版本-->
10
+    <select id="getNew" resultType="com.xhkjedu.sapi.model.appversion.TAppLive">
11
+        select v.* from t_app_live v order by v.versioncode desc limit 1
12
+    </select>
13
+    <!--获取详情-->
14
+    <select id="findById" resultType="com.xhkjedu.sapi.model.appversion.TAppLive">
15
+        select v.*,u.username createname
16
+        from t_app_live v left join t_user u on v.createid=u.userid
17
+        where v.versionid=#{versionid} limit 1
18
+    </select>
19
+    <!--获取APP文件-->
20
+    <select id="listApppath" resultType="java.lang.String">
21
+        SELECT versionpath FROM t_app_live WHERE versionid=#{versionid}
22
+    </select>
23
+</mapper>

読み込み中…
キャンセル
保存