LoginHistoryMapper.xml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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.anlovek.saas.mapper.LoginHistoryMapper">
  4. <resultMap id="BaseResultMap" type="com.anlovek.saas.mapper.LoginHistory">
  5. <id column="id" jdbcType="BIGINT" property="id" />
  6. <result column="username" jdbcType="VARCHAR" property="username" />
  7. <result column="login_time" jdbcType="TIMESTAMP" property="loginTime" />
  8. <result column="login_ip" jdbcType="CHAR" property="loginIp" />
  9. <result column="success" jdbcType="BIT" property="success" />
  10. <result column="other_info" jdbcType="VARCHAR" property="otherInfo" />
  11. </resultMap>
  12. <sql id="Base_Column_List">
  13. id, username, login_time, login_ip, success, other_info
  14. </sql>
  15. <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
  16. select
  17. <include refid="Base_Column_List" />
  18. from sys_user_login_history
  19. where id = #{id,jdbcType=BIGINT}
  20. </select>
  21. <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
  22. delete from sys_user_login_history
  23. where id = #{id,jdbcType=BIGINT}
  24. </delete>
  25. <insert id="insert" parameterType="com.anlovek.saas.mapper.LoginHistory">
  26. insert into sys_user_login_history (id, username, login_time,
  27. login_ip, success, other_info
  28. )
  29. values (#{id,jdbcType=BIGINT}, #{username,jdbcType=VARCHAR}, #{loginTime,jdbcType=TIMESTAMP},
  30. #{loginIp,jdbcType=CHAR}, #{success,jdbcType=BIT}, #{otherInfo,jdbcType=VARCHAR}
  31. )
  32. </insert>
  33. <insert id="insertSelective" parameterType="com.anlovek.saas.mapper.LoginHistory">
  34. insert into sys_user_login_history
  35. <trim prefix="(" suffix=")" suffixOverrides=",">
  36. <if test="id != null">
  37. id,
  38. </if>
  39. <if test="username != null">
  40. username,
  41. </if>
  42. <if test="loginTime != null">
  43. login_time,
  44. </if>
  45. <if test="loginIp != null">
  46. login_ip,
  47. </if>
  48. <if test="success != null">
  49. success,
  50. </if>
  51. <if test="otherInfo != null">
  52. other_info,
  53. </if>
  54. </trim>
  55. <trim prefix="values (" suffix=")" suffixOverrides=",">
  56. <if test="id != null">
  57. #{id,jdbcType=BIGINT},
  58. </if>
  59. <if test="username != null">
  60. #{username,jdbcType=VARCHAR},
  61. </if>
  62. <if test="loginTime != null">
  63. #{loginTime,jdbcType=TIMESTAMP},
  64. </if>
  65. <if test="loginIp != null">
  66. #{loginIp,jdbcType=CHAR},
  67. </if>
  68. <if test="success != null">
  69. #{success,jdbcType=BIT},
  70. </if>
  71. <if test="otherInfo != null">
  72. #{otherInfo,jdbcType=VARCHAR},
  73. </if>
  74. </trim>
  75. </insert>
  76. <update id="updateByPrimaryKeySelective" parameterType="com.anlovek.saas.mapper.LoginHistory">
  77. update sys_user_login_history
  78. <set>
  79. <if test="username != null">
  80. username = #{username,jdbcType=VARCHAR},
  81. </if>
  82. <if test="loginTime != null">
  83. login_time = #{loginTime,jdbcType=TIMESTAMP},
  84. </if>
  85. <if test="loginIp != null">
  86. login_ip = #{loginIp,jdbcType=CHAR},
  87. </if>
  88. <if test="success != null">
  89. success = #{success,jdbcType=BIT},
  90. </if>
  91. <if test="otherInfo != null">
  92. other_info = #{otherInfo,jdbcType=VARCHAR},
  93. </if>
  94. </set>
  95. where id = #{id,jdbcType=BIGINT}
  96. </update>
  97. <update id="updateByPrimaryKey" parameterType="com.anlovek.saas.mapper.LoginHistory">
  98. update sys_user_login_history
  99. set username = #{username,jdbcType=VARCHAR},
  100. login_time = #{loginTime,jdbcType=TIMESTAMP},
  101. login_ip = #{loginIp,jdbcType=CHAR},
  102. success = #{success,jdbcType=BIT},
  103. other_info = #{otherInfo,jdbcType=VARCHAR}
  104. where id = #{id,jdbcType=BIGINT}
  105. </update>
  106. </mapper>