<?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-10-11 16:57:03  -->
<mapper namespace="net.northking.cctp.testbug.db.dao.BugLogDao">


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

  <resultMap id="DetailMap" type="net.northking.cctp.testbug.dto.BugLogDetailDto">
    <!-- 主键 -->
    <id column="bug_log_id" jdbcType="VARCHAR" property="bugLogId"/>
    <!-- 缺陷id -->
    <result column="bug_id" jdbcType="VARCHAR" property="bugId"/>
    <!-- 注释 -->
    <result column="message" jdbcType="LONGVARCHAR" property="message"/>
    <!-- 创建人 -->
    <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>

  <select id="pagingQuery" resultMap="DetailMap" parameterType="net.northking.cctp.testbug.db.entity.BugLog">
    select
    BUG_LOG_ID
    ,BUG_ID
    ,MESSAGE
    ,CREATED_BY
    ,CREATED_TIME
    ,UPDATED_BY
    ,UPDATED_TIME
    ,TENANT_ID
    from
    <include refid="Table_Name"/>
    <trim prefix="WHERE" prefixOverrides="AND" >
      <if test="bugLogId != null">
        AND BUG_LOG_ID = #{bugLogId,jdbcType=VARCHAR}
      </if>
      <if test="bugId != null">
        AND BUG_ID = #{bugId,jdbcType=VARCHAR}
      </if>
      <if test="message != null">
        AND MESSAGE = #{message,jdbcType=LONGVARCHAR}
      </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>

  <insert id="pubAdd" parameterType="net.northking.cctp.testbug.db.entity.BugLog">
    insert into
    <include refid="Table_Name"/>
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="bugLogId != null">
        bug_log_id,
      </if>
      <if test="bugId != null">
        bug_id,
      </if>
      <if test="message != null">
        message,
      </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="bugLogId != null">
        #{bugLogId, jdbcType=VARCHAR},
      </if>
      <if test="bugId != null">
        #{bugId, jdbcType=VARCHAR},
      </if>
      <if test="message != null">
        #{message, jdbcType=LONGVARCHAR},
      </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>
</mapper>