SysUserLoginLogMapper.xml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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.ssm.mapper.system.SysUserLoginLogMapper" >
  4. <resultMap id="BaseResultMap" type="com.ssm.model.system.SysUserLoginLog" >
  5. <id column="ID" property="id" jdbcType="INTEGER" />
  6. <result column="UserID" property="userid" jdbcType="INTEGER" />
  7. <result column="IpAddress" property="ipaddress" jdbcType="VARCHAR" />
  8. <result column="Comments" property="comments" jdbcType="VARCHAR" />
  9. <result column="CreatedDate" property="createddate" jdbcType="TIMESTAMP" />
  10. <result column="cd" property="cd" jdbcType="VARCHAR" />
  11. <result column="UserName" property="username" jdbcType="VARCHAR" />
  12. <result column="startDate" property="startDate" jdbcType="TIMESTAMP" />
  13. <result column="endDate" property="endDate" jdbcType="TIMESTAMP" />
  14. </resultMap>
  15. <sql id="Base_Column_List" >
  16. ID, IpAddress, Comments, CreatedDate ,UserName
  17. </sql>
  18. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
  19. select
  20. <include refid="Base_Column_List" />
  21. from SysUserLoginLog
  22. where ID = #{id,jdbcType=INTEGER}
  23. </select>
  24. <select id="selectlog" resultMap="BaseResultMap">
  25. select
  26. <include refid="Base_Column_List" />
  27. ,date_format(CreatedDate, '%Y-%m-%d %H:%i:%s') as cd from SysUserLoginLog LEFT JOIN SysUser on SysUserLoginLog.UserID=SysUser.UserID
  28. where 1 = 1
  29. <if test="username != null and username != '' ">
  30. and SysUser.UserName like '%${username}%'
  31. </if>
  32. <if test="startDate != null and startDate != '' ">
  33. <![CDATA[ and SysUserLoginLog.CreatedDate >= #{startDate} ]]>
  34. </if>
  35. <if test="endDate != null and endDate != '' ">
  36. <![CDATA[ and SysUserLoginLog.CreatedDate <= #{endDate} ]]>
  37. </if>
  38. ORDER BY SysUserLoginLog.CreatedDate Desc
  39. </select>
  40. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
  41. delete from SysUserLoginLog
  42. where ID = #{id,jdbcType=INTEGER}
  43. </delete>
  44. <insert id="insert" parameterType="com.ssm.model.system.SysUserLoginLog" >
  45. insert into SysUserLoginLog (ID, UserID, IpAddress,
  46. Comments, CreatedDate)
  47. values (#{id,jdbcType=INTEGER}, #{userid,jdbcType=INTEGER}, #{ipaddress,jdbcType=VARCHAR},
  48. #{comments,jdbcType=VARCHAR}, #{createddate,jdbcType=TIMESTAMP})
  49. </insert>
  50. <insert id="insertSelective" parameterType="com.ssm.model.system.SysUserLoginLog" >
  51. insert into SysUserLoginLog
  52. <trim prefix="(" suffix=")" suffixOverrides="," >
  53. <if test="id != null" >
  54. ID,
  55. </if>
  56. <if test="userid != null" >
  57. UserID,
  58. </if>
  59. <if test="ipaddress != null" >
  60. IpAddress,
  61. </if>
  62. <if test="comments != null" >
  63. Comments,
  64. </if>
  65. <if test="createddate != null" >
  66. CreatedDate,
  67. </if>
  68. </trim>
  69. <trim prefix="values (" suffix=")" suffixOverrides="," >
  70. <if test="id != null" >
  71. #{id,jdbcType=INTEGER},
  72. </if>
  73. <if test="userid != null" >
  74. #{userid,jdbcType=INTEGER},
  75. </if>
  76. <if test="ipaddress != null" >
  77. #{ipaddress,jdbcType=VARCHAR},
  78. </if>
  79. <if test="comments != null" >
  80. #{comments,jdbcType=VARCHAR},
  81. </if>
  82. <if test="createddate != null" >
  83. #{createddate,jdbcType=TIMESTAMP},
  84. </if>
  85. </trim>
  86. </insert>
  87. <update id="updateByPrimaryKeySelective" parameterType="com.ssm.model.system.SysUserLoginLog" >
  88. update SysUserLoginLog
  89. <set >
  90. <if test="userid != null" >
  91. UserID = #{userid,jdbcType=INTEGER},
  92. </if>
  93. <if test="ipaddress != null" >
  94. IpAddress = #{ipaddress,jdbcType=VARCHAR},
  95. </if>
  96. <if test="comments != null" >
  97. Comments = #{comments,jdbcType=VARCHAR},
  98. </if>
  99. <if test="createddate != null" >
  100. CreatedDate = #{createddate,jdbcType=TIMESTAMP},
  101. </if>
  102. </set>
  103. where ID = #{id,jdbcType=INTEGER}
  104. </update>
  105. <update id="updateByPrimaryKey" parameterType="com.ssm.model.system.SysUserLoginLog" >
  106. update SysUserLoginLog
  107. set UserID = #{userid,jdbcType=INTEGER},
  108. IpAddress = #{ipaddress,jdbcType=VARCHAR},
  109. Comments = #{comments,jdbcType=VARCHAR},
  110. CreatedDate = #{createddate,jdbcType=TIMESTAMP}
  111. where ID = #{id,jdbcType=INTEGER}
  112. </update>
  113. </mapper>