<?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-28 13:45:44  -->
<mapper namespace="net.northking.cctp.dw.db.dao.SynBugInfoDao">
  <resultMap id="BaseResultMap" type="net.northking.cctp.dw.db.entity.SynBugInfo">
      <!-- 缺陷id -->
    <id column="bug_id" jdbcType="VARCHAR" property="bugId"/>
        <!-- 严重程度:   建议性错误-E类、警告性错误-D类、一般性错误-C类、严重性错误-B类、致命性错误-A类-->
    <result column="bug_grade" jdbcType="CHAR" property="bugGrade"/>
        <!-- 缺陷分类:  1.需求缺陷、2.设计缺陷、3.编码缺陷、4.UI缺陷、5.兼容性缺陷、6.环境缺陷、7.用户体验、8移植缺陷 -->
    <result column="bug_type" jdbcType="VARCHAR" property="bugType"/>
        <!-- 缺陷来源：1.手动提交,2.自动化提交,3.测试执行提交 -->
    <result column="bug_from" jdbcType="VARCHAR" property="bugFrom"/>
        <!-- 紧急程度：1.高、2.中、3.低 -->
    <result column="emergency" jdbcType="VARCHAR" property="emergency"/>
        <!-- 缺陷状态：1.新建、2.打开、3.已分配、4.拒绝、5.待验证、6.处理中、7.延迟、8.已修复、9.关闭、10.无效、11.重新打开、12.挂起、13.待裁决、14.待完善、15.待分配、16.待修复、17.待审核 -->
    <result column="bug_status" jdbcType="VARCHAR" property="bugStatus"/>
        <!-- 分配给，缺陷接收人 -->
    <result column="receiver" jdbcType="VARCHAR" property="receiver"/>
        <!-- 修复时间 -->
    <result column="repair_time" jdbcType="TIMESTAMP" property="repairTime"/>
        <!-- 修复人 -->
    <result column="repair_user" jdbcType="VARCHAR" property="repairUser"/>
        <!-- 关闭日期 -->
    <result column="close_time" jdbcType="TIMESTAMP" property="closeTime"/>
        <!-- 系统id -->
    <result column="system_id" jdbcType="VARCHAR" property="systemId"/>
        <!-- 轮次id -->
    <result column="round_id" jdbcType="VARCHAR" property="roundId"/>
        <!-- 模块id -->
    <result column="module_id" jdbcType="VARCHAR" property="moduleId"/>
        <!-- 项目id -->
    <result column="pro_id" jdbcType="VARCHAR" property="proId"/>
        <!-- 创建发现人 -->
    <result column="created_by" jdbcType="VARCHAR" property="createdBy"/>
        <!-- 创建时间 -->
    <result column="created_time" jdbcType="TIMESTAMP" property="createdTime"/>
        <!-- 更新人 -->
    <result column="updated_by" jdbcType="VARCHAR" property="updatedBy"/>
        <!-- 更新时间 -->
    <result column="updated_time" jdbcType="TIMESTAMP" property="updatedTime"/>
        <!-- 租户id -->
    <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
    </resultMap>

  <sql id="Base_Column_List">
    bug_id
    ,bug_grade
    ,bug_type
    ,bug_from
    ,emergency
    ,bug_status
    ,receiver
    ,repair_time
    ,repair_user
    ,close_time
    ,system_id
    ,round_id
    ,module_id
    ,pro_id
    ,created_by
    ,created_time
    ,updated_by
    ,updated_time
    ,tenant_id
  </sql>

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

  <select id="findByPrimaryKey" parameterType="String" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List"/>
    from
    <include refid="Table_Name"/>
    where bug_id = #{bugId,jdbcType=VARCHAR}
  </select>

  <select id="findByPrimaryKeys" parameterType="java.util.List">
    select
    <include refid="Base_Column_List"/>
    from
    <include refid="Table_Name"/>
    where bug_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 bug_id = #{bugId,jdbcType=VARCHAR}
  </delete>

  <delete id="deleteByPrimaryKeys" parameterType="String">
    delete from
    <include refid="Table_Name"/>
    where bug_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.SynBugInfo">
    delete from
    <include refid="Table_Name"/>
    <trim prefix="WHERE" prefixOverrides="AND" >
      <if test="bugId != null">
          AND bug_id=#{bugId,jdbcType=VARCHAR}
      </if>
      <if test="bugGrade != null">
          AND bug_grade=#{bugGrade,jdbcType=CHAR}
      </if>
      <if test="bugType != null">
          AND bug_type=#{bugType,jdbcType=VARCHAR}
      </if>
      <if test="bugFrom != null">
          AND bug_from=#{bugFrom,jdbcType=VARCHAR}
      </if>
      <if test="emergency != null">
          AND emergency=#{emergency,jdbcType=VARCHAR}
      </if>
      <if test="bugStatus != null">
          AND bug_status=#{bugStatus,jdbcType=VARCHAR}
      </if>
      <if test="receiver != null">
          AND receiver=#{receiver,jdbcType=VARCHAR}
      </if>
      <if test="repairTime != null">
          AND repair_time=#{repairTime,jdbcType=TIMESTAMP}
      </if>
      <if test="repairUser != null">
          AND repair_user=#{repairUser,jdbcType=VARCHAR}
      </if>
      <if test="closeTime != null">
          AND close_time=#{closeTime,jdbcType=TIMESTAMP}
      </if>
      <if test="systemId != null">
          AND system_id=#{systemId,jdbcType=VARCHAR}
      </if>
      <if test="roundId != null">
          AND round_id=#{roundId,jdbcType=VARCHAR}
      </if>
      <if test="moduleId != null">
          AND module_id=#{moduleId,jdbcType=VARCHAR}
      </if>
      <if test="proId != null">
          AND pro_id=#{proId,jdbcType=VARCHAR}
      </if>
      <if test="createdBy != null">
          AND created_by=#{createdBy,jdbcType=VARCHAR}
      </if>
      <if test="createdTime != null">
          AND created_time=#{createdTime,jdbcType=TIMESTAMP}
      </if>
      <if test="updatedBy != null">
          AND updated_by=#{updatedBy,jdbcType=VARCHAR}
      </if>
      <if test="updatedTime != null">
          AND updated_time=#{updatedTime,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.SynBugInfo">
    insert into
    <include refid="Table_Name"/>
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="bugId != null">
        bug_id,
      </if>
      <if test="bugGrade != null">
        bug_grade,
      </if>
      <if test="bugType != null">
        bug_type,
      </if>
      <if test="bugFrom != null">
        bug_from,
      </if>
      <if test="emergency != null">
        emergency,
      </if>
      <if test="bugStatus != null">
        bug_status,
      </if>
      <if test="receiver != null">
        receiver,
      </if>
      <if test="repairTime != null">
        repair_time,
      </if>
      <if test="repairUser != null">
        repair_user,
      </if>
      <if test="closeTime != null">
        close_time,
      </if>
      <if test="systemId != null">
        system_id,
      </if>
      <if test="roundId != null">
        round_id,
      </if>
      <if test="moduleId != null">
        module_id,
      </if>
      <if test="proId != null">
        pro_id,
      </if>
      <if test="createdBy != null">
        created_by,
      </if>
      <if test="createdTime != null">
        created_time,
      </if>
      <if test="updatedBy != null">
        updated_by,
      </if>
      <if test="updatedTime != null">
        updated_time,
      </if>
      <if test="tenantId != null">
        tenant_id,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="bugId != null">
          #{bugId, jdbcType=VARCHAR},
      </if>
      <if test="bugGrade != null">
          #{bugGrade, jdbcType=CHAR},
      </if>
      <if test="bugType != null">
          #{bugType, jdbcType=VARCHAR},
      </if>
      <if test="bugFrom != null">
          #{bugFrom, jdbcType=VARCHAR},
      </if>
      <if test="emergency != null">
          #{emergency, jdbcType=VARCHAR},
      </if>
      <if test="bugStatus != null">
          #{bugStatus, jdbcType=VARCHAR},
      </if>
      <if test="receiver != null">
          #{receiver, jdbcType=VARCHAR},
      </if>
      <if test="repairTime != null">
          #{repairTime, jdbcType=TIMESTAMP},
      </if>
      <if test="repairUser != null">
          #{repairUser, jdbcType=VARCHAR},
      </if>
      <if test="closeTime != null">
          #{closeTime, jdbcType=TIMESTAMP},
      </if>
      <if test="systemId != null">
          #{systemId, jdbcType=VARCHAR},
      </if>
      <if test="roundId != null">
          #{roundId, jdbcType=VARCHAR},
      </if>
      <if test="moduleId != null">
          #{moduleId, jdbcType=VARCHAR},
      </if>
      <if test="proId != null">
          #{proId, jdbcType=VARCHAR},
      </if>
      <if test="createdBy != null">
          #{createdBy, jdbcType=VARCHAR},
      </if>
      <if test="createdTime != null">
          #{createdTime, jdbcType=TIMESTAMP},
      </if>
      <if test="updatedBy != null">
          #{updatedBy, jdbcType=VARCHAR},
      </if>
      <if test="updatedTime != null">
          #{updatedTime, 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=",">
    bug_id,
    bug_grade,
    bug_type,
    bug_from,
    emergency,
    bug_status,
    receiver,
    repair_time,
    repair_user,
    close_time,
    system_id,
    round_id,
    module_id,
    pro_id,
    created_by,
    created_time,
    updated_by,
    updated_time,
    tenant_id,
    </trim>
    values
    <foreach collection="list" item="item" index="index" separator=",">
      <trim prefix="(" suffix=")" suffixOverrides=",">
    #{item.bugId, jdbcType=VARCHAR},
    #{item.bugGrade, jdbcType=CHAR},
    #{item.bugType, jdbcType=VARCHAR},
    #{item.bugFrom, jdbcType=VARCHAR},
    #{item.emergency, jdbcType=VARCHAR},
    #{item.bugStatus, jdbcType=VARCHAR},
    #{item.receiver, jdbcType=VARCHAR},
    #{item.repairTime, jdbcType=TIMESTAMP},
    #{item.repairUser, jdbcType=VARCHAR},
    #{item.closeTime, jdbcType=TIMESTAMP},
    #{item.systemId, jdbcType=VARCHAR},
    #{item.roundId, jdbcType=VARCHAR},
    #{item.moduleId, jdbcType=VARCHAR},
    #{item.proId, jdbcType=VARCHAR},
    #{item.createdBy, jdbcType=VARCHAR},
    #{item.createdTime, jdbcType=TIMESTAMP},
    #{item.updatedBy, jdbcType=VARCHAR},
    #{item.updatedTime, jdbcType=TIMESTAMP},
    #{item.tenantId, jdbcType=VARCHAR},
      </trim>
    </foreach>
  </insert>

  <update id="updateByPrimaryKey" parameterType="net.northking.cctp.dw.db.entity.SynBugInfo">
    update
    <include refid="Table_Name"/>
    <set>
      <if test="bugGrade != null">
        bug_grade = #{bugGrade, jdbcType=CHAR},
      </if>
      <if test="bugType != null">
        bug_type = #{bugType, jdbcType=VARCHAR},
      </if>
      <if test="bugFrom != null">
        bug_from = #{bugFrom, jdbcType=VARCHAR},
      </if>
      <if test="emergency != null">
        emergency = #{emergency, jdbcType=VARCHAR},
      </if>
      <if test="bugStatus != null">
        bug_status = #{bugStatus, jdbcType=VARCHAR},
      </if>
      <if test="receiver != null">
        receiver = #{receiver, jdbcType=VARCHAR},
      </if>
      <if test="repairTime != null">
        repair_time = #{repairTime, jdbcType=TIMESTAMP},
      </if>
      <if test="repairUser != null">
        repair_user = #{repairUser, jdbcType=VARCHAR},
      </if>
      <if test="closeTime != null">
        close_time = #{closeTime, jdbcType=TIMESTAMP},
      </if>
      <if test="systemId != null">
        system_id = #{systemId, jdbcType=VARCHAR},
      </if>
      <if test="roundId != null">
        round_id = #{roundId, jdbcType=VARCHAR},
      </if>
      <if test="moduleId != null">
        module_id = #{moduleId, jdbcType=VARCHAR},
      </if>
      <if test="proId != null">
        pro_id = #{proId, jdbcType=VARCHAR},
      </if>
      <if test="createdBy != null">
        created_by = #{createdBy, jdbcType=VARCHAR},
      </if>
      <if test="createdTime != null">
        created_time = #{createdTime, jdbcType=TIMESTAMP},
      </if>
      <if test="updatedBy != null">
        updated_by = #{updatedBy, jdbcType=VARCHAR},
      </if>
      <if test="updatedTime != null">
        updated_time = #{updatedTime, jdbcType=TIMESTAMP},
      </if>
    </set>
    where bug_id = #{bugId,jdbcType=VARCHAR}
    AND tenant_id = #{tenantId,jdbcType=VARCHAR}
  </update>

  <select id="query" resultMap="BaseResultMap" parameterType="net.northking.cctp.dw.db.entity.SynBugInfo">
    select
    <include refid="Base_Column_List" />
    from
    <include refid="Table_Name"/>
    <trim prefix="WHERE" prefixOverrides="AND" >
      <if test="bugId != null">
        AND bug_id = #{bugId,jdbcType=VARCHAR}
      </if>
      <if test="bugGrade != null">
        AND bug_grade = #{bugGrade,jdbcType=CHAR}
      </if>
      <if test="bugType != null">
        AND bug_type = #{bugType,jdbcType=VARCHAR}
      </if>
      <if test="bugFrom != null">
        AND bug_from = #{bugFrom,jdbcType=VARCHAR}
      </if>
      <if test="emergency != null">
        AND emergency = #{emergency,jdbcType=VARCHAR}
      </if>
      <if test="bugStatus != null">
        AND bug_status = #{bugStatus,jdbcType=VARCHAR}
      </if>
      <if test="receiver != null">
        AND receiver = #{receiver,jdbcType=VARCHAR}
      </if>
      <if test="repairTime != null">
        AND repair_time = #{repairTime,jdbcType=TIMESTAMP}
      </if>
      <if test="repairUser != null">
        AND repair_user = #{repairUser,jdbcType=VARCHAR}
      </if>
      <if test="closeTime != null">
        AND close_time = #{closeTime,jdbcType=TIMESTAMP}
      </if>
      <if test="systemId != null">
        AND system_id = #{systemId,jdbcType=VARCHAR}
      </if>
      <if test="roundId != null">
        AND round_id = #{roundId,jdbcType=VARCHAR}
      </if>
      <if test="moduleId != null">
        AND module_id = #{moduleId,jdbcType=VARCHAR}
      </if>
      <if test="proId != null">
        AND pro_id = #{proId,jdbcType=VARCHAR}
      </if>
      <if test="createdBy != null">
        AND created_by = #{createdBy,jdbcType=VARCHAR}
      </if>
      <if test="createdTime != null">
        AND created_time = #{createdTime,jdbcType=TIMESTAMP}
      </if>
      <if test="updatedBy != null">
        AND updated_by = #{updatedBy,jdbcType=VARCHAR}
      </if>
      <if test="updatedTime != null">
        AND updated_time = #{updatedTime,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.SynBugInfo">
    select count(*) from
    <include refid="Table_Name"/>
    <trim prefix="WHERE" prefixOverrides="AND" >
      <if test="bugId != null">
        AND bug_id=#{bugId,jdbcType=VARCHAR}
      </if>
      <if test="bugGrade != null">
        AND bug_grade=#{bugGrade,jdbcType=CHAR}
      </if>
      <if test="bugType != null">
        AND bug_type=#{bugType,jdbcType=VARCHAR}
      </if>
      <if test="bugFrom != null">
        AND bug_from=#{bugFrom,jdbcType=VARCHAR}
      </if>
      <if test="emergency != null">
        AND emergency=#{emergency,jdbcType=VARCHAR}
      </if>
      <if test="bugStatus != null">
        AND bug_status=#{bugStatus,jdbcType=VARCHAR}
      </if>
      <if test="receiver != null">
        AND receiver=#{receiver,jdbcType=VARCHAR}
      </if>
      <if test="repairTime != null">
        AND repair_time=#{repairTime,jdbcType=TIMESTAMP}
      </if>
      <if test="repairUser != null">
        AND repair_user=#{repairUser,jdbcType=VARCHAR}
      </if>
      <if test="closeTime != null">
        AND close_time=#{closeTime,jdbcType=TIMESTAMP}
      </if>
      <if test="systemId != null">
        AND system_id=#{systemId,jdbcType=VARCHAR}
      </if>
      <if test="roundId != null">
        AND round_id=#{roundId,jdbcType=VARCHAR}
      </if>
      <if test="moduleId != null">
        AND module_id=#{moduleId,jdbcType=VARCHAR}
      </if>
      <if test="proId != null">
        AND pro_id=#{proId,jdbcType=VARCHAR}
      </if>
      <if test="createdBy != null">
        AND created_by=#{createdBy,jdbcType=VARCHAR}
      </if>
      <if test="createdTime != null">
        AND created_time=#{createdTime,jdbcType=TIMESTAMP}
      </if>
      <if test="updatedBy != null">
        AND updated_by=#{updatedBy,jdbcType=VARCHAR}
      </if>
      <if test="updatedTime != null">
        AND updated_time=#{updatedTime,jdbcType=TIMESTAMP}
      </if>
      <if test="tenantId != null">
        AND tenant_id=#{tenantId,jdbcType=VARCHAR}
      </if>
    </trim>
  </select>

</mapper>