<?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:14:34  -->
<mapper namespace="net.northking.cctp.dw.db.dao.BugDensityChartDao">
  <resultMap id="BaseResultMap" type="net.northking.cctp.dw.db.entity.BugDensityChart">
      <!--  -->
    <id column="id" jdbcType="BIGINT" property="id"/>
                          <!-- 人员名称 -->
    <result column="user_name" jdbcType="VARCHAR" property="userName"/>
        <!-- 登陆帐号 -->
    <result column="login_no" jdbcType="VARCHAR" property="loginNo"/>
        <!-- 缺陷数量 -->
    <result column="bug_num" jdbcType="REAL" property="bugNum"/>
        <!-- 有效执行用例数 -->
    <result column="exec_count" jdbcType="INTEGER" property="execCount"/>
        <!-- 缺陷密度 -->
    <result column="bug_density" jdbcType="REAL" property="bugDensity"/>
        <!--  -->
    <result column="project_id" jdbcType="VARCHAR" property="projectId"/>
        <!--  -->
    <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
    </resultMap>

  <sql id="Base_Column_List">
    id
    ,user_name
    ,login_no
    ,bug_num
    ,exec_count
    ,bug_density
    ,project_id
    ,tenant_id
  </sql>

  <sql id="Table_Name">
    bug_density_chart
  </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.BugDensityChart">
    delete from
    <include refid="Table_Name"/>
    <trim prefix="WHERE" prefixOverrides="AND" >
      <if test="id != null">
          AND id=#{id,jdbcType=BIGINT}
      </if>
      <if test="userName != null">
          AND user_name=#{userName,jdbcType=VARCHAR}
      </if>
      <if test="loginNo != null">
          AND login_no=#{loginNo,jdbcType=VARCHAR}
      </if>
      <if test="bugNum != null">
          AND bug_num=#{bugNum,jdbcType=REAL}
      </if>
      <if test="execCount != null">
          AND exec_count=#{execCount,jdbcType=INTEGER}
      </if>
      <if test="bugDensity != null">
          AND bug_density=#{bugDensity,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.BugDensityChart">
    insert into
    <include refid="Table_Name"/>
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="userName != null">
        user_name,
      </if>
      <if test="loginNo != null">
        login_no,
      </if>
      <if test="bugNum != null">
        bug_num,
      </if>
      <if test="execCount != null">
        exec_count,
      </if>
      <if test="bugDensity != null">
        bug_density,
      </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="userName != null">
          #{userName, jdbcType=VARCHAR},
      </if>
      <if test="loginNo != null">
          #{loginNo, jdbcType=VARCHAR},
      </if>
      <if test="bugNum != null">
          #{bugNum, jdbcType=REAL},
      </if>
      <if test="execCount != null">
          #{execCount, jdbcType=INTEGER},
      </if>
      <if test="bugDensity != null">
          #{bugDensity, 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,
    user_name,
    login_no,
    bug_num,
    exec_count,
    bug_density,
    project_id,
    tenant_id,
    </trim>
    values
    <foreach collection="list" item="item" index="index" separator=",">
      <trim prefix="(" suffix=")" suffixOverrides=",">
    #{item.id, jdbcType=BIGINT},
    #{item.userName, jdbcType=VARCHAR},
    #{item.loginNo, jdbcType=VARCHAR},
    #{item.bugNum, jdbcType=REAL},
    #{item.execCount, jdbcType=INTEGER},
    #{item.bugDensity, jdbcType=REAL},
    #{item.projectId, jdbcType=VARCHAR},
    #{item.tenantId, jdbcType=VARCHAR},
      </trim>
    </foreach>
  </insert>

  <update id="updateByPrimaryKey" parameterType="net.northking.cctp.dw.db.entity.BugDensityChart">
    update
    <include refid="Table_Name"/>
    <set>
      <if test="userName != null">
        user_name = #{userName, jdbcType=VARCHAR},
      </if>
      <if test="loginNo != null">
        login_no = #{loginNo, jdbcType=VARCHAR},
      </if>
      <if test="bugNum != null">
        bug_num = #{bugNum, jdbcType=REAL},
      </if>
      <if test="execCount != null">
        exec_count = #{execCount, jdbcType=INTEGER},
      </if>
      <if test="bugDensity != null">
        bug_density = #{bugDensity, 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.BugDensityChart">
    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="userName != null">
        AND user_name = #{userName,jdbcType=VARCHAR}
      </if>
      <if test="loginNo != null">
        AND login_no = #{loginNo,jdbcType=VARCHAR}
      </if>
      <if test="bugNum != null">
        AND bug_num = #{bugNum,jdbcType=REAL}
      </if>
      <if test="execCount != null">
        AND exec_count = #{execCount,jdbcType=INTEGER}
      </if>
      <if test="bugDensity != null">
        AND bug_density = #{bugDensity,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.BugDensityChart">
    select count(*) from
    <include refid="Table_Name"/>
    <trim prefix="WHERE" prefixOverrides="AND" >
      <if test="id != null">
        AND id=#{id,jdbcType=BIGINT}
      </if>
      <if test="userName != null">
        AND user_name=#{userName,jdbcType=VARCHAR}
      </if>
      <if test="loginNo != null">
        AND login_no=#{loginNo,jdbcType=VARCHAR}
      </if>
      <if test="bugNum != null">
        AND bug_num=#{bugNum,jdbcType=REAL}
      </if>
      <if test="execCount != null">
        AND exec_count=#{execCount,jdbcType=INTEGER}
      </if>
      <if test="bugDensity != null">
        AND bug_density=#{bugDensity,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>