You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

UserPropertiesMapper.xml 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd">
  3. <mapper namespace="org.sonar.db.user.UserPropertiesMapper">
  4. <sql id="userPropertiesColumns">
  5. us.uuid as uuid,
  6. us.user_uuid as userUuid,
  7. us.kee as "key",
  8. us.text_value as "value"
  9. </sql>
  10. <select id="selectByUserUuid" parameterType="String" resultType="org.sonar.db.user.UserPropertyDto">
  11. SELECT
  12. <include refid="userPropertiesColumns"/>
  13. FROM user_properties us
  14. WHERE us.user_uuid=#{userUuid}
  15. </select>
  16. <insert id="insert" parameterType="map" useGeneratedKeys="false">
  17. INSERT INTO user_properties (
  18. uuid,
  19. user_uuid,
  20. kee,
  21. text_value,
  22. created_at,
  23. updated_at
  24. ) VALUES (
  25. #{userProperty.uuid,jdbcType=VARCHAR},
  26. #{userProperty.userUuid,jdbcType=VARCHAR},
  27. #{userProperty.key,jdbcType=VARCHAR},
  28. #{userProperty.value,jdbcType=VARCHAR},
  29. #{now,jdbcType=BIGINT},
  30. #{now,jdbcType=BIGINT}
  31. )
  32. </insert>
  33. <update id="update" parameterType="map">
  34. UPDATE user_properties SET
  35. text_value = #{userProperty.value, jdbcType=VARCHAR},
  36. updated_at = #{now,jdbcType=BIGINT}
  37. WHERE
  38. user_uuid = #{userProperty.userUuid, jdbcType=VARCHAR}
  39. AND kee = #{userProperty.key, jdbcType=VARCHAR}
  40. </update>
  41. <update id="deleteByUserUuid" parameterType="String">
  42. DELETE FROM user_properties WHERE user_uuid=#{userUuid,jdbcType=VARCHAR}
  43. </update>
  44. </mapper>