<?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 2023 . All rights reserved. -->
<!--  Mybatis数据库持久层（底层映射文件）：业务组件库组件列表 -->
<!--  version: 1.0  -->
<!--  author:  maven-cctp-plugin    -->
<!--  date:  2023-10-06 17:59:28  -->
<mapper namespace="net.northking.cctp.scriptcase.db.dao.LibraryBusComInfoDao">
  <resultMap id="BaseResultMap" type="net.northking.cctp.scriptcase.db.entity.LibraryBusComInfo">
      <!-- 主键 -->
    <id column="id" jdbcType="VARCHAR" property="id"/>
                                          <!-- 组件名称 -->
    <result column="com_name" jdbcType="VARCHAR" property="comName"/>
        <!-- 组件类型1-接口，2-pcbs，3-pccs，4-安卓，5-ios -->
    <result column="com_type" jdbcType="INTEGER" property="comType"/>
        <!-- 说明 -->
    <result column="memo" jdbcType="VARCHAR" property="memo"/>
        <!-- 脚本内容 -->
    <result column="script_content" jdbcType="VARCHAR" property="scriptContent"/>
        <!-- 组件复杂度 -->
    <result column="complexity" jdbcType="INTEGER" property="complexity"/>
        <!-- 逻辑删除0-可用1-已删除 -->
    <result column="is_deleted" jdbcType="INTEGER" property="isDeleted"/>
        <!-- 组件版本号 -->
    <result column="com_version" jdbcType="VARCHAR" property="comVersion"/>
        <!-- 目录树id -->
    <result column="tree_id" jdbcType="VARCHAR" property="treeId"/>
        <!-- 入库状态0-未审核，1-已入库，2-不通过 -->
    <result column="lib_status" jdbcType="INTEGER" property="libStatus"/>
        <!-- 创建人 -->
    <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"/>
        <!-- 共享来源系统 -->
    <result column="project_id" jdbcType="VARCHAR" property="projectId"/>
    </resultMap>

  <sql id="Base_Column_List">
    id
    ,com_name
    ,com_type
    ,memo
    ,script_content
    ,complexity
    ,is_deleted
    ,com_version
    ,tree_id
    ,lib_status
    ,created_by
    ,created_time
    ,updated_by
    ,updated_time
    ,tenant_id
    ,project_id
  </sql>

  <sql id="Table_Name">
    ${defaultSchema}.library_bus_com_info
  </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.scriptcase.db.entity.LibraryBusComInfo">
    delete from
    <include refid="Table_Name"/>
    <trim prefix="WHERE" prefixOverrides="AND" >
      <if test="id != null">
          AND id=#{id,jdbcType=VARCHAR}
      </if>
      <if test="comName != null">
          AND com_name=#{comName,jdbcType=VARCHAR}
      </if>
      <if test="comType != null">
          AND com_type=#{comType,jdbcType=INTEGER}
      </if>
      <if test="memo != null">
          AND memo=#{memo,jdbcType=VARCHAR}
      </if>
      <if test="scriptContent != null">
          AND script_content=#{scriptContent,jdbcType=VARCHAR}
      </if>
      <if test="complexity != null">
          AND complexity=#{complexity,jdbcType=INTEGER}
      </if>
      <if test="isDeleted != null">
          AND is_deleted=#{isDeleted,jdbcType=INTEGER}
      </if>
      <if test="comVersion != null">
          AND com_version=#{comVersion,jdbcType=VARCHAR}
      </if>
      <if test="treeId != null">
          AND tree_id=#{treeId,jdbcType=VARCHAR}
      </if>
      <if test="libStatus != null">
          AND lib_status=#{libStatus,jdbcType=INTEGER}
      </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>
      <if test="projectId != null">
          AND project_id=#{projectId,jdbcType=VARCHAR}
      </if>
    </trim>
  </delete>

  <insert id="insert" parameterType="net.northking.cctp.scriptcase.db.entity.LibraryBusComInfo">
    insert into
    <include refid="Table_Name"/>
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="comName != null">
        com_name,
      </if>
      <if test="comType != null">
        com_type,
      </if>
      <if test="memo != null">
        memo,
      </if>
      <if test="scriptContent != null">
        script_content,
      </if>
      <if test="complexity != null">
        complexity,
      </if>
      <if test="isDeleted != null">
        is_deleted,
      </if>
      <if test="comVersion != null">
        com_version,
      </if>
      <if test="treeId != null">
        tree_id,
      </if>
      <if test="libStatus != null">
        lib_status,
      </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>
      <if test="projectId != null">
        project_id,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
          #{id, jdbcType=VARCHAR},
      </if>
      <if test="comName != null">
          #{comName, jdbcType=VARCHAR},
      </if>
      <if test="comType != null">
          #{comType, jdbcType=INTEGER},
      </if>
      <if test="memo != null">
          #{memo, jdbcType=VARCHAR},
      </if>
      <if test="scriptContent != null">
          #{scriptContent, jdbcType=VARCHAR},
      </if>
      <if test="complexity != null">
          #{complexity, jdbcType=INTEGER},
      </if>
      <if test="isDeleted != null">
          #{isDeleted, jdbcType=INTEGER},
      </if>
      <if test="comVersion != null">
          #{comVersion, jdbcType=VARCHAR},
      </if>
      <if test="treeId != null">
          #{treeId, jdbcType=VARCHAR},
      </if>
      <if test="libStatus != null">
          #{libStatus, jdbcType=INTEGER},
      </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>
      <if test="projectId != null">
          #{projectId, jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>

  <insert id="insertByBatch" parameterType="java.util.List">
    insert into
    <include refid="Table_Name"/>
    <trim prefix="(" suffix=")" suffixOverrides=",">
    id,
    com_name,
    com_type,
    memo,
    script_content,
    complexity,
    is_deleted,
    com_version,
    tree_id,
    lib_status,
    created_by,
    created_time,
    updated_by,
    updated_time,
    tenant_id,
    project_id,
    </trim>
    values
    <foreach collection="list" item="item" index="index" separator=",">
      <trim prefix="(" suffix=")" suffixOverrides=",">
    #{item.id, jdbcType=VARCHAR},
    #{item.comName, jdbcType=VARCHAR},
    #{item.comType, jdbcType=INTEGER},
    #{item.memo, jdbcType=VARCHAR},
    #{item.scriptContent, jdbcType=VARCHAR},
    #{item.complexity, jdbcType=INTEGER},
    #{item.isDeleted, jdbcType=INTEGER},
    #{item.comVersion, jdbcType=VARCHAR},
    #{item.treeId, jdbcType=VARCHAR},
    #{item.libStatus, jdbcType=INTEGER},
    #{item.createdBy, jdbcType=VARCHAR},
    #{item.createdTime, jdbcType=TIMESTAMP},
    #{item.updatedBy, jdbcType=VARCHAR},
    #{item.updatedTime, jdbcType=TIMESTAMP},
    #{item.tenantId, jdbcType=VARCHAR},
    #{item.projectId, jdbcType=VARCHAR},
      </trim>
    </foreach>
  </insert>

  <update id="updateByPrimaryKey" parameterType="net.northking.cctp.scriptcase.db.entity.LibraryBusComInfo">
    update
    <include refid="Table_Name"/>
    <set>
      <if test="comName != null">
        com_name = #{comName, jdbcType=VARCHAR},
      </if>
      <if test="comType != null">
        com_type = #{comType, jdbcType=INTEGER},
      </if>
      <if test="memo != null">
        memo = #{memo, jdbcType=VARCHAR},
      </if>
      <if test="scriptContent != null">
        script_content = #{scriptContent, jdbcType=VARCHAR},
      </if>
      <if test="complexity != null">
        complexity = #{complexity, jdbcType=INTEGER},
      </if>
      <if test="isDeleted != null">
        is_deleted = #{isDeleted, jdbcType=INTEGER},
      </if>
      <if test="comVersion != null">
        com_version = #{comVersion, jdbcType=VARCHAR},
      </if>
      <if test="treeId != null">
        tree_id = #{treeId, jdbcType=VARCHAR},
      </if>
      <if test="libStatus != null">
        lib_status = #{libStatus, jdbcType=INTEGER},
      </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>
      <if test="projectId != null">
        project_id = #{projectId, jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=VARCHAR}
    AND tenant_id = #{tenantId,jdbcType=VARCHAR}
  </update>

  <select id="query" resultMap="BaseResultMap" parameterType="net.northking.cctp.scriptcase.db.entity.LibraryBusComInfo">
    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="comName != null">
        AND com_name = #{comName,jdbcType=VARCHAR}
      </if>
      <if test="comType != null">
        AND com_type = #{comType,jdbcType=INTEGER}
      </if>
      <if test="memo != null">
        AND memo = #{memo,jdbcType=VARCHAR}
      </if>
      <if test="scriptContent != null">
        AND script_content = #{scriptContent,jdbcType=VARCHAR}
      </if>
      <if test="complexity != null">
        AND complexity = #{complexity,jdbcType=INTEGER}
      </if>
      <if test="isDeleted != null">
        AND is_deleted = #{isDeleted,jdbcType=INTEGER}
      </if>
      <if test="comVersion != null">
        AND com_version = #{comVersion,jdbcType=VARCHAR}
      </if>
      <if test="treeId != null">
        AND tree_id = #{treeId,jdbcType=VARCHAR}
      </if>
      <if test="libStatus != null">
        AND lib_status = #{libStatus,jdbcType=INTEGER}
      </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>
      <if test="projectId != null">
        AND project_id = #{projectId,jdbcType=VARCHAR}
      </if>
    </trim>
  </select>

  <select id="queryCount" resultType="java.lang.Long" parameterType="net.northking.cctp.scriptcase.db.entity.LibraryBusComInfo">
    select count(*) from
    <include refid="Table_Name"/>
    <trim prefix="WHERE" prefixOverrides="AND" >
      <if test="id != null">
        AND id=#{id,jdbcType=VARCHAR}
      </if>
      <if test="comName != null">
        AND com_name=#{comName,jdbcType=VARCHAR}
      </if>
      <if test="comType != null">
        AND com_type=#{comType,jdbcType=INTEGER}
      </if>
      <if test="memo != null">
        AND memo=#{memo,jdbcType=VARCHAR}
      </if>
      <if test="scriptContent != null">
        AND script_content=#{scriptContent,jdbcType=VARCHAR}
      </if>
      <if test="complexity != null">
        AND complexity=#{complexity,jdbcType=INTEGER}
      </if>
      <if test="isDeleted != null">
        AND is_deleted=#{isDeleted,jdbcType=INTEGER}
      </if>
      <if test="comVersion != null">
        AND com_version=#{comVersion,jdbcType=VARCHAR}
      </if>
      <if test="treeId != null">
        AND tree_id=#{treeId,jdbcType=VARCHAR}
      </if>
      <if test="libStatus != null">
        AND lib_status=#{libStatus,jdbcType=INTEGER}
      </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>
      <if test="projectId != null">
        AND project_id=#{projectId,jdbcType=VARCHAR}
      </if>
    </trim>
  </select>

</mapper>