<?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.usoft.credit.dal.mapper.UserMapper">
  <resultMap id="BaseResultMap" type="com.usoft.credit.dal.entity.User">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="code" jdbcType="VARCHAR" property="code" />
    <result column="enuu" jdbcType="INTEGER" property="enuu" />
    <result column="password" jdbcType="VARCHAR" property="password" />
    <result column="useruu" jdbcType="INTEGER" property="useruu" />
  </resultMap>
  <sql id="Base_Column_List">
    id, code, enuu, password, useruu
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from t_user
    where id = #{id,jdbcType=INTEGER}
  </select>

  <select id="selectByUser" parameterType="com.usoft.credit.dal.entity.User" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from t_user
    where enuu = #{enuu} AND password = #{password} AND useruu = #{useruu}
  </select>

  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from t_user
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.usoft.credit.dal.entity.User">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into t_user (code, enuu, password, 
      useruu)
    values (#{code,jdbcType=VARCHAR}, #{enuu,jdbcType=INTEGER}, #{password,jdbcType=VARCHAR}, 
      #{useruu,jdbcType=INTEGER})
  </insert>
  <insert id="insertSelective" parameterType="com.usoft.credit.dal.entity.User">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into t_user
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="code != null">
        code,
      </if>
      <if test="enuu != null">
        enuu,
      </if>
      <if test="password != null">
        password,
      </if>
      <if test="useruu != null">
        useruu,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="code != null">
        #{code,jdbcType=VARCHAR},
      </if>
      <if test="enuu != null">
        #{enuu,jdbcType=INTEGER},
      </if>
      <if test="password != null">
        #{password,jdbcType=VARCHAR},
      </if>
      <if test="useruu != null">
        #{useruu,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.usoft.credit.dal.entity.User">
    update t_user
    <set>
      <if test="code != null">
        code = #{code,jdbcType=VARCHAR},
      </if>
      <if test="enuu != null">
        enuu = #{enuu,jdbcType=INTEGER},
      </if>
      <if test="password != null">
        password = #{password,jdbcType=VARCHAR},
      </if>
      <if test="useruu != null">
        useruu = #{useruu,jdbcType=INTEGER},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.usoft.credit.dal.entity.User">
    update t_user
    set code = #{code,jdbcType=VARCHAR},
      enuu = #{enuu,jdbcType=INTEGER},
      password = #{password,jdbcType=VARCHAR},
      useruu = #{useruu,jdbcType=INTEGER}
    where id = #{id,jdbcType=INTEGER}
  </update>
</mapper>