<?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">
<!--  Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved. -->
<!--  文件内容由代码生成器产生，请不要手动修改！ -->
<!--  version: 1.0  -->
<!--  author:  maven-cctp-plugin    -->
<!--  date:  2022-09-26 10:56:47  -->
<mapper namespace="net.northking.cctp.device.db.dao.CdPcDeviceDao">
  <resultMap id="BaseResultMap" type="net.northking.cctp.device.db.entity.CdPcDevice">
      <!-- 主键id -->
    <id column="id" jdbcType="VARCHAR" property="id"/>
                                      <!-- 设备名称 -->
    <result column="device_name" jdbcType="VARCHAR" property="deviceName"/>
        <!-- 设备域名 -->
    <result column="domain_name" jdbcType="VARCHAR" property="domainName"/>
        <!-- ip地址 -->
    <result column="ip_addr" jdbcType="VARCHAR" property="ipAddr"/>
        <!-- mac地址 -->
    <result column="mac_addr" jdbcType="VARCHAR" property="macAddr"/>
        <!-- 操作系统架构 -->
    <result column="os_arch" jdbcType="VARCHAR" property="osArch"/>
        <!-- 内存容量 -->
    <result column="os_name" jdbcType="VARCHAR" property="osName"/>
        <!-- 内存容量 -->
    <result column="ram_size" jdbcType="VARCHAR" property="ramSize"/>
        <!-- 分辨率-宽 -->
    <result column="width" jdbcType="INTEGER" property="width"/>
        <!-- 分辨率-高 -->
    <result column="height" jdbcType="INTEGER" property="height"/>
        <!-- 执行机位置 -->
    <result column="location" jdbcType="VARCHAR" property="location"/>
        <!-- job名称 -->
    <result column="job_name" jdbcType="VARCHAR" property="jobName"/>
        <!-- 实例 -->
    <result column="instance" jdbcType="VARCHAR" property="instance"/>
        <!-- prometheus端口号 -->
    <result column="prom_port" jdbcType="VARCHAR" property="promPort"/>
        <!-- 远程协议 -->
    <result column="remote_protocol" jdbcType="VARCHAR" property="remoteProtocol"/>
        <!-- 远程端口 -->
    <result column="remote_port" jdbcType="VARCHAR" property="remotePort"/>
        <!-- 注册时间 -->
    <result column="registed_time" jdbcType="TIMESTAMP" property="registedTime"/>
        <!-- 创建人 -->
    <result column="created_by" jdbcType="VARCHAR" property="createdBy"/>
        <!-- 创建时间 -->
    <result column="created_time" jdbcType="TIMESTAMP" property="createdTime"/>
        <!-- 更新人 -->
    <result column="updated_by" jdbcType="VARCHAR" property="updatedBy"/>
        <!-- 更新时间 -->
    <result column="updated_time" jdbcType="TIMESTAMP" property="updatedTime"/>
    </resultMap>

  <sql id="Base_Column_List">
    id
    ,device_name
    ,domain_name
    ,ip_addr
    ,mac_addr
    ,os_arch
    ,os_name
    ,ram_size
    ,width
    ,height
    ,location
    ,job_name
    ,instance
    ,prom_port
    ,remote_protocol
    ,remote_port
    ,registed_time
    ,created_by
    ,created_time
    ,updated_by
    ,updated_time
  </sql>

  <sql id="Table_Name">
    ${defaultSchema}.cd_pc_device
  </sql>

  <select id="findByPrimaryKey" parameterType="String" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List"/>
    from
    <include refid="Table_Name"/>
    where id = #{id,jdbcType=VARCHAR}
  </select>

  <select id="findByPrimaryKeys" parameterType="java.util.List">
    select
    <include refid="Base_Column_List"/>
    from
    <include refid="Table_Name"/>
    where id in
    <foreach collection="list" item="idItem" open="(" separator="," close=")">
      #{idItem, jdbcType=VARCHAR}
    </foreach>
  </select>

  <delete id="deleteByPrimaryKey" parameterType="String">
    delete from
    <include refid="Table_Name"/>
    where id = #{id,jdbcType=VARCHAR}
  </delete>

  <delete id="deleteByPrimaryKeys" parameterType="String">
    delete from
    <include refid="Table_Name"/>
    where id in
    <foreach collection="list" item="idItem" open="(" separator="," close=")">
      #{idItem, jdbcType=VARCHAR}
    </foreach>
  </delete>

  <delete id="deleteByExample" parameterType="net.northking.cctp.device.db.entity.CdPcDevice">
    delete from
    <include refid="Table_Name"/>
    <trim prefix="WHERE" prefixOverrides="AND" >
      <choose>
        <when test="id != null">
          id = #{id,jdbcType=VARCHAR}
        </when>
      </choose>
              <if test="id != null">
          AND id=#{id,jdbcType=VARCHAR}
        </if>
              <if test="deviceName != null">
          AND device_name=#{deviceName,jdbcType=VARCHAR}
        </if>
              <if test="domainName != null">
          AND domain_name=#{domainName,jdbcType=VARCHAR}
        </if>
              <if test="ipAddr != null">
          AND ip_addr=#{ipAddr,jdbcType=VARCHAR}
        </if>
              <if test="macAddr != null">
          AND mac_addr=#{macAddr,jdbcType=VARCHAR}
        </if>
              <if test="osArch != null">
          AND os_arch=#{osArch,jdbcType=VARCHAR}
        </if>
              <if test="osName != null">
          AND os_name=#{osName,jdbcType=VARCHAR}
        </if>
              <if test="ramSize != null">
          AND ram_size=#{ramSize,jdbcType=VARCHAR}
        </if>
              <if test="location != null">
          AND location=#{location,jdbcType=VARCHAR}
        </if>
              <if test="jobName != null">
          AND job_name=#{jobName,jdbcType=VARCHAR}
        </if>
              <if test="instance != null">
          AND instance=#{instance,jdbcType=VARCHAR}
        </if>
              <if test="promPort != null">
          AND prom_port=#{promPort,jdbcType=VARCHAR}
        </if>
              <if test="remoteProtocol != null">
          AND remote_protocol=#{remoteProtocol,jdbcType=VARCHAR}
        </if>
              <if test="remotePort != null">
          AND remote_port=#{remotePort,jdbcType=VARCHAR}
        </if>
              <if test="registedTime != null">
          AND registed_time=#{registedTime,jdbcType=TIMESTAMP}
        </if>
              <if test="createdBy != null">
          AND created_by=#{createdBy,jdbcType=VARCHAR}
        </if>
              <if test="createdTime != null">
          AND created_time=#{createdTime,jdbcType=TIMESTAMP}
        </if>
              <if test="updatedBy != null">
          AND updated_by=#{updatedBy,jdbcType=VARCHAR}
        </if>
              <if test="updatedTime != null">
          AND updated_time=#{updatedTime,jdbcType=TIMESTAMP}
        </if>
          </trim>
  </delete>

  <insert id="insert" parameterType="net.northking.cctp.device.db.entity.CdPcDevice">
    insert into
    <include refid="Table_Name"/>
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="deviceName != null">
        device_name,
      </if>
      <if test="domainName != null">
        domain_name,
      </if>
      <if test="ipAddr != null">
        ip_addr,
      </if>
      <if test="macAddr != null">
        mac_addr,
      </if>
      <if test="osArch != null">
        os_arch,
      </if>
      <if test="osName != null">
        os_name,
      </if>
      <if test="ramSize != null">
        ram_size,
      </if>
      <if test="width != null">
        width,
      </if>
      <if test="height != null">
        height,
      </if>
      <if test="location != null">
        location,
      </if>
      <if test="jobName != null">
        job_name,
      </if>
      <if test="instance != null">
        instance,
      </if>
      <if test="promPort != null">
        prom_port,
      </if>
      <if test="remoteProtocol != null">
        remote_protocol,
      </if>
      <if test="remotePort != null">
        remote_port,
      </if>
      <if test="registedTime != null">
        registed_time,
      </if>
      <if test="createdBy != null">
        created_by,
      </if>
      <if test="createdTime != null">
        created_time,
      </if>
      <if test="updatedBy != null">
        updated_by,
      </if>
      <if test="updatedTime != null">
        updated_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
          #{id, jdbcType=VARCHAR},
      </if>
      <if test="deviceName != null">
          #{deviceName, jdbcType=VARCHAR},
      </if>
      <if test="domainName != null">
          #{domainName, jdbcType=VARCHAR},
      </if>
      <if test="ipAddr != null">
          #{ipAddr, jdbcType=VARCHAR},
      </if>
      <if test="macAddr != null">
          #{macAddr, jdbcType=VARCHAR},
      </if>
      <if test="osArch != null">
          #{osArch, jdbcType=VARCHAR},
      </if>
      <if test="osName != null">
          #{osName, jdbcType=VARCHAR},
      </if>
      <if test="ramSize != null">
          #{ramSize, jdbcType=VARCHAR},
      </if>
      <if test="width != null">
          #{width, jdbcType=INTEGER},
      </if>
      <if test="height != null">
          #{height, jdbcType=INTEGER},
      </if>
      <if test="location != null">
          #{location, jdbcType=VARCHAR},
      </if>
      <if test="jobName != null">
        #{jobName, jdbcType=VARCHAR},
      </if>
      <if test="instance != null">
        #{instance, jdbcType=VARCHAR},
      </if>
      <if test="promPort != null">
        #{promPort, jdbcType=VARCHAR},
      </if>
      <if test="remoteProtocol != null">
        #{remoteProtocol, jdbcType=VARCHAR},
      </if>
      <if test="remotePort != null">
        #{remotePort, jdbcType=VARCHAR},
      </if>
      <if test="registedTime != null">
          #{registedTime, jdbcType=TIMESTAMP},
      </if>
      <if test="createdBy != null">
          #{createdBy, jdbcType=VARCHAR},
      </if>
      <if test="createdTime != null">
          #{createdTime, jdbcType=TIMESTAMP},
      </if>
      <if test="updatedBy != null">
          #{updatedBy, jdbcType=VARCHAR},
      </if>
      <if test="updatedTime != null">
          #{updatedTime, jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>

  <insert id="insertByBatch" parameterType="java.util.List">
    insert into
    <include refid="Table_Name"/>
    <trim prefix="(" suffix=")" suffixOverrides=",">
    id,
    device_name,
    domain_name,
    ip_addr,
    mac_addr,
    os_arch,
    os_name,
    ram_size,
      width,
      height,
    location,
    job_name,
    instance,
    prom_port,
    remote_protocol,
    remote_port,
    registed_time,
    created_by,
    created_time,
    updated_by,
    updated_time,
    </trim>
    values
    <foreach collection="list" item="item" index="index" separator=",">
      <trim prefix="(" suffix=")" suffixOverrides=",">
    #{item.id, jdbcType=VARCHAR},
    #{item.deviceName, jdbcType=VARCHAR},
    #{item.domainName, jdbcType=VARCHAR},
    #{item.ipAddr, jdbcType=VARCHAR},
    #{item.macAddr, jdbcType=VARCHAR},
    #{item.osArch, jdbcType=VARCHAR},
    #{item.osName, jdbcType=VARCHAR}
    #{item.ramSize, jdbcType=VARCHAR},
    #{item.width, jdbcType=VARCHAR},
    #{item.height, jdbcType=INTEGER},
    #{item.location, jdbcType=INTEGER},
    #{item.jobName, jdbcType=VARCHAR},
    #{item.instance, jdbcType=VARCHAR},
    #{item.promPort, jdbcType=VARCHAR},
    #{item.remoteProtocol, jdbcType=VARCHAR},
    #{item.remotePort, jdbcType=VARCHAR},
    #{item.registedTime, jdbcType=TIMESTAMP},
    #{item.createdBy, jdbcType=VARCHAR},
    #{item.createdTime, jdbcType=TIMESTAMP},
    #{item.updatedBy, jdbcType=VARCHAR},
    #{item.updatedTime, jdbcType=TIMESTAMP},
      </trim>
    </foreach>
  </insert>

  <update id="updateByPrimaryKey" parameterType="net.northking.cctp.device.db.entity.CdPcDevice">
    update
    <include refid="Table_Name"/>
    <set>
      <if test="deviceName != null">
        device_name = #{deviceName, jdbcType=VARCHAR},
      </if>
      <if test="domainName != null">
        domain_name = #{domainName, jdbcType=VARCHAR},
      </if>
      <if test="ipAddr != null">
        ip_addr = #{ipAddr, jdbcType=VARCHAR},
      </if>
      <if test="macAddr != null">
        mac_addr = #{macAddr, jdbcType=VARCHAR},
      </if>
      <if test="osArch != null">
        os_arch = #{osArch, jdbcType=VARCHAR},
      </if>
      <if test="osName != null">
        os_name = #{osName, jdbcType=VARCHAR},
      </if>
      <if test="ramSize != null">
        ram_size = #{ramSize, jdbcType=VARCHAR},
      </if>
      <if test="width != null">
        width =  #{width, jdbcType=INTEGER},
      </if>
      <if test="height != null">
        height = #{height, jdbcType=INTEGER},
      </if>
      <if test="location != null">
        location = #{location, jdbcType=VARCHAR},
      </if>
      <if test="jobName != null">
        job_name = #{jobName, jdbcType=VARCHAR},
      </if>
      <if test="instance != null">
        instance = #{instance, jdbcType=VARCHAR},
      </if>
      <if test="promPort != null">
        prom_port = #{promPort, jdbcType=VARCHAR},
      </if>
      <if test="remoteProtocol != null">
        remote_protocol = #{remoteProtocol, jdbcType=VARCHAR},
      </if>
      <if test="remotePort != null">
        remote_port = #{remotePort, jdbcType=VARCHAR},
      </if>
      <if test="registedTime != null">
        registed_time = #{registedTime, jdbcType=TIMESTAMP},
      </if>
      <if test="createdBy != null">
        created_by = #{createdBy, jdbcType=VARCHAR},
      </if>
      <if test="createdTime != null">
        created_time = #{createdTime, jdbcType=TIMESTAMP},
      </if>
      <if test="updatedBy != null">
        updated_by = #{updatedBy, jdbcType=VARCHAR},
      </if>
      <if test="updatedTime != null">
        updated_time = #{updatedTime, jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=VARCHAR}
  </update>

  <select id="query" resultMap="BaseResultMap" parameterType="net.northking.cctp.device.db.entity.CdPcDevice">
    select
    <include refid="Base_Column_List" />
    from
    <include refid="Table_Name"/>
    <trim prefix="WHERE" prefixOverrides="AND" >
      <if test="id != null">
        AND id = #{id,jdbcType=VARCHAR}
      </if>
      <if test="deviceName != null">
        AND device_name = #{deviceName,jdbcType=VARCHAR}
      </if>
      <if test="domainName != null">
        AND domain_name = #{domainName,jdbcType=VARCHAR}
      </if>
      <if test="ipAddr != null">
        AND ip_addr = #{ipAddr,jdbcType=VARCHAR}
      </if>
      <if test="macAddr != null">
        AND mac_addr = #{macAddr,jdbcType=VARCHAR}
      </if>
      <if test="osArch != null">
        AND os_arch = #{osArch,jdbcType=VARCHAR}
      </if>
      <if test="osName != null">
        AND os_name = #{osName,jdbcType=VARCHAR}
      </if>
      <if test="ramSize != null">
        AND ram_size = #{ramSize,jdbcType=VARCHAR}
      </if>
      <if test="location != null">
        AND location = #{location,jdbcType=VARCHAR}
      </if>
      <if test="jobName != null">
        AND job_name = #{jobName,jdbcType=VARCHAR}
      </if>
      <if test="instance != null">
        AND instance = #{instance,jdbcType=VARCHAR}
      </if>
      <if test="promPort != null">
        AND prom_port = #{promPort,jdbcType=VARCHAR}
      </if>
      <if test="remoteProtocol != null">
        AND remote_protocol = #{remoteProtocol,jdbcType=VARCHAR}
      </if>
      <if test="remotePort != null">
        AND remote_port = #{remotePort,jdbcType=VARCHAR}
      </if>
      <if test="registedTime != null">
        AND registed_time = #{registedTime,jdbcType=TIMESTAMP}
      </if>
      <if test="createdBy != null">
        AND created_by = #{createdBy,jdbcType=VARCHAR}
      </if>
      <if test="createdTime != null">
        AND created_time = #{createdTime,jdbcType=TIMESTAMP}
      </if>
      <if test="updatedBy != null">
        AND updated_by = #{updatedBy,jdbcType=VARCHAR}
      </if>
      <if test="updatedTime != null">
        AND updated_time = #{updatedTime,jdbcType=TIMESTAMP}
      </if>
    </trim>
  </select>

  <select id="queryCount" resultType="java.lang.Long" parameterType="net.northking.cctp.device.db.entity.CdPcDevice">
    select count(*) from
    <include refid="Table_Name"/>
    <trim prefix="WHERE" prefixOverrides="AND" >
      <if test="id != null">
        AND id=#{id,jdbcType=VARCHAR}
      </if>
      <if test="deviceName != null">
        AND device_name=#{deviceName,jdbcType=VARCHAR}
      </if>
      <if test="domainName != null">
        AND domain_name=#{domainName,jdbcType=VARCHAR}
      </if>
      <if test="ipAddr != null">
        AND ip_addr=#{ipAddr,jdbcType=VARCHAR}
      </if>
      <if test="macAddr != null">
        AND mac_addr=#{macAddr,jdbcType=VARCHAR}
      </if>
      <if test="osArch != null">
        AND os_arch=#{osArch,jdbcType=VARCHAR}
      </if>
      <if test="osName != null">
        AND os_name=#{osName,jdbcType=VARCHAR}
      </if>
      <if test="ramSize != null">
        AND ram_size=#{ramSize,jdbcType=VARCHAR}
      </if>
      <if test="location != null">
        AND location=#{location,jdbcType=VARCHAR}
      </if>
      <if test="jobName != null">
        AND job_name = #{jobName,jdbcType=VARCHAR}
      </if>
      <if test="instance != null">
        AND instance = #{instance,jdbcType=VARCHAR}
      </if>
      <if test="promPort != null">
        AND prom_port = #{promPort,jdbcType=VARCHAR}
      </if>
      <if test="remoteProtocol != null">
        AND remote_protocol=#{remoteProtocol,jdbcType=VARCHAR}
      </if>
      <if test="remotePort != null">
        AND remote_port = #{remotePort,jdbcType=VARCHAR}
      </if>
      <if test="registedTime != null">
        AND registed_time=#{registedTime,jdbcType=TIMESTAMP}
      </if>
      <if test="createdBy != null">
        AND created_by=#{createdBy,jdbcType=VARCHAR}
      </if>
      <if test="createdTime != null">
        AND created_time=#{createdTime,jdbcType=TIMESTAMP}
      </if>
      <if test="updatedBy != null">
        AND updated_by=#{updatedBy,jdbcType=VARCHAR}
      </if>
      <if test="updatedTime != null">
        AND updated_time=#{updatedTime,jdbcType=TIMESTAMP}
      </if>
    </trim>
  </select>

</mapper>