SysOperLogMapper.xml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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.slibra.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. insert into sys_oper_log(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, cost_time, oper_time)
  31. values (#{title}, #{businessType}, #{method}, #{requestMethod}, #{operatorType}, #{operName}, #{deptName}, #{operUrl}, #{operIp}, #{operLocation}, #{operParam}, #{jsonResult}, #{status}, #{errorMsg}, #{costTime}, sysdate())
  32. </insert>
  33. <select id="selectOperLogList" parameterType="SysOperLog" resultMap="SysOperLogResult">
  34. <include refid="selectOperLogVo"/>
  35. <where>
  36. <if test="operIp != null and operIp != ''">
  37. AND oper_ip like concat('%', #{operIp}, '%')
  38. </if>
  39. <if test="title != null and title != ''">
  40. AND title like concat('%', #{title}, '%')
  41. </if>
  42. <if test="businessType != null">
  43. AND business_type = #{businessType}
  44. </if>
  45. <if test="businessTypes != null and businessTypes.length > 0">
  46. AND business_type in
  47. <foreach collection="businessTypes" item="businessType" open="(" separator="," close=")">
  48. #{businessType}
  49. </foreach>
  50. </if>
  51. <if test="status != null">
  52. AND status = #{status}
  53. </if>
  54. <if test="operName != null and operName != ''">
  55. AND oper_name like concat('%', #{operName}, '%')
  56. </if>
  57. <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
  58. AND oper_time &gt;= #{params.beginTime}
  59. </if>
  60. <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
  61. AND oper_time &lt;= #{params.endTime}
  62. </if>
  63. </where>
  64. order by oper_id desc
  65. </select>
  66. <delete id="deleteOperLogByIds" parameterType="Long">
  67. delete from sys_oper_log where oper_id in
  68. <foreach collection="array" item="operId" open="(" separator="," close=")">
  69. #{operId}
  70. </foreach>
  71. </delete>
  72. <select id="selectOperLogById" parameterType="Long" resultMap="SysOperLogResult">
  73. <include refid="selectOperLogVo"/>
  74. where oper_id = #{operId}
  75. </select>
  76. <update id="cleanOperLog">
  77. truncate table sys_oper_log
  78. </update>
  79. </mapper>