新增用户名 描述信息
Some checks failed
CI Build and Test / build (push) Has been cancelled
Deploy to Server / build-and-deploy (push) Has been cancelled

This commit is contained in:
2025-10-21 14:50:56 +08:00
parent 4ebef69130
commit 8a1ef59a8f
4 changed files with 41 additions and 84 deletions

View File

@@ -116,6 +116,7 @@ Authorization: your-token必填
"data": {
"id": 1,
"userId": 1,
"username": "张三",
"paramName": "默认参数配置",
"deviceName": "我的无人机",
"description": "这是一个测试参数配置",
@@ -164,6 +165,7 @@ GET /params/all/list?fcModel=Pixhawk%204
{
"id": 1,
"userId": 1,
"username": "张三",
"paramName": "默认参数配置",
"deviceName": "我的无人机",
"description": "这是一个测试参数配置",
@@ -219,6 +221,7 @@ GET /params/all/page?current=1&size=10&fcModel=Pixhawk%204
{
"id": 1,
"userId": 1,
"username": "张三",
"paramName": "默认参数配置",
"deviceName": "我的无人机",
"description": "这是一个测试参数配置",
@@ -276,6 +279,7 @@ GET /params/my/list?fcModel=Pixhawk%204
{
"id": 1,
"userId": 1,
"username": "张三",
"paramName": "默认参数配置",
"deviceName": "我的无人机",
"description": "这是一个测试参数配置",

View File

@@ -9,6 +9,7 @@ import com.corewing.app.dto.UpdateParamRequest;
import com.corewing.app.entity.AppParamsCenter;
import com.corewing.app.service.AppParamsCenterService;
import com.corewing.app.util.I18nUtil;
import com.corewing.app.vo.AppParamsCenterVO;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
@@ -124,11 +125,11 @@ public class AppParamsCenterController {
* 根据ID查询参数配置
*/
@GetMapping("/{id}")
public Result<AppParamsCenter> getById(@PathVariable Long id) {
public Result<AppParamsCenterVO> getById(@PathVariable Long id) {
try {
Long userId = StpUtil.getLoginIdAsLong();
AppParamsCenter params = paramsService.getById(id);
AppParamsCenterVO params = paramsService.getVOById(id);
if (params == null) {
return Result.error(I18nUtil.getMessage("params.not.found"));
}
@@ -146,9 +147,9 @@ public class AppParamsCenterController {
* 查询所有参数列表(公开接口,支持飞控型号过滤)
*/
@GetMapping("/all/list")
public Result<List<AppParamsCenter>> listAll(@RequestParam(required = false) String fcModel) {
public Result<List<AppParamsCenterVO>> listAll(@RequestParam(required = false) String fcModel) {
try {
List<AppParamsCenter> list = paramsService.listAllByFcModel(fcModel);
List<AppParamsCenterVO> list = paramsService.listAllByFcModel(fcModel);
return Result.success(list);
} catch (Exception e) {
return Result.error(e.getMessage());
@@ -159,10 +160,10 @@ public class AppParamsCenterController {
* 查询当前用户的参数列表(支持飞控型号过滤)
*/
@GetMapping("/my/list")
public Result<List<AppParamsCenter>> listMy(@RequestParam(required = false) String fcModel) {
public Result<List<AppParamsCenterVO>> listMy(@RequestParam(required = false) String fcModel) {
try {
Long userId = StpUtil.getLoginIdAsLong();
List<AppParamsCenter> list = paramsService.listByUserIdAndFcModel(userId, fcModel);
List<AppParamsCenterVO> list = paramsService.listByUserIdAndFcModel(userId, fcModel);
return Result.success(list);
} catch (Exception e) {
return Result.error(e.getMessage());
@@ -173,13 +174,13 @@ public class AppParamsCenterController {
* 分页查询所有参数列表(公开接口,支持飞控型号过滤)
*/
@GetMapping("/all/page")
public Result<IPage<AppParamsCenter>> pageAll(
public Result<IPage<AppParamsCenterVO>> pageAll(
@RequestParam(defaultValue = "1") Long current,
@RequestParam(defaultValue = "10") Long size,
@RequestParam(required = false) String fcModel) {
try {
Page<AppParamsCenter> page = new Page<>(current, size);
IPage<AppParamsCenter> result = paramsService.pageAllByFcModel(fcModel, page);
Page<AppParamsCenterVO> page = new Page<>(current, size);
IPage<AppParamsCenterVO> result = paramsService.pageAllByFcModel(fcModel, page);
return Result.success(result);
} catch (Exception e) {
return Result.error(e.getMessage());
@@ -190,14 +191,14 @@ public class AppParamsCenterController {
* 分页查询当前用户的参数列表(支持飞控型号过滤)
*/
@GetMapping("/my/page")
public Result<IPage<AppParamsCenter>> pageMy(
public Result<IPage<AppParamsCenterVO>> pageMy(
@RequestParam(defaultValue = "1") Long current,
@RequestParam(defaultValue = "10") Long size,
@RequestParam(required = false) String fcModel) {
try {
Long userId = StpUtil.getLoginIdAsLong();
Page<AppParamsCenter> page = new Page<>(current, size);
IPage<AppParamsCenter> result = paramsService.pageByUserIdAndFcModel(userId, fcModel, page);
Page<AppParamsCenterVO> page = new Page<>(current, size);
IPage<AppParamsCenterVO> result = paramsService.pageByUserIdAndFcModel(userId, fcModel, page);
return Result.success(result);
} catch (Exception e) {
return Result.error(e.getMessage());

View File

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.corewing.app.entity.AppParamsCenter;
import com.corewing.app.vo.AppParamsCenterVO;
import java.util.List;
@@ -13,62 +14,46 @@ import java.util.List;
public interface AppParamsCenterService extends IService<AppParamsCenter> {
/**
* 根据用户ID查询参数列表
* 根据ID查询参数VO带用户名
*
* @param userId 用户ID
* @return 参数列表
* @param id 参数ID
* @return 参数VO
*/
List<AppParamsCenter> listByUserId(Long userId);
AppParamsCenterVO getVOById(Long id);
/**
* 根据用户ID和飞控型号查询参数列表
* 根据用户ID和飞控型号查询参数列表(带用户名)
*
* @param userId 用户ID
* @param fcModel 飞控型号
* @return 参数列表
*/
List<AppParamsCenter> listByUserIdAndFcModel(Long userId, String fcModel);
List<AppParamsCenterVO> listByUserIdAndFcModel(Long userId, String fcModel);
/**
* 分页查询用户的参数列表
*
* @param userId 用户ID
* @param page 分页对象
* @return 分页结果
*/
IPage<AppParamsCenter> pageByUserId(Long userId, Page<AppParamsCenter> page);
/**
* 分页查询用户的参数列表(支持飞控型号过滤)
* 分页查询用户的参数列表(支持飞控型号过滤,带用户名)
*
* @param userId 用户ID
* @param fcModel 飞控型号(可选)
* @param page 分页对象
* @return 分页结果
*/
IPage<AppParamsCenter> pageByUserIdAndFcModel(Long userId, String fcModel, Page<AppParamsCenter> page);
IPage<AppParamsCenterVO> pageByUserIdAndFcModel(Long userId, String fcModel, Page<AppParamsCenterVO> page);
/**
* 查询所有参数列表
*
* @return 参数列表
*/
List<AppParamsCenter> listAll();
/**
* 根据飞控型号查询所有参数列表
* 根据飞控型号查询所有参数列表(带用户名)
*
* @param fcModel 飞控型号
* @return 参数列表
*/
List<AppParamsCenter> listAllByFcModel(String fcModel);
List<AppParamsCenterVO> listAllByFcModel(String fcModel);
/**
* 分页查询所有参数列表(支持飞控型号过滤)
* 分页查询所有参数列表(支持飞控型号过滤,带用户名
*
* @param fcModel 飞控型号(可选)
* @param page 分页对象
* @return 分页结果
*/
IPage<AppParamsCenter> pageAllByFcModel(String fcModel, Page<AppParamsCenter> page);
IPage<AppParamsCenterVO> pageAllByFcModel(String fcModel, Page<AppParamsCenterVO> page);
}

View File

@@ -1,14 +1,13 @@
package com.corewing.app.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.corewing.app.entity.AppParamsCenter;
import com.corewing.app.mapper.AppParamsCenterMapper;
import com.corewing.app.service.AppParamsCenterService;
import com.corewing.app.vo.AppParamsCenterVO;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.List;
@@ -19,59 +18,27 @@ import java.util.List;
public class AppParamsCenterServiceImpl extends ServiceImpl<AppParamsCenterMapper, AppParamsCenter> implements AppParamsCenterService {
@Override
public List<AppParamsCenter> listByUserId(Long userId) {
LambdaQueryWrapper<AppParamsCenter> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(AppParamsCenter::getUserId, userId)
.orderByDesc(AppParamsCenter::getUpdateTime);
return this.list(wrapper);
public AppParamsCenterVO getVOById(Long id) {
return this.baseMapper.selectVOById(id);
}
@Override
public List<AppParamsCenter> listByUserIdAndFcModel(Long userId, String fcModel) {
LambdaQueryWrapper<AppParamsCenter> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(AppParamsCenter::getUserId, userId)
.eq(StringUtils.hasText(fcModel), AppParamsCenter::getFcModel, fcModel)
.orderByDesc(AppParamsCenter::getUpdateTime);
return this.list(wrapper);
public List<AppParamsCenterVO> listByUserIdAndFcModel(Long userId, String fcModel) {
return this.baseMapper.selectVOListByUserId(userId, fcModel);
}
@Override
public IPage<AppParamsCenter> pageByUserId(Long userId, Page<AppParamsCenter> page) {
LambdaQueryWrapper<AppParamsCenter> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(AppParamsCenter::getUserId, userId)
.orderByDesc(AppParamsCenter::getUpdateTime);
return this.page(page, wrapper);
public IPage<AppParamsCenterVO> pageByUserIdAndFcModel(Long userId, String fcModel, Page<AppParamsCenterVO> page) {
return this.baseMapper.selectVOPageByUserId(page, userId, fcModel);
}
@Override
public IPage<AppParamsCenter> pageByUserIdAndFcModel(Long userId, String fcModel, Page<AppParamsCenter> page) {
LambdaQueryWrapper<AppParamsCenter> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(AppParamsCenter::getUserId, userId)
.eq(StringUtils.hasText(fcModel), AppParamsCenter::getFcModel, fcModel)
.orderByDesc(AppParamsCenter::getUpdateTime);
return this.page(page, wrapper);
public List<AppParamsCenterVO> listAllByFcModel(String fcModel) {
return this.baseMapper.selectAllVOList(fcModel);
}
@Override
public List<AppParamsCenter> listAll() {
LambdaQueryWrapper<AppParamsCenter> wrapper = new LambdaQueryWrapper<>();
wrapper.orderByDesc(AppParamsCenter::getUpdateTime);
return this.list(wrapper);
}
@Override
public List<AppParamsCenter> listAllByFcModel(String fcModel) {
LambdaQueryWrapper<AppParamsCenter> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(StringUtils.hasText(fcModel), AppParamsCenter::getFcModel, fcModel)
.orderByDesc(AppParamsCenter::getUpdateTime);
return this.list(wrapper);
}
@Override
public IPage<AppParamsCenter> pageAllByFcModel(String fcModel, Page<AppParamsCenter> page) {
LambdaQueryWrapper<AppParamsCenter> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(StringUtils.hasText(fcModel), AppParamsCenter::getFcModel, fcModel)
.orderByDesc(AppParamsCenter::getUpdateTime);
return this.page(page, wrapper);
public IPage<AppParamsCenterVO> pageAllByFcModel(String fcModel, Page<AppParamsCenterVO> page) {
return this.baseMapper.selectAllVOPage(page, fcModel);
}
}