Prechádzať zdrojové kódy

增加应用下拉选接口

marxjaw 3 mesiacov pred
rodič
commit
d71633ddb8

+ 17 - 0
yt-middle/middle-platform/src/main/java/com/ytpm/middle/controller/DropdownController.java

@@ -2,13 +2,16 @@ package com.ytpm.middle.controller;
 
 import com.ytpm.general.Result;
 import com.ytpm.general.ResultTable;
+import com.ytpm.middle.service.AppService;
 import com.ytpm.middle.service.DeptService;
 import com.ytpm.middle.service.PermissionService;
+import com.ytpm.middle.service.RoleService;
 import com.ytpm.middle.view.DropDownVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
@@ -23,6 +26,8 @@ public class DropdownController {
     private DeptService deptService;
     @Resource
     private PermissionService permissionService;
+    @Resource
+    private AppService appService;
 
     @ApiOperation("查询部门树形菜单")
     @GetMapping("/deptTree")
@@ -35,4 +40,16 @@ public class DropdownController {
     public ResultTable<DropDownVO> permissionDropList() {
         return permissionService.permissionDropList();
     }
+
+    @ApiOperation("查询上架应用列表")
+    @GetMapping("/getIssuedAppList")
+    public ResultTable<DropDownVO> getIssuedAppList() {
+        return appService.getIssuedAppList();
+    }
+
+    @ApiOperation("根据上级应用获取apk包")
+    @GetMapping("/getApkList")
+    public ResultTable<DropDownVO> getApkList(@RequestParam(name = "appId")String appId) {
+        return appService.getApkList(appId);
+    }
 }

+ 10 - 1
yt-middle/middle-platform/src/main/java/com/ytpm/middle/dao/AppMapper.java

@@ -3,6 +3,7 @@ package com.ytpm.middle.dao;
 import com.ytpm.agent.model.YtPlatformUserApp;
 import com.ytpm.middle.param.AppListParam;
 import com.ytpm.middle.view.AppListVO;
+import com.ytpm.middle.view.DropDownVO;
 import org.apache.ibatis.annotations.Param;
 import org.mapstruct.Mapper;
 
@@ -36,7 +37,15 @@ public interface AppMapper {
 
     /**
      * 修改app信息
-     * @param app
      */
     void updateById(YtPlatformUserApp app);
+
+    /**
+     * 查询上架应用
+     */
+    List<DropDownVO> getIssuedAppList();
+    /**
+     * 根据上级应用获取apk包
+     */
+    List<DropDownVO> getApkList(@Param("appId") String appId);
 }

+ 11 - 0
yt-middle/middle-platform/src/main/java/com/ytpm/middle/service/AppService.java

@@ -6,6 +6,7 @@ import com.ytpm.middle.param.AppForm;
 import com.ytpm.middle.param.AppListParam;
 import com.ytpm.middle.param.GrantAppParam;
 import com.ytpm.middle.view.AppListVO;
+import com.ytpm.middle.view.DropDownVO;
 
 public interface AppService {
     /**
@@ -29,4 +30,14 @@ public interface AppService {
      * 修改上架应用信息
      */
     Result<String> updateApp(AppForm form);
+
+    /**
+     * 查询上架应用
+     */
+    ResultTable<DropDownVO> getIssuedAppList();
+
+    /**
+     * 根据上级应用获取apk包
+     */
+    ResultTable<DropDownVO> getApkList(String appId);
 }

+ 17 - 2
yt-middle/middle-platform/src/main/java/com/ytpm/middle/service/impl/AppServiceImpl.java

@@ -1,6 +1,5 @@
 package com.ytpm.middle.service.impl;
 
-import cn.hutool.core.util.IdUtil;
 import cn.hutool.core.util.StrUtil;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
@@ -8,7 +7,6 @@ import com.ytpm.agent.model.YtPlatformUserApp;
 import com.ytpm.general.RepMessage;
 import com.ytpm.general.Result;
 import com.ytpm.general.ResultTable;
-import com.ytpm.middle.dao.AgentMapper;
 import com.ytpm.middle.dao.AppMapper;
 import com.ytpm.middle.dao.EnterpriseMapper;
 import com.ytpm.middle.model.YtMiddleEnterprise;
@@ -17,6 +15,7 @@ import com.ytpm.middle.param.AppListParam;
 import com.ytpm.middle.param.GrantAppParam;
 import com.ytpm.middle.service.AppService;
 import com.ytpm.middle.view.AppListVO;
+import com.ytpm.middle.view.DropDownVO;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 
@@ -105,4 +104,20 @@ public class AppServiceImpl implements AppService {
         appMapper.updateById(app);
         return Result.resultOk(RepMessage.GRANT_SUCCESS);
     }
+
+    /**
+     * 查询上架应用
+     */
+    @Override
+    public ResultTable<DropDownVO> getIssuedAppList() {
+        return ResultTable.resultTableOk(new PageInfo<>(appMapper.getIssuedAppList()));
+    }
+
+    /**
+     * 根据上级应用获取apk包
+     */
+    @Override
+    public ResultTable<DropDownVO> getApkList(String appId) {
+        return ResultTable.resultTableOk(new PageInfo<DropDownVO>(appMapper.getApkList(appId)));
+    }
 }

+ 14 - 0
yt-middle/middle-platform/src/main/resources/mapper/AppMapper.xml

@@ -124,4 +124,18 @@
         from yt_platform_user_app
         where app_id = #{appId}
     </select>
+    <select id="getIssuedAppList" resultType="com.ytpm.middle.view.DropDownVO">
+        select
+            app_id optionVal,
+            app_name optionName
+        from yt_platform_user_app
+        where available = 1
+    </select>
+    <select id="getApkList" resultType="com.ytpm.middle.view.DropDownVO">
+        select
+            app_id optionVal,
+            app_name optionName
+        from yt_app
+        where superior_id = #{appId}
+    </select>
 </mapper>