fix: bugfix
This commit is contained in:
parent
b0ce09777f
commit
6b3b286e25
@ -5,7 +5,7 @@ import com.cmvr.common.core.controller.BaseController;
|
||||
import com.cmvr.common.core.domain.AjaxResult;
|
||||
import com.cmvr.common.enums.BusinessType;
|
||||
import com.cmvr.ti.model.domain.TiVehicleConfig;
|
||||
import com.cmvr.ti.model.vo.VehicleConfigTreeVO;
|
||||
import com.cmvr.ti.model.vo.TiVehicleConfigTreeVO;
|
||||
import com.cmvr.ti.service.ITiVehicleConfigService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@ -33,7 +33,7 @@ public class TiVehicleConfigController extends BaseController {
|
||||
@ApiOperation("查询车辆配置列表")
|
||||
@PreAuthorize("@ss.hasPermi('ti:config:list')")
|
||||
@GetMapping("/list")
|
||||
public List<VehicleConfigTreeVO> list() {
|
||||
public List<TiVehicleConfigTreeVO> list() {
|
||||
return tiVehicleConfigService.selectTiVehicleConfigList();
|
||||
}
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@ import com.cmvr.common.core.domain.AjaxResult;
|
||||
import com.cmvr.common.core.page.TableDataInfo;
|
||||
import com.cmvr.common.enums.BusinessType;
|
||||
import com.cmvr.ti.model.domain.TiVehicleFunction;
|
||||
import com.cmvr.ti.model.vo.TiVehicleFunctionVO;
|
||||
import com.cmvr.ti.service.ITiVehicleFunctionService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@ -32,9 +33,9 @@ public class TiVehicleFunctionController extends BaseController {
|
||||
@ApiOperation("查询车机功能列表")
|
||||
@PreAuthorize("@ss.hasPermi('ti:function:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(TiVehicleFunction tiVehicleFunction) {
|
||||
public TableDataInfo list(TiVehicleFunctionVO tiVehicleFunctionVO) {
|
||||
startPage();
|
||||
List<TiVehicleFunction> list = tiVehicleFunctionService.selectTiVehicleFunctionList(tiVehicleFunction);
|
||||
List<TiVehicleFunction> list = tiVehicleFunctionService.selectTiVehicleFunctionList(tiVehicleFunctionVO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
@ -20,9 +20,6 @@ public class TiVehicleFunction extends BaseEntity {
|
||||
@ApiModelProperty("车辆配置ID")
|
||||
private Long vehicleConfigId;
|
||||
|
||||
@ApiModelProperty("所属界面ID")
|
||||
private Long uiId;
|
||||
|
||||
@ApiModelProperty("功能字典键值(sys_dict_data.value)")
|
||||
private String funcKey;
|
||||
|
||||
|
||||
@ -7,8 +7,8 @@ import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@ApiModel("触控交互--车机界面")
|
||||
@Data
|
||||
@ApiModel("触控交互--车机界面")
|
||||
public class TiVehicleUi extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ -8,7 +8,7 @@ import java.util.List;
|
||||
|
||||
@Data
|
||||
@ApiModel("车辆配置树形VO")
|
||||
public class VehicleConfigTreeVO {
|
||||
public class TiVehicleConfigTreeVO {
|
||||
|
||||
@ApiModelProperty("节点ID(对应车辆配置ID)")
|
||||
private Long id;
|
||||
@ -26,5 +26,5 @@ public class VehicleConfigTreeVO {
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty("子节点")
|
||||
private List<VehicleConfigTreeVO> children;
|
||||
private List<TiVehicleConfigTreeVO> children;
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
package com.cmvr.ti.model.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ApiModel("触控交互--车机功能列表查询")
|
||||
public class TiVehicleFunctionVO {
|
||||
|
||||
@ApiModelProperty("车辆配置ID")
|
||||
private Long vehicleConfigId;
|
||||
|
||||
@ApiModelProperty("功能名称")
|
||||
private String funcKey;
|
||||
|
||||
@ApiModelProperty("描述")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty("id数组")
|
||||
private List<String> funcIds;
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
package com.cmvr.ti.service;
|
||||
|
||||
import com.cmvr.ti.model.domain.TiVehicleConfig;
|
||||
import com.cmvr.ti.model.vo.VehicleConfigTreeVO;
|
||||
import com.cmvr.ti.model.vo.TiVehicleConfigTreeVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -20,7 +20,7 @@ public interface ITiVehicleConfigService {
|
||||
/**
|
||||
* 查询车辆配置列表
|
||||
*/
|
||||
public List<VehicleConfigTreeVO> selectTiVehicleConfigList();
|
||||
public List<TiVehicleConfigTreeVO> selectTiVehicleConfigList();
|
||||
|
||||
/**
|
||||
* 新增车辆配置
|
||||
|
||||
@ -2,6 +2,7 @@ package com.cmvr.ti.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.cmvr.ti.model.domain.TiVehicleFunction;
|
||||
import com.cmvr.ti.model.vo.TiVehicleFunctionVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -20,10 +21,10 @@ public interface ITiVehicleFunctionService extends IService<TiVehicleFunction> {
|
||||
/**
|
||||
* 查询车辆功能列表
|
||||
*
|
||||
* @param tiVehicleFunction 车辆功能
|
||||
* @param tiVehicleFunctionVO 车辆功能
|
||||
* @return 列表
|
||||
*/
|
||||
public List<TiVehicleFunction> selectTiVehicleFunctionList(TiVehicleFunction tiVehicleFunction);
|
||||
public List<TiVehicleFunction> selectTiVehicleFunctionList(TiVehicleFunctionVO tiVehicleFunctionVO);
|
||||
|
||||
/**
|
||||
* 新增车辆功能
|
||||
|
||||
@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.cmvr.common.exception.GlobalException;
|
||||
import com.cmvr.ti.mapper.TiVehicleConfigMapper;
|
||||
import com.cmvr.ti.model.domain.TiVehicleConfig;
|
||||
import com.cmvr.ti.model.vo.VehicleConfigTreeVO;
|
||||
import com.cmvr.ti.model.vo.TiVehicleConfigTreeVO;
|
||||
import com.cmvr.ti.service.ITiVehicleConfigService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -34,14 +34,14 @@ public class TiVehicleConfigServiceImpl
|
||||
* 返回树结构:OEM → Model → Version
|
||||
*/
|
||||
@Override
|
||||
public List<VehicleConfigTreeVO> selectTiVehicleConfigList() {
|
||||
public List<TiVehicleConfigTreeVO> selectTiVehicleConfigList() {
|
||||
|
||||
// 1. 获取全部节点
|
||||
List<TiVehicleConfig> list = this.list();
|
||||
|
||||
// 2. 转为 VO
|
||||
List<VehicleConfigTreeVO> treeNodes = list.stream().map(cfg -> {
|
||||
VehicleConfigTreeVO vo = new VehicleConfigTreeVO();
|
||||
List<TiVehicleConfigTreeVO> treeNodes = list.stream().map(cfg -> {
|
||||
TiVehicleConfigTreeVO vo = new TiVehicleConfigTreeVO();
|
||||
vo.setId(cfg.getId());
|
||||
vo.setParentId(cfg.getParentId());
|
||||
vo.setLabel(cfg.getName());
|
||||
@ -57,17 +57,17 @@ public class TiVehicleConfigServiceImpl
|
||||
/**
|
||||
* 标准树构建
|
||||
*/
|
||||
private List<VehicleConfigTreeVO> buildTree(List<VehicleConfigTreeVO> nodes) {
|
||||
Map<Long, VehicleConfigTreeVO> map = nodes.stream()
|
||||
.collect(Collectors.toMap(VehicleConfigTreeVO::getId, n -> n));
|
||||
private List<TiVehicleConfigTreeVO> buildTree(List<TiVehicleConfigTreeVO> nodes) {
|
||||
Map<Long, TiVehicleConfigTreeVO> map = nodes.stream()
|
||||
.collect(Collectors.toMap(TiVehicleConfigTreeVO::getId, n -> n));
|
||||
|
||||
List<VehicleConfigTreeVO> root = new ArrayList<>();
|
||||
List<TiVehicleConfigTreeVO> root = new ArrayList<>();
|
||||
|
||||
for (VehicleConfigTreeVO node : nodes) {
|
||||
for (TiVehicleConfigTreeVO node : nodes) {
|
||||
if (node.getParentId() == 0) {
|
||||
root.add(node);
|
||||
} else {
|
||||
VehicleConfigTreeVO parent = map.get(node.getParentId());
|
||||
TiVehicleConfigTreeVO parent = map.get(node.getParentId());
|
||||
if (parent != null) {
|
||||
if (parent.getChildren() == null) {
|
||||
parent.setChildren(new ArrayList<>());
|
||||
|
||||
@ -1,18 +1,19 @@
|
||||
package com.cmvr.ti.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.cmvr.ti.mapper.TiVehicleFunctionMapper;
|
||||
import com.cmvr.ti.model.domain.TiVehicleFunction;
|
||||
import com.cmvr.ti.model.vo.TiVehicleFunctionVO;
|
||||
import com.cmvr.ti.service.ITiVehicleFunctionService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -28,10 +29,12 @@ public class TiVehicleFunctionServiceImpl extends ServiceImpl<TiVehicleFunctionM
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TiVehicleFunction> selectTiVehicleFunctionList(TiVehicleFunction tiVehicleFunction) {
|
||||
public List<TiVehicleFunction> selectTiVehicleFunctionList(TiVehicleFunctionVO tiVehicleFunctionVO) {
|
||||
LambdaQueryWrapper<TiVehicleFunction> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.like(StrUtil.isNotEmpty(tiVehicleFunction.getFuncKey()), TiVehicleFunction::getFuncKey, tiVehicleFunction.getFuncKey())
|
||||
.like(StrUtil.isNotEmpty(tiVehicleFunction.getRemark()), TiVehicleFunction::getRemark, tiVehicleFunction.getRemark());
|
||||
wrapper.eq(TiVehicleFunction::getVehicleConfigId, tiVehicleFunctionVO.getVehicleConfigId())
|
||||
.in(CollUtil.isNotEmpty(tiVehicleFunctionVO.getFuncIds()),TiVehicleFunction::getId, tiVehicleFunctionVO.getFuncIds())
|
||||
.like(StrUtil.isNotEmpty(tiVehicleFunctionVO.getFuncKey()), TiVehicleFunction::getFuncKey, tiVehicleFunctionVO.getFuncKey())
|
||||
.like(StrUtil.isNotEmpty(tiVehicleFunctionVO.getRemark()), TiVehicleFunction::getRemark, tiVehicleFunctionVO.getRemark());
|
||||
return this.list(wrapper);
|
||||
}
|
||||
|
||||
|
||||
@ -6,14 +6,12 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.cmvr.ti.mapper.TiVehicleUiMapper;
|
||||
import com.cmvr.ti.model.domain.TiVehicleFunction;
|
||||
import com.cmvr.ti.model.domain.TiVehicleUi;
|
||||
import com.cmvr.ti.service.ITiVehicleUiService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -31,7 +29,8 @@ public class TiVehicleUiServiceImpl extends ServiceImpl<TiVehicleUiMapper, TiVeh
|
||||
@Override
|
||||
public List<TiVehicleUi> selectTiVehicleUiList(TiVehicleUi tiVehicleUi) {
|
||||
LambdaQueryWrapper<TiVehicleUi> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.like(StrUtil.isNotEmpty(tiVehicleUi.getUiKey()), TiVehicleUi::getUiKey, tiVehicleUi.getUiKey())
|
||||
wrapper.eq(TiVehicleUi::getVehicleConfigId, tiVehicleUi.getVehicleConfigId())
|
||||
.like(StrUtil.isNotEmpty(tiVehicleUi.getUiKey()), TiVehicleUi::getUiKey, tiVehicleUi.getUiKey())
|
||||
.like(StrUtil.isNotEmpty(tiVehicleUi.getRemark()), TiVehicleUi::getRemark, tiVehicleUi.getRemark());
|
||||
return this.list(wrapper);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user