<?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-04 09:57:41  -->
<mapper namespace="net.northking.cctp.scriptcase.db.dao.AtuElementInfoDao">
  <resultMap id="BaseResultMap" type="net.northking.cctp.scriptcase.db.entity.AtuElementInfo">
      <!-- 元素ID -->
    <id column="id" jdbcType="VARCHAR" property="id"/>
                                        <!-- 元素分组ID -->
    <result column="group_id" jdbcType="VARCHAR" property="groupId"/>
        <!-- 元素名称 -->
    <result column="name" jdbcType="VARCHAR" property="name"/>
        <!-- 元素类型 -->
    <result column="type" jdbcType="VARCHAR" property="type"/>
        <!-- 元素获取方式 -->
    <result column="fetch_type" jdbcType="VARCHAR" property="fetchType"/>
        <!-- 元素属性表达式 -->
    <result column="fetch_value" jdbcType="VARCHAR" property="fetchValue"/>
        <!-- 元素备选获取方式 -->
    <result column="second_ftype" jdbcType="VARCHAR" property="secondFtype"/>
        <!-- 元素备选属性表达式 -->
    <result column="second_fvalue" jdbcType="VARCHAR" property="secondFvalue"/>
        <!-- 是否删除 -->
    <result column="is_deleted" jdbcType="VARCHAR" property="isDeleted"/>
        <!-- 系统ID -->
    <result column="project_id" jdbcType="VARCHAR" property="projectId"/>
        <!-- 租户号 -->
    <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
        <!-- 创建人 -->
    <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
    ,group_id
    ,name
    ,type
    ,fetch_type
    ,fetch_value
    ,second_ftype
    ,second_fvalue
    ,is_deleted
    ,project_id
    ,tenant_id
    ,created_by
    ,created_time
    ,updated_by
    ,updated_time
  </sql>

  <sql id="Table_Name">
    ${defaultSchema}.atu_element_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">
    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.AtuElementInfo">
    delete from
    <include refid="Table_Name"/>
    <trim prefix="WHERE" prefixOverrides="AND" >
      <if test="id != null">
          AND id=#{id,jdbcType=VARCHAR}
      </if>
      <if test="groupId != null">
          AND group_id=#{groupId,jdbcType=VARCHAR}
      </if>
      <if test="name != null">
          AND name=#{name,jdbcType=VARCHAR}
      </if>
      <if test="type != null">
          AND type=#{type,jdbcType=VARCHAR}
      </if>
      <if test="fetchType != null">
          AND fetch_type=#{fetchType,jdbcType=VARCHAR}
      </if>
      <if test="fetchValue != null">
          AND fetch_value=#{fetchValue,jdbcType=VARCHAR}
      </if>
      <if test="secondFtype != null">
          AND second_ftype=#{secondFtype,jdbcType=VARCHAR}
      </if>
      <if test="secondFvalue != null">
          AND second_fvalue=#{secondFvalue,jdbcType=VARCHAR}
      </if>
      <if test="isDeleted != null">
          AND is_deleted=#{isDeleted,jdbcType=VARCHAR}
      </if>
      <if test="projectId != null">
          AND project_id=#{projectId,jdbcType=VARCHAR}
      </if>
      <if test="tenantId != null">
          AND tenant_id=#{tenantId,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.scriptcase.db.entity.AtuElementInfo">
    insert into
    <include refid="Table_Name"/>
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="groupId != null">
        group_id,
      </if>
      <if test="name != null">
        name,
      </if>
      <if test="type != null">
        type,
      </if>
      <if test="fetchType != null">
        fetch_type,
      </if>
      <if test="fetchValue != null">
        fetch_value,
      </if>
      <if test="secondFtype != null">
        second_ftype,
      </if>
      <if test="secondFvalue != null">
        second_fvalue,
      </if>
      <if test="isDeleted != null">
        is_deleted,
      </if>
      <if test="projectId != null">
        project_id,
      </if>
      <if test="tenantId != null">
        tenant_id,
      </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="groupId != null">
          #{groupId, jdbcType=VARCHAR},
      </if>
      <if test="name != null">
          #{name, jdbcType=VARCHAR},
      </if>
      <if test="type != null">
          #{type, jdbcType=VARCHAR},
      </if>
      <if test="fetchType != null">
          #{fetchType, jdbcType=VARCHAR},
      </if>
      <if test="fetchValue != null">
          #{fetchValue, jdbcType=VARCHAR},
      </if>
      <if test="secondFtype != null">
          #{secondFtype, jdbcType=VARCHAR},
      </if>
      <if test="secondFvalue != null">
          #{secondFvalue, jdbcType=VARCHAR},
      </if>
      <if test="isDeleted != null">
          #{isDeleted, jdbcType=VARCHAR},
      </if>
      <if test="projectId != null">
          #{projectId, jdbcType=VARCHAR},
      </if>
      <if test="tenantId != null">
          #{tenantId, 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,
    group_id,
    name,
    type,
    fetch_type,
    fetch_value,
    second_ftype,
    second_fvalue,
    is_deleted,
    project_id,
    tenant_id,
    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.groupId, jdbcType=VARCHAR},
    #{item.name, jdbcType=VARCHAR},
    #{item.type, jdbcType=VARCHAR},
    #{item.fetchType, jdbcType=VARCHAR},
    #{item.fetchValue, jdbcType=VARCHAR},
    #{item.secondFtype, jdbcType=VARCHAR},
    #{item.secondFvalue, jdbcType=VARCHAR},
    #{item.isDeleted, jdbcType=VARCHAR},
    #{item.projectId, jdbcType=VARCHAR},
    #{item.tenantId, 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.scriptcase.db.entity.AtuElementInfo">
    update
    <include refid="Table_Name"/>
    <set>
      <if test="groupId != null">
        group_id = #{groupId, jdbcType=VARCHAR},
      </if>
      <if test="name != null">
        name = #{name, jdbcType=VARCHAR},
      </if>
      <if test="type != null">
        type = #{type, jdbcType=VARCHAR},
      </if>
      <if test="fetchType != null">
        fetch_type = #{fetchType, jdbcType=VARCHAR},
      </if>
      <if test="fetchValue != null">
        fetch_value = #{fetchValue, jdbcType=VARCHAR},
      </if>
      <if test="secondFtype != null">
        second_ftype = #{secondFtype, jdbcType=VARCHAR},
      </if>
      <if test="secondFvalue != null">
        second_fvalue = #{secondFvalue, jdbcType=VARCHAR},
      </if>
      <if test="isDeleted != null">
        is_deleted = #{isDeleted, jdbcType=VARCHAR},
      </if>
      <if test="projectId != null">
        project_id = #{projectId, 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.scriptcase.db.entity.AtuElementInfo">
    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="groupId != null">
        AND group_id = #{groupId,jdbcType=VARCHAR}
      </if>
      <if test="name != null">
        AND name = #{name,jdbcType=VARCHAR}
      </if>
      <if test="type != null">
        AND type = #{type,jdbcType=VARCHAR}
      </if>
      <if test="fetchType != null">
        AND fetch_type = #{fetchType,jdbcType=VARCHAR}
      </if>
      <if test="fetchValue != null">
        AND fetch_value = #{fetchValue,jdbcType=VARCHAR}
      </if>
      <if test="secondFtype != null">
        AND second_ftype = #{secondFtype,jdbcType=VARCHAR}
      </if>
      <if test="secondFvalue != null">
        AND second_fvalue = #{secondFvalue,jdbcType=VARCHAR}
      </if>
      <if test="isDeleted != null">
        AND is_deleted = #{isDeleted,jdbcType=VARCHAR}
      </if>
      <if test="projectId != null">
        AND project_id = #{projectId,jdbcType=VARCHAR}
      </if>
      <if test="tenantId != null">
        AND tenant_id = #{tenantId,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.scriptcase.db.entity.AtuElementInfo">
    select count(*) from
    <include refid="Table_Name"/>
    <trim prefix="WHERE" prefixOverrides="AND" >
      <if test="id != null">
        AND id=#{id,jdbcType=VARCHAR}
      </if>
      <if test="groupId != null">
        AND group_id=#{groupId,jdbcType=VARCHAR}
      </if>
      <if test="name != null">
        AND name=#{name,jdbcType=VARCHAR}
      </if>
      <if test="type != null">
        AND type=#{type,jdbcType=VARCHAR}
      </if>
      <if test="fetchType != null">
        AND fetch_type=#{fetchType,jdbcType=VARCHAR}
      </if>
      <if test="fetchValue != null">
        AND fetch_value=#{fetchValue,jdbcType=VARCHAR}
      </if>
      <if test="secondFtype != null">
        AND second_ftype=#{secondFtype,jdbcType=VARCHAR}
      </if>
      <if test="secondFvalue != null">
        AND second_fvalue=#{secondFvalue,jdbcType=VARCHAR}
      </if>
      <if test="isDeleted != null">
        AND is_deleted=#{isDeleted,jdbcType=VARCHAR}
      </if>
      <if test="projectId != null">
        AND project_id=#{projectId,jdbcType=VARCHAR}
      </if>
      <if test="tenantId != null">
        AND tenant_id=#{tenantId,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>