<?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="cn.iocoder.yudao.module.knowledge.mapper.UserInfoMapper" >
  <resultMap id="BaseResultMap" type="cn.iocoder.yudao.module.knowledge.entity.UserInfo" >
    <id column="ID" property="id" jdbcType="DECIMAL" />
    <result column="USERNAME" property="username" jdbcType="VARCHAR" />
    <result column="PASSWORD" property="password" jdbcType="VARCHAR" />
    <result column="AGE" property="age" jdbcType="INTEGER" />
    <result column="MOBILE" property="mobile" jdbcType="VARCHAR" />
    <result column="SEX" property="sex" jdbcType="TINYINT" />
    <result column="BIRTHDAY" property="birthday" jdbcType="TIMESTAMP" />
    <result column="CREATE_TIME" jdbcType="TIMESTAMP" property="createTime" />
    <result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime" />
    <result column="DELETED" jdbcType="DECIMAL" property="deleted" />
    <result column="DEPT_ID" jdbcType="DECIMAL" property="deptId" />
    <result column="IDENTITY_ID" jdbcType="VARCHAR" property="identityId" />
  </resultMap>
  <sql id="Base_Column_List" >
    ID, USERNAME, PASSWORD, AGE, MOBILE , SEX, BIRTHDAY,CREATE_TIME, UPDATE_TIME,IDENTITY_ID,DEPT_ID,DELETED
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select
    <include refid="Base_Column_List" />
    from USER_INFO
    where ID = #{id,jdbcType=DECIMAL}
  </select>

<!--  <select id="selectById" resultMap="BaseResultMap" parameterType="java.lang.Integer" >-->
<!--    select-->
<!--    <include refid="Base_Column_List" />-->
<!--    from USER_INFO-->
<!--    where ID = #{id,jdbcType=DECIMAL}-->
<!--  </select>-->
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
    delete from USER_INFO
    where id = #{id,jdbcType=DECIMAL}
  </delete>
  <insert id="insert" parameterType="cn.iocoder.yudao.module.knowledge.entity.UserInfo" useGeneratedKeys="true" keyProperty="id">
    insert into USER_INFO ( ID, USERNAME, PASSWORD, AGE, MOBILE , SEX, BIRTHDAY, CREATE_TIME, UPDATE_TIME,IDENTITY_ID,DEPT_ID,DELETED)
    values (#{id,jdbcType=DECIMAL}, #{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},
      #{age,jdbcType=INTEGER}, #{mobile,jdbcType=VARCHAR}, #{sex,jdbcType=TINYINT},
      #{birthday,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
            #{deptId,jdbcType=DECIMAL},
            #{deleted,jdbcType=DECIMAL},
            #{identityId,jdbcType=VARCHAR})
  </insert>
  <insert id="insertUser"  parameterType="cn.iocoder.yudao.module.knowledge.entity.UserInfo">
    insert into USER_INFO ( USERNAME, PASSWORD, AGE, MOBILE , SEX, BIRTHDAY, CREATE_TIME, UPDATE_TIME,IDENTITY_ID,DEPT_ID,DELETED)
    values ( #{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},
            #{age,jdbcType=INTEGER}, #{mobile,jdbcType=VARCHAR}, #{sex,jdbcType=TINYINT},
            #{birthday,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
            #{identityId,jdbcType=VARCHAR},
            #{deptId,jdbcType=DECIMAL},
            #{deleted,jdbcType=DECIMAL}
          )
  </insert>
  <update id="updateByPrimaryKey" parameterType="cn.iocoder.yudao.module.knowledge.entity.UserInfo" >
    update USER_INFO
    set USERNAME = #{username,jdbcType=VARCHAR},
        PASSWORD = #{password,jdbcType=VARCHAR},
        AGE = #{age,jdbcType=INTEGER},
        MOBILE = #{mobile,jdbcType=VARCHAR},
        SEX = #{sex,jdbcType=TINYINT},
        BIRTHDAY = #{birthday,jdbcType=TIMESTAMP},
      CREATE_TIME = #{createTime,jdbcType=TIMESTAMP},
      UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
      DEPT_ID = #{deptId,jdbcType=DECIMAL},
      IDENTITY_ID = #{identityId,jdbcType=VARCHAR},
      DELETED = #{deleted,jdbcType=DECIMAL}
    where ID = #{id,jdbcType=DECIMAL}
  </update>
  <update id="updateAge"  parameterType="cn.iocoder.yudao.module.knowledge.entity.UserInfo">
    update USER_INFO
    set AGE = #{age,jdbcType=INTEGER} , UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP}
    where ID = #{id,jdbcType=DECIMAL}
  </update>
  <select id="selectByName" resultMap="BaseResultMap" parameterType="java.lang.String" >
    select
    <include refid="Base_Column_List" />
    from USER_INFO
    where USERNAME = #{username,jdbcType=VARCHAR}
  </select>
  <select id="getMyById" resultType="cn.iocoder.yudao.module.knowledge.entity.UserInfo">
    select
    <include refid="Base_Column_List" />
    from USER_INFO
    where ID = #{id,jdbcType=DECIMAL}

  </select>
  <select id="selectPageVo" resultType="cn.iocoder.yudao.module.knowledge.entity.UserInfo">
    select
    <include refid="Base_Column_List" />
    from USER_INFO
    where  USERNAME = #{username,jdbcType=VARCHAR}
  </select>
</mapper>
