<?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.chaozhanggui.dao.system.dao.TbPlussUserOrganMapper">
  <resultMap id="BaseResultMap" type="com.chaozhanggui.dao.system.entity.TbPlussUserOrgan">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="userId" jdbcType="BIGINT" property="userid" />
    <result column="organCode" jdbcType="VARCHAR" property="organcode" />
    <result column="organName" jdbcType="VARCHAR" property="organname" />
    <result column="organTypeCode" jdbcType="VARCHAR" property="organtypecode" />
    <result column="organTypeName" jdbcType="VARCHAR" property="organtypename" />
  </resultMap>
  <sql id="Base_Column_List">
    id, userId, organCode, organName, organTypeCode, organTypeName
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from tb_pluss_user_organ
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from tb_pluss_user_organ
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.chaozhanggui.dao.system.entity.TbPlussUserOrgan">
    insert into tb_pluss_user_organ (id, userId, organCode, 
      organName, organTypeCode, organTypeName
      )
    values (#{id,jdbcType=INTEGER}, #{userid,jdbcType=BIGINT}, #{organcode,jdbcType=VARCHAR}, 
      #{organname,jdbcType=VARCHAR}, #{organtypecode,jdbcType=VARCHAR}, #{organtypename,jdbcType=VARCHAR}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.chaozhanggui.dao.system.entity.TbPlussUserOrgan">
    insert into tb_pluss_user_organ
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="userid != null">
        userId,
      </if>
      <if test="organcode != null">
        organCode,
      </if>
      <if test="organname != null">
        organName,
      </if>
      <if test="organtypecode != null">
        organTypeCode,
      </if>
      <if test="organtypename != null">
        organTypeName,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=INTEGER},
      </if>
      <if test="userid != null">
        #{userid,jdbcType=BIGINT},
      </if>
      <if test="organcode != null">
        #{organcode,jdbcType=VARCHAR},
      </if>
      <if test="organname != null">
        #{organname,jdbcType=VARCHAR},
      </if>
      <if test="organtypecode != null">
        #{organtypecode,jdbcType=VARCHAR},
      </if>
      <if test="organtypename != null">
        #{organtypename,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.dao.system.entity.TbPlussUserOrgan">
    update tb_pluss_user_organ
    <set>
      <if test="userid != null">
        userId = #{userid,jdbcType=BIGINT},
      </if>
      <if test="organcode != null">
        organCode = #{organcode,jdbcType=VARCHAR},
      </if>
      <if test="organname != null">
        organName = #{organname,jdbcType=VARCHAR},
      </if>
      <if test="organtypecode != null">
        organTypeCode = #{organtypecode,jdbcType=VARCHAR},
      </if>
      <if test="organtypename != null">
        organTypeName = #{organtypename,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.chaozhanggui.dao.system.entity.TbPlussUserOrgan">
    update tb_pluss_user_organ
    set userId = #{userid,jdbcType=BIGINT},
      organCode = #{organcode,jdbcType=VARCHAR},
      organName = #{organname,jdbcType=VARCHAR},
      organTypeCode = #{organtypecode,jdbcType=VARCHAR},
      organTypeName = #{organtypename,jdbcType=VARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>
</mapper>