Commit 3e3f2147 authored by 王晓倩's avatar 王晓倩

设备所属管道关联id

parent 45388b5a
...@@ -7,6 +7,7 @@ import com.zehong.common.core.page.TableDataInfo; ...@@ -7,6 +7,7 @@ import com.zehong.common.core.page.TableDataInfo;
import com.zehong.common.enums.BusinessType; import com.zehong.common.enums.BusinessType;
import com.zehong.common.utils.poi.ExcelUtil; import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.system.domain.TDeviceInfo; import com.zehong.system.domain.TDeviceInfo;
import com.zehong.system.domain.vo.DeviceInfoVo;
import com.zehong.system.service.ITDeviceInfoService; import com.zehong.system.service.ITDeviceInfoService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
...@@ -36,7 +37,7 @@ public class TDeviceInfoController extends BaseController ...@@ -36,7 +37,7 @@ public class TDeviceInfoController extends BaseController
public TableDataInfo list(TDeviceInfo tDeviceInfo) public TableDataInfo list(TDeviceInfo tDeviceInfo)
{ {
startPage(); startPage();
List<TDeviceInfo> list = tDeviceInfoService.selectTDeviceInfoList(tDeviceInfo); List<DeviceInfoVo> list = tDeviceInfoService.selectTDeviceInfoList(tDeviceInfo);
return getDataTable(list); return getDataTable(list);
} }
...@@ -84,8 +85,8 @@ public class TDeviceInfoController extends BaseController ...@@ -84,8 +85,8 @@ public class TDeviceInfoController extends BaseController
@GetMapping("/export") @GetMapping("/export")
public AjaxResult export(TDeviceInfo tDeviceInfo) public AjaxResult export(TDeviceInfo tDeviceInfo)
{ {
List<TDeviceInfo> list = tDeviceInfoService.selectTDeviceInfoList(tDeviceInfo); List<DeviceInfoVo> list = tDeviceInfoService.selectTDeviceInfoList(tDeviceInfo);
ExcelUtil<TDeviceInfo> util = new ExcelUtil<TDeviceInfo>(TDeviceInfo.class); ExcelUtil<DeviceInfoVo> util = new ExcelUtil<DeviceInfoVo>(DeviceInfoVo.class);
return util.exportExcel(list, "设备信息数据"); return util.exportExcel(list, "设备信息数据");
} }
......
...@@ -27,7 +27,7 @@ public class TDeviceInfo extends BaseEntity ...@@ -27,7 +27,7 @@ public class TDeviceInfo extends BaseEntity
/** 所属管道编号 */ /** 所属管道编号 */
@Excel(name = "所属管道编号") @Excel(name = "所属管道编号")
private String pipeCode; private int pipeId;
/** 设备名称 */ /** 设备名称 */
@Excel(name = "设备名称") @Excel(name = "设备名称")
...@@ -109,14 +109,14 @@ public class TDeviceInfo extends BaseEntity ...@@ -109,14 +109,14 @@ public class TDeviceInfo extends BaseEntity
{ {
return enterpriseId; return enterpriseId;
} }
public void setPipeCode(String pipeCode) public void setPipeId(int pipeId)
{ {
this.pipeCode = pipeCode; this.pipeId = pipeId;
} }
public String getPipeCode() public int getPipeId()
{ {
return pipeCode; return pipeId;
} }
public void setDeviceName(String deviceName) public void setDeviceName(String deviceName)
{ {
...@@ -259,7 +259,7 @@ public class TDeviceInfo extends BaseEntity ...@@ -259,7 +259,7 @@ public class TDeviceInfo extends BaseEntity
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("deviceId", getDeviceId()) .append("deviceId", getDeviceId())
.append("enterpriseId", getEnterpriseId()) .append("enterpriseId", getEnterpriseId())
.append("pipeCode", getPipeCode()) .append("pipeCode", getPipeId())
.append("deviceName", getDeviceName()) .append("deviceName", getDeviceName())
.append("deviceCode", getDeviceCode()) .append("deviceCode", getDeviceCode())
.append("deviceAddr", getDeviceAddr()) .append("deviceAddr", getDeviceAddr())
......
package com.zehong.system.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.zehong.common.annotation.Excel;
import com.zehong.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.math.BigDecimal;
import java.util.Date;
/**
* 设备信息对象 t_device_info
*
* @author zehong
* @date 2021-07-09
*/
public class DeviceInfoVo extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 设备id */
private Integer deviceId;
/** 企业id */
@Excel(name = "企业id")
private Integer enterpriseId;
/** 所属管道编号 */
@Excel(name = "所属管道编号")
private int pipeId;
/** 所属管道名称 */
@Excel(name = "所属管道名称")
private String pipeName;
/** 设备名称 */
@Excel(name = "设备名称")
private String deviceName;
/** 设备编号 */
@Excel(name = "设备编号")
private String deviceCode;
/** 所在地址 */
@Excel(name = "所在地址")
private String deviceAddr;
/** 设备型号 */
@Excel(name = "设备型号")
private String deviceModel;
/** 设备类型(1调压阀,2阀门井,3流量计,4压力表) */
@Excel(name = "设备类型")
private String deviceType;
/** 经度 */
@Excel(name = "经度")
private BigDecimal longitude;
/** 纬度 */
@Excel(name = "纬度")
private BigDecimal latitude;
/** 物联网编号 */
@Excel(name = "物联网编号")
private String iotNo;
/** 设备图片路径 */
@Excel(name = "设备图片路径")
private String iconUrl;
/** 联系人 */
@Excel(name = "联系人")
private String linkman;
/** 电话 */
@Excel(name = "电话")
private String phone;
/** 安装时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "安装时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date installationTime;
/** 最后巡检时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "最后巡检时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date inspectionTime;
/** 是否删除 */
@Excel(name = "是否删除")
private String isDel;
/** 备注 */
@Excel(name = "备注")
private String remarks;
public void setDeviceId(Integer deviceId)
{
this.deviceId = deviceId;
}
public Integer getDeviceId()
{
return deviceId;
}
public void setEnterpriseId(Integer enterpriseId)
{
this.enterpriseId = enterpriseId;
}
public Integer getEnterpriseId()
{
return enterpriseId;
}
public int getPipeId() {
return pipeId;
}
public void setPipeId(int pipeId) {
this.pipeId = pipeId;
}
public String getPipeName() {
return pipeName;
}
public void setPipeName(String pipeName) {
this.pipeName = pipeName;
}
public void setDeviceName(String deviceName)
{
this.deviceName = deviceName;
}
public String getDeviceName()
{
return deviceName;
}
public String getDeviceCode() {
return deviceCode;
}
public void setDeviceCode(String deviceCode) {
this.deviceCode = deviceCode;
}
public void setDeviceAddr(String deviceAddr)
{
this.deviceAddr = deviceAddr;
}
public String getDeviceAddr()
{
return deviceAddr;
}
public void setDeviceModel(String deviceModel)
{
this.deviceModel = deviceModel;
}
public String getDeviceModel()
{
return deviceModel;
}
public void setDeviceType(String deviceType)
{
this.deviceType = deviceType;
}
public String getDeviceType()
{
return deviceType;
}
public void setLongitude(BigDecimal longitude)
{
this.longitude = longitude;
}
public BigDecimal getLongitude()
{
return longitude;
}
public void setLatitude(BigDecimal latitude)
{
this.latitude = latitude;
}
public BigDecimal getLatitude()
{
return latitude;
}
public void setIotNo(String iotNo)
{
this.iotNo = iotNo;
}
public String getIotNo()
{
return iotNo;
}
public void setIconUrl(String iconUrl)
{
this.iconUrl = iconUrl;
}
public String getIconUrl()
{
return iconUrl;
}
public void setLinkman(String linkman)
{
this.linkman = linkman;
}
public String getLinkman()
{
return linkman;
}
public void setPhone(String phone)
{
this.phone = phone;
}
public String getPhone()
{
return phone;
}
public void setInstallationTime(Date installationTime)
{
this.installationTime = installationTime;
}
public Date getInstallationTime()
{
return installationTime;
}
public void setInspectionTime(Date inspectionTime)
{
this.inspectionTime = inspectionTime;
}
public Date getInspectionTime()
{
return inspectionTime;
}
public String getIsDel() {
return isDel;
}
public void setIsDel(String isDel) {
this.isDel = isDel;
}
public void setRemarks(String remarks)
{
this.remarks = remarks;
}
public String getRemarks()
{
return remarks;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("deviceId", getDeviceId())
.append("enterpriseId", getEnterpriseId())
.append("pipeId", getPipeId())
.append("pipeName", getPipeName())
.append("deviceName", getDeviceName())
.append("deviceCode", getDeviceCode())
.append("deviceAddr", getDeviceAddr())
.append("deviceModel", getDeviceModel())
.append("deviceType", getDeviceType())
.append("longitude", getLongitude())
.append("latitude", getLatitude())
.append("iotNo", getIotNo())
.append("iconUrl", getIconUrl())
.append("linkman", getLinkman())
.append("phone", getPhone())
.append("installationTime", getInstallationTime())
.append("inspectionTime", getInspectionTime())
.append("remarks", getRemarks())
.toString();
}
}
...@@ -4,6 +4,7 @@ import java.util.List; ...@@ -4,6 +4,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import com.zehong.system.domain.TDeviceInfo; import com.zehong.system.domain.TDeviceInfo;
import com.zehong.system.domain.vo.DeviceInfoVo;
/** /**
* 设备信息Service接口 * 设备信息Service接口
...@@ -27,7 +28,7 @@ public interface ITDeviceInfoService ...@@ -27,7 +28,7 @@ public interface ITDeviceInfoService
* @param tDeviceInfo 设备信息 * @param tDeviceInfo 设备信息
* @return 设备信息集合 * @return 设备信息集合
*/ */
public List<TDeviceInfo> selectTDeviceInfoList(TDeviceInfo tDeviceInfo); public List<DeviceInfoVo> selectTDeviceInfoList(TDeviceInfo tDeviceInfo);
/** /**
* 构建前端所需要下拉树结构 * 构建前端所需要下拉树结构
......
...@@ -3,7 +3,9 @@ package com.zehong.system.service.impl; ...@@ -3,7 +3,9 @@ package com.zehong.system.service.impl;
import java.util.*; import java.util.*;
import com.zehong.system.domain.TPipe; import com.zehong.system.domain.TPipe;
import com.zehong.system.domain.vo.DeviceInfoVo;
import com.zehong.system.mapper.TPipeMapper; import com.zehong.system.mapper.TPipeMapper;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TDeviceInfoMapper; import com.zehong.system.mapper.TDeviceInfoMapper;
...@@ -43,9 +45,25 @@ public class TDeviceInfoServiceImpl implements ITDeviceInfoService ...@@ -43,9 +45,25 @@ public class TDeviceInfoServiceImpl implements ITDeviceInfoService
* @return 设备信息 * @return 设备信息
*/ */
@Override @Override
public List<TDeviceInfo> selectTDeviceInfoList(TDeviceInfo tDeviceInfo) public List<DeviceInfoVo> selectTDeviceInfoList(TDeviceInfo tDeviceInfo)
{ {
return tDeviceInfoMapper.selectTDeviceInfoList(tDeviceInfo); List<DeviceInfoVo> list = new ArrayList<>();
List<TDeviceInfo> deviceInfoList = tDeviceInfoMapper.selectTDeviceInfoList(tDeviceInfo);
if(deviceInfoList.size() != 0){
DeviceInfoVo deviceInfoVo = new DeviceInfoVo();
for(TDeviceInfo device : deviceInfoList){
BeanUtils.copyProperties(device, deviceInfoVo);
TPipe pipe = tPipeMapper.selectTPipeById(device.getPipeId());
deviceInfoVo.setPipeName(pipe.getPipeName());
list.add(deviceInfoVo);
}
}
return list;
} }
/** /**
......
...@@ -7,7 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -7,7 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="TDeviceInfo" id="TDeviceInfoResult"> <resultMap type="TDeviceInfo" id="TDeviceInfoResult">
<result property="deviceId" column="device_id" /> <result property="deviceId" column="device_id" />
<result property="enterpriseId" column="enterprise_id" /> <result property="enterpriseId" column="enterprise_id" />
<result property="pipeCode" column="pipe_code" /> <result property="pipeId" column="pipe_id" />
<result property="deviceName" column="device_name" /> <result property="deviceName" column="device_name" />
<result property="deviceCode" column="device_code" /> <result property="deviceCode" column="device_code" />
<result property="deviceAddr" column="device_addr" /> <result property="deviceAddr" column="device_addr" />
...@@ -26,7 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -26,7 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectTDeviceInfoVo"> <sql id="selectTDeviceInfoVo">
select device_id, enterprise_id, pipe_code, device_name, device_code, device_addr, device_model, device_type, longitude, latitude, iot_no, icon_url, linkman, phone, installation_time, inspection_time, is_del, remarks from t_device_info select device_id, enterprise_id, pipe_id, device_name, device_code, device_addr, device_model, device_type, longitude, latitude, iot_no, icon_url, linkman, phone, installation_time, inspection_time, is_del, remarks from t_device_info
</sql> </sql>
<select id="selectTDeviceInfoList" parameterType="TDeviceInfo" resultMap="TDeviceInfoResult"> <select id="selectTDeviceInfoList" parameterType="TDeviceInfo" resultMap="TDeviceInfoResult">
...@@ -34,7 +34,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -34,7 +34,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where> <where>
is_del = '0' is_del = '0'
<if test="enterpriseId != null and enterpriseId != 0 "> and enterprise_id = #{enterpriseId}</if> <if test="enterpriseId != null and enterpriseId != 0 "> and enterprise_id = #{enterpriseId}</if>
<if test="pipeCode != null "> and pipe_code = #{pipeCode}</if> <if test="pipeId != null "> and pipe_id = #{pipeId}</if>
<if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if> <if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if>
<if test="deviceCode != null and deviceCode != ''"> and device_code like concat('%', #{deviceCode}, '%')</if> <if test="deviceCode != null and deviceCode != ''"> and device_code like concat('%', #{deviceCode}, '%')</if>
<if test="deviceAddr != null and deviceAddr != ''"> and device_addr = #{deviceAddr}</if> <if test="deviceAddr != null and deviceAddr != ''"> and device_addr = #{deviceAddr}</if>
...@@ -72,7 +72,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -72,7 +72,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
insert into t_device_info insert into t_device_info
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="enterpriseId != null and enterpriseId != 0">enterprise_id,</if> <if test="enterpriseId != null and enterpriseId != 0">enterprise_id,</if>
<if test="pipeCode != null">pipe_code,</if> <if test="pipeId != null">pipe_id,</if>
<if test="deviceName != null">device_name,</if> <if test="deviceName != null">device_name,</if>
<if test="deviceCode != null">device_code,</if> <if test="deviceCode != null">device_code,</if>
<if test="deviceAddr != null">device_addr,</if> <if test="deviceAddr != null">device_addr,</if>
...@@ -90,7 +90,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -90,7 +90,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="enterpriseId != null and enterpriseId != 0">#{enterpriseId},</if> <if test="enterpriseId != null and enterpriseId != 0">#{enterpriseId},</if>
<if test="pipeCode != null">#{pipeCode},</if> <if test="pipeId != null">#{pipeId},</if>
<if test="deviceName != null">#{deviceName},</if> <if test="deviceName != null">#{deviceName},</if>
<if test="deviceCode != null">#{deviceCode},</if> <if test="deviceCode != null">#{deviceCode},</if>
<if test="deviceAddr != null">#{deviceAddr},</if> <if test="deviceAddr != null">#{deviceAddr},</if>
...@@ -112,7 +112,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -112,7 +112,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update t_device_info update t_device_info
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="enterpriseId != null and enterpriseId != 0">enterprise_id = #{enterpriseId},</if> <if test="enterpriseId != null and enterpriseId != 0">enterprise_id = #{enterpriseId},</if>
<if test="pipeCode != null">pipe_code = #{pipeCode},</if> <if test="pipeId != null">pipe_id = #{pipeId},</if>
<if test="deviceName != null">device_name = #{deviceName},</if> <if test="deviceName != null">device_name = #{deviceName},</if>
<if test="deviceCode != null">device_code = #{deviceCode},</if> <if test="deviceCode != null">device_code = #{deviceCode},</if>
<if test="deviceAddr != null">device_addr = #{deviceAddr},</if> <if test="deviceAddr != null">device_addr = #{deviceAddr},</if>
......
...@@ -8,17 +8,17 @@ ...@@ -8,17 +8,17 @@
<el-form ref="form" :model="form" :rules="rules" label-width="135px"> <el-form ref="form" :model="form" :rules="rules" label-width="135px">
<el-row> <el-row>
<el-col :span="11"> <el-col :span="11">
<el-form-item label="所属管道" prop="pipeCode"> <el-form-item label="所属管道" prop="pipeId">
<el-select <el-select
v-model="form.pipeCode" v-model="form.pipeId"
placeholder="请选择所属管道" placeholder="请选择所属管道"
style="width: 100%" style="width: 100%"
> >
<el-option <el-option
v-for="item in pipeList" v-for="item in pipeList"
:key="item.pipeCode" :key="item.pipeId"
:label="item.pipeName" :label="item.pipeName"
:value="item.pipeCode" :value="item.pipeId"
> >
</el-option> </el-option>
</el-select> </el-select>
...@@ -159,7 +159,7 @@ export default { ...@@ -159,7 +159,7 @@ export default {
fileArr: [], fileArr: [],
pipeList: [], pipeList: [],
rules: { rules: {
pipeCode: [ pipeId: [
{ required: true, message: "请选择所属管道", trigger: "blur" }, { required: true, message: "请选择所属管道", trigger: "blur" },
// { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" }, // { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" },
], ],
......
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