LogMapper.xml 2.0 KB

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