<?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-13 16:13:26  -->
<mapper namespace="net.northking.cctp.device.db.dao.CdDeviceModelDao">
  <resultMap id="BaseResultMap" type="net.northking.cctp.device.db.entity.CdDeviceModel">
      <!-- 机型id -->
    <id column="id" jdbcType="VARCHAR" property="id"/>
                                            <!-- 机型名称 -->
    <result column="model_name" jdbcType="VARCHAR" property="modelName"/>
        <!-- 所属品牌 -->
    <result column="brand_id" jdbcType="VARCHAR" property="brandId"/>
        <!-- 产品名称 -->
    <result column="product_name" jdbcType="VARCHAR" property="productName"/>
        <!-- 屏幕尺寸 -->
    <result column="screen_size" jdbcType="VARCHAR" property="screenSize"/>
        <!-- 分辨率 -->
    <result column="resolution" jdbcType="VARCHAR" property="resolution"/>
        <!-- 类型 -->
    <result column="type" jdbcType="VARCHAR" property="type"/>
        <!-- 机型图片 -->
    <result column="model_img" jdbcType="VARCHAR" property="modelImg"/>
        <!-- 系统版本 -->
    <result column="system_version" jdbcType="VARCHAR" property="systemVersion"/>
        <!-- cpu核心数 -->
    <result column="cpu_core_num" jdbcType="INTEGER" property="cpuCoreNum"/>
        <!-- cpu型号 -->
    <result column="cpu_model" jdbcType="VARCHAR" property="cpuModel"/>
        <!-- cpu品牌 -->
    <result column="cpu_brand" jdbcType="VARCHAR" property="cpuBrand"/>
        <!-- 内存大小 -->
    <result column="ram_size" jdbcType="VARCHAR" property="ramSize"/>
        <!-- 创建人 -->
    <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
    ,model_name
    ,brand_id
    ,product_name
    ,screen_size
    ,resolution
    ,type
    ,model_img
    ,system_version
    ,cpu_core_num
    ,cpu_model
    ,cpu_brand
    ,ram_size
    ,created_by
    ,created_time
    ,updated_by
    ,updated_time
  </sql>

  <sql id="Table_Name">
    ${defaultSchema}.cd_device_model
  </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.CdDeviceModel">
    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="modelName != null">
          AND model_name=#{modelName,jdbcType=VARCHAR}
        </if>
              <if test="brandId != null">
          AND brand_id=#{brandId,jdbcType=VARCHAR}
        </if>
              <if test="productName != null">
          AND product_name=#{productName,jdbcType=VARCHAR}
        </if>
              <if test="screenSize != null">
          AND screen_size=#{screenSize,jdbcType=VARCHAR}
        </if>
              <if test="resolution != null">
          AND resolution=#{resolution,jdbcType=VARCHAR}
        </if>
              <if test="type != null">
          AND type=#{type,jdbcType=VARCHAR}
        </if>
              <if test="modelImg != null">
          AND model_img=#{modelImg,jdbcType=VARCHAR}
        </if>
              <if test="systemVersion != null">
          AND system_version=#{systemVersion,jdbcType=VARCHAR}
        </if>
              <if test="cpuCoreNum != null">
          AND cpu_core_num=#{cpuCoreNum,jdbcType=INTEGER}
        </if>
              <if test="cpuModel != null">
          AND cpu_model=#{cpuModel,jdbcType=VARCHAR}
        </if>
              <if test="cpuBrand != null">
          AND cpu_brand=#{cpuBrand,jdbcType=VARCHAR}
        </if>
              <if test="ramSize != null">
          AND ram_size=#{ramSize,jdbcType=VARCHAR}
        </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.CdDeviceModel">
    insert into
    <include refid="Table_Name"/>
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="modelName != null">
        model_name,
      </if>
      <if test="brandId != null">
        brand_id,
      </if>
      <if test="productName != null">
        product_name,
      </if>
      <if test="screenSize != null">
        screen_size,
      </if>
      <if test="resolution != null">
        resolution,
      </if>
      <if test="type != null">
        type,
      </if>
      <if test="modelImg != null">
        model_img,
      </if>
      <if test="systemVersion != null">
        system_version,
      </if>
      <if test="cpuCoreNum != null">
        cpu_core_num,
      </if>
      <if test="cpuModel != null">
        cpu_model,
      </if>
      <if test="cpuBrand != null">
        cpu_brand,
      </if>
      <if test="ramSize != null">
        ram_size,
      </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="modelName != null">
          #{modelName, jdbcType=VARCHAR},
      </if>
      <if test="brandId != null">
          #{brandId, jdbcType=VARCHAR},
      </if>
      <if test="productName != null">
          #{productName, jdbcType=VARCHAR},
      </if>
      <if test="screenSize != null">
          #{screenSize, jdbcType=VARCHAR},
      </if>
      <if test="resolution != null">
          #{resolution, jdbcType=VARCHAR},
      </if>
      <if test="type != null">
          #{type, jdbcType=VARCHAR},
      </if>
      <if test="modelImg != null">
          #{modelImg, jdbcType=VARCHAR},
      </if>
      <if test="systemVersion != null">
          #{systemVersion, jdbcType=VARCHAR},
      </if>
      <if test="cpuCoreNum != null">
          #{cpuCoreNum, jdbcType=INTEGER},
      </if>
      <if test="cpuModel != null">
          #{cpuModel, jdbcType=VARCHAR},
      </if>
      <if test="cpuBrand != null">
          #{cpuBrand, jdbcType=VARCHAR},
      </if>
      <if test="ramSize != null">
          #{ramSize, jdbcType=VARCHAR},
      </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,
    model_name,
    brand_id,
    product_name,
    screen_size,
    resolution,
    type,
    model_img,
    system_version,
    cpu_core_num,
    cpu_model,
    cpu_brand,
    ram_size,
    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.modelName, jdbcType=VARCHAR},
    #{item.brandId, jdbcType=VARCHAR},
    #{item.productName, jdbcType=VARCHAR},
    #{item.screenSize, jdbcType=VARCHAR},
    #{item.resolution, jdbcType=VARCHAR},
    #{item.type, jdbcType=VARCHAR},
    #{item.modelImg, jdbcType=VARCHAR},
    #{item.systemVersion, jdbcType=VARCHAR},
    #{item.cpuCoreNum, jdbcType=INTEGER},
    #{item.cpuModel, jdbcType=VARCHAR},
    #{item.cpuBrand, jdbcType=VARCHAR},
    #{item.ramSize, jdbcType=VARCHAR},
    #{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.CdDeviceModel">
    update
    <include refid="Table_Name"/>
    <set>
      <if test="modelName != null">
        model_name = #{modelName, jdbcType=VARCHAR},
      </if>
      <if test="brandId != null">
        brand_id = #{brandId, jdbcType=VARCHAR},
      </if>
      <if test="productName != null">
        product_name = #{productName, jdbcType=VARCHAR},
      </if>
      <if test="screenSize != null">
        screen_size = #{screenSize, jdbcType=VARCHAR},
      </if>
      <if test="resolution != null">
        resolution = #{resolution, jdbcType=VARCHAR},
      </if>
      <if test="type != null">
        type = #{type, jdbcType=VARCHAR},
      </if>
      <if test="modelImg != null">
        model_img = #{modelImg, jdbcType=VARCHAR},
      </if>
      <if test="systemVersion != null">
        system_version = #{systemVersion, jdbcType=VARCHAR},
      </if>
      <if test="cpuCoreNum != null">
        cpu_core_num = #{cpuCoreNum, jdbcType=INTEGER},
      </if>
      <if test="cpuModel != null">
        cpu_model = #{cpuModel, jdbcType=VARCHAR},
      </if>
      <if test="cpuBrand != null">
        cpu_brand = #{cpuBrand, jdbcType=VARCHAR},
      </if>
      <if test="ramSize != null">
        ram_size = #{ramSize, jdbcType=VARCHAR},
      </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.CdDeviceModel">
    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="modelName != null">
        AND model_name = #{modelName,jdbcType=VARCHAR}
      </if>
      <if test="brandId != null">
        AND brand_id = #{brandId,jdbcType=VARCHAR}
      </if>
      <if test="productName != null">
        AND product_name = #{productName,jdbcType=VARCHAR}
      </if>
      <if test="screenSize != null">
        AND screen_size = #{screenSize,jdbcType=VARCHAR}
      </if>
      <if test="resolution != null">
        AND resolution = #{resolution,jdbcType=VARCHAR}
      </if>
      <if test="type != null">
        AND type = #{type,jdbcType=VARCHAR}
      </if>
      <if test="modelImg != null">
        AND model_img = #{modelImg,jdbcType=VARCHAR}
      </if>
      <if test="systemVersion != null">
        AND system_version = #{systemVersion,jdbcType=VARCHAR}
      </if>
      <if test="cpuCoreNum != null">
        AND cpu_core_num = #{cpuCoreNum,jdbcType=INTEGER}
      </if>
      <if test="cpuModel != null">
        AND cpu_model = #{cpuModel,jdbcType=VARCHAR}
      </if>
      <if test="cpuBrand != null">
        AND cpu_brand = #{cpuBrand,jdbcType=VARCHAR}
      </if>
      <if test="ramSize != null">
        AND ram_size = #{ramSize,jdbcType=VARCHAR}
      </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.CdDeviceModel">
    select count(*) from
    <include refid="Table_Name"/>
    <trim prefix="WHERE" prefixOverrides="AND" >
      <if test="id != null">
        AND id=#{id,jdbcType=VARCHAR}
      </if>
      <if test="modelName != null">
        AND model_name=#{modelName,jdbcType=VARCHAR}
      </if>
      <if test="brandId != null">
        AND brand_id=#{brandId,jdbcType=VARCHAR}
      </if>
      <if test="productName != null">
        AND product_name=#{productName,jdbcType=VARCHAR}
      </if>
      <if test="screenSize != null">
        AND screen_size=#{screenSize,jdbcType=VARCHAR}
      </if>
      <if test="resolution != null">
        AND resolution=#{resolution,jdbcType=VARCHAR}
      </if>
      <if test="type != null">
        AND type=#{type,jdbcType=VARCHAR}
      </if>
      <if test="modelImg != null">
        AND model_img=#{modelImg,jdbcType=VARCHAR}
      </if>
      <if test="systemVersion != null">
        AND system_version=#{systemVersion,jdbcType=VARCHAR}
      </if>
      <if test="cpuCoreNum != null">
        AND cpu_core_num=#{cpuCoreNum,jdbcType=INTEGER}
      </if>
      <if test="cpuModel != null">
        AND cpu_model=#{cpuModel,jdbcType=VARCHAR}
      </if>
      <if test="cpuBrand != null">
        AND cpu_brand=#{cpuBrand,jdbcType=VARCHAR}
      </if>
      <if test="ramSize != null">
        AND ram_size=#{ramSize,jdbcType=VARCHAR}
      </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>