<?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.community.huiju.dao.TaAgreementMapper" >
  <resultMap id="BaseResultMap" type="com.community.huiju.model.TaAgreement" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="user_agreement" property="userAgreement" jdbcType="VARCHAR" />
    <result column="protection_statement" property="urotectionStatement" jdbcType="VARCHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, user_agreement, protection_statement
  </sql>

  <select id="getAgreement" resultMap="BaseResultMap" parameterType="com.community.huiju.model.TaAgreement" >
    select
    <include refid="Base_Column_List" />
    from ta_agreement limit 1
  </select>

  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    from ta_agreement
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
    delete from ta_agreement
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.community.huiju.model.TaAgreement" >
    insert into ta_agreement (id, user_agreement, protection_statement)
    values (#{id,jdbcType=INTEGER}, #{userAgreement,jdbcType=VARCHAR}, #{protectionStatement,jdbcType=VARCHAR}
  </insert>
  <insert id="insertSelective" parameterType="com.community.huiju.model.TaAgreement" >
    insert into ta_agreement
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="communityName != null" >
        user_agreement,
      </if>
      <if test="communityAlias != null" >
        protection_statement,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=INTEGER},
      </if>
      <if test="communityName != null" >
        #{userAgreement,jdbcType=VARCHAR},
      </if>
      <if test="communityAlias != null" >
        #{protectionStatement,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.community.huiju.model.TaAgreement" >
    update ta_agreement
    <set >
      <if test="communityName != null" >
        user_agreement = #{userAgreement,jdbcType=VARCHAR},
      </if>
      <if test="communityAlias != null" >
        protection_statement = #{protectionStatement,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.community.huiju.model.TaAgreement" >
    update ta_agreement
    set user_agreement = #{userAgreement,jdbcType=VARCHAR},
      protection_statement = #{protectionStatement,jdbcType=VARCHAR},
    where id = #{id,jdbcType=INTEGER}
  </update>
</mapper>