增加mongodb配置及查询

This commit is contained in:
2025-09-04 18:14:55 +08:00
parent 5d16ba01bd
commit 5ce369db71
7 changed files with 190 additions and 1 deletions

View File

@@ -0,0 +1,37 @@
package com.onekeycall.videotablet.controller;
import com.onekeycall.videotablet.entity.ApkInfo;
import com.onekeycall.videotablet.service.ApkInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/api/apks")
public class ApkInfoController {
@Autowired
private ApkInfoService apkInfoService;
@GetMapping("/device/{deviceId}")
public List<ApkInfo> getApksByDeviceId(@PathVariable String deviceId) {
return apkInfoService.getApkInfosByDeviceId(deviceId);
}
@PostMapping
public ApkInfo saveApkInfo(@RequestBody ApkInfo apkInfo) {
return apkInfoService.saveOrUpdateApkInfo(apkInfo);
}
@PostMapping("/batch")
public List<ApkInfo> saveApkInfos(@RequestBody List<ApkInfo> apkInfos) {
return apkInfoService.saveAllApkInfos(apkInfos);
}
@DeleteMapping("/{packageName}")
public void deleteApkInfo(@PathVariable String packageName) {
apkInfoService.deleteApkInfoByPackageName(packageName);
}
}

View File

@@ -91,7 +91,7 @@ public class LoginController {
return Result.ok().data(Collections.singletonMap("token", tokenPair.toMap()));
} catch (Exception e) {
e.printStackTrace();
return Result.error().message("登录失败");
return Result.error().message("登录失败:密码错误");
}
}