LogMapper.xml 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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.jeeplus.modules.sys.mapper.LogMapper">
  4. <select id="findList" resultType="Log">
  5. SELECT
  6. a.*,
  7. u.id AS "createBy.id",
  8. u.name AS "createBy.name",
  9. o.name AS "createBy.office.name"
  10. FROM sys_log a
  11. JOIN sys_user u ON u.id = a.create_by
  12. JOIN sys_office o ON o.id = u.office_id
  13. WHERE a.create_date BETWEEN #{beginDate} AND #{endDate}
  14. <if test="title != null and title != ''">
  15. AND a.title LIKE
  16. <if test="dbName == 'oracle'">'%'||#{title}||'%'</if>
  17. <if test="dbName == 'mysql'">CONCAT('%', #{title}, '%')</if>
  18. <if test="dbName == 'mssql'">'%'+#{title}+'%'</if>
  19. </if>
  20. <if test="createBy != null and createBy.name != null and createBy.name != ''">
  21. AND u.name = #{createBy.name}
  22. </if>
  23. <if test="requestUri != null and requestUri != ''">
  24. AND a.request_uri LIKE
  25. <if test="dbName == 'oracle'">'%'||#{requestUri}||'%'</if>
  26. <if test="dbName == 'mysql'">CONCAT('%', #{requestUri}, '%')</if>
  27. <if test="dbName == 'mssql'">'%'+#{requestUri}+'%'</if>
  28. </if>
  29. <if test="exception != null and exception != ''">
  30. AND a.type = #{TYPE_EXCEPTION}
  31. </if>
  32. ORDER BY a.create_date DESC
  33. </select>
  34. <select id="get" resultType="Log">
  35. SELECT
  36. *
  37. FROM sys_log
  38. WHERE id = #{id}
  39. </select>
  40. <update id="delete">
  41. DELETE FROM sys_log
  42. WHERE id = #{id}
  43. </update>
  44. <update id="empty">
  45. DELETE FROM sys_log
  46. </update>
  47. <insert id="insert">
  48. INSERT INTO sys_log(
  49. id,
  50. type,
  51. title,
  52. create_by,
  53. create_date,
  54. remote_addr,
  55. user_agent,
  56. request_uri,
  57. method,
  58. params,
  59. exception
  60. ) VALUES (
  61. #{id},
  62. #{type},
  63. #{title},
  64. #{createBy.id},
  65. #{createDate},
  66. #{remoteAddr},
  67. #{userAgent},
  68. #{requestUri},
  69. #{method},
  70. #{params},
  71. #{exception}
  72. )
  73. </insert>
  74. </mapper>