2021与蓝度共同重构项目,服务端
liuhaonan
2022-05-11 7b43c04dd530bdd193e0cf02c4e19ba7c2ee2c11
设备归属
已修改2个文件
34 ■■■■ 文件已修改
dao/src/main/java/com/sandu/ximon/dao/mapper/PoleBindingMapper.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
dao/src/main/resources/mapper/PoleBindingMapper.xml 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
dao/src/main/java/com/sandu/ximon/dao/mapper/PoleBindingMapper.java
@@ -1,7 +1,8 @@
package com.sandu.ximon.dao.mapper;
import com.sandu.ximon.dao.domain.PoleBinding;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sandu.ximon.dao.domain.Pole;
import com.sandu.ximon.dao.domain.PoleBinding;
import org.apache.ibatis.annotations.Mapper;
/**
@@ -10,6 +11,13 @@
@Mapper
public interface PoleBindingMapper extends BaseMapper<PoleBinding> {
    /**
     * 根据绑定关系查询设备归属
     */
    Pole getPoleByBinding(Integer type, String Mac);
}
dao/src/main/resources/mapper/PoleBindingMapper.xml
@@ -5,18 +5,26 @@
<mapper namespace="com.sandu.ximon.dao.mapper.PoleBindingMapper">
    <resultMap id="BaseResultMap" type="com.sandu.ximon.dao.domain.PoleBinding">
            <id property="id" column="id" jdbcType="BIGINT"/>
            <result property="poleId" column="pole_id" jdbcType="BIGINT"/>
            <result property="deviceName" column="device_name" jdbcType="VARCHAR"/>
            <result property="deviceCode" column="device_code" jdbcType="VARCHAR"/>
            <result property="deviceType" column="device_type" jdbcType="INTEGER"/>
            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
            <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
        <id property="id" column="id" jdbcType="BIGINT"/>
        <result property="poleId" column="pole_id" jdbcType="BIGINT"/>
        <result property="deviceName" column="device_name" jdbcType="VARCHAR"/>
        <result property="deviceCode" column="device_code" jdbcType="VARCHAR"/>
        <result property="deviceType" column="device_type" jdbcType="INTEGER"/>
        <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
        <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
    </resultMap>
    <sql id="Base_Column_List">
        id,pole_id,device_name,
        id
        ,pole_id,device_name,
        device_code,device_type,create_time,
        update_time
    </sql>
    <select id="getPoleByBinding" resultType="com.sandu.ximon.dao.domain.Pole">
        SELECT t2.*
        FROM `pole_binding` t1
                 LEFT JOIN pole t2 ON t1.pole_id = t2.id
        WHERE t1.device_type = #{type}
          AND t1.device_code = #{Mac}
    </select>
</mapper>