<?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-01-21 10:29:37  -->
<mapper namespace="net.northking.cctp.dw.db.dao.MtCaseExecPassRatioDao">
  <resultMap id="BaseResultMap" type="net.northking.cctp.dw.db.entity.MtCaseExecPassRatio">
      <!--  -->
    <id column="id" jdbcType="BIGINT" property="id"/>
                        <!-- 子节点目录名 -->
    <result column="dir_name" jdbcType="VARCHAR" property="dirName"/>
        <!-- 案例数 -->
    <result column="case_count" jdbcType="INTEGER" property="caseCount"/>
        <!-- 通过案例数 -->
    <result column="pass_count" jdbcType="INTEGER" property="passCount"/>
        <!-- 通过案例率 -->
    <result column="case_pass_percent" jdbcType="REAL" property="casePassPercent"/>
        <!--  -->
    <result column="project_id" jdbcType="VARCHAR" property="projectId"/>
        <!--  -->
    <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
    </resultMap>

  <sql id="Base_Column_List">
    id
    ,dir_name
    ,case_count
    ,pass_count
    ,case_pass_percent
    ,project_id
    ,tenant_id
  </sql>

  <sql id="Table_Name">
    mt_case_exec_pass_ratio
  </sql>

  <select id="findByPrimaryKey" parameterType="Long" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List"/>
    from
    <include refid="Table_Name"/>
    where id = #{id,jdbcType=BIGINT}
  </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=BIGINT}
    </foreach>
  </select>

  <delete id="deleteByPrimaryKey" parameterType="Long">
    delete from
    <include refid="Table_Name"/>
    where id = #{id,jdbcType=BIGINT}
  </delete>

  <delete id="deleteByPrimaryKeys" parameterType="Long">
    delete from
    <include refid="Table_Name"/>
    where id in
    <foreach collection="list" item="idItem" open="(" separator="," close=")">
      #{idItem, jdbcType=BIGINT}
    </foreach>
  </delete>

  <delete id="deleteByExample" parameterType="net.northking.cctp.dw.db.entity.MtCaseExecPassRatio">
    delete from
    <include refid="Table_Name"/>
    <trim prefix="WHERE" prefixOverrides="AND" >
      <if test="id != null">
          AND id=#{id,jdbcType=BIGINT}
      </if>
      <if test="dirName != null">
          AND dir_name=#{dirName,jdbcType=VARCHAR}
      </if>
      <if test="caseCount != null">
          AND case_count=#{caseCount,jdbcType=INTEGER}
      </if>
      <if test="passCount != null">
          AND pass_count=#{passCount,jdbcType=INTEGER}
      </if>
      <if test="casePassPercent != null">
          AND case_pass_percent=#{casePassPercent,jdbcType=REAL}
      </if>
      <if test="projectId != null">
          AND project_id=#{projectId,jdbcType=VARCHAR}
      </if>
      <if test="tenantId != null">
          AND tenant_id=#{tenantId,jdbcType=VARCHAR}
      </if>
    </trim>
  </delete>

  <insert id="insert" parameterType="net.northking.cctp.dw.db.entity.MtCaseExecPassRatio">
    insert into
    <include refid="Table_Name"/>
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="dirName != null">
        dir_name,
      </if>
      <if test="caseCount != null">
        case_count,
      </if>
      <if test="passCount != null">
        pass_count,
      </if>
      <if test="casePassPercent != null">
        case_pass_percent,
      </if>
      <if test="projectId != null">
        project_id,
      </if>
      <if test="tenantId != null">
        tenant_id,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
          #{id, jdbcType=BIGINT},
      </if>
      <if test="dirName != null">
          #{dirName, jdbcType=VARCHAR},
      </if>
      <if test="caseCount != null">
          #{caseCount, jdbcType=INTEGER},
      </if>
      <if test="passCount != null">
          #{passCount, jdbcType=INTEGER},
      </if>
      <if test="casePassPercent != null">
          #{casePassPercent, jdbcType=REAL},
      </if>
      <if test="projectId != null">
          #{projectId, jdbcType=VARCHAR},
      </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,
    dir_name,
    case_count,
    pass_count,
    case_pass_percent,
    project_id,
    tenant_id,
    </trim>
    values
    <foreach collection="list" item="item" index="index" separator=",">
      <trim prefix="(" suffix=")" suffixOverrides=",">
    #{item.id, jdbcType=BIGINT},
    #{item.dirName, jdbcType=VARCHAR},
    #{item.caseCount, jdbcType=INTEGER},
    #{item.passCount, jdbcType=INTEGER},
    #{item.casePassPercent, jdbcType=REAL},
    #{item.projectId, jdbcType=VARCHAR},
    #{item.tenantId, jdbcType=VARCHAR},
      </trim>
    </foreach>
  </insert>

  <update id="updateByPrimaryKey" parameterType="net.northking.cctp.dw.db.entity.MtCaseExecPassRatio">
    update
    <include refid="Table_Name"/>
    <set>
      <if test="dirName != null">
        dir_name = #{dirName, jdbcType=VARCHAR},
      </if>
      <if test="caseCount != null">
        case_count = #{caseCount, jdbcType=INTEGER},
      </if>
      <if test="passCount != null">
        pass_count = #{passCount, jdbcType=INTEGER},
      </if>
      <if test="casePassPercent != null">
        case_pass_percent = #{casePassPercent, jdbcType=REAL},
      </if>
      <if test="projectId != null">
        project_id = #{projectId, jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
    AND tenant_id = #{tenantId,jdbcType=VARCHAR}
  </update>

  <select id="query" resultMap="BaseResultMap" parameterType="net.northking.cctp.dw.db.entity.MtCaseExecPassRatio">
    select
    <include refid="Base_Column_List" />
    from
    <include refid="Table_Name"/>
    <trim prefix="WHERE" prefixOverrides="AND" >
      <if test="id != null">
        AND id = #{id,jdbcType=BIGINT}
      </if>
      <if test="dirName != null">
        AND dir_name = #{dirName,jdbcType=VARCHAR}
      </if>
      <if test="caseCount != null">
        AND case_count = #{caseCount,jdbcType=INTEGER}
      </if>
      <if test="passCount != null">
        AND pass_count = #{passCount,jdbcType=INTEGER}
      </if>
      <if test="casePassPercent != null">
        AND case_pass_percent = #{casePassPercent,jdbcType=REAL}
      </if>
      <if test="projectId != null">
        AND project_id = #{projectId,jdbcType=VARCHAR}
      </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.dw.db.entity.MtCaseExecPassRatio">
    select count(*) from
    <include refid="Table_Name"/>
    <trim prefix="WHERE" prefixOverrides="AND" >
      <if test="id != null">
        AND id=#{id,jdbcType=BIGINT}
      </if>
      <if test="dirName != null">
        AND dir_name=#{dirName,jdbcType=VARCHAR}
      </if>
      <if test="caseCount != null">
        AND case_count=#{caseCount,jdbcType=INTEGER}
      </if>
      <if test="passCount != null">
        AND pass_count=#{passCount,jdbcType=INTEGER}
      </if>
      <if test="casePassPercent != null">
        AND case_pass_percent=#{casePassPercent,jdbcType=REAL}
      </if>
      <if test="projectId != null">
        AND project_id=#{projectId,jdbcType=VARCHAR}
      </if>
      <if test="tenantId != null">
        AND tenant_id=#{tenantId,jdbcType=VARCHAR}
      </if>
    </trim>
  </select>

</mapper>