SysOperLogMapper.xml 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ruoyi.system.mapper.SysOperLogMapper">
  6. <resultMap type="SysOperLog" id="SysOperLogResult">
  7. <id property="operId" column="oper_id" />
  8. <result property="title" column="title" />
  9. <result property="businessType" column="business_type" />
  10. <result property="method" column="method" />
  11. <result property="requestMethod" column="request_method" />
  12. <result property="operatorType" column="operator_type" />
  13. <result property="operName" column="oper_name" />
  14. <result property="deptName" column="dept_name" />
  15. <result property="operUrl" column="oper_url" />
  16. <result property="operIp" column="oper_ip" />
  17. <result property="operLocation" column="oper_location" />
  18. <result property="operParam" column="oper_param" />
  19. <result property="jsonResult" column="json_result" />
  20. <result property="status" column="status" />
  21. <result property="errorMsg" column="error_msg" />
  22. <result property="operTime" column="oper_time" />
  23. <result property="costTime" column="cost_time" />
  24. </resultMap>
  25. <sql id="selectOperLogVo">
  26. select oper_id, title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param, json_result, status, error_msg, oper_time, cost_time
  27. from sys_oper_log
  28. </sql>
  29. <insert id="insertOperlog" parameterType="SysOperLog">
  30. <selectKey keyProperty="operId" resultType="long" order="BEFORE">
  31. SELECT seq_sys_oper_log.NEXTVAL as operId FROM DUAL
  32. </selectKey>
  33. insert into sys_oper_log(
  34. <if test="operId != null and operId != 0">oper_id,</if>
  35. <if test="title != null and title != ''">title,</if>
  36. <if test="businessType != null and businessType != ''">business_type,</if>
  37. <if test="method != null and method != ''">method,</if>
  38. <if test="requestMethod != null and requestMethod != ''">request_method,</if>
  39. <if test="operatorType != null and operatorType != ''">operator_type,</if>
  40. <if test="operName != null and operName != ''">oper_name,</if>
  41. <if test="deptName != null and deptName != ''">dept_name,</if>
  42. <if test="operUrl != null and operUrl != ''">oper_url,</if>
  43. <if test="operIp != null and operIp != ''">oper_ip,</if>
  44. <if test="operLocation != null and operLocation != ''">oper_location,</if>
  45. <if test="operParam != null and operParam != ''">oper_param,</if>
  46. <if test="jsonResult != null and jsonResult != ''">json_result,</if>
  47. <if test="status != null and status != ''">status,</if>
  48. <if test="errorMsg != null and errorMsg != ''">error_msg,</if>
  49. oper_time
  50. )values(
  51. <if test="operId != null and operId != 0">#{operId},</if>
  52. <if test="title != null and title != ''">#{title},</if>
  53. <if test="businessType != null and businessType != ''">#{businessType},</if>
  54. <if test="method != null and method != ''">#{method},</if>
  55. <if test="requestMethod != null and requestMethod != ''">#{requestMethod},</if>
  56. <if test="operatorType != null and operatorType != ''">#{operatorType},</if>
  57. <if test="operName != null and operName != ''">#{operName},</if>
  58. <if test="deptName != null and deptName != ''">#{deptName},</if>
  59. <if test="operUrl != null and operUrl != ''">#{operUrl},</if>
  60. <if test="operIp != null and operIp != ''">#{operIp},</if>
  61. <if test="operLocation != null and operLocation != ''">#{operLocation},</if>
  62. <if test="operParam != null and operParam != ''">#{operParam},</if>
  63. <if test="jsonResult != null and jsonResult != ''">#{jsonResult},</if>
  64. <if test="status != null and status != ''">#{status},</if>
  65. <if test="errorMsg != null and errorMsg != ''">#{errorMsg},</if>
  66. sysdate
  67. )
  68. </insert>
  69. <select id="selectOperLogList" parameterType="SysOperLog" resultMap="SysOperLogResult">
  70. <include refid="selectOperLogVo"/>
  71. <where>
  72. <if test="title != null and title != ''">
  73. AND title like concat('%', #{title}, '%')
  74. </if>
  75. <if test="businessType != null">
  76. AND business_type = #{businessType}
  77. </if>
  78. <if test="businessTypes != null and businessTypes.length > 0">
  79. AND business_type in
  80. <foreach collection="businessTypes" item="businessType" open="(" separator="," close=")">
  81. #{businessType}
  82. </foreach>
  83. </if>
  84. <if test="status != null">
  85. AND status = #{status}
  86. </if>
  87. <if test="operName != null and operName != ''">
  88. AND oper_name like concat('%', #{operName}, '%')
  89. </if>
  90. <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
  91. AND oper_time &gt;= #{params.beginTime}
  92. </if>
  93. <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
  94. AND oper_time &lt;= #{params.endTime}
  95. </if>
  96. </where>
  97. order by oper_id desc
  98. </select>
  99. <delete id="deleteOperLogByIds" parameterType="Long">
  100. delete from sys_oper_log where oper_id in
  101. <foreach collection="array" item="operId" open="(" separator="," close=")">
  102. #{operId}
  103. </foreach>
  104. </delete>
  105. <select id="selectOperLogById" parameterType="Long" resultMap="SysOperLogResult">
  106. <include refid="selectOperLogVo"/>
  107. where oper_id = #{operId}
  108. </select>
  109. <update id="cleanOperLog">
  110. truncate table sys_oper_log
  111. </update>
  112. </mapper>