查询型号返回版本信息功能完善
This commit is contained in:
parent
6d08137305
commit
d46df2ebd9
|
@ -10,9 +10,9 @@ spring:
|
||||||
# username: root
|
# username: root
|
||||||
# password: 123456
|
# password: 123456
|
||||||
master:
|
master:
|
||||||
url: jdbc:mysql://localhost:3306/autosprout?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
url: jdbc:mysql://47.120.68.19:3306/autosprout-dev?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||||
username: root
|
username: root
|
||||||
password: 123456
|
password: d0dbe100b71c1d09
|
||||||
# 从库数据源
|
# 从库数据源
|
||||||
slave:
|
slave:
|
||||||
# 从数据源开关/默认关闭
|
# 从数据源开关/默认关闭
|
||||||
|
|
|
@ -258,6 +258,18 @@ export default {
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
/** 查询版本号 */
|
||||||
|
getVersionByModel(modelId) {
|
||||||
|
listVersion({ modelId: modelId }) // 假设后端支持modelId参数过滤
|
||||||
|
.then(response => {
|
||||||
|
this.versionOptions = response.rows;
|
||||||
|
// 保持当前选择的版本有效性
|
||||||
|
if (this.form.versionId &&
|
||||||
|
!this.versionOptions.some(v => v.versionId === this.form.versionId)) {
|
||||||
|
this.form.versionId = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
/** 查询型号列表列表 */
|
/** 查询型号列表列表 */
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
|
@ -320,17 +332,19 @@ export default {
|
||||||
this.reset();
|
this.reset();
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "添加型号";
|
this.title = "添加型号";
|
||||||
this.loading = true;
|
this.versionOptions = []; // 关键代码
|
||||||
|
|
||||||
},
|
},
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
handleUpdate(row) {
|
handleUpdate(row) {
|
||||||
this.reset();
|
this.reset();
|
||||||
const modelId = row.modelId || this.ids
|
const modelId = row.modelId || this.ids;
|
||||||
getModel(modelId).then(response => {
|
getModel(modelId).then(response => {
|
||||||
this.form = response.data;
|
this.form = response.data;
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "修改型号列表";
|
this.title = "修改型号";
|
||||||
|
|
||||||
|
this.getVersionByModel(modelId); // 关键代码
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
|
|
|
@ -470,6 +470,16 @@ public class AppController extends BaseController
|
||||||
return AjaxResult.success(asDevices);
|
return AjaxResult.success(asDevices);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取型号详情信息
|
||||||
|
*/
|
||||||
|
@GetMapping("/model/{id}")
|
||||||
|
public AjaxResult getModelDetail(@PathVariable Long id)
|
||||||
|
{
|
||||||
|
AsModel asModel = asModelService.selectAsModelDetail(id);
|
||||||
|
return AjaxResult.success(asModel);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 所有型号列表
|
* 所有型号列表
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -2,6 +2,9 @@ package com.ruoyi.device.controller;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.ruoyi.device.domain.AsDeviceVersion;
|
||||||
|
import com.ruoyi.device.service.IAsDeviceVersionService;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
@ -34,6 +37,8 @@ public class AsModelController extends BaseController
|
||||||
@Autowired
|
@Autowired
|
||||||
private IAsModelService asModelService;
|
private IAsModelService asModelService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IAsDeviceVersionService asDeviceVersionService;
|
||||||
/**
|
/**
|
||||||
* 查询型号列表列表
|
* 查询型号列表列表
|
||||||
*/
|
*/
|
||||||
|
@ -66,7 +71,10 @@ public class AsModelController extends BaseController
|
||||||
@GetMapping(value = "/{modelId}")
|
@GetMapping(value = "/{modelId}")
|
||||||
public AjaxResult getInfo(@PathVariable("modelId") Long modelId)
|
public AjaxResult getInfo(@PathVariable("modelId") Long modelId)
|
||||||
{
|
{
|
||||||
return success(asModelService.selectAsModelByModelId(modelId));
|
AsModel asModel = asModelService.selectAsModelByModelId(modelId);
|
||||||
|
List<String> versionList = asDeviceVersionService.selectAsDeviceVersionByModelId(modelId);
|
||||||
|
asModel.setVersionList(versionList);
|
||||||
|
return success(asModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -5,6 +5,8 @@ import lombok.Data;
|
||||||
import com.ruoyi.common.annotation.Excel;
|
import com.ruoyi.common.annotation.Excel;
|
||||||
import com.ruoyi.common.core.domain.BaseEntity;
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 型号列表对象 as_model
|
* 型号列表对象 as_model
|
||||||
*
|
*
|
||||||
|
@ -59,4 +61,10 @@ public class AsModel extends BaseEntity
|
||||||
@Excel(name = "在线率")
|
@Excel(name = "在线率")
|
||||||
private String onlineRate;
|
private String onlineRate;
|
||||||
|
|
||||||
|
@Excel(name = "版本数据")
|
||||||
|
private AsDeviceVersion asDeviceVersion;
|
||||||
|
|
||||||
|
@Excel(name = "版本号集合")
|
||||||
|
private List<String> versionList;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.ruoyi.device.domain.vo;
|
||||||
|
|
||||||
|
import com.ruoyi.common.annotation.Excel;
|
||||||
|
import com.ruoyi.device.domain.AsDeviceVersion;
|
||||||
|
import com.ruoyi.device.domain.AsModel;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class AsModelVO extends AsModel {
|
||||||
|
|
||||||
|
/** 版本信息集合 */
|
||||||
|
@Excel(name = "版本信息集合")
|
||||||
|
private List<AsDeviceVersion> asDeviceVersions;
|
||||||
|
|
||||||
|
}
|
|
@ -66,4 +66,6 @@ public interface AsDeviceVersionMapper extends BaseMapper<AsDeviceVersion>
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteAsDeviceVersionByVersionIds(Long[] versionIds);
|
public int deleteAsDeviceVersionByVersionIds(Long[] versionIds);
|
||||||
|
|
||||||
|
public List<String> selectAsDeviceVersionByModelId(Long modelId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,4 +67,6 @@ public interface IAsDeviceVersionService
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteAsDeviceVersionByVersionId(Long versionId);
|
public int deleteAsDeviceVersionByVersionId(Long versionId);
|
||||||
|
|
||||||
|
public List<String> selectAsDeviceVersionByModelId(Long modelId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,4 +75,6 @@ public interface IAsModelService
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public boolean checkModelUnique(AsModel asModel);
|
public boolean checkModelUnique(AsModel asModel);
|
||||||
|
|
||||||
|
public AsModel selectAsModelDetail(Long modelId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.ruoyi.device.service.impl;
|
package com.ruoyi.device.service.impl;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
@ -107,4 +108,9 @@ public class AsDeviceVersionServiceImpl extends ServiceImpl<AsDeviceVersionMappe
|
||||||
{
|
{
|
||||||
return asDeviceVersionMapper.deleteAsDeviceVersionByVersionId(versionId);
|
return asDeviceVersionMapper.deleteAsDeviceVersionByVersionId(versionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> selectAsDeviceVersionByModelId(Long modelId) {
|
||||||
|
return asDeviceVersionMapper.selectAsDeviceVersionByModelId(modelId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,7 @@ public class AsModelServiceImpl extends ServiceImpl<AsModelMapper, AsModel> impl
|
||||||
@Resource
|
@Resource
|
||||||
private AsDeviceVersionMapper versionMapper;
|
private AsDeviceVersionMapper versionMapper;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询型号列表
|
* 查询型号列表
|
||||||
*
|
*
|
||||||
|
@ -184,4 +185,17 @@ public class AsModelServiceImpl extends ServiceImpl<AsModelMapper, AsModel> impl
|
||||||
}
|
}
|
||||||
return UserConstants.UNIQUE;
|
return UserConstants.UNIQUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取型号详细信息以及对应的版本信息
|
||||||
|
* @param modelId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AsModel selectAsModelDetail(Long modelId) {
|
||||||
|
AsModel asModel = asModelMapper.selectAsModelByModelId(modelId);
|
||||||
|
AsDeviceVersion asDeviceVersion = versionMapper.selectAsDeviceVersionByVersionId(asModel.getVersionId());
|
||||||
|
asModel.setAsDeviceVersion(asDeviceVersion);
|
||||||
|
return asModel;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
v.upgrade_describe
|
v.upgrade_describe
|
||||||
from as_device_version v
|
from as_device_version v
|
||||||
left join as_model m on v.model_id = m.model_id
|
left join as_model m on v.model_id = m.model_id
|
||||||
|
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectAsDeviceVersionList" parameterType="AsDeviceVersion" resultMap="AsDeviceVersionResult">
|
<select id="selectAsDeviceVersionList" parameterType="AsDeviceVersion" resultMap="AsDeviceVersionResult">
|
||||||
|
@ -57,6 +58,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
where v.version = #{version}
|
where v.version = #{version}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectAsDeviceVersionByModelId" resultType="java.lang.String">
|
||||||
|
select adv.version
|
||||||
|
from as_model am
|
||||||
|
left join as_device_version adv on am.model_id = adv.model_id
|
||||||
|
where am.model_id = #{modelId}
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="insertAsDeviceVersion" parameterType="AsDeviceVersion" useGeneratedKeys="true" keyProperty="versionId">
|
<insert id="insertAsDeviceVersion" parameterType="AsDeviceVersion" useGeneratedKeys="true" keyProperty="versionId">
|
||||||
insert into as_device_version
|
insert into as_device_version
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
|
|
@ -42,6 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<include refid="selectAsModelVo"/>
|
<include refid="selectAsModelVo"/>
|
||||||
where model_id = #{modelId}
|
where model_id = #{modelId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="checkModelUnique" parameterType="String" resultMap="AsModelResult">
|
<select id="checkModelUnique" parameterType="String" resultMap="AsModelResult">
|
||||||
select model_id, model from as_model where model = #{model} limit 1
|
select model_id, model from as_model where model = #{model} limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user