<?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">
<mapper namespace="net.northking.cctp.platform.db.dao.CpLogContentDetailDao">


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

  <sql id="Table_Name">
    ${defaultSchema}.cp_log_content_detail
  </sql>

  <insert id="insertCpLogContentDetail" parameterType="net.northking.cctp.platform.db.entity.CpLogContentDetail">
    insert into
    <include refid="Table_Name"/>
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="logId != null">
        log_id,
      </if>
      <if test="content != null">
        content,
      </if>
      <if test="tenantId != null">
        tenant_id,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id, jdbcType=VARCHAR},
      </if>
      <if test="logId != null">
        #{logId, jdbcType=VARCHAR},
      </if>
      <if test="content != null">
        #{content, jdbcType=VARCHAR},
      </if>
      <if test="tenantId != null">
        #{tenantId, jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>

  <select id="listLogContentDetail" resultType="java.lang.String">
    select content from
    <include refid="Table_Name"/>
    <where>
      <if test="logId != null">
        log_id = #{logId, jdbcType=VARCHAR}
      </if>
      <if test="tenantId != null">
        and tenant_id = #{tenantId, jdbcType=VARCHAR}
      </if>
    </where>
  </select>

  <select id="countLogContentDetail" resultType="java.lang.Integer">
    select count(id) from
    <include refid="Table_Name"/>
    <where>
      <if test="logId != null">
        log_id = #{logId, jdbcType=VARCHAR}
      </if>
      <if test="tenantId != null">
        and tenant_id = #{tenantId, jdbcType=VARCHAR}
      </if>
    </where>
  </select>
</mapper>