<?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 2021 . All rights reserved. -->
<!--  Mybatis数据库持久层（底层映射文件）：用例执行统计图表 -->
<!--  version: 1.0  -->
<!--  author:  maven-cctp-plugin    -->
<!--  date:  2021-12-15 14:58:27  -->
<mapper namespace="net.northking.cctp.dw.db.dao.MtCaseExecChartDao">
  <resultMap id="BaseResultMap" type="net.northking.cctp.dw.db.entity.MtCaseExecChart">
      <!--  -->
    <id column="id" jdbcType="VARCHAR" property="id"/>
                                    <!-- 创建人 -->
    <result column="created_by" jdbcType="VARCHAR" property="createdBy"/>
        <!-- 租户id -->
    <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
        <!-- 创建时间 -->
    <result column="created_time" jdbcType="VARCHAR" property="createdTime"/>
        <!-- 未执行 -->
    <result column="no_exec" jdbcType="INTEGER" property="noExec"/>
        <!-- 无效 -->
    <result column="invalid" jdbcType="INTEGER" property="invalid"/>
        <!-- 失败 -->
    <result column="fail" jdbcType="INTEGER" property="fail"/>
        <!-- 阻塞 -->
    <result column="block" jdbcType="INTEGER" property="block"/>
        <!-- 挂起 -->
    <result column="hang" jdbcType="INTEGER" property="hang"/>
        <!-- 未完成 -->
    <result column="incomplete" jdbcType="INTEGER" property="incomplete"/>
        <!-- 通过 -->
    <result column="pass" jdbcType="INTEGER" property="pass"/>
        <!--  -->
    <result column="project_id" jdbcType="VARCHAR" property="projectId"/>
        <!-- 类型 -->
    <result column="statistics_type" jdbcType="INTEGER" property="statisticsType"/>
    </resultMap>

  <sql id="Base_Column_List">
    id
    ,created_by
    ,tenant_id
    ,created_time
    ,no_exec
    ,invalid
    ,fail
    ,block
    ,hang
    ,incomplete
    ,pass
    ,project_id
    ,statistics_type
  </sql>

  <sql id="Table_Name">
    ${defaultSchema}.mt_case_exec_chart
  </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.dw.db.entity.MtCaseExecChart">
    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="createdBy != null">
          AND created_by=#{createdBy,jdbcType=VARCHAR}
        </if>
              <if test="tenantId != null">
          AND tenant_id=#{tenantId,jdbcType=VARCHAR}
        </if>
              <if test="createdTime != null">
          AND created_time=#{createdTime,jdbcType=VARCHAR}
        </if>
              <if test="noExec != null">
          AND no_exec=#{noExec,jdbcType=INTEGER}
        </if>
              <if test="invalid != null">
          AND invalid=#{invalid,jdbcType=INTEGER}
        </if>
              <if test="fail != null">
          AND fail=#{fail,jdbcType=INTEGER}
        </if>
              <if test="block != null">
          AND block=#{block,jdbcType=INTEGER}
        </if>
              <if test="hang != null">
          AND hang=#{hang,jdbcType=INTEGER}
        </if>
              <if test="incomplete != null">
          AND incomplete=#{incomplete,jdbcType=INTEGER}
        </if>
              <if test="pass != null">
          AND pass=#{pass,jdbcType=INTEGER}
        </if>
              <if test="projectId != null">
          AND project_id=#{projectId,jdbcType=VARCHAR}
        </if>
              <if test="statisticsType != null">
          AND statistics_type=#{statisticsType,jdbcType=INTEGER}
        </if>
          </trim>
  </delete>

  <insert id="insert" parameterType="net.northking.cctp.dw.db.entity.MtCaseExecChart">
    insert into
    <include refid="Table_Name"/>
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="createdBy != null">
        created_by,
      </if>
      <if test="tenantId != null">
        tenant_id,
      </if>
      <if test="createdTime != null">
        created_time,
      </if>
      <if test="noExec != null">
        no_exec,
      </if>
      <if test="invalid != null">
        invalid,
      </if>
      <if test="fail != null">
        fail,
      </if>
      <if test="block != null">
        block,
      </if>
      <if test="hang != null">
        hang,
      </if>
      <if test="incomplete != null">
        incomplete,
      </if>
      <if test="pass != null">
        pass,
      </if>
      <if test="projectId != null">
        project_id,
      </if>
      <if test="statisticsType != null">
        statistics_type,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
          #{id, jdbcType=VARCHAR},
      </if>
      <if test="createdBy != null">
          #{createdBy, jdbcType=VARCHAR},
      </if>
      <if test="tenantId != null">
          #{tenantId, jdbcType=VARCHAR},
      </if>
      <if test="createdTime != null">
          #{createdTime, jdbcType=VARCHAR},
      </if>
      <if test="noExec != null">
          #{noExec, jdbcType=INTEGER},
      </if>
      <if test="invalid != null">
          #{invalid, jdbcType=INTEGER},
      </if>
      <if test="fail != null">
          #{fail, jdbcType=INTEGER},
      </if>
      <if test="block != null">
          #{block, jdbcType=INTEGER},
      </if>
      <if test="hang != null">
          #{hang, jdbcType=INTEGER},
      </if>
      <if test="incomplete != null">
          #{incomplete, jdbcType=INTEGER},
      </if>
      <if test="pass != null">
          #{pass, jdbcType=INTEGER},
      </if>
      <if test="projectId != null">
          #{projectId, jdbcType=VARCHAR},
      </if>
      <if test="statisticsType != null">
          #{statisticsType, jdbcType=INTEGER},
      </if>
    </trim>
  </insert>

  <insert id="insertByBatch" parameterType="java.util.List">
    insert into
    <include refid="Table_Name"/>
    <trim prefix="(" suffix=")" suffixOverrides=",">
    id,
    created_by,
    tenant_id,
    created_time,
    no_exec,
    invalid,
    fail,
    block,
    hang,
    incomplete,
    pass,
    project_id,
    statistics_type,
    </trim>
    values
    <foreach collection="list" item="item" index="index" separator=",">
      <trim prefix="(" suffix=")" suffixOverrides=",">
    #{item.id, jdbcType=VARCHAR},
    #{item.createdBy, jdbcType=VARCHAR},
    #{item.tenantId, jdbcType=VARCHAR},
    #{item.createdTime, jdbcType=VARCHAR},
    #{item.noExec, jdbcType=INTEGER},
    #{item.invalid, jdbcType=INTEGER},
    #{item.fail, jdbcType=INTEGER},
    #{item.block, jdbcType=INTEGER},
    #{item.hang, jdbcType=INTEGER},
    #{item.incomplete, jdbcType=INTEGER},
    #{item.pass, jdbcType=INTEGER},
    #{item.projectId, jdbcType=VARCHAR},
    #{item.statisticsType, jdbcType=INTEGER},
      </trim>
    </foreach>
  </insert>

  <update id="updateByPrimaryKey" parameterType="net.northking.cctp.dw.db.entity.MtCaseExecChart">
    update
    <include refid="Table_Name"/>
    <set>
      <if test="createdBy != null">
        created_by = #{createdBy, jdbcType=VARCHAR},
      </if>
      <if test="tenantId != null">
        tenant_id = #{tenantId, jdbcType=VARCHAR},
      </if>
      <if test="createdTime != null">
        created_time = #{createdTime, jdbcType=VARCHAR},
      </if>
      <if test="noExec != null">
        no_exec = #{noExec, jdbcType=INTEGER},
      </if>
      <if test="invalid != null">
        invalid = #{invalid, jdbcType=INTEGER},
      </if>
      <if test="fail != null">
        fail = #{fail, jdbcType=INTEGER},
      </if>
      <if test="block != null">
        block = #{block, jdbcType=INTEGER},
      </if>
      <if test="hang != null">
        hang = #{hang, jdbcType=INTEGER},
      </if>
      <if test="incomplete != null">
        incomplete = #{incomplete, jdbcType=INTEGER},
      </if>
      <if test="pass != null">
        pass = #{pass, jdbcType=INTEGER},
      </if>
      <if test="projectId != null">
        project_id = #{projectId, jdbcType=VARCHAR},
      </if>
      <if test="statisticsType != null">
        statistics_type = #{statisticsType, jdbcType=INTEGER},
      </if>
    </set>
    where id = #{id,jdbcType=VARCHAR}
  </update>

  <select id="query" resultMap="BaseResultMap" parameterType="net.northking.cctp.dw.db.entity.MtCaseExecChart">
    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="createdBy != null">
        AND created_by = #{createdBy,jdbcType=VARCHAR}
      </if>
      <if test="tenantId != null">
        AND tenant_id = #{tenantId,jdbcType=VARCHAR}
      </if>
      <if test="createdTime != null">
        AND created_time = #{createdTime,jdbcType=VARCHAR}
      </if>
      <if test="noExec != null">
        AND no_exec = #{noExec,jdbcType=INTEGER}
      </if>
      <if test="invalid != null">
        AND invalid = #{invalid,jdbcType=INTEGER}
      </if>
      <if test="fail != null">
        AND fail = #{fail,jdbcType=INTEGER}
      </if>
      <if test="block != null">
        AND block = #{block,jdbcType=INTEGER}
      </if>
      <if test="hang != null">
        AND hang = #{hang,jdbcType=INTEGER}
      </if>
      <if test="incomplete != null">
        AND incomplete = #{incomplete,jdbcType=INTEGER}
      </if>
      <if test="pass != null">
        AND pass = #{pass,jdbcType=INTEGER}
      </if>
      <if test="projectId != null">
        AND project_id = #{projectId,jdbcType=VARCHAR}
      </if>
      <if test="statisticsType != null">
        AND statistics_type = #{statisticsType,jdbcType=INTEGER}
      </if>
    </trim>
  </select>

  <select id="queryCount" resultType="java.lang.Long" parameterType="net.northking.cctp.dw.db.entity.MtCaseExecChart">
    select count(*) from
    <include refid="Table_Name"/>
    <trim prefix="WHERE" prefixOverrides="AND" >
      <if test="id != null">
        AND id=#{id,jdbcType=VARCHAR}
      </if>
      <if test="createdBy != null">
        AND created_by=#{createdBy,jdbcType=VARCHAR}
      </if>
      <if test="tenantId != null">
        AND tenant_id=#{tenantId,jdbcType=VARCHAR}
      </if>
      <if test="createdTime != null">
        AND created_time=#{createdTime,jdbcType=VARCHAR}
      </if>
      <if test="noExec != null">
        AND no_exec=#{noExec,jdbcType=INTEGER}
      </if>
      <if test="invalid != null">
        AND invalid=#{invalid,jdbcType=INTEGER}
      </if>
      <if test="fail != null">
        AND fail=#{fail,jdbcType=INTEGER}
      </if>
      <if test="block != null">
        AND block=#{block,jdbcType=INTEGER}
      </if>
      <if test="hang != null">
        AND hang=#{hang,jdbcType=INTEGER}
      </if>
      <if test="incomplete != null">
        AND incomplete=#{incomplete,jdbcType=INTEGER}
      </if>
      <if test="pass != null">
        AND pass=#{pass,jdbcType=INTEGER}
      </if>
      <if test="projectId != null">
        AND project_id=#{projectId,jdbcType=VARCHAR}
      </if>
      <if test="statisticsType != null">
        AND statistics_type=#{statisticsType,jdbcType=INTEGER}
      </if>
    </trim>
  </select>

</mapper>