<?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-08-29 10:24:48  -->
<mapper namespace="net.northking.cctp.platform.db.dao.CpComponentParamterDao">


  <!-- 请在本文件内添加自定义SQL语句 -->

  <resultMap id="DetailMap" type="net.northking.cctp.platform.dto.comlibrary.CpComponentParamterDetailDto">
      <!-- 主键 -->
    <id column="id" jdbcType="VARCHAR" property="id"/>
                                        <!-- 组件id -->
    <result column="com_id" jdbcType="VARCHAR" property="comId"/>
        <!-- 参数名 -->
    <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"/>
        <!-- 是否必填0-必输,1-非必输 -->
    <result column="required" jdbcType="INTEGER" property="required"/>
        <!-- 默认值 -->
    <result column="default_value" jdbcType="VARCHAR" property="defaultValue"/>
    <result column="enum_values" jdbcType="VARCHAR" property="enumValues"/>
    <!-- 输入框类型默认text普通文本框 -->
    <result column="input_type" jdbcType="VARCHAR" property="inputType"/>
        <!-- 参数范围 -->
    <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>

  <select id="pagingQuery" resultMap="DetailMap" parameterType="net.northking.cctp.platform.db.entity.CpComponentParamter">
    select
    id
    ,com_id
    ,param_name
    ,param_intro
    ,param_type
    ,param_flag
    ,param_order
    ,required
    ,default_value
    ,default_display
    ,input_type
    ,enum_values
    ,param_scope
    ,created_by
    ,created_time
    ,updated_by
    ,updated_time
    ,tenant_id
    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="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="required != null">
        AND required = #{required,jdbcType=INTEGER}
      </if>
      <if test="defaultValue != null">
        AND default_value = #{defaultValue,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="queryParamByComIds" parameterType="java.util.List" resultType="net.northking.cctp.platform.db.entity.CpComponentParamter">
    select
      id
      ,com_id
      ,param_name
      ,param_intro
      ,param_type
      ,param_flag
      ,param_order
      ,required
      ,default_value
      ,default_display
      ,input_type
      ,enum_values
      ,param_scope
      ,created_by
      ,created_time
      ,updated_by
      ,updated_time
      ,tenant_id
    from
    <include refid="Table_Name"/>
    where com_id in
    <foreach collection="list" item="idItem" open="(" separator="," close=")">
      #{idItem, jdbcType=VARCHAR}
    </foreach>
    order by param_order
  </select>
</mapper>