UserLoginAccountMapper.xml 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3. <mapper namespace="com.zhiqiyun.open.mapper.UserLoginAccountMapper">
  4. <resultMap id="BaseResultMap" type="com.zhiqiyun.open.models.UserLoginAccount">
  5. <id column="id" property="id" jdbcType="VARCHAR"/>
  6. <result column="uid" property="uid" jdbcType="BIGINT"/>
  7. <result column="login_account" property="loginAccount" jdbcType="VARCHAR"/>
  8. <result column="account_type" property="accountType" typeHandler="com.zhiqiyun.open.mybatis.typeHandler.IEnumTypeHandler"/>
  9. </resultMap>
  10. <sql id="Base_Column">
  11. `id`
  12. , `uid`, `login_account`, `account_type`
  13. </sql>
  14. <insert id="insertOrUpdate">
  15. replace
  16. into `user_login_account` (`id`, `uid`, `login_account`, `account_type`)
  17. values (
  18. #{id, jdbcType=BIGINT},
  19. #{uid, jdbcType=BIGINT},
  20. #{loginAccount, jdbcType=VARCHAR},
  21. #{accountType, typeHandler=com.zhiqiyun.open.mybatis.typeHandler.IEnumTypeHandler}
  22. )
  23. </insert>
  24. <delete id="deleteByUid">
  25. delete
  26. from `user_login_account`
  27. where uid = #{uid}
  28. </delete>
  29. <select id="findLoginAccount" resultMap="BaseResultMap">
  30. select
  31. <include refid="Base_Column"/>
  32. from `user_login_account`
  33. <where>
  34. `login_account`=#{loginAccount} and `account_type`=#{accountType,typeHandler=com.zhiqiyun.open.mybatis.typeHandler.IEnumTypeHandler}
  35. </where>
  36. </select>
  37. <select id="findLoginAccounts" resultMap="BaseResultMap">
  38. select
  39. <include refid="Base_Column"/>
  40. from `user_login_account`
  41. <where>
  42. `uid` = #{uid,jdbcType=BIGINT}
  43. </where>
  44. </select>
  45. </mapper>