<?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. -->
<!--  Mybatis数据库持久层（底层映射文件）：组件参数 -->
<!--  version: 1.0  -->
<!--  author:  maven-cctp-plugin    -->
<!--  date:  2022-11-01 19:52:09  -->
<mapper namespace="net.northking.cctp.platform.db.dao.CpComponentParamterDao">
  <resultMap id="BaseResultMap" type="net.northking.cctp.platform.db.entity.CpComponentParamter">
      <!-- 主键 -->
    <id column="id" jdbcType="VARCHAR" property="id"/>
                                                <!-- 组件id -->
    <result column="com_id" jdbcType="VARCHAR" property="comId"/>
        <!-- 所属组件库id -->
    <result column="lib_id" jdbcType="VARCHAR" property="libId"/>
        <!-- 参数名 -->
    <result column="param_name" jdbcType="VARCHAR" property="paramName"/>
        <!-- 参数说明 -->
    <result column="param_intro" jdbcType="VARCHAR" property="paramIntro"/>
        <!-- 参数类型 -->
    <result column="param_type" jdbcType="VARCHAR" property="paramType"/>
        <!-- 参数标志0-输入,1-输出 -->
    <result column="param_flag" jdbcType="INTEGER" property="paramFlag"/>
        <!-- 参数顺序 -->
    <result column="param_order" jdbcType="INTEGER" property="paramOrder"/>
        <!-- 输入框类型默认text普通文本框 -->
    <result column="input_type" jdbcType="VARCHAR" property="inputType"/>
        <!-- 是否必填0-必输,1-非必输 -->
    <result column="required" jdbcType="INTEGER" property="required"/>
        <!-- 默认值 -->
    <result column="default_value" jdbcType="VARCHAR" property="defaultValue"/>
        <!-- 是否默认展示0-展示1-隐藏 -->
    <result column="default_display" jdbcType="INTEGER" property="defaultDisplay"/>
        <!-- 枚举值 -->
    <result column="enum_values" jdbcType="VARCHAR" property="enumValues"/>
        <!-- 参数范围 -->
    <result column="param_scope" jdbcType="VARCHAR" property="paramScope"/>
        <!-- 创建人 -->
    <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"/>
        <!-- 租户id -->
    <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
    </resultMap>

  <sql id="Base_Column_List">
    id
    ,com_id
    ,lib_id
    ,param_name
    ,param_intro
    ,param_type
    ,param_flag
    ,param_order
    ,input_type
    ,required
    ,default_value
    ,default_display
    ,enum_values
    ,param_scope
    ,created_by
    ,created_time
    ,updated_by
    ,updated_time
    ,tenant_id
  </sql>

  <sql id="Table_Name">
    ${defaultSchema}.cp_component_paramter
  </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" resultMap="BaseResultMap">
    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.platform.db.entity.CpComponentParamter">
    delete from
    <include refid="Table_Name"/>
    <trim prefix="WHERE" prefixOverrides="AND" >
      <if test="id != null">
          AND id=#{id,jdbcType=VARCHAR}
      </if>
      <if test="comId != null">
          AND com_id=#{comId,jdbcType=VARCHAR}
      </if>
      <if test="libId != null">
          AND lib_id=#{libId,jdbcType=VARCHAR}
      </if>
      <if test="paramName != null">
          AND param_name=#{paramName,jdbcType=VARCHAR}
      </if>
      <if test="paramIntro != null">
          AND param_intro=#{paramIntro,jdbcType=VARCHAR}
      </if>
      <if test="paramType != null">
          AND param_type=#{paramType,jdbcType=VARCHAR}
      </if>
      <if test="paramFlag != null">
          AND param_flag=#{paramFlag,jdbcType=INTEGER}
      </if>
      <if test="paramOrder != null">
          AND param_order=#{paramOrder,jdbcType=INTEGER}
      </if>
      <if test="inputType != null">
          AND input_type=#{inputType,jdbcType=VARCHAR}
      </if>
      <if test="required != null">
          AND required=#{required,jdbcType=INTEGER}
      </if>
      <if test="defaultValue != null">
          AND default_value=#{defaultValue,jdbcType=VARCHAR}
      </if>
      <if test="defaultDisplay != null">
          AND default_display=#{defaultDisplay,jdbcType=INTEGER}
      </if>
      <if test="enumValues != null">
          AND enum_values=#{enumValues,jdbcType=VARCHAR}
      </if>
      <if test="paramScope != null">
          AND param_scope=#{paramScope,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.platform.db.entity.CpComponentParamter">
    insert into
    <include refid="Table_Name"/>
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="comId != null">
        com_id,
      </if>
      <if test="libId != null">
        lib_id,
      </if>
      <if test="paramName != null">
        param_name,
      </if>
      <if test="paramIntro != null">
        param_intro,
      </if>
      <if test="paramType != null">
        param_type,
      </if>
      <if test="paramFlag != null">
        param_flag,
      </if>
      <if test="paramOrder != null">
        param_order,
      </if>
      <if test="inputType != null">
        input_type,
      </if>
      <if test="required != null">
        required,
      </if>
      <if test="defaultValue != null">
        default_value,
      </if>
      <if test="defaultDisplay != null">
        default_display,
      </if>
      <if test="enumValues != null">
        enum_values,
      </if>
      <if test="paramScope != null">
        param_scope,
      </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>
      <if test="tenantId != null">
        tenant_id,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
          #{id, jdbcType=VARCHAR},
      </if>
      <if test="comId != null">
          #{comId, jdbcType=VARCHAR},
      </if>
      <if test="libId != null">
          #{libId, jdbcType=VARCHAR},
      </if>
      <if test="paramName != null">
          #{paramName, jdbcType=VARCHAR},
      </if>
      <if test="paramIntro != null">
          #{paramIntro, jdbcType=VARCHAR},
      </if>
      <if test="paramType != null">
          #{paramType, jdbcType=VARCHAR},
      </if>
      <if test="paramFlag != null">
          #{paramFlag, jdbcType=INTEGER},
      </if>
      <if test="paramOrder != null">
          #{paramOrder, jdbcType=INTEGER},
      </if>
      <if test="inputType != null">
          #{inputType, jdbcType=VARCHAR},
      </if>
      <if test="required != null">
          #{required, jdbcType=INTEGER},
      </if>
      <if test="defaultValue != null">
          #{defaultValue, jdbcType=VARCHAR},
      </if>
      <if test="defaultDisplay != null">
          #{defaultDisplay, jdbcType=INTEGER},
      </if>
      <if test="enumValues != null">
          #{enumValues, jdbcType=VARCHAR},
      </if>
      <if test="paramScope != null">
          #{paramScope, 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>
      <if test="tenantId != null">
          #{tenantId, jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>

  <insert id="insertByBatch" parameterType="java.util.List">
    insert into
    <include refid="Table_Name"/>
    <trim prefix="(" suffix=")" suffixOverrides=",">
    id,
    com_id,
    lib_id,
    param_name,
    param_intro,
    param_type,
    param_flag,
    param_order,
    input_type,
    required,
    default_value,
    default_display,
    enum_values,
    param_scope,
    created_by,
    created_time,
    updated_by,
    updated_time,
    tenant_id,
    </trim>
    values
    <foreach collection="list" item="item" index="index" separator=",">
      <trim prefix="(" suffix=")" suffixOverrides=",">
    #{item.id, jdbcType=VARCHAR},
    #{item.comId, jdbcType=VARCHAR},
    #{item.libId, jdbcType=VARCHAR},
    #{item.paramName, jdbcType=VARCHAR},
    #{item.paramIntro, jdbcType=VARCHAR},
    #{item.paramType, jdbcType=VARCHAR},
    #{item.paramFlag, jdbcType=INTEGER},
    #{item.paramOrder, jdbcType=INTEGER},
    #{item.inputType, jdbcType=VARCHAR},
    #{item.required, jdbcType=INTEGER},
    #{item.defaultValue, jdbcType=VARCHAR},
    #{item.defaultDisplay, jdbcType=INTEGER},
    #{item.enumValues, jdbcType=VARCHAR},
    #{item.paramScope, jdbcType=VARCHAR},
    #{item.createdBy, jdbcType=VARCHAR},
    #{item.createdTime, jdbcType=TIMESTAMP},
    #{item.updatedBy, jdbcType=VARCHAR},
    #{item.updatedTime, jdbcType=TIMESTAMP},
    #{item.tenantId, jdbcType=VARCHAR},
      </trim>
    </foreach>
  </insert>

  <update id="updateByPrimaryKey" parameterType="net.northking.cctp.platform.db.entity.CpComponentParamter">
    update
    <include refid="Table_Name"/>
    <set>
      <if test="comId != null">
        com_id = #{comId, jdbcType=VARCHAR},
      </if>
      <if test="libId != null">
        lib_id = #{libId, jdbcType=VARCHAR},
      </if>
      <if test="paramName != null">
        param_name = #{paramName, jdbcType=VARCHAR},
      </if>
      <if test="paramIntro != null">
        param_intro = #{paramIntro, jdbcType=VARCHAR},
      </if>
      <if test="paramType != null">
        param_type = #{paramType, jdbcType=VARCHAR},
      </if>
      <if test="paramFlag != null">
        param_flag = #{paramFlag, jdbcType=INTEGER},
      </if>
      <if test="paramOrder != null">
        param_order = #{paramOrder, jdbcType=INTEGER},
      </if>
      <if test="inputType != null">
        input_type = #{inputType, jdbcType=VARCHAR},
      </if>
      <if test="required != null">
        required = #{required, jdbcType=INTEGER},
      </if>
      <if test="defaultValue != null">
        default_value = #{defaultValue, jdbcType=VARCHAR},
      </if>
      <if test="defaultDisplay != null">
        default_display = #{defaultDisplay, jdbcType=INTEGER},
      </if>
      <if test="enumValues != null">
        enum_values = #{enumValues, jdbcType=VARCHAR},
      </if>
      <if test="paramScope != null">
        param_scope = #{paramScope, 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}
    AND tenant_id = #{tenantId,jdbcType=VARCHAR}
  </update>

  <select id="query" resultMap="BaseResultMap" parameterType="net.northking.cctp.platform.db.entity.CpComponentParamter">
    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="comId != null">
        AND com_id = #{comId,jdbcType=VARCHAR}
      </if>
      <if test="libId != null">
        AND lib_id = #{libId,jdbcType=VARCHAR}
      </if>
      <if test="paramName != null">
        AND param_name = #{paramName,jdbcType=VARCHAR}
      </if>
      <if test="paramIntro != null">
        AND param_intro = #{paramIntro,jdbcType=VARCHAR}
      </if>
      <if test="paramType != null">
        AND param_type = #{paramType,jdbcType=VARCHAR}
      </if>
      <if test="paramFlag != null">
        AND param_flag = #{paramFlag,jdbcType=INTEGER}
      </if>
      <if test="paramOrder != null">
        AND param_order = #{paramOrder,jdbcType=INTEGER}
      </if>
      <if test="inputType != null">
        AND input_type = #{inputType,jdbcType=VARCHAR}
      </if>
      <if test="required != null">
        AND required = #{required,jdbcType=INTEGER}
      </if>
      <if test="defaultValue != null">
        AND default_value = #{defaultValue,jdbcType=VARCHAR}
      </if>
      <if test="defaultDisplay != null">
        AND default_display = #{defaultDisplay,jdbcType=INTEGER}
      </if>
      <if test="enumValues != null">
        AND enum_values = #{enumValues,jdbcType=VARCHAR}
      </if>
      <if test="paramScope != null">
        AND param_scope = #{paramScope,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>
      <if test="tenantId != null">
        AND tenant_id = #{tenantId,jdbcType=VARCHAR}
      </if>
    </trim>
  </select>

  <select id="queryCount" resultType="java.lang.Long" parameterType="net.northking.cctp.platform.db.entity.CpComponentParamter">
    select count(*) from
    <include refid="Table_Name"/>
    <trim prefix="WHERE" prefixOverrides="AND" >
      <if test="id != null">
        AND id=#{id,jdbcType=VARCHAR}
      </if>
      <if test="comId != null">
        AND com_id=#{comId,jdbcType=VARCHAR}
      </if>
      <if test="libId != null">
        AND lib_id=#{libId,jdbcType=VARCHAR}
      </if>
      <if test="paramName != null">
        AND param_name=#{paramName,jdbcType=VARCHAR}
      </if>
      <if test="paramIntro != null">
        AND param_intro=#{paramIntro,jdbcType=VARCHAR}
      </if>
      <if test="paramType != null">
        AND param_type=#{paramType,jdbcType=VARCHAR}
      </if>
      <if test="paramFlag != null">
        AND param_flag=#{paramFlag,jdbcType=INTEGER}
      </if>
      <if test="paramOrder != null">
        AND param_order=#{paramOrder,jdbcType=INTEGER}
      </if>
      <if test="inputType != null">
        AND input_type=#{inputType,jdbcType=VARCHAR}
      </if>
      <if test="required != null">
        AND required=#{required,jdbcType=INTEGER}
      </if>
      <if test="defaultValue != null">
        AND default_value=#{defaultValue,jdbcType=VARCHAR}
      </if>
      <if test="defaultDisplay != null">
        AND default_display=#{defaultDisplay,jdbcType=INTEGER}
      </if>
      <if test="enumValues != null">
        AND enum_values=#{enumValues,jdbcType=VARCHAR}
      </if>
      <if test="paramScope != null">
        AND param_scope=#{paramScope,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>
      <if test="tenantId != null">
        AND tenant_id=#{tenantId,jdbcType=VARCHAR}
      </if>
    </trim>
  </select>

</mapper>