SysOperLogMapper.xml 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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. </resultMap>
  24. <sql id="selectOperLogVo">
  25. 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
  26. from sys_oper_log
  27. </sql>
  28. <insert id="insertOperlog" parameterType="SysOperLog">
  29. <selectKey keyProperty="operId" resultType="long" order="BEFORE">
  30. SELECT seq_sys_oper_log.NEXTVAL as operId FROM DUAL
  31. </selectKey>
  32. insert into sys_oper_log(
  33. <if test="operId != null and operId != 0">oper_id,</if>
  34. <if test="title != null and title != ''">title,</if>
  35. <if test="businessType != null and businessType != ''">business_type,</if>
  36. <if test="method != null and method != ''">method,</if>
  37. <if test="requestMethod != null and requestMethod != ''">request_method,</if>
  38. <if test="operatorType != null and operatorType != ''">operator_type,</if>
  39. <if test="operName != null and operName != ''">oper_name,</if>
  40. <if test="deptName != null and deptName != ''">dept_name,</if>
  41. <if test="operUrl != null and operUrl != ''">oper_url,</if>
  42. <if test="operIp != null and operIp != ''">oper_ip,</if>
  43. <if test="operLocation != null and operLocation != ''">oper_location,</if>
  44. <if test="operParam != null and operParam != ''">oper_param,</if>
  45. <if test="jsonResult != null and jsonResult != ''">json_result,</if>
  46. <if test="status != null and status != ''">status,</if>
  47. <if test="errorMsg != null and errorMsg != ''">error_msg,</if>
  48. oper_time
  49. )values(
  50. <if test="operId != null and operId != 0">#{operId},</if>
  51. <if test="title != null and title != ''">#{title},</if>
  52. <if test="businessType != null and businessType != ''">#{businessType},</if>
  53. <if test="method != null and method != ''">#{method},</if>
  54. <if test="requestMethod != null and requestMethod != ''">#{requestMethod},</if>
  55. <if test="operatorType != null and operatorType != ''">#{operatorType},</if>
  56. <if test="operName != null and operName != ''">#{operName},</if>
  57. <if test="deptName != null and deptName != ''">#{deptName},</if>
  58. <if test="operUrl != null and operUrl != ''">#{operUrl},</if>
  59. <if test="operIp != null and operIp != ''">#{operIp},</if>
  60. <if test="operLocation != null and operLocation != ''">#{operLocation},</if>
  61. <if test="operParam != null and operParam != ''">#{operParam},</if>
  62. <if test="jsonResult != null and jsonResult != ''">#{jsonResult},</if>
  63. <if test="status != null and status != ''">#{status},</if>
  64. <if test="errorMsg != null and errorMsg != ''">#{errorMsg},</if>
  65. sysdate
  66. )
  67. </insert>
  68. <select id="selectOperLogList" parameterType="SysOperLog" resultMap="SysOperLogResult">
  69. <include refid="selectOperLogVo"/>
  70. <where>
  71. <if test="title != null and title != ''">
  72. AND title like concat(concat('%',#{title}),'%')
  73. </if>
  74. <if test="businessType != null">
  75. AND business_type = #{businessType}
  76. </if>
  77. <if test="businessTypes != null and businessTypes.length > 0">
  78. AND business_type in
  79. <foreach collection="businessTypes" item="businessType" open="(" separator="," close=")">
  80. #{businessType}
  81. </foreach>
  82. </if>
  83. <if test="status != null">
  84. AND status = #{status}
  85. </if>
  86. <if test="operName != null and operName != ''">
  87. AND oper_name like concat(concat('%',#{operName}),'%')
  88. </if>
  89. <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
  90. and oper_time &gt;= to_date(#{params.beginTime},'yyyy-MM-dd HH24:mi:ss')
  91. </if>
  92. <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
  93. and oper_time &lt;= to_date(#{params.endTime},'yyyy-MM-dd HH24:mi:ss')
  94. </if>
  95. </where>
  96. </select>
  97. <delete id="deleteOperLogByIds" parameterType="String">
  98. delete from sys_oper_log where oper_id in
  99. <foreach collection="array" item="operId" open="(" separator="," close=")">
  100. #{operId}
  101. </foreach>
  102. </delete>
  103. <select id="selectOperLogById" parameterType="Long" resultMap="SysOperLogResult">
  104. <include refid="selectOperLogVo"/>
  105. where oper_id = #{operId}
  106. </select>
  107. <update id="cleanOperLog">
  108. truncate table sys_oper_log
  109. </update>
  110. </mapper>