提交增加运维管理
This commit is contained in:
@@ -247,6 +247,8 @@ public class Device extends BaseEntity {
|
||||
* 关联组态,来源产品
|
||||
*/
|
||||
private String guid;
|
||||
|
||||
private Long scadaId;
|
||||
// todo
|
||||
private Long agenciesId;
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.xinda.iot.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.xinda.common.annotation.Excel;
|
||||
import com.xinda.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 机构管网对象 iot_pip
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2025-04-18
|
||||
*/
|
||||
@ApiModel(value = "Pip",description = "机构管网 iot_pip")
|
||||
@Data
|
||||
public class Pip extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 机构ID */
|
||||
@Excel(name = "机构ID")
|
||||
@ApiModelProperty("机构ID")
|
||||
private Long deptId;
|
||||
|
||||
/** 管线JSON */
|
||||
@Excel(name = "管线JSON")
|
||||
@ApiModelProperty("管线JSON")
|
||||
private String pipJson;
|
||||
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import com.xinda.common.core.device.DeviceAndProtocol;
|
||||
import com.xinda.common.core.thingsModel.ThingsModelValuesInput;
|
||||
import com.xinda.iot.domain.Device;
|
||||
import com.xinda.iot.domain.DeviceGroup;
|
||||
import com.xinda.iot.domain.Product;
|
||||
import com.xinda.iot.model.*;
|
||||
import com.xinda.iot.model.ThingsModels.ThingsModelValuesOutput;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@@ -369,6 +370,7 @@ public interface DeviceMapper
|
||||
List<DeviceShortOutput> selectDeviceShortTreeList(Device device);
|
||||
|
||||
List<DeviceShortOutput> selectCamDeviceListByDeviceId(Long deviceId);
|
||||
List<DeviceShortOutput> selectListScadaIdByGuidS(@Param("guidList") List<String> guidList);
|
||||
|
||||
|
||||
Long selectScadaIdByGuid(String guid);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.xinda.iot.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.xinda.iot.domain.Pip;
|
||||
|
||||
/**
|
||||
* 机构管网Mapper接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2025-04-18
|
||||
*/
|
||||
public interface PipMapper
|
||||
{
|
||||
/**
|
||||
* 查询机构管网
|
||||
*
|
||||
* @param deptId 机构管网主键
|
||||
* @return 机构管网
|
||||
*/
|
||||
public Pip selectPipByDeptId(Long deptId);
|
||||
|
||||
/**
|
||||
* 查询机构管网列表
|
||||
*
|
||||
* @param pip 机构管网
|
||||
* @return 机构管网集合
|
||||
*/
|
||||
public List<Pip> selectPipList(Pip pip);
|
||||
|
||||
/**
|
||||
* 新增机构管网
|
||||
*
|
||||
* @param pip 机构管网
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertPip(Pip pip);
|
||||
|
||||
/**
|
||||
* 修改机构管网
|
||||
*
|
||||
* @param pip 机构管网
|
||||
* @return 结果
|
||||
*/
|
||||
public int updatePip(Pip pip);
|
||||
|
||||
/**
|
||||
* 删除机构管网
|
||||
*
|
||||
* @param deptId 机构管网主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deletePipByDeptId(Long deptId);
|
||||
|
||||
/**
|
||||
* 批量删除机构管网
|
||||
*
|
||||
* @param deptIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deletePipByDeptIds(Long[] deptIds);
|
||||
}
|
||||
@@ -74,6 +74,27 @@ public class DeviceAllShortOutput
|
||||
|
||||
private Integer subDeviceCount;
|
||||
|
||||
private Long gwId;
|
||||
|
||||
/** 监控设备名称 */
|
||||
private String gwName;
|
||||
|
||||
public Long getGwId() {
|
||||
return gwId;
|
||||
}
|
||||
|
||||
public void setGwId(Long gwId) {
|
||||
this.gwId = gwId;
|
||||
}
|
||||
|
||||
public String getGwName() {
|
||||
return gwName;
|
||||
}
|
||||
|
||||
public void setGwName(String gwName) {
|
||||
this.gwName = gwName;
|
||||
}
|
||||
|
||||
public Integer getSubDeviceCount() {
|
||||
return subDeviceCount;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.xinda.iot.model.ThingsModels.ThingsModelValueItem;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.xinda.common.annotation.Excel;
|
||||
import com.xinda.iot.model.ThingsModelItem.*;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -136,11 +137,42 @@ public class DeviceShortOutput
|
||||
* 产品guid
|
||||
*/
|
||||
private String guid;
|
||||
private Long scadaId;
|
||||
|
||||
|
||||
private Long groupId;
|
||||
private Long agenciesId;
|
||||
|
||||
private Long gwId;
|
||||
|
||||
/** 监控设备名称 */
|
||||
private String gwName;
|
||||
|
||||
|
||||
public Long getScadaId() {
|
||||
return scadaId;
|
||||
}
|
||||
|
||||
public void setScadaId(Long scadaId) {
|
||||
this.scadaId = scadaId;
|
||||
}
|
||||
|
||||
public Long getGwId() {
|
||||
return gwId;
|
||||
}
|
||||
|
||||
public void setGwId(Long gwId) {
|
||||
this.gwId = gwId;
|
||||
}
|
||||
|
||||
public String getGwName() {
|
||||
return gwName;
|
||||
}
|
||||
|
||||
public void setGwName(String gwName) {
|
||||
this.gwName = gwName;
|
||||
}
|
||||
|
||||
/**
|
||||
* 所属机构
|
||||
* agenciesName
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.xinda.iot.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.xinda.iot.domain.Pip;
|
||||
|
||||
/**
|
||||
* 机构管网Service接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2025-04-18
|
||||
*/
|
||||
public interface IPipService
|
||||
{
|
||||
/**
|
||||
* 查询机构管网
|
||||
*
|
||||
* @param deptId 机构管网主键
|
||||
* @return 机构管网
|
||||
*/
|
||||
public Pip selectPipByDeptId(Long deptId);
|
||||
|
||||
/**
|
||||
* 查询机构管网列表
|
||||
*
|
||||
* @param pip 机构管网
|
||||
* @return 机构管网集合
|
||||
*/
|
||||
public List<Pip> selectPipList(Pip pip);
|
||||
|
||||
/**
|
||||
* 新增机构管网
|
||||
*
|
||||
* @param pip 机构管网
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertPip(Pip pip);
|
||||
|
||||
/**
|
||||
* 修改机构管网
|
||||
*
|
||||
* @param pip 机构管网
|
||||
* @return 结果
|
||||
*/
|
||||
public int updatePip(Pip pip);
|
||||
|
||||
/**
|
||||
* 批量删除机构管网
|
||||
*
|
||||
* @param deptIds 需要删除的机构管网主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deletePipByDeptIds(Long[] deptIds);
|
||||
|
||||
/**
|
||||
* 删除机构管网信息
|
||||
*
|
||||
* @param deptId 机构管网主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deletePipByDeptId(Long deptId);
|
||||
}
|
||||
@@ -2,19 +2,28 @@ package com.xinda.iot.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.xinda.common.core.domain.entity.SysRole;
|
||||
import com.xinda.common.core.domain.entity.SysUser;
|
||||
import com.xinda.common.enums.TopicType;
|
||||
import com.xinda.common.utils.DateUtils;
|
||||
import com.xinda.common.utils.SecurityUtils;
|
||||
import com.xinda.framework.websocket.WebSocketAlertServer;
|
||||
import com.xinda.iot.domain.Device;
|
||||
import com.xinda.iot.model.AlertCountVO;
|
||||
import com.xinda.iot.model.param.DataCenterParam;
|
||||
import com.xinda.iot.model.DeviceAlertCount;
|
||||
import com.xinda.system.mapper.SysUserMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.xinda.iot.mapper.AlertLogMapper;
|
||||
import com.xinda.iot.domain.AlertLog;
|
||||
import com.xinda.iot.service.IAlertLogService;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static com.xinda.common.utils.SecurityUtils.getLoginUser;
|
||||
|
||||
/**
|
||||
@@ -25,9 +34,14 @@ import static com.xinda.common.utils.SecurityUtils.getLoginUser;
|
||||
*/
|
||||
@Service
|
||||
public class AlertLogServiceImpl implements IAlertLogService {
|
||||
@Autowired
|
||||
private WebSocketAlertServer webSocketAlertServer;
|
||||
|
||||
@Autowired
|
||||
private AlertLogMapper alertLogMapper;
|
||||
|
||||
@Resource
|
||||
private SysUserMapper sysUserMapper;
|
||||
/**
|
||||
* 查询设备告警
|
||||
*
|
||||
@@ -142,6 +156,18 @@ public class AlertLogServiceImpl implements IAlertLogService {
|
||||
|
||||
@Override
|
||||
public int insertAlertLogBatch(List<AlertLog> alertLogList) {
|
||||
if(alertLogList.size()>0){
|
||||
Long deptId = sysUserMapper.getDeptUserByUserId(alertLogList.get(0).getUserId()).getDeptId();
|
||||
if (deptId != null) {
|
||||
webSocketAlertServer.sendToUser(deptId, JSON.toJSONString(alertLogList));
|
||||
}
|
||||
}
|
||||
// for(AlertLog alertLog:alertLogList){
|
||||
// Long deptId = sysUserMapper.getDeptUserByUserId(alertLog.getUserId()).getDeptId();
|
||||
// if (deptId != null) {
|
||||
// webSocketAlertServer.sendToUser(deptId, JSON.toJSONString(alertLog));
|
||||
// }
|
||||
// }
|
||||
return alertLogMapper.insertAlertLogBatch(alertLogList);
|
||||
}
|
||||
|
||||
|
||||
@@ -159,6 +159,13 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
if (StringUtils.isEmpty(device.getImgUrl())) {
|
||||
device.setImgUrl(productService.selectImgUrlByProductId(device.getProductId()));
|
||||
}
|
||||
// 组态
|
||||
if(device.getGuid()!=null){
|
||||
Long scadaId = deviceMapper.selectScadaIdByGuid(device.getGuid());
|
||||
if(scadaId !=null) {
|
||||
device.setScadaId(scadaId);
|
||||
}
|
||||
}
|
||||
return device;
|
||||
}
|
||||
|
||||
@@ -583,8 +590,16 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
}
|
||||
|
||||
}
|
||||
// // 组态不是所有人都买了,故单独查询组态信息
|
||||
// List<String> guidList = productList.stream().map(Product::getGuid).collect(Collectors.toList());
|
||||
// 组态不是所有人都买了,故单独查询组态信息
|
||||
List<String> guidList = list.stream().map(DeviceShortOutput::getGuid).collect(Collectors.toList());
|
||||
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(guidList)) {
|
||||
List<DeviceShortOutput> scadaList = deviceMapper.selectListScadaIdByGuidS(guidList);
|
||||
Map<String, Long> map = scadaList.stream().collect(Collectors.toMap(DeviceShortOutput::getGuid, DeviceShortOutput::getScadaId));
|
||||
for (DeviceShortOutput device1 : list) {
|
||||
Long scadaId = map.get(device1.getGuid());
|
||||
device1.setScadaId(scadaId);
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
@@ -614,7 +629,7 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
for (DeviceShortOutput deviceShortOutput : list )
|
||||
{
|
||||
Device sdevice = new Device();
|
||||
sdevice.setGwId(device.getDeviceId());
|
||||
sdevice.setGwId(deviceShortOutput.getDeviceId());
|
||||
sdevice.setDeviceType(3);
|
||||
List<DeviceShortOutput> sipList = deviceMapper.selectDeviceShortList(sdevice);
|
||||
if(sipList.size()>0){
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.xinda.iot.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.xinda.iot.mapper.PipMapper;
|
||||
import com.xinda.iot.domain.Pip;
|
||||
import com.xinda.iot.service.IPipService;
|
||||
|
||||
/**
|
||||
* 机构管网Service业务层处理
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2025-04-18
|
||||
*/
|
||||
@Service
|
||||
public class PipServiceImpl implements IPipService
|
||||
{
|
||||
@Autowired
|
||||
private PipMapper pipMapper;
|
||||
|
||||
/**
|
||||
* 查询机构管网
|
||||
*
|
||||
* @param deptId 机构管网主键
|
||||
* @return 机构管网
|
||||
*/
|
||||
@Override
|
||||
public Pip selectPipByDeptId(Long deptId)
|
||||
{
|
||||
return pipMapper.selectPipByDeptId(deptId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询机构管网列表
|
||||
*
|
||||
* @param pip 机构管网
|
||||
* @return 机构管网
|
||||
*/
|
||||
@Override
|
||||
public List<Pip> selectPipList(Pip pip)
|
||||
{
|
||||
return pipMapper.selectPipList(pip);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增机构管网
|
||||
*
|
||||
* @param pip 机构管网
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertPip(Pip pip)
|
||||
{
|
||||
return pipMapper.insertPip(pip);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改机构管网
|
||||
*
|
||||
* @param pip 机构管网
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updatePip(Pip pip)
|
||||
{
|
||||
// 查询指定部门 ID 的 Pip 对象
|
||||
Pip result = pipMapper.selectPipByDeptId(pip.getDeptId());
|
||||
if (result != null) {
|
||||
return pipMapper.updatePip(pip);
|
||||
}else{
|
||||
return pipMapper.insertPip(pip);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除机构管网
|
||||
*
|
||||
* @param deptIds 需要删除的机构管网主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deletePipByDeptIds(Long[] deptIds)
|
||||
{
|
||||
return pipMapper.deletePipByDeptIds(deptIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除机构管网信息
|
||||
*
|
||||
* @param deptId 机构管网主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deletePipByDeptId(Long deptId)
|
||||
{
|
||||
return pipMapper.deletePipByDeptId(deptId);
|
||||
}
|
||||
}
|
||||
@@ -447,7 +447,7 @@
|
||||
else 1
|
||||
end as is_owner,
|
||||
(select count(*) from iot_device d1 where d1.gw_dev_code = d.serial_number) as sub_device_count,
|
||||
p.protocol_code,p.transport,p.guid,
|
||||
p.protocol_code,p.transport,d.guid,
|
||||
d.group_id,d.agencies_id
|
||||
from iot_device d
|
||||
left join iot_product p on p.product_id=d.product_id
|
||||
@@ -547,7 +547,7 @@
|
||||
else 1
|
||||
end as is_owner,
|
||||
(select count(*) from iot_device d1 where d1.gw_dev_code = d.serial_number) as sub_device_count,
|
||||
p.protocol_code,p.transport,p.guid
|
||||
p.protocol_code,p.transport,d.guid
|
||||
from iot_device d
|
||||
left join iot_product p on p.product_id=d.product_id
|
||||
<if test="groupId != null and groupId !=0 "> left join iot_device_group g on g.device_id=d.device_id </if>
|
||||
@@ -585,7 +585,7 @@
|
||||
else 1
|
||||
end as is_owner,
|
||||
(select count(*) from iot_device d1 where d1.gw_dev_code = d.serial_number) as sub_device_count,
|
||||
p.protocol_code,p.transport,p.guid
|
||||
p.protocol_code,p.transport,d.guid
|
||||
from iot_device d
|
||||
left join iot_product p on p.product_id=d.product_id
|
||||
<if test="groupId != null and groupId !=0 "> left join iot_device_group g on g.device_id=d.device_id </if>
|
||||
@@ -624,7 +624,7 @@
|
||||
else 1
|
||||
end as is_owner,
|
||||
(select count(*) from iot_device d1 where d1.gw_dev_code = d.serial_number) as sub_device_count,
|
||||
p.protocol_code,p.transport,p.guid
|
||||
p.protocol_code,p.transport,d.guid
|
||||
from iot_device d
|
||||
left join iot_product p on p.product_id=d.product_id
|
||||
<if test="groupId != null and groupId !=0 "> left join iot_device_group g on g.device_id=d.device_id </if>
|
||||
@@ -658,7 +658,7 @@
|
||||
d.firmware_version, d.status,d.rssi,d.is_shadow,d.is_simulate ,d.location_way,d.ic_way,d.iccid,d.volt,d.sd,d.pd,d.imei, d.gw_id, d.gw_name,
|
||||
d.things_model_value, d.active_time,d.create_time, if(null = d.img_url or '' = d.img_url, p.img_url, d.img_url) as img_url,
|
||||
(select count(*) from iot_device d1 where d1.gw_dev_code = d.serial_number) as sub_device_count,
|
||||
p.protocol_code,p.transport,p.guid
|
||||
p.protocol_code,p.transport,d.guid
|
||||
from iot_device d
|
||||
left join iot_product p on p.product_id=d.product_id
|
||||
<where>
|
||||
@@ -697,7 +697,7 @@
|
||||
d.img_url,
|
||||
d.summary,
|
||||
d.remark,
|
||||
p.guid,
|
||||
d.guid,
|
||||
d.group_id,
|
||||
d.agencies_id,
|
||||
d.ic_way,
|
||||
@@ -891,6 +891,8 @@
|
||||
<if test="imei != null">imei,</if>
|
||||
<if test="gwId != null">gw_id,</if>
|
||||
<if test="gwName != null">gw_name,</if>
|
||||
<if test="guid != null">guid,</if>
|
||||
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="deviceName != null and deviceName != ''">#{deviceName},</if>
|
||||
@@ -931,13 +933,14 @@
|
||||
<if test="imei != null">#{imei},</if>
|
||||
<if test="gwId != null">#{gwId},</if>
|
||||
<if test="gwName != null">#{gwName},</if>
|
||||
<if test="guid != null">#{guid},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatchDevice" parameterType="com.xinda.iot.domain.Device" useGeneratedKeys="true"
|
||||
keyProperty="deviceId">
|
||||
insert into iot_device (device_name, product_id, product_name, tenant_id, tenant_name, serial_number,
|
||||
firmware_version, rssi, is_shadow, location_way, create_by, create_time,ic_way,iccid,volt,sd,pd,imei, gw_id, gw_name)
|
||||
firmware_version, rssi, is_shadow, location_way, create_by, create_time,ic_way,iccid,volt,sd,pd,imei, gw_id, gw_name,guid)
|
||||
values
|
||||
<foreach collection="deviceList" item="device" separator=",">
|
||||
(#{device.deviceName},
|
||||
@@ -959,7 +962,8 @@
|
||||
#{device.pd}),
|
||||
#{device.imei}),
|
||||
#{device.gwId}),
|
||||
#{device.geName})
|
||||
#{device.geName}),
|
||||
#{device.guid})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
@@ -1004,6 +1008,7 @@
|
||||
<if test="imei != null">imei = #{imei},</if>
|
||||
<if test="gwId != null">gw_id = #{gwId},</if>
|
||||
<if test="gwName != null">gw_name = #{gwName},</if>
|
||||
<if test="guid != null">guid = #{guid},</if>
|
||||
</trim>
|
||||
where device_id = #{deviceId}
|
||||
</update>
|
||||
@@ -1085,6 +1090,7 @@
|
||||
<if test="imei != null">imei = #{imei},</if>
|
||||
<if test="gwId != null">gw_id = #{gwId},</if>
|
||||
<if test="gwName != null">gw_name = #{gwName},</if>
|
||||
<if test="guid != null">guid = #{guid},</if>
|
||||
</trim>
|
||||
where serial_number = #{serialNumber}
|
||||
</update>
|
||||
@@ -1408,5 +1414,17 @@
|
||||
where status = 4
|
||||
and group_id = '0'
|
||||
</update>
|
||||
|
||||
<select id="selectScadaIdByGuid" resultType="Long">
|
||||
select id
|
||||
from scada
|
||||
where guid = #{guid}
|
||||
</select>
|
||||
<select id="selectListScadaIdByGuidS" resultType="com.xinda.iot.model.DeviceShortOutput">
|
||||
select id scadaId, guid
|
||||
from scada
|
||||
where guid in
|
||||
<foreach collection="guidList" item="guid" open="(" separator="," close=")">
|
||||
#{guid}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xinda.iot.mapper.PipMapper">
|
||||
|
||||
<resultMap type="Pip" id="PipResult">
|
||||
<result property="deptId" column="dept_id" />
|
||||
<result property="pipJson" column="pip_json" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectPipVo">
|
||||
select p.dept_id, p.pip_json from iot_pip p
|
||||
</sql>
|
||||
|
||||
<select id="selectPipList" parameterType="Pip" resultMap="PipResult">
|
||||
<include refid="selectPipVo"/>
|
||||
<where>
|
||||
<if test="deptId != null and deptId != 0 ">
|
||||
and
|
||||
( d.dept_id in (SELECT de.dept_id FROM sys_dept de
|
||||
WHERE FIND_IN_SET(#{deptId}, de.ancestors) OR de.dept_id = #{deptId})
|
||||
)
|
||||
</if>
|
||||
<if test="pipJson != null and pipJson != ''"> and p.pip_json = #{pipJson}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectPipByDeptId" parameterType="Long" resultMap="PipResult">
|
||||
<include refid="selectPipVo"/>
|
||||
where p.dept_id = #{deptId}
|
||||
</select>
|
||||
|
||||
<insert id="insertPip" parameterType="Pip">
|
||||
insert into iot_pip
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="deptId != null">dept_id,</if>
|
||||
<if test="pipJson != null">pip_json,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="deptId != null">#{deptId},</if>
|
||||
<if test="pipJson != null">#{pipJson},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updatePip" parameterType="Pip">
|
||||
update iot_pip
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="pipJson != null">pip_json = #{pipJson},</if>
|
||||
</trim>
|
||||
where dept_id = #{deptId}
|
||||
</update>
|
||||
|
||||
<delete id="deletePipByDeptId" parameterType="Long">
|
||||
delete from iot_pip where dept_id = #{deptId}
|
||||
</delete>
|
||||
|
||||
<delete id="deletePipByDeptIds" parameterType="String">
|
||||
delete from iot_pip where dept_id in
|
||||
<foreach item="deptId" collection="array" open="(" separator="," close=")">
|
||||
#{deptId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user