<?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.sys.dao.Oauth2ClientMapper" >
  <resultMap id="BaseResultMap" type="com.sys.model.Oauth2Client" >
    <id column="id" property="id" jdbcType="BIGINT" />
    <result column="client_name" property="clientName" jdbcType="VARCHAR" />
    <result column="client_id" property="clientId" jdbcType="VARCHAR" />
    <result column="client_secret" property="clientSecret" jdbcType="VARCHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, client_name, client_id, client_secret
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
    select 
    <include refid="Base_Column_List" />
    from oauth2_client
    where id = #{id,jdbcType=BIGINT}
  </select>
  
  <select id="selectByClientId" resultMap="BaseResultMap" parameterType="java.lang.String" >
    select
    <include refid="Base_Column_List" />
    from oauth2_client
    where client_id = #{clientId,jdbcType=VARCHAR}
  </select>
  
  <select id="selectByClientSecret" resultMap="BaseResultMap" parameterType="java.lang.String" >
    select
    <include refid="Base_Column_List" />
    from oauth2_client
    where client_secret = #{clientSecret,jdbcType=VARCHAR}
  </select>
  
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
    delete from oauth2_client
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <insert id="insert" parameterType="com.sys.model.Oauth2Client" >
    insert into oauth2_client (id, client_name, client_id, 
      client_secret)
    values (#{id,jdbcType=BIGINT}, #{clientName,jdbcType=VARCHAR}, #{clientId,jdbcType=VARCHAR}, 
      #{clientSecret,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.sys.model.Oauth2Client" >
    insert into oauth2_client
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="clientName != null" >
        client_name,
      </if>
      <if test="clientId != null" >
        client_id,
      </if>
      <if test="clientSecret != null" >
        client_secret,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=BIGINT},
      </if>
      <if test="clientName != null" >
        #{clientName,jdbcType=VARCHAR},
      </if>
      <if test="clientId != null" >
        #{clientId,jdbcType=VARCHAR},
      </if>
      <if test="clientSecret != null" >
        #{clientSecret,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.sys.model.Oauth2Client" >
    update oauth2_client
    <set >
      <if test="clientName != null" >
        client_name = #{clientName,jdbcType=VARCHAR},
      </if>
      <if test="clientId != null" >
        client_id = #{clientId,jdbcType=VARCHAR},
      </if>
      <if test="clientSecret != null" >
        client_secret = #{clientSecret,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.sys.model.Oauth2Client" >
    update oauth2_client
    set client_name = #{clientName,jdbcType=VARCHAR},
      client_id = #{clientId,jdbcType=VARCHAR},
      client_secret = #{clientSecret,jdbcType=VARCHAR}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>