SysLogMapper.xml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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.ydtech.modules.admin.dao.SysLogDao">
  4. <resultMap id="BaseResultMap" type="com.ydtech.modules.admin.model.SysLog">
  5. <id column="id" jdbcType="VARCHAR" property="id"/>
  6. <result column="user_name" jdbcType="VARCHAR" property="userName"/>
  7. <result column="url" jdbcType="VARCHAR" property="url"/>
  8. <result column="description" jdbcType="VARCHAR" property="description"/>
  9. <result column="method" jdbcType="VARCHAR" property="method"/>
  10. <result column="request_class" jdbcType="VARCHAR" property="requestClass"/>
  11. <result column="request_method" jdbcType="VARCHAR" property="requestMethod"/>
  12. <result column="ip" jdbcType="VARCHAR" property="ip"/>
  13. <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
  14. </resultMap>
  15. <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.ydtech.modules.admin.model.SysLog">
  16. <result column="params" jdbcType="LONGVARCHAR" property="params"/>
  17. </resultMap>
  18. <sql id="Base_Column_List">
  19. id, user_name, url, description, method, request_class, request_method, ip, create_time
  20. </sql>
  21. <sql id="Blob_Column_List">
  22. params
  23. </sql>
  24. <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
  25. select
  26. <include refid="Base_Column_List"/>
  27. ,
  28. <include refid="Blob_Column_List"/>
  29. from sys_log
  30. where id = #{id,jdbcType=VARCHAR}
  31. </select>
  32. <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
  33. delete
  34. from sys_log
  35. where id = #{id,jdbcType=VARCHAR}
  36. </delete>
  37. <insert id="insert" parameterType="com.ydtech.modules.admin.model.SysLog">
  38. insert into sys_log (id, user_name, url, description,
  39. method, request_class, request_method,
  40. ip, create_time, params)
  41. values (#{id,jdbcType=VARCHAR}, #{userName,jdbcType=VARCHAR}, #{url,jdbcType=VARCHAR},
  42. #{description,jdbcType=VARCHAR},
  43. #{method,jdbcType=VARCHAR}, #{requestClass,jdbcType=VARCHAR}, #{requestMethod,jdbcType=VARCHAR},
  44. #{ip,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{params,jdbcType=LONGVARCHAR})
  45. </insert>
  46. <insert id="insertSelective" parameterType="com.ydtech.modules.admin.model.SysLog">
  47. insert into sys_log
  48. <trim prefix="(" suffix=")" suffixOverrides=",">
  49. <if test="id != null">
  50. id,
  51. </if>
  52. <if test="userName != null">
  53. user_name,
  54. </if>
  55. <if test="url != null">
  56. url,
  57. </if>
  58. <if test="description != null">
  59. description,
  60. </if>
  61. <if test="method != null">
  62. method,
  63. </if>
  64. <if test="requestClass != null">
  65. request_class,
  66. </if>
  67. <if test="requestMethod != null">
  68. request_method,
  69. </if>
  70. <if test="ip != null">
  71. ip,
  72. </if>
  73. <if test="createTime != null">
  74. create_time,
  75. </if>
  76. <if test="params != null">
  77. params,
  78. </if>
  79. </trim>
  80. <trim prefix="values (" suffix=")" suffixOverrides=",">
  81. <if test="id != null">
  82. #{id,jdbcType=VARCHAR},
  83. </if>
  84. <if test="userName != null">
  85. #{userName,jdbcType=VARCHAR},
  86. </if>
  87. <if test="url != null">
  88. #{url,jdbcType=VARCHAR},
  89. </if>
  90. <if test="description != null">
  91. #{description,jdbcType=VARCHAR},
  92. </if>
  93. <if test="method != null">
  94. #{method,jdbcType=VARCHAR},
  95. </if>
  96. <if test="requestClass != null">
  97. #{requestClass,jdbcType=VARCHAR},
  98. </if>
  99. <if test="requestMethod != null">
  100. #{requestMethod,jdbcType=VARCHAR},
  101. </if>
  102. <if test="ip != null">
  103. #{ip,jdbcType=VARCHAR},
  104. </if>
  105. <if test="createTime != null">
  106. #{createTime,jdbcType=TIMESTAMP},
  107. </if>
  108. <if test="params != null">
  109. #{params,jdbcType=LONGVARCHAR},
  110. </if>
  111. </trim>
  112. </insert>
  113. <select id="selectPaging" parameterType="com.ydtech.modules.admin.model.vo.SysLogQueryVO" resultMap="BaseResultMap">
  114. select
  115. <include refid="Base_Column_List"/>
  116. ,
  117. <include refid="Blob_Column_List"/>
  118. from sys_log
  119. <where>
  120. <if test="userName != null and userName != ''">
  121. AND user_name = #{userName,jdbcType=VARCHAR}
  122. </if>
  123. <if test="method != null and method != ''">
  124. AND method = #{method,jdbcType=VARCHAR}
  125. </if>
  126. <if test="requestMethod != null and requestMethod != ''">
  127. AND request_method = #{requestMethod,jdbcType=VARCHAR}
  128. </if>
  129. <if test="startDate != null and endDate != null">
  130. AND DATE_FORMAT(create_time, '%Y-%m-%d') between DATE_FORMAT(#{startDate,jdbcType=VARCHAR}, '%Y-%m-%d')
  131. and DATE_FORMAT(#{endDate,jdbcType=VARCHAR}, '%Y-%m-%d')
  132. </if>
  133. <if test="params != null and params != ''">
  134. AND params like concat('%' #{params,jdbcType=VARCHAR} '%')
  135. </if>
  136. </where>
  137. order by create_time desc
  138. </select>
  139. </mapper>