<?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.BugGradeStatisticsDao">
  <resultMap id="BaseResultMap" type="net.northking.cctp.dw.db.entity.BugGradeStatistics">
      <!--  -->
    <id column="id" jdbcType="VARCHAR" property="id"/>
                                    <!-- 分配人 -->
    <result column="receiver_name" jdbcType="VARCHAR" property="receiverName"/>
        <!-- 登陆帐号 -->
    <result column="login_no" jdbcType="VARCHAR" property="loginNo"/>
        <!-- 模块 -->
    <result column="module_id" jdbcType="VARCHAR" property="moduleId"/>
        <!-- 类型 -->
    <result column="record_type" jdbcType="CHAR" property="type"/>
        <!-- 致命性错误-A类 -->
    <result column="A" jdbcType="INTEGER" property="a"/>
        <!-- 严重性错误-B类 -->
    <result column="B" jdbcType="INTEGER" property="b"/>
        <!-- 一般性错误-C类 -->
    <result column="C" jdbcType="INTEGER" property="c"/>
        <!-- 警告性错误-D类 -->
    <result column="D" jdbcType="INTEGER" property="d"/>
        <!-- 建议性错误-E类 -->
    <result column="E" jdbcType="INTEGER" property="e"/>
        <!-- 项目id -->
    <result column="project_id" jdbcType="VARCHAR" property="projectId"/>
        <!-- 创建时间 -->
    <result column="created_time" jdbcType="TIMESTAMP" property="createdTime"/>
        <!-- 租户id -->
    <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
    </resultMap>

  <sql id="Base_Column_List">
    id
    ,receiver_name
    ,login_no
    ,module_id
    ,record_type
    ,A
    ,B
    ,C
    ,D
    ,E
    ,project_id
    ,created_time
    ,tenant_id
  </sql>

  <sql id="Table_Name">
    ${defaultSchema}.bug_grade_statistics
  </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.BugGradeStatistics">
    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="receiverName != null">
          AND receiver_name=#{receiverName,jdbcType=VARCHAR}
        </if>
              <if test="loginNo != null">
          AND login_no=#{loginNo,jdbcType=VARCHAR}
        </if>
              <if test="moduleId != null">
          AND module_id=#{moduleId,jdbcType=VARCHAR}
        </if>
              <if test="type != null">
          AND record_type=#{type,jdbcType=CHAR}
        </if>
              <if test="a != null">
          AND A=#{a,jdbcType=INTEGER}
        </if>
              <if test="b != null">
          AND B=#{b,jdbcType=INTEGER}
        </if>
              <if test="c != null">
          AND C=#{c,jdbcType=INTEGER}
        </if>
              <if test="d != null">
          AND D=#{d,jdbcType=INTEGER}
        </if>
              <if test="e != null">
          AND E=#{e,jdbcType=INTEGER}
        </if>
              <if test="projectId != null">
          AND project_id=#{projectId,jdbcType=VARCHAR}
        </if>
              <if test="createdTime != null">
          AND created_time=#{createdTime,jdbcType=TIMESTAMP}
        </if>
              <if test="tenantId != null">
          AND tenant_id=#{tenantId,jdbcType=VARCHAR}
        </if>
          </trim>
  </delete>

  <insert id="insert" parameterType="net.northking.cctp.dw.db.entity.BugGradeStatistics">
    insert into
    <include refid="Table_Name"/>
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="receiverName != null">
        receiver_name,
      </if>
      <if test="loginNo != null">
        login_no,
      </if>
      <if test="moduleId != null">
        module_id,
      </if>
      <if test="type != null">
        record_type,
      </if>
      <if test="a != null">
        A,
      </if>
      <if test="b != null">
        B,
      </if>
      <if test="c != null">
        C,
      </if>
      <if test="d != null">
        D,
      </if>
      <if test="e != null">
        E,
      </if>
      <if test="projectId != null">
        project_id,
      </if>
      <if test="createdTime != null">
        created_time,
      </if>
      <if test="tenantId != null">
        tenant_id,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
          #{id, jdbcType=VARCHAR},
      </if>
      <if test="receiverName != null">
          #{receiverName, jdbcType=VARCHAR},
      </if>
      <if test="loginNo != null">
          #{loginNo, jdbcType=VARCHAR},
      </if>
      <if test="moduleId != null">
          #{moduleId, jdbcType=VARCHAR},
      </if>
      <if test="type != null">
          #{type, jdbcType=CHAR},
      </if>
      <if test="a != null">
          #{a, jdbcType=INTEGER},
      </if>
      <if test="b != null">
          #{b, jdbcType=INTEGER},
      </if>
      <if test="c != null">
          #{c, jdbcType=INTEGER},
      </if>
      <if test="d != null">
          #{d, jdbcType=INTEGER},
      </if>
      <if test="e != null">
          #{e, jdbcType=INTEGER},
      </if>
      <if test="projectId != null">
          #{projectId, jdbcType=VARCHAR},
      </if>
      <if test="createdTime != null">
          #{createdTime, jdbcType=TIMESTAMP},
      </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,
    receiver_name,
    login_no,
    module_id,
    record_type,
    A,
    B,
    C,
    D,
    E,
    project_id,
    created_time,
    tenant_id,
    </trim>
    values
    <foreach collection="list" item="item" index="index" separator=",">
      <trim prefix="(" suffix=")" suffixOverrides=",">
    #{item.id, jdbcType=VARCHAR},
    #{item.receiverName, jdbcType=VARCHAR},
    #{item.loginNo, jdbcType=VARCHAR},
    #{item.moduleId, jdbcType=VARCHAR},
    #{item.type, jdbcType=CHAR},
    #{item.a, jdbcType=INTEGER},
    #{item.b, jdbcType=INTEGER},
    #{item.c, jdbcType=INTEGER},
    #{item.d, jdbcType=INTEGER},
    #{item.e, jdbcType=INTEGER},
    #{item.projectId, jdbcType=VARCHAR},
    #{item.createdTime, jdbcType=TIMESTAMP},
    #{item.tenantId, jdbcType=VARCHAR},
      </trim>
    </foreach>
  </insert>

  <update id="updateByPrimaryKey" parameterType="net.northking.cctp.dw.db.entity.BugGradeStatistics">
    update
    <include refid="Table_Name"/>
    <set>
      <if test="receiverName != null">
        receiver_name = #{receiverName, jdbcType=VARCHAR},
      </if>
      <if test="loginNo != null">
        login_no = #{loginNo, jdbcType=VARCHAR},
      </if>
      <if test="moduleId != null">
        module_id = #{moduleId, jdbcType=VARCHAR},
      </if>
      <if test="type != null">
        record_type = #{type, jdbcType=CHAR},
      </if>
      <if test="a != null">
        A = #{a, jdbcType=INTEGER},
      </if>
      <if test="b != null">
        B = #{b, jdbcType=INTEGER},
      </if>
      <if test="c != null">
        C = #{c, jdbcType=INTEGER},
      </if>
      <if test="d != null">
        D = #{d, jdbcType=INTEGER},
      </if>
      <if test="e != null">
        E = #{e, jdbcType=INTEGER},
      </if>
      <if test="projectId != null">
        project_id = #{projectId, jdbcType=VARCHAR},
      </if>
      <if test="createdTime != null">
        created_time = #{createdTime, jdbcType=TIMESTAMP},
      </if>
      <if test="tenantId != null">
        tenant_id = #{tenantId, jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=VARCHAR}
  </update>

  <select id="query" resultMap="BaseResultMap" parameterType="net.northking.cctp.dw.db.entity.BugGradeStatistics">
    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="receiverName != null">
        AND receiver_name = #{receiverName,jdbcType=VARCHAR}
      </if>
      <if test="loginNo != null">
        AND login_no = #{loginNo,jdbcType=VARCHAR}
      </if>
      <if test="moduleId != null">
        AND module_id = #{moduleId,jdbcType=VARCHAR}
      </if>
      <if test="type != null">
        AND record_type = #{type,jdbcType=CHAR}
      </if>
      <if test="a != null">
        AND A = #{a,jdbcType=INTEGER}
      </if>
      <if test="b != null">
        AND B = #{b,jdbcType=INTEGER}
      </if>
      <if test="c != null">
        AND C = #{c,jdbcType=INTEGER}
      </if>
      <if test="d != null">
        AND D = #{d,jdbcType=INTEGER}
      </if>
      <if test="e != null">
        AND E = #{e,jdbcType=INTEGER}
      </if>
      <if test="projectId != null">
        AND project_id = #{projectId,jdbcType=VARCHAR}
      </if>
      <if test="createdTime != null">
        AND created_time = #{createdTime,jdbcType=TIMESTAMP}
      </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.BugGradeStatistics">
    select count(*) from
    <include refid="Table_Name"/>
    <trim prefix="WHERE" prefixOverrides="AND" >
      <if test="id != null">
        AND id=#{id,jdbcType=VARCHAR}
      </if>
      <if test="receiverName != null">
        AND receiver_name=#{receiverName,jdbcType=VARCHAR}
      </if>
      <if test="loginNo != null">
        AND login_no=#{loginNo,jdbcType=VARCHAR}
      </if>
      <if test="moduleId != null">
        AND module_id=#{moduleId,jdbcType=VARCHAR}
      </if>
      <if test="type != null">
        AND record_type=#{type,jdbcType=CHAR}
      </if>
      <if test="a != null">
        AND A=#{a,jdbcType=INTEGER}
      </if>
      <if test="b != null">
        AND B=#{b,jdbcType=INTEGER}
      </if>
      <if test="c != null">
        AND C=#{c,jdbcType=INTEGER}
      </if>
      <if test="d != null">
        AND D=#{d,jdbcType=INTEGER}
      </if>
      <if test="e != null">
        AND E=#{e,jdbcType=INTEGER}
      </if>
      <if test="projectId != null">
        AND project_id=#{projectId,jdbcType=VARCHAR}
      </if>
      <if test="createdTime != null">
        AND created_time=#{createdTime,jdbcType=TIMESTAMP}
      </if>
      <if test="tenantId != null">
        AND tenant_id=#{tenantId,jdbcType=VARCHAR}
      </if>
    </trim>
  </select>

</mapper>