Commit e9e89cc2 authored by 王晓倩's avatar 王晓倩

接口查询管道类型、管道压力,设备类型

parent 7a059a08
......@@ -20,7 +20,7 @@ public interface ITDeviceInfoService
* @param deviceId 设备信息ID
* @return 设备信息
*/
public TDeviceInfo selectTDeviceInfoById(int deviceId);
public DeviceInfoVo selectTDeviceInfoById(int deviceId);
/**
* 查询设备信息列表
......
......@@ -2,9 +2,12 @@ package com.zehong.system.service.impl;
import java.util.*;
import com.zehong.common.core.domain.entity.SysDictData;
import com.zehong.common.utils.StringUtils;
import com.zehong.system.domain.TPipe;
import com.zehong.system.domain.vo.DeviceInfoVo;
import com.zehong.system.mapper.TPipeMapper;
import com.zehong.system.service.ISysDictTypeService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -25,6 +28,8 @@ public class TDeviceInfoServiceImpl implements ITDeviceInfoService
private TDeviceInfoMapper tDeviceInfoMapper;
@Autowired
private TPipeMapper tPipeMapper;
@Autowired
private ISysDictTypeService iSysDictTypeService;
/**
* 查询设备信息
......@@ -33,9 +38,22 @@ public class TDeviceInfoServiceImpl implements ITDeviceInfoService
* @return 设备信息
*/
@Override
public TDeviceInfo selectTDeviceInfoById(int deviceId)
public DeviceInfoVo selectTDeviceInfoById(int deviceId)
{
return tDeviceInfoMapper.selectTDeviceInfoById(deviceId);
DeviceInfoVo deviceInfoVo = new DeviceInfoVo();
TDeviceInfo tDeviceInfo = tDeviceInfoMapper.selectTDeviceInfoById(deviceId);
BeanUtils.copyProperties(tDeviceInfo, deviceInfoVo);
if (StringUtils.isNotEmpty(tDeviceInfo.getDeviceType())) {
List<SysDictData> sysDictDataList = iSysDictTypeService.selectDictDataByType("t_device_type");
for (SysDictData sysDictData : sysDictDataList) {
if (tDeviceInfo.getDeviceType().equals(sysDictData.getDictValue())) {
deviceInfoVo.setDeviceType(sysDictData.getDictLabel());
}
}
}
return deviceInfoVo;
}
/**
......@@ -59,6 +77,15 @@ public class TDeviceInfoServiceImpl implements ITDeviceInfoService
TPipe pipe = tPipeMapper.selectTPipeById(device.getPipeId());
deviceInfoVo.setPipeName(pipe.getPipeName());
if (StringUtils.isNotEmpty(device.getDeviceType())) {
List<SysDictData> sysDictDataList = iSysDictTypeService.selectDictDataByType("t_device_type");
for (SysDictData sysDictData : sysDictDataList) {
if (device.getDeviceType().equals(sysDictData.getDictValue())) {
deviceInfoVo.setDeviceType(sysDictData.getDictLabel());
}
}
}
list.add(deviceInfoVo);
}
}
......
package com.zehong.system.service.impl;
import java.util.List;
import com.zehong.common.core.domain.entity.SysDictData;
import com.zehong.common.utils.StringUtils;
import com.zehong.system.service.ISysDictTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TPipeMapper;
......@@ -18,6 +22,8 @@ public class TPipeServiceImpl implements ITPipeService
{
@Autowired
private TPipeMapper tPipeMapper;
@Autowired
private ISysDictTypeService iSysDictTypeService;
/**
* 查询管道信息
......@@ -28,7 +34,24 @@ public class TPipeServiceImpl implements ITPipeService
@Override
public TPipe selectTPipeById(int pipeId)
{
return tPipeMapper.selectTPipeById(pipeId);
TPipe tPipe = tPipeMapper.selectTPipeById(pipeId);
if (StringUtils.isNotEmpty(tPipe.getPipeType())) {
List<SysDictData> sysDictDataList = iSysDictTypeService.selectDictDataByType("t_pipe_type");
for (SysDictData sysDictData : sysDictDataList) {
if (tPipe.getPipeType().equals(sysDictData.getDictValue())) {
tPipe.setPipeType(sysDictData.getDictLabel());
}
}
}
if (StringUtils.isNotEmpty(tPipe.getPipePressure())) {
List<SysDictData> sysDictDataList = iSysDictTypeService.selectDictDataByType("t_pipe_pressure");
for (SysDictData sysDictData : sysDictDataList) {
if (tPipe.getPipePressure().equals(sysDictData.getDictValue())) {
tPipe.setPipePressure(sysDictData.getDictLabel());
}
}
}
return tPipe;
}
/**
......@@ -40,7 +63,33 @@ public class TPipeServiceImpl implements ITPipeService
@Override
public List<TPipe> selectTPipeList(TPipe tPipe)
{
return tPipeMapper.selectTPipeList(tPipe);
List<TPipe> tPipeList = tPipeMapper.selectTPipeList(tPipe);
if(tPipeList.size() != 0){
for(TPipe pipe : tPipeList){
if (StringUtils.isNotEmpty(pipe.getPipeType())) {
List<SysDictData> sysDictDataList = iSysDictTypeService.selectDictDataByType("t_pipe_type");
for (SysDictData sysDictData : sysDictDataList) {
if (pipe.getPipeType().equals(sysDictData.getDictValue())) {
pipe.setPipeType(sysDictData.getDictLabel());
}
}
}
if (StringUtils.isNotEmpty(pipe.getPipePressure())) {
List<SysDictData> sysDictDataList = iSysDictTypeService.selectDictDataByType("t_pipe_pressure");
for (SysDictData sysDictData : sysDictDataList) {
if (pipe.getPipePressure().equals(sysDictData.getDictValue())) {
pipe.setPipePressure(sysDictData.getDictLabel());
}
}
}
}
}
return tPipeList;
}
/**
......
......@@ -86,14 +86,7 @@
<el-table-column label="设备名称" align="center" prop="deviceName" />
<el-table-column label="所属管道" align="center" prop="pipeName" />
<el-table-column label="设备编号" align="center" prop="deviceCode" />
<el-table-column label="设备类型" align="center" prop="deviceType">
<template slot-scope="scope">
<span v-if="scope.row.deviceType == 1">调压箱</span>
<span v-if="scope.row.deviceType == 2">阀门井</span>
<span v-if="scope.row.deviceType == 3">流量计</span>
<span v-if="scope.row.deviceType == 4">智能燃气表</span>
</template>
</el-table-column>
<el-table-column label="设备类型" align="center" prop="deviceType" />
<el-table-column label="设备型号" align="center" prop="deviceModel" />
<el-table-column label="所在地址" align="center" prop="deviceAddr" />
<el-table-column label="安装时间" align="center" prop="installationTime" width="180">
......
......@@ -85,20 +85,8 @@
<el-table v-loading="loading" :data="pipeList" @selection-change="handleSelectionChange">
<el-table-column label="管道名称" align="center" prop="pipeName" />
<el-table-column label="管道编号" align="center" prop="pipeCode" />
<el-table-column label="管道类型" align="center" prop="pipeType" >
<template slot-scope="scope">
<span v-if="scope.row.pipeType == 1">地埋管线</span>
<span v-if="scope.row.pipeType == 2">地表管线</span>
</template>
</el-table-column>
<el-table-column label="管道压力" align="center" prop="pipePressure" >
<template slot-scope="scope">
<span v-if="scope.row.pipePressure == 1">低压</span>
<span v-if="scope.row.pipePressure == 2">中压</span>
<span v-if="scope.row.pipePressure == 3">次高压</span>
<span v-if="scope.row.pipePressure == 4">高压</span>
</template>
</el-table-column>
<el-table-column label="管道类型" align="center" prop="pipeType" />
<el-table-column label="管道压力" align="center" prop="pipePressure" />
<el-table-column label="管道长度" align="center" prop="pipeLength" />
<el-table-column label="所在地址" align="center" prop="pipeAddr" />
<el-table-column label="安装时间" align="center" prop="installationTime" width="180">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment