Browse Source

fix:点位管理,新增字段方案

master
wangguangyuan 2 weeks ago
parent
commit
83a23dc8a0
9 changed files with 133 additions and 30 deletions
  1. +20
    -0
      inspect-metadata/src/main/java/com/inspect/metadata/area/domain/BaseDataArea.java
  2. +3
    -0
      inspect-metadata/src/main/java/com/inspect/metadata/patrolpointmnt/controller/BasedataPatrolPointController.java
  3. +32
    -0
      inspect-metadata/src/main/java/com/inspect/metadata/patrolpointmnt/domain/BasedataPatrolPoint.java
  4. +2
    -2
      inspect-metadata/src/main/java/com/inspect/metadata/patrolpointmnt/service/impl/BasedataPatrolPointServiceImpl.java
  5. +2
    -0
      inspect-metadata/src/main/java/com/inspect/metadata/prodevmnt/domain/BasedataDevice.java
  6. +37
    -10
      inspect-metadata/src/main/java/com/inspect/metadata/prodevmnt/service/impl/BasedataDeviceServiceImpl.java
  7. +7
    -5
      inspect-metadata/src/main/resources/mapper/area/BaseDataAreaMapper.xml
  8. +23
    -8
      inspect-metadata/src/main/resources/mapper/patrolpointmnt/BasedataPatrolPointMapper.xml
  9. +7
    -5
      inspect-metadata/src/main/resources/mapper/prodevmnt/BasedataDeviceMapper.xml

+ 20
- 0
inspect-metadata/src/main/java/com/inspect/metadata/area/domain/BaseDataArea.java View File

@ -40,7 +40,9 @@ public class BaseDataArea extends BaseEntity {
) )
private String deviceTypeCode; private String deviceTypeCode;
private Long parentId; private Long parentId;
private Long relationParentId ;
private String ancestors; private String ancestors;
private String relationAncestors;
private String orderNum; private String orderNum;
private String status; private String status;
private String delFlag; private String delFlag;
@ -71,6 +73,22 @@ public class BaseDataArea extends BaseEntity {
return this.ancestors; return this.ancestors;
} }
public Long getRelationParentId() {
return relationParentId;
}
public void setRelationParentId(Long relationParentId) {
this.relationParentId = relationParentId;
}
public String getRelationAncestors() {
return relationAncestors;
}
public void setRelationAncestors(String relationAncestors) {
this.relationAncestors = relationAncestors;
}
@NotBlank( @NotBlank(
message = "部门名称不能为空" message = "部门名称不能为空"
) )
@ -149,7 +167,9 @@ public class BaseDataArea extends BaseEntity {
", areaType='" + areaType + '\'' + ", areaType='" + areaType + '\'' +
", deviceTypeCode='" + deviceTypeCode + '\'' + ", deviceTypeCode='" + deviceTypeCode + '\'' +
", parentId=" + parentId + ", parentId=" + parentId +
", relationParentId=" + relationParentId +
", ancestors='" + ancestors + '\'' + ", ancestors='" + ancestors + '\'' +
", relationAncestors='" + relationAncestors + '\'' +
", orderNum='" + orderNum + '\'' + ", orderNum='" + orderNum + '\'' +
", status='" + status + '\'' + ", status='" + status + '\'' +
", delFlag='" + delFlag + '\'' + ", delFlag='" + delFlag + '\'' +


+ 3
- 0
inspect-metadata/src/main/java/com/inspect/metadata/patrolpointmnt/controller/BasedataPatrolPointController.java View File

@ -209,6 +209,9 @@ public class BasedataPatrolPointController extends BaseController {
assert basedataDevice != null; assert basedataDevice != null;
basedataPatrolpoint.setMainDeviceId(basedataDevice.getDeviceId()); basedataPatrolpoint.setMainDeviceId(basedataDevice.getDeviceId());
} }
basedataPatrolpoint.setRelationAreaId(basedataPatrolpoint.getAreaId());
basedataPatrolpoint.setRelationDeviceId(basedataPatrolpoint.getDeviceId());
basedataPatrolpoint.setRelationMainDeviceId(basedataPatrolpoint.getMainDeviceId());
basedataPatrolPointService.insertBasedataPatrolPoint(basedataPatrolpoint); basedataPatrolPointService.insertBasedataPatrolPoint(basedataPatrolpoint);
return null != basedataPatrolpoint.getPatrolPointId() ? AjaxResult.success(basedataPatrolpoint.getPatrolPointId()) : AjaxResult.error("新增异常"); return null != basedataPatrolpoint.getPatrolPointId() ? AjaxResult.success(basedataPatrolpoint.getPatrolPointId()) : AjaxResult.error("新增异常");


+ 32
- 0
inspect-metadata/src/main/java/com/inspect/metadata/patrolpointmnt/domain/BasedataPatrolPoint.java View File

@ -41,10 +41,14 @@ public class BasedataPatrolPoint extends BaseEntity {
name = "主设备id" name = "主设备id"
) )
private Long mainDeviceId; private Long mainDeviceId;
private Long relationMainDeviceId;
@Excel( @Excel(
name = "设备id,真正配置点位的主设备id或者部件id" name = "设备id,真正配置点位的主设备id或者部件id"
) )
private Long deviceId; private Long deviceId;
private Long relationDeviceId;
private String deviceName; private String deviceName;
@Excel( @Excel(
name = "巡检内容" name = "巡检内容"
@ -64,6 +68,7 @@ public class BasedataPatrolPoint extends BaseEntity {
@JsonProperty("stdparolPointId") @JsonProperty("stdparolPointId")
private Long stdParolPointId; private Long stdParolPointId;
private Long areaId; private Long areaId;
private Long relationAreaId;
private String patrolTypeId; private String patrolTypeId;
private String pointImptLevel; private String pointImptLevel;
private String alarmThreshold; private String alarmThreshold;
@ -119,6 +124,30 @@ public class BasedataPatrolPoint extends BaseEntity {
this.patrolpointName = patrolPointName; this.patrolpointName = patrolPointName;
} }
public Long getRelationMainDeviceId() {
return relationMainDeviceId;
}
public void setRelationMainDeviceId(Long relationMainDeviceId) {
this.relationMainDeviceId = relationMainDeviceId;
}
public Long getRelationDeviceId() {
return relationDeviceId;
}
public void setRelationDeviceId(Long relationDeviceId) {
this.relationDeviceId = relationDeviceId;
}
public Long getRelationAreaId() {
return relationAreaId;
}
public void setRelationAreaId(Long relationAreaId) {
this.relationAreaId = relationAreaId;
}
public String getPointTypeName() { public String getPointTypeName() {
return pointTypeName; return pointTypeName;
} }
@ -161,13 +190,16 @@ public class BasedataPatrolPoint extends BaseEntity {
", patrolpointName='" + patrolpointName + '\'' + ", patrolpointName='" + patrolpointName + '\'' +
", deviceTypeId=" + deviceTypeId + ", deviceTypeId=" + deviceTypeId +
", mainDeviceId=" + mainDeviceId + ", mainDeviceId=" + mainDeviceId +
", relationMainDeviceId=" + relationMainDeviceId +
", deviceId=" + deviceId + ", deviceId=" + deviceId +
", relationDeviceId=" + relationDeviceId +
", deviceName='" + deviceName + '\'' + ", deviceName='" + deviceName + '\'' +
", patrolContent='" + patrolContent + '\'' + ", patrolContent='" + patrolContent + '\'' +
", purpose='" + purpose + '\'' + ", purpose='" + purpose + '\'' +
", deleteFlag='" + deleteFlag + '\'' + ", deleteFlag='" + deleteFlag + '\'' +
", stdParolPointId=" + stdParolPointId + ", stdParolPointId=" + stdParolPointId +
", areaId=" + areaId + ", areaId=" + areaId +
", relationAreaId=" + relationAreaId +
", patrolTypeId='" + patrolTypeId + '\'' + ", patrolTypeId='" + patrolTypeId + '\'' +
", pointImptLevel='" + pointImptLevel + '\'' + ", pointImptLevel='" + pointImptLevel + '\'' +
", alarmThreshold='" + alarmThreshold + '\'' + ", alarmThreshold='" + alarmThreshold + '\'' +


+ 2
- 2
inspect-metadata/src/main/java/com/inspect/metadata/patrolpointmnt/service/impl/BasedataPatrolPointServiceImpl.java View File

@ -135,8 +135,8 @@ public class BasedataPatrolPointServiceImpl implements IBasedataPatrolPointServi
public List<BasedataPatrolPoint> selectBasedataMonitorRelationList(BasedataPatrolPoint basedataPatrolpoint) { public List<BasedataPatrolPoint> selectBasedataMonitorRelationList(BasedataPatrolPoint basedataPatrolpoint) {
List<BasedataPatrolPoint> pointList = basedataPatrolpointMapper.selectBasedataMonitorRelationList(basedataPatrolpoint); List<BasedataPatrolPoint> pointList = basedataPatrolpointMapper.selectBasedataMonitorRelationList(basedataPatrolpoint);
logger.info("[META] pointList size: {},pointList: {}", pointList.size(), pointList); logger.info("[META] pointList size: {},pointList: {}", pointList.size(), pointList);
if (null != basedataPatrolpoint.getDeviceId()) {
BasedataDevice basedataDevice = basedataDeviceMapper.selectBasedataDeviceRelationByDeviceId(basedataPatrolpoint.getDeviceId());
if (null != basedataPatrolpoint.getRelationDeviceId()) {
BasedataDevice basedataDevice = basedataDeviceMapper.selectBasedataDeviceRelationByDeviceId(basedataPatrolpoint.getRelationDeviceId());
if(basedataDevice != null) { if(basedataDevice != null) {
basedataPatrolpoint.setDeviceTypeId(basedataDevice.getDeviceTypeId()); basedataPatrolpoint.setDeviceTypeId(basedataDevice.getDeviceTypeId());
List<BasedataPatrolPoint> stdPointList = basedataPatrolpointMapper.selectBasedataMonitorUnionList(basedataPatrolpoint); List<BasedataPatrolPoint> stdPointList = basedataPatrolpointMapper.selectBasedataMonitorUnionList(basedataPatrolpoint);


+ 2
- 0
inspect-metadata/src/main/java/com/inspect/metadata/prodevmnt/domain/BasedataDevice.java View File

@ -56,6 +56,7 @@ public class BasedataDevice extends BaseEntity {
private Long parentId; private Long parentId;
private String ancestors; private String ancestors;
private Long areaId; private Long areaId;
private Long relationAreaId;
@JsonProperty("devicetypeId") @JsonProperty("devicetypeId")
private Long deviceTypeId; private Long deviceTypeId;
@ -103,6 +104,7 @@ public class BasedataDevice extends BaseEntity {
", parentId=" + parentId + ", parentId=" + parentId +
", ancestors='" + ancestors + '\'' + ", ancestors='" + ancestors + '\'' +
", areaId=" + areaId + ", areaId=" + areaId +
", relationAreaId='" + relationAreaId + '\'' +
", deviceTypeId=" + deviceTypeId + ", deviceTypeId=" + deviceTypeId +
", powerMainEquFlag='" + powerMainEquFlag + '\'' + ", powerMainEquFlag='" + powerMainEquFlag + '\'' +
", phyAssetId='" + phyAssetId + '\'' + ", phyAssetId='" + phyAssetId + '\'' +


+ 37
- 10
inspect-metadata/src/main/java/com/inspect/metadata/prodevmnt/service/impl/BasedataDeviceServiceImpl.java View File

@ -461,7 +461,7 @@ public class BasedataDeviceServiceImpl implements IBasedataDeviceService {
List<BasedataPatrolPoint> patrolPoints = basedataPatrolPointMapper.selectBasedataPatrolPointRelationListByDeviceIds(new ArrayList<>(deviceIds)); List<BasedataPatrolPoint> patrolPoints = basedataPatrolPointMapper.selectBasedataPatrolPointRelationListByDeviceIds(new ArrayList<>(deviceIds));
// 按设备ID分组 // 按设备ID分组
Map<Long, List<BasedataPatrolPoint>> devicePatrolMap = patrolPoints.stream() Map<Long, List<BasedataPatrolPoint>> devicePatrolMap = patrolPoints.stream()
.collect(Collectors.groupingBy(BasedataPatrolPoint::getDeviceId));
.collect(Collectors.groupingBy(BasedataPatrolPoint::getRelationDeviceId));
// 递归设置统计值 // 递归设置统计值
setPointNumRelation(treeList, devicePatrolMap); setPointNumRelation(treeList, devicePatrolMap);
@ -514,7 +514,7 @@ public class BasedataDeviceServiceImpl implements IBasedataDeviceService {
List<BasedataPatrolPoint> patrolPoints = basedataPatrolPointMapper.selectBasedataPatrolPointRelationListByDeviceIds(new ArrayList<>(deviceIds)); List<BasedataPatrolPoint> patrolPoints = basedataPatrolPointMapper.selectBasedataPatrolPointRelationListByDeviceIds(new ArrayList<>(deviceIds));
// 按设备ID分组 // 按设备ID分组
Map<Long, List<BasedataPatrolPoint>> devicePatrolMap = patrolPoints.stream() Map<Long, List<BasedataPatrolPoint>> devicePatrolMap = patrolPoints.stream()
.collect(Collectors.groupingBy(BasedataPatrolPoint::getDeviceId));
.collect(Collectors.groupingBy(BasedataPatrolPoint::getRelationDeviceId));
// 递归设置统计值和点位 // 递归设置统计值和点位
setPointNumAndPatrolPoints(treeList, devicePatrolMap); setPointNumAndPatrolPoints(treeList, devicePatrolMap);
@ -526,15 +526,16 @@ public class BasedataDeviceServiceImpl implements IBasedataDeviceService {
HashMap<Long, BasedataDevice> deviceHashMap = new HashMap<>(); HashMap<Long, BasedataDevice> deviceHashMap = new HashMap<>();
List<AreaDeviceTreeSelect> areaVOS = new ArrayList<>(); List<AreaDeviceTreeSelect> areaVOS = new ArrayList<>();
// 根据新的relationParentId和relationAncestors构建树结构
for (BaseDataArea area : areas) { for (BaseDataArea area : areas) {
areaIdList.add(area.getAreaId()); areaIdList.add(area.getAreaId());
areaMap.put(area.getAreaId(), area); areaMap.put(area.getAreaId(), area);
AreaDeviceTreeSelect areaVO = new AreaDeviceTreeSelect(); AreaDeviceTreeSelect areaVO = new AreaDeviceTreeSelect();
areaVO.setDataId(String.valueOf(area.getAreaId())); areaVO.setDataId(String.valueOf(area.getAreaId()));
areaVO.setParentId(String.valueOf(area.getParentId()));
areaVO.setParentId(String.valueOf(area.getRelationParentId()));
areaVO.setAreaId(area.getAreaId()); areaVO.setAreaId(area.getAreaId());
areaVO.setAreaFlag("Yes"); areaVO.setAreaFlag("Yes");
areaVO.setAreaParentId(area.getParentId());
areaVO.setAreaParentId(area.getRelationParentId());
areaVO.setAreaName(area.getAreaName()); areaVO.setAreaName(area.getAreaName());
areaVO.setAreaType(area.getAreaType()); areaVO.setAreaType(area.getAreaType());
areaVOS.add(areaVO); areaVOS.add(areaVO);
@ -544,6 +545,7 @@ public class BasedataDeviceServiceImpl implements IBasedataDeviceService {
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("areaIdList", areaIdList); params.put("areaIdList", areaIdList);
basedataDeviceQuery.setParams(params); basedataDeviceQuery.setParams(params);
// 根据新的relation_area_id查询设备信息构建树结构
List<BasedataDevice> deviceList = this.basedataDeviceMapper.selectBasedataDeviceRelationList(basedataDeviceQuery); List<BasedataDevice> deviceList = this.basedataDeviceMapper.selectBasedataDeviceRelationList(basedataDeviceQuery);
Iterator<BasedataDevice> iterator = deviceList.iterator(); Iterator<BasedataDevice> iterator = deviceList.iterator();
@ -560,10 +562,10 @@ public class BasedataDeviceServiceImpl implements IBasedataDeviceService {
AreaDeviceTreeSelect deviceVO = new AreaDeviceTreeSelect(); AreaDeviceTreeSelect deviceVO = new AreaDeviceTreeSelect();
StringBuilder idBuilder = new StringBuilder(); StringBuilder idBuilder = new StringBuilder();
StringBuilder pIdBuilder = new StringBuilder(); StringBuilder pIdBuilder = new StringBuilder();
this.getAreaDeviceTreeDeviceCode(basedataDevice.getDeviceId(), areaMap, deviceHashMap, idBuilder, pIdBuilder);
this.getAreaDeviceTreeDeviceCodeRelation(basedataDevice.getDeviceId(), areaMap, deviceHashMap, idBuilder, pIdBuilder);
deviceVO.setDataId(idBuilder.toString()); deviceVO.setDataId(idBuilder.toString());
deviceVO.setParentId(pIdBuilder.toString()); deviceVO.setParentId(pIdBuilder.toString());
deviceVO.setAreaId(basedataDevice.getAreaId());
deviceVO.setAreaId(basedataDevice.getRelationAreaId());
deviceVO.setDeviceParentId(basedataDevice.getParentId()); deviceVO.setDeviceParentId(basedataDevice.getParentId());
deviceVO.setDeviceId(basedataDevice.getDeviceId()); deviceVO.setDeviceId(basedataDevice.getDeviceId());
deviceVO.setDeviceName(basedataDevice.getDeviceName()); deviceVO.setDeviceName(basedataDevice.getDeviceName());
@ -596,10 +598,10 @@ public class BasedataDeviceServiceImpl implements IBasedataDeviceService {
areaMap.put(area.getAreaId(), area); areaMap.put(area.getAreaId(), area);
AreaDeviceTreeSelect areaVO = new AreaDeviceTreeSelect(); AreaDeviceTreeSelect areaVO = new AreaDeviceTreeSelect();
areaVO.setDataId(String.valueOf(area.getAreaId())); areaVO.setDataId(String.valueOf(area.getAreaId()));
areaVO.setParentId(String.valueOf(area.getParentId()));
areaVO.setParentId(String.valueOf(area.getRelationParentId()));
areaVO.setAreaId(area.getAreaId()); areaVO.setAreaId(area.getAreaId());
areaVO.setAreaFlag("Yes"); areaVO.setAreaFlag("Yes");
areaVO.setAreaParentId(area.getParentId());
areaVO.setAreaParentId(area.getRelationParentId());
areaVO.setAreaName(area.getAreaName()); areaVO.setAreaName(area.getAreaName());
areaVO.setAreaType(area.getAreaType()); areaVO.setAreaType(area.getAreaType());
areaVOS.add(areaVO); areaVOS.add(areaVO);
@ -625,10 +627,10 @@ public class BasedataDeviceServiceImpl implements IBasedataDeviceService {
AreaDeviceTreeSelect deviceVO = new AreaDeviceTreeSelect(); AreaDeviceTreeSelect deviceVO = new AreaDeviceTreeSelect();
StringBuilder idBuilder = new StringBuilder(); StringBuilder idBuilder = new StringBuilder();
StringBuilder pIdBuilder = new StringBuilder(); StringBuilder pIdBuilder = new StringBuilder();
this.getAreaDeviceTreeDeviceCode(basedataDevice.getDeviceId(), areaMap, deviceHashMap, idBuilder, pIdBuilder);
this.getAreaDeviceTreeDeviceCodeRelation(basedataDevice.getDeviceId(), areaMap, deviceHashMap, idBuilder, pIdBuilder);
deviceVO.setDataId(idBuilder.toString()); deviceVO.setDataId(idBuilder.toString());
deviceVO.setParentId(pIdBuilder.toString()); deviceVO.setParentId(pIdBuilder.toString());
deviceVO.setAreaId(basedataDevice.getAreaId());
deviceVO.setAreaId(basedataDevice.getRelationAreaId());
deviceVO.setDeviceParentId(basedataDevice.getParentId()); deviceVO.setDeviceParentId(basedataDevice.getParentId());
deviceVO.setDeviceId(basedataDevice.getDeviceId()); deviceVO.setDeviceId(basedataDevice.getDeviceId());
deviceVO.setDeviceName(basedataDevice.getDeviceName()); deviceVO.setDeviceName(basedataDevice.getDeviceName());
@ -812,6 +814,31 @@ public class BasedataDeviceServiceImpl implements IBasedataDeviceService {
} }
private void getAreaDeviceTreeDeviceCodeRelation(Long deviceId, HashMap<Long, BaseDataArea> areaMap, HashMap<Long, BasedataDevice> deviceHashMap, StringBuilder idBuilder, StringBuilder pIdBuilder) {
if (deviceHashMap.containsKey(deviceId)) {
BasedataDevice device = deviceHashMap.get(deviceId);
idBuilder.insert(0, "-" + deviceId);
Long parentId = device.getParentId();
Long areaId;
if (deviceId.longValue() == parentId.longValue()) {
areaId = device.getRelationAreaId();
idBuilder.insert(0, areaId);
pIdBuilder.insert(0, areaId);
return;
}
if (deviceHashMap.containsKey(parentId)) {
pIdBuilder.insert(0, "-" + parentId);
this.getAreaDeviceTreeDeviceCodeRelation(parentId, areaMap, deviceHashMap, idBuilder, pIdBuilder);
} else {
areaId = device.getRelationAreaId();
idBuilder.insert(0, areaId);
pIdBuilder.insert(0, areaId);
}
}
}
public List<BaseDataAreaProDeviceVO> getAreaDeviceList(List<BaseDataArea> areas) { public List<BaseDataAreaProDeviceVO> getAreaDeviceList(List<BaseDataArea> areas) {
List<BaseDataAreaProDeviceVO> proDeviceVOS = new ArrayList<>(); List<BaseDataAreaProDeviceVO> proDeviceVOS = new ArrayList<>();
List<BasedataDevice> mainDeviceList = this.basedataDeviceMapper.selectBasedataDeviceMainEquBatchByAreas(areas); List<BasedataDevice> mainDeviceList = this.basedataDeviceMapper.selectBasedataDeviceMainEquBatchByAreas(areas);


+ 7
- 5
inspect-metadata/src/main/resources/mapper/area/BaseDataAreaMapper.xml View File

@ -6,6 +6,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="com.inspect.metadata.area.domain.BaseDataArea" id="BaseDataAreaResult"> <resultMap type="com.inspect.metadata.area.domain.BaseDataArea" id="BaseDataAreaResult">
<id property="areaId" column="area_id" /> <id property="areaId" column="area_id" />
<result property="parentId" column="parent_id" /> <result property="parentId" column="parent_id" />
<result property="relationParentId" column="relation_parent_id" />
<result property="relationAncestors" column="relation_ancestors" />
<result property="ancestors" column="ancestors" /> <result property="ancestors" column="ancestors" />
<result property="areaName" column="area_name" /> <result property="areaName" column="area_name" />
<result property="areaType" column="area_type" /> <result property="areaType" column="area_type" />
@ -74,9 +76,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectAreaRelationList" parameterType="com.inspect.metadata.area.domain.BaseDataArea" resultMap="BaseDataAreaResult"> <select id="selectAreaRelationList" parameterType="com.inspect.metadata.area.domain.BaseDataArea" resultMap="BaseDataAreaResult">
select d.area_id, d.parent_id, d.ancestors, d.area_name, d.area_type, d.order_num, d.status, d.del_flag, d.create_by, d.create_time,d.device_type_code,d.area_addr,d.remark,d.area_code
select d.area_id, d.parent_id, d.relation_parent_id, d.ancestors, d.relation_ancestors, d.area_name, d.area_type, d.order_num, d.status, d.del_flag, d.create_by, d.create_time,d.device_type_code,d.area_addr,d.remark,d.area_code
,d.old_area_id, d.old_parent_id ,d.old_area_id, d.old_parent_id
from basedata_area_relation d
from basedata_area d
where d.del_flag = '0' where d.del_flag = '0'
<if test="areaId != null and areaId != 0"> <if test="areaId != null and areaId != 0">
AND area_id = #{areaId} AND area_id = #{areaId}
@ -135,15 +137,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectAreaRelationById" parameterType="Long" resultMap="BaseDataAreaResult"> <select id="selectAreaRelationById" parameterType="Long" resultMap="BaseDataAreaResult">
select d.area_id, d.parent_id, d.ancestors, d.area_name, d.area_type, d.order_num, d.status, d.del_flag, d.create_by, d.create_time,d.device_type_code,d.area_addr,d.remark,d.area_code select d.area_id, d.parent_id, d.ancestors, d.area_name, d.area_type, d.order_num, d.status, d.del_flag, d.create_by, d.create_time,d.device_type_code,d.area_addr,d.remark,d.area_code
,d.old_area_id, d.old_parent_id ,d.old_area_id, d.old_parent_id
from basedata_area_relation d
from basedata_area d
where area_id = #{areaId} where area_id = #{areaId}
</select> </select>
<update id="updateAreaRelationById"> <update id="updateAreaRelationById">
update update
basedata_area_relation
basedata_area
set set
parent_id = #{toAreaId} , ancestors = concat(#{ancestors}, ',', #{toAreaId})
relation_parent_id = #{toAreaId} , relation_ancestors = concat(#{ancestors}, ',', #{toAreaId})
where area_id = #{areaId} where area_id = #{areaId}
</update> </update>


+ 23
- 8
inspect-metadata/src/main/resources/mapper/patrolpointmnt/BasedataPatrolPointMapper.xml View File

@ -10,7 +10,9 @@
<result property="patrolPointName" column="patrol_point_name"/> <result property="patrolPointName" column="patrol_point_name"/>
<result property="deviceTypeId" column="device_type_id"/> <result property="deviceTypeId" column="device_type_id"/>
<result property="mainDeviceId" column="main_device_id"/> <result property="mainDeviceId" column="main_device_id"/>
<result property="relationMainDeviceId" column="relation_main_device_id"/>
<result property="deviceId" column="device_id"/> <result property="deviceId" column="device_id"/>
<result property="relationDeviceId" column="relation_device_id"/>
<result property="patrolContent" column="patrol_content"/> <result property="patrolContent" column="patrol_content"/>
<result property="purpose" column="purpose"/> <result property="purpose" column="purpose"/>
<result property="createBy" column="create_by"/> <result property="createBy" column="create_by"/>
@ -20,6 +22,7 @@
<result property="deleteFlag" column="delete_flag"/> <result property="deleteFlag" column="delete_flag"/>
<result property="stdParolPointId" column="std_parol_point_id"/> <result property="stdParolPointId" column="std_parol_point_id"/>
<result property="areaId" column="area_id"/> <result property="areaId" column="area_id"/>
<result property="relationAreaId" column="relation_area_id"/>
<result property="pointImptLevel" column="point_impt_level"/> <result property="pointImptLevel" column="point_impt_level"/>
<result property="patrolTypeId" column="patrol_type_id"/> <result property="patrolTypeId" column="patrol_type_id"/>
<result property="alarmThreshold" column="alarm_threshold"/> <result property="alarmThreshold" column="alarm_threshold"/>
@ -161,8 +164,11 @@
patrol_point_name, patrol_point_name,
device_type_id, device_type_id,
main_device_id, main_device_id,
relation_main_device_id,
device_id, device_id,
relation_device_id,
area_id, area_id,
relation_area_id,
patrol_content, patrol_content,
purpose, purpose,
create_by, create_by,
@ -185,8 +191,8 @@
original_main_device_id, original_main_device_id,
alarm_threshold, alarm_threshold,
meter_type meter_type
from basedata_patrolpoint_relation
WHERE device_id IN
from basedata_patrolpoint
WHERE relation_device_id IN
<foreach item="item" collection="deviceIds" open="(" separator="," close=")"> <foreach item="item" collection="deviceIds" open="(" separator="," close=")">
#{item} #{item}
</foreach> </foreach>
@ -236,9 +242,12 @@
a.patrol_point_id, a.patrol_point_id,
a.patrol_point_code, a.patrol_point_code,
a.area_id, a.area_id,
a.relation_area_id,
a.patrol_point_name, a.patrol_point_name,
a.main_device_id, a.main_device_id,
a.relation_main_device_id,
a.device_id, a.device_id,
a.relation_device_id,
a.patrol_content, a.patrol_content,
a.purpose, a.purpose,
a.std_parol_point_id, a.std_parol_point_id,
@ -253,14 +262,14 @@
a.dis_ref_picture_path, a.dis_ref_picture_path,
a.alarm_threshold a.alarm_threshold
FROM FROM
basedata_patrolpoint_relation a
basedata_patrolpoint a
<where> <where>
<if test="patrolPointName != null and patrolPointName != ''">and a.patrol_point_name like concat('%', <if test="patrolPointName != null and patrolPointName != ''">and a.patrol_point_name like concat('%',
#{patrolPointName}, '%') #{patrolPointName}, '%')
</if> </if>
<if test="mainDeviceId != null ">and a.main_device_id = #{mainDeviceId}</if>
<if test="deviceId != null ">and a.device_id = #{deviceId}</if>
<if test="areaId != null ">and a.area_id = #{areaId}</if>
<if test="mainDeviceId != null ">and a.relation_main_device_id = #{mainDeviceId}</if>
<if test="deviceId != null ">and a.relation_device_id = #{deviceId}</if>
<if test="areaId != null ">and a.relation_area_id = #{areaId}</if>
<if test="pointImptLevel != null and pointImptLevel != ''">and a.point_impt_level = #{pointImptLevel}</if> <if test="pointImptLevel != null and pointImptLevel != ''">and a.point_impt_level = #{pointImptLevel}</if>
<if test="patrolTypeId != null and patrolTypeId != ''">and a.patrol_type_id = #{patrolTypeId}</if> <if test="patrolTypeId != null and patrolTypeId != ''">and a.patrol_type_id = #{patrolTypeId}</if>
</where> </where>
@ -343,8 +352,11 @@
<if test="patrolPointName != null and patrolPointName != ''">patrol_point_name,</if> <if test="patrolPointName != null and patrolPointName != ''">patrol_point_name,</if>
<if test="deviceTypeId != null">device_type_id,</if> <if test="deviceTypeId != null">device_type_id,</if>
<if test="mainDeviceId != null">main_device_id,</if> <if test="mainDeviceId != null">main_device_id,</if>
<if test="relationMainDeviceId != null">relation_main_device_id,</if>
<if test="deviceId != null">device_id,</if> <if test="deviceId != null">device_id,</if>
<if test="relationDeviceId != null">relation_device_id,</if>
<if test="areaId != null">area_id,</if> <if test="areaId != null">area_id,</if>
<if test="relationAreaId != null">relation_area_id,</if>
<if test="patrolContent != null">patrol_content,</if> <if test="patrolContent != null">patrol_content,</if>
<if test="purpose != null">purpose,</if> <if test="purpose != null">purpose,</if>
<if test="createBy != null">create_by,</if> <if test="createBy != null">create_by,</if>
@ -373,8 +385,11 @@
<if test="patrolPointName != null and patrolPointName != ''">#{patrolPointName},</if> <if test="patrolPointName != null and patrolPointName != ''">#{patrolPointName},</if>
<if test="deviceTypeId != null">#{deviceTypeId},</if> <if test="deviceTypeId != null">#{deviceTypeId},</if>
<if test="mainDeviceId != null">#{mainDeviceId},</if> <if test="mainDeviceId != null">#{mainDeviceId},</if>
<if test="relationMainDeviceId != null">#{relationMainDeviceId},</if>
<if test="deviceId != null">#{deviceId},</if> <if test="deviceId != null">#{deviceId},</if>
<if test="relationDeviceId != null">#{relationDeviceId},</if>
<if test="areaId != null">#{areaId},</if> <if test="areaId != null">#{areaId},</if>
<if test="relationAreaId != null">#{relationAreaId},</if>
<if test="patrolContent != null">#{patrolContent},</if> <if test="patrolContent != null">#{patrolContent},</if>
<if test="purpose != null">#{purpose},</if> <if test="purpose != null">#{purpose},</if>
<if test="createBy != null">#{createBy},</if> <if test="createBy != null">#{createBy},</if>
@ -436,11 +451,11 @@
</update> </update>
<update id="updateBasedataPatrolPointRelation"> <update id="updateBasedataPatrolPointRelation">
update basedata_patrolpoint_relation set area_id = #{toAreaId} where device_id in (select device_id from basedata_device where device_id = #{deviceId} or parent_id = #{deviceId})
update basedata_patrolpoint set relation_area_id = #{toAreaId} where device_id in (select device_id from basedata_device where device_id = #{deviceId} or parent_id = #{deviceId})
</update> </update>
<update id="batchUpdateBasedataPatrolPointRelation"> <update id="batchUpdateBasedataPatrolPointRelation">
update basedata_patrolpoint_relation set area_id = #{toAreaId},device_id = #{toDeviceId},main_device_id = #{toParentId}
update basedata_patrolpoint set relation_area_id = #{toAreaId},relation_device_id = #{toDeviceId},relation_main_device_id = #{toParentId}
where patrol_point_id in where patrol_point_id in
<foreach item="patrolPointId" collection="patrolPointIds" open="(" separator="," close=")"> <foreach item="patrolPointId" collection="patrolPointIds" open="(" separator="," close=")">
#{patrolPointId} #{patrolPointId}


+ 7
- 5
inspect-metadata/src/main/resources/mapper/prodevmnt/BasedataDeviceMapper.xml View File

@ -12,6 +12,7 @@
<result property="parentId" column="parent_id"/> <result property="parentId" column="parent_id"/>
<result property="ancestors" column="ancestors"/> <result property="ancestors" column="ancestors"/>
<result property="areaId" column="area_id"/> <result property="areaId" column="area_id"/>
<result property="relationAreaId" column="relation_area_id"/>
<result property="areaName" column="area_name"/> <result property="areaName" column="area_name"/>
<result property="deviceTypeId" column="device_type_id"/> <result property="deviceTypeId" column="device_type_id"/>
<result property="deviceTypeName" column="device_type_name"/> <result property="deviceTypeName" column="device_type_name"/>
@ -144,6 +145,7 @@
parent_id, parent_id,
ancestors, ancestors,
area_id, area_id,
relation_area_id,
area_name, area_name,
device_type_id, device_type_id,
device_type_name, device_type_name,
@ -171,7 +173,7 @@
old_parent_id, old_parent_id,
old_area_id, old_area_id,
old_area_name old_area_name
from basedata_device_relation
from basedata_device
<where> <where>
<if test="deviceId != null and deviceId != ''">and device_id = #{deviceId}</if> <if test="deviceId != null and deviceId != ''">and device_id = #{deviceId}</if>
<if test="deviceCode != null and deviceCode != ''">and device_code = #{deviceCode}</if> <if test="deviceCode != null and deviceCode != ''">and device_code = #{deviceCode}</if>
@ -215,7 +217,7 @@
<!-- 区域数组查询 --> <!-- 区域数组查询 -->
<if test="params != null"> <if test="params != null">
<if test="params.areaIdList != null"> <if test="params.areaIdList != null">
and area_id in
and relation_area_id in
<foreach item="item" collection="params.areaIdList" open="(" separator="," close=")"> <foreach item="item" collection="params.areaIdList" open="(" separator="," close=")">
#{item} #{item}
</foreach> </foreach>
@ -493,12 +495,12 @@
create_time, create_time,
update_by, update_by,
update_time, update_time,
order_num
order_num,
old_device_id, old_device_id,
old_parent_id, old_parent_id,
old_area_id, old_area_id,
old_area_name old_area_name
from basedata_device_relation
from basedata_device
where device_id = #{deviceId} where device_id = #{deviceId}
</select> </select>
@ -616,7 +618,7 @@
</update> </update>
<update id="updateBasedataDeviceRelation"> <update id="updateBasedataDeviceRelation">
update basedata_device_relation set area_id = #{toAreaId} where device_id = #{deviceId} or parent_id = #{deviceId}
update basedata_device set relation_area_id = #{toAreaId} where device_id = #{deviceId} or parent_id = #{deviceId}
</update> </update>


Loading…
Cancel
Save