<?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="life.majiang.community.mapper.CommentMapper">
  <resultMap id="BaseResultMap" type="life.majiang.community.model.Comment">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri Jun 14 08:00:35 CST 2019.
    -->
    <id column="ID" jdbcType="BIGINT" property="id" />
    <result column="PARENT_ID" jdbcType="BIGINT" property="parentId" />
    <result column="TYPE" jdbcType="INTEGER" property="type" />
    <result column="COMMENTATOR" jdbcType="BIGINT" property="commentator" />
    <result column="GMT_CREATE" jdbcType="BIGINT" property="gmtCreate" />
    <result column="GMT_MODIFIED" jdbcType="BIGINT" property="gmtModified" />
    <result column="LIKE_COUNT" jdbcType="BIGINT" property="likeCount" />
    <result column="CONTENT" jdbcType="VARCHAR" property="content" />
    <result column="COMMENT_COUNT" jdbcType="INTEGER" property="commentCount" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri Jun 14 08:00:35 CST 2019.
    -->
    <where>
      <foreach collection="oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Update_By_Example_Where_Clause">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri Jun 14 08:00:35 CST 2019.
    -->
    <where>
      <foreach collection="example.oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri Jun 14 08:00:35 CST 2019.
    -->
    ID, PARENT_ID, TYPE, COMMENTATOR, GMT_CREATE, GMT_MODIFIED, LIKE_COUNT, CONTENT, 
    COMMENT_COUNT
  </sql>
  <select id="selectByExample" parameterType="life.majiang.community.model.CommentExample" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri Jun 14 08:00:35 CST 2019.
    -->
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from COMMENT
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri Jun 14 08:00:35 CST 2019.
    -->
    select 
    <include refid="Base_Column_List" />
    from COMMENT
    where ID = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri Jun 14 08:00:35 CST 2019.
    -->
    delete from COMMENT
    where ID = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="life.majiang.community.model.CommentExample">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri Jun 14 08:00:35 CST 2019.
    -->
    delete from COMMENT
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="life.majiang.community.model.Comment">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri Jun 14 08:00:35 CST 2019.
    -->
    insert into COMMENT (ID, PARENT_ID, TYPE, 
      COMMENTATOR, GMT_CREATE, GMT_MODIFIED, 
      LIKE_COUNT, CONTENT, COMMENT_COUNT
      )
    values (#{id,jdbcType=BIGINT}, #{parentId,jdbcType=BIGINT}, #{type,jdbcType=INTEGER}, 
      #{commentator,jdbcType=BIGINT}, #{gmtCreate,jdbcType=BIGINT}, #{gmtModified,jdbcType=BIGINT}, 
      #{likeCount,jdbcType=BIGINT}, #{content,jdbcType=VARCHAR}, #{commentCount,jdbcType=INTEGER}
      )
  </insert>
  <insert id="insertSelective" parameterType="life.majiang.community.model.Comment">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri Jun 14 08:00:35 CST 2019.
    -->
    insert into COMMENT
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        ID,
      </if>
      <if test="parentId != null">
        PARENT_ID,
      </if>
      <if test="type != null">
        TYPE,
      </if>
      <if test="commentator != null">
        COMMENTATOR,
      </if>
      <if test="gmtCreate != null">
        GMT_CREATE,
      </if>
      <if test="gmtModified != null">
        GMT_MODIFIED,
      </if>
      <if test="likeCount != null">
        LIKE_COUNT,
      </if>
      <if test="content != null">
        CONTENT,
      </if>
      <if test="commentCount != null">
        COMMENT_COUNT,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=BIGINT},
      </if>
      <if test="parentId != null">
        #{parentId,jdbcType=BIGINT},
      </if>
      <if test="type != null">
        #{type,jdbcType=INTEGER},
      </if>
      <if test="commentator != null">
        #{commentator,jdbcType=BIGINT},
      </if>
      <if test="gmtCreate != null">
        #{gmtCreate,jdbcType=BIGINT},
      </if>
      <if test="gmtModified != null">
        #{gmtModified,jdbcType=BIGINT},
      </if>
      <if test="likeCount != null">
        #{likeCount,jdbcType=BIGINT},
      </if>
      <if test="content != null">
        #{content,jdbcType=VARCHAR},
      </if>
      <if test="commentCount != null">
        #{commentCount,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="life.majiang.community.model.CommentExample" resultType="java.lang.Long">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri Jun 14 08:00:35 CST 2019.
    -->
    select count(*) from COMMENT
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri Jun 14 08:00:35 CST 2019.
    -->
    update COMMENT
    <set>
      <if test="record.id != null">
        ID = #{record.id,jdbcType=BIGINT},
      </if>
      <if test="record.parentId != null">
        PARENT_ID = #{record.parentId,jdbcType=BIGINT},
      </if>
      <if test="record.type != null">
        TYPE = #{record.type,jdbcType=INTEGER},
      </if>
      <if test="record.commentator != null">
        COMMENTATOR = #{record.commentator,jdbcType=BIGINT},
      </if>
      <if test="record.gmtCreate != null">
        GMT_CREATE = #{record.gmtCreate,jdbcType=BIGINT},
      </if>
      <if test="record.gmtModified != null">
        GMT_MODIFIED = #{record.gmtModified,jdbcType=BIGINT},
      </if>
      <if test="record.likeCount != null">
        LIKE_COUNT = #{record.likeCount,jdbcType=BIGINT},
      </if>
      <if test="record.content != null">
        CONTENT = #{record.content,jdbcType=VARCHAR},
      </if>
      <if test="record.commentCount != null">
        COMMENT_COUNT = #{record.commentCount,jdbcType=INTEGER},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri Jun 14 08:00:35 CST 2019.
    -->
    update COMMENT
    set ID = #{record.id,jdbcType=BIGINT},
      PARENT_ID = #{record.parentId,jdbcType=BIGINT},
      TYPE = #{record.type,jdbcType=INTEGER},
      COMMENTATOR = #{record.commentator,jdbcType=BIGINT},
      GMT_CREATE = #{record.gmtCreate,jdbcType=BIGINT},
      GMT_MODIFIED = #{record.gmtModified,jdbcType=BIGINT},
      LIKE_COUNT = #{record.likeCount,jdbcType=BIGINT},
      CONTENT = #{record.content,jdbcType=VARCHAR},
      COMMENT_COUNT = #{record.commentCount,jdbcType=INTEGER}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="life.majiang.community.model.Comment">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri Jun 14 08:00:35 CST 2019.
    -->
    update COMMENT
    <set>
      <if test="parentId != null">
        PARENT_ID = #{parentId,jdbcType=BIGINT},
      </if>
      <if test="type != null">
        TYPE = #{type,jdbcType=INTEGER},
      </if>
      <if test="commentator != null">
        COMMENTATOR = #{commentator,jdbcType=BIGINT},
      </if>
      <if test="gmtCreate != null">
        GMT_CREATE = #{gmtCreate,jdbcType=BIGINT},
      </if>
      <if test="gmtModified != null">
        GMT_MODIFIED = #{gmtModified,jdbcType=BIGINT},
      </if>
      <if test="likeCount != null">
        LIKE_COUNT = #{likeCount,jdbcType=BIGINT},
      </if>
      <if test="content != null">
        CONTENT = #{content,jdbcType=VARCHAR},
      </if>
      <if test="commentCount != null">
        COMMENT_COUNT = #{commentCount,jdbcType=INTEGER},
      </if>
    </set>
    where ID = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="life.majiang.community.model.Comment">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri Jun 14 08:00:35 CST 2019.
    -->
    update COMMENT
    set PARENT_ID = #{parentId,jdbcType=BIGINT},
      TYPE = #{type,jdbcType=INTEGER},
      COMMENTATOR = #{commentator,jdbcType=BIGINT},
      GMT_CREATE = #{gmtCreate,jdbcType=BIGINT},
      GMT_MODIFIED = #{gmtModified,jdbcType=BIGINT},
      LIKE_COUNT = #{likeCount,jdbcType=BIGINT},
      CONTENT = #{content,jdbcType=VARCHAR},
      COMMENT_COUNT = #{commentCount,jdbcType=INTEGER}
    where ID = #{id,jdbcType=BIGINT}
  </update>
  <select id="selectByExampleWithRowbounds" parameterType="life.majiang.community.model.CommentExample" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri Jun 14 08:00:35 CST 2019.
    -->
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from COMMENT
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
</mapper>