<?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-11-23 15:55:22  -->
<mapper namespace="net.northking.cctp.testbug.db.dao.BugStatisticsChartDao">


  <!-- 请在本文件内添加自定义SQL语句 -->

  <resultMap id="DetailMap" type="net.northking.cctp.testbug.dto.BugStatisticsChartDetailDto">
      <!--  -->
    <id column="id" jdbcType="VARCHAR" property="id"/>
                              <!-- 分配人 -->
    <result column="receiver_name" jdbcType="VARCHAR" property="receiverName"/>
        <!-- 模块 -->
    <result column="module_id" jdbcType="VARCHAR" property="moduleId"/>
        <!-- 分类: 0分配人，1模块 -->
    <result column="type" jdbcType="CHAR" property="type"/>
        <!-- 项目id -->
    <result column="project_id" jdbcType="VARCHAR" property="projectId"/>
        <!-- 缺陷状态 -->
    <result column="bug_status" jdbcType="VARCHAR" property="bugStatus"/>
        <!-- 缺陷状态码 -->
    <result column="bug_status_code" jdbcType="VARCHAR" property="bugStatusCode"/>
        <!--  -->
    <result column="amount" jdbcType="INTEGER" property="amount"/>
        <!-- 创建时间 -->
    <result column="create_time" jdbcType="VARCHAR" property="createTime"/>
        <!-- 租户id -->
    <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
    </resultMap>

  <select id="pagingQuery" resultMap="DetailMap" parameterType="net.northking.cctp.testbug.db.entity.BugStatisticsChart">
    select
    id
    ,receiver_name
    ,module_id
    ,type
    ,project_id
    ,bug_status
    ,bug_status_code
    ,amount
    ,create_time
    ,tenant_id
    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="moduleId != null">
        AND module_id = #{moduleId,jdbcType=VARCHAR}
      </if>
      <if test="type != null">
        AND type = #{type,jdbcType=CHAR}
      </if>
      <if test="projectId != null">
        AND project_id = #{projectId,jdbcType=VARCHAR}
      </if>
      <if test="bugStatus != null">
        AND bug_status = #{bugStatus,jdbcType=VARCHAR}
      </if>
      <if test="bugStatusCode != null">
        AND bug_status_code = #{bugStatusCode,jdbcType=VARCHAR}
      </if>
      <if test="amount != null">
        AND amount = #{amount,jdbcType=INTEGER}
      </if>
      <if test="createTime != null">
        AND create_time = #{createTime,jdbcType=VARCHAR}
      </if>
      <if test="tenantId != null">
        AND tenant_id = #{tenantId,jdbcType=VARCHAR}
      </if>
    </trim>
  </select>
</mapper>