<?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="com.zheng.cms.dao.mapper.CmsCommentMapper" >
  <resultMap id="BaseResultMap" type="com.zheng.cms.dao.model.CmsComment" >
    <id column="comment_id" property="commentId" jdbcType="INTEGER" />
    <result column="pid" property="pid" jdbcType="INTEGER" />
    <result column="article_id" property="articleId" jdbcType="INTEGER" />
    <result column="user_id" property="userId" jdbcType="INTEGER" />
    <result column="status" property="status" jdbcType="TINYINT" />
    <result column="ip" property="ip" jdbcType="VARCHAR" />
    <result column="agent" property="agent" jdbcType="VARCHAR" />
    <result column="ctime" property="ctime" jdbcType="BIGINT" />
  </resultMap>
  <resultMap id="ResultMapWithBLOBs" type="com.zheng.cms.dao.model.CmsComment" extends="BaseResultMap" >
    <result column="content" property="content" jdbcType="LONGVARCHAR" />
  </resultMap>
  <sql id="Example_Where_Clause" >
    <where >
      <foreach collection="oredCriteria" item="criteria" separator="or" >
        <if test="criteria.valid" >
          <trim prefix="(" suffix=")" prefixOverrides="and" >
            <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 collection="criterion.value" item="listItem" open="(" close=")" separator="," >
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Update_By_Example_Where_Clause" >
    <where >
      <foreach collection="example.oredCriteria" item="criteria" separator="or" >
        <if test="criteria.valid" >
          <trim prefix="(" suffix=")" prefixOverrides="and" >
            <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 collection="criterion.value" item="listItem" open="(" close=")" separator="," >
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List" >
    comment_id, pid, article_id, user_id, status, ip, agent, ctime
  </sql>
  <sql id="Blob_Column_List" >
    content
  </sql>
  <select id="selectByExampleWithBLOBs" resultMap="ResultMapWithBLOBs" parameterType="com.zheng.cms.dao.model.CmsCommentExample" >
    select
    <if test="distinct" >
      distinct
    </if>
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from cms_comment
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null" >
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.zheng.cms.dao.model.CmsCommentExample" >
    select
    <if test="distinct" >
      distinct
    </if>
    <include refid="Base_Column_List" />
    from cms_comment
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null" >
      order by ${orderByClause}
    </if>
    <if test="limit != null" >
      <if test="offset != null" >
        limit ${offset}, ${limit}
      </if>
      <if test="offset == null" >
        limit ${limit}
      </if>
    </if>
  </select>
  <select id="selectByPrimaryKey" resultMap="ResultMapWithBLOBs" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from cms_comment
    where comment_id = #{commentId,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
    delete from cms_comment
    where comment_id = #{commentId,jdbcType=INTEGER}
  </delete>
  <delete id="deleteByExample" parameterType="com.zheng.cms.dao.model.CmsCommentExample" >
    delete from cms_comment
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.zheng.cms.dao.model.CmsComment" >
    insert into cms_comment (comment_id, pid, article_id, 
      user_id, status, ip, 
      agent, ctime, content
      )
    values (#{commentId,jdbcType=INTEGER}, #{pid,jdbcType=INTEGER}, #{articleId,jdbcType=INTEGER}, 
      #{userId,jdbcType=INTEGER}, #{status,jdbcType=TINYINT}, #{ip,jdbcType=VARCHAR}, 
      #{agent,jdbcType=VARCHAR}, #{ctime,jdbcType=BIGINT}, #{content,jdbcType=LONGVARCHAR}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.zheng.cms.dao.model.CmsComment" >
    insert into cms_comment
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="commentId != null" >
        comment_id,
      </if>
      <if test="pid != null" >
        pid,
      </if>
      <if test="articleId != null" >
        article_id,
      </if>
      <if test="userId != null" >
        user_id,
      </if>
      <if test="status != null" >
        status,
      </if>
      <if test="ip != null" >
        ip,
      </if>
      <if test="agent != null" >
        agent,
      </if>
      <if test="ctime != null" >
        ctime,
      </if>
      <if test="content != null" >
        content,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="commentId != null" >
        #{commentId,jdbcType=INTEGER},
      </if>
      <if test="pid != null" >
        #{pid,jdbcType=INTEGER},
      </if>
      <if test="articleId != null" >
        #{articleId,jdbcType=INTEGER},
      </if>
      <if test="userId != null" >
        #{userId,jdbcType=INTEGER},
      </if>
      <if test="status != null" >
        #{status,jdbcType=TINYINT},
      </if>
      <if test="ip != null" >
        #{ip,jdbcType=VARCHAR},
      </if>
      <if test="agent != null" >
        #{agent,jdbcType=VARCHAR},
      </if>
      <if test="ctime != null" >
        #{ctime,jdbcType=BIGINT},
      </if>
      <if test="content != null" >
        #{content,jdbcType=LONGVARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.zheng.cms.dao.model.CmsCommentExample" resultType="java.lang.Integer" >
    select count(*) from cms_comment
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map" >
    update cms_comment
    <set >
      <if test="record.commentId != null" >
        comment_id = #{record.commentId,jdbcType=INTEGER},
      </if>
      <if test="record.pid != null" >
        pid = #{record.pid,jdbcType=INTEGER},
      </if>
      <if test="record.articleId != null" >
        article_id = #{record.articleId,jdbcType=INTEGER},
      </if>
      <if test="record.userId != null" >
        user_id = #{record.userId,jdbcType=INTEGER},
      </if>
      <if test="record.status != null" >
        status = #{record.status,jdbcType=TINYINT},
      </if>
      <if test="record.ip != null" >
        ip = #{record.ip,jdbcType=VARCHAR},
      </if>
      <if test="record.agent != null" >
        agent = #{record.agent,jdbcType=VARCHAR},
      </if>
      <if test="record.ctime != null" >
        ctime = #{record.ctime,jdbcType=BIGINT},
      </if>
      <if test="record.content != null" >
        content = #{record.content,jdbcType=LONGVARCHAR},
      </if>
    </set>
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExampleWithBLOBs" parameterType="map" >
    update cms_comment
    set comment_id = #{record.commentId,jdbcType=INTEGER},
      pid = #{record.pid,jdbcType=INTEGER},
      article_id = #{record.articleId,jdbcType=INTEGER},
      user_id = #{record.userId,jdbcType=INTEGER},
      status = #{record.status,jdbcType=TINYINT},
      ip = #{record.ip,jdbcType=VARCHAR},
      agent = #{record.agent,jdbcType=VARCHAR},
      ctime = #{record.ctime,jdbcType=BIGINT},
      content = #{record.content,jdbcType=LONGVARCHAR}
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map" >
    update cms_comment
    set comment_id = #{record.commentId,jdbcType=INTEGER},
      pid = #{record.pid,jdbcType=INTEGER},
      article_id = #{record.articleId,jdbcType=INTEGER},
      user_id = #{record.userId,jdbcType=INTEGER},
      status = #{record.status,jdbcType=TINYINT},
      ip = #{record.ip,jdbcType=VARCHAR},
      agent = #{record.agent,jdbcType=VARCHAR},
      ctime = #{record.ctime,jdbcType=BIGINT}
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.zheng.cms.dao.model.CmsComment" >
    update cms_comment
    <set >
      <if test="pid != null" >
        pid = #{pid,jdbcType=INTEGER},
      </if>
      <if test="articleId != null" >
        article_id = #{articleId,jdbcType=INTEGER},
      </if>
      <if test="userId != null" >
        user_id = #{userId,jdbcType=INTEGER},
      </if>
      <if test="status != null" >
        status = #{status,jdbcType=TINYINT},
      </if>
      <if test="ip != null" >
        ip = #{ip,jdbcType=VARCHAR},
      </if>
      <if test="agent != null" >
        agent = #{agent,jdbcType=VARCHAR},
      </if>
      <if test="ctime != null" >
        ctime = #{ctime,jdbcType=BIGINT},
      </if>
      <if test="content != null" >
        content = #{content,jdbcType=LONGVARCHAR},
      </if>
    </set>
    where comment_id = #{commentId,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.zheng.cms.dao.model.CmsComment" >
    update cms_comment
    set pid = #{pid,jdbcType=INTEGER},
      article_id = #{articleId,jdbcType=INTEGER},
      user_id = #{userId,jdbcType=INTEGER},
      status = #{status,jdbcType=TINYINT},
      ip = #{ip,jdbcType=VARCHAR},
      agent = #{agent,jdbcType=VARCHAR},
      ctime = #{ctime,jdbcType=BIGINT},
      content = #{content,jdbcType=LONGVARCHAR}
    where comment_id = #{commentId,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.zheng.cms.dao.model.CmsComment" >
    update cms_comment
    set pid = #{pid,jdbcType=INTEGER},
      article_id = #{articleId,jdbcType=INTEGER},
      user_id = #{userId,jdbcType=INTEGER},
      status = #{status,jdbcType=TINYINT},
      ip = #{ip,jdbcType=VARCHAR},
      agent = #{agent,jdbcType=VARCHAR},
      ctime = #{ctime,jdbcType=BIGINT}
    where comment_id = #{commentId,jdbcType=INTEGER}
  </update>
  <cache type="org.mybatis.caches.ehcache.LoggingEhcache" />
</mapper>