OperLogMapper.xml 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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.juxiao.xchat.module.monitor.mapper.OperLogMapper">
  6. <resultMap type="com.juxiao.xchat.module.monitor.domain.OperLog" id="OperLogResult">
  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="operatorType" column="operator_type" />
  12. <result property="operName" column="oper_name" />
  13. <result property="deptName" column="dept_name" />
  14. <result property="operUrl" column="oper_url" />
  15. <result property="operIp" column="oper_ip" />
  16. <result property="operLocation" column="oper_location" />
  17. <result property="operParam" column="oper_param" />
  18. <result property="status" column="status" />
  19. <result property="errorMsg" column="error_msg" />
  20. <result property="operTime" column="oper_time" />
  21. </resultMap>
  22. <sql id="selectOperLogVo">
  23. select oper_id, title, business_type, method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param, status, error_msg, oper_time
  24. from sys_oper_log
  25. </sql>
  26. <insert id="insertOperlog" parameterType="com.juxiao.xchat.module.monitor.domain.OperLog">
  27. insert into sys_oper_log(title, business_type, method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param, status, error_msg, oper_time)
  28. values (#{title}, #{businessType}, #{method}, #{operatorType}, #{operName}, #{deptName}, #{operUrl}, #{operIp}, #{operLocation}, #{operParam}, #{status}, #{errorMsg}, sysdate())
  29. </insert>
  30. <select id="selectOperLogList" parameterType="com.juxiao.xchat.module.monitor.domain.OperLog" resultMap="OperLogResult">
  31. <include refid="selectOperLogVo"/>
  32. <where>
  33. <if test="title != null and title != ''">
  34. AND title like concat('%', #{title}, '%')
  35. </if>
  36. <if test="businessType != null and businessType != ''">
  37. AND business_type = #{businessType}
  38. </if>
  39. <if test="businessTypes != null and businessTypes.length > 0">
  40. AND business_type in
  41. <foreach collection="businessTypes" item="businessType" open="(" separator="," close=")">
  42. #{businessType}
  43. </foreach>
  44. </if>
  45. <if test="status != null">
  46. AND status = #{status}
  47. </if>
  48. <if test="operName != null and operName != ''">
  49. AND oper_name like concat('%', #{operName}, '%')
  50. </if>
  51. <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
  52. and date_format(oper_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
  53. </if>
  54. <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
  55. and date_format(oper_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
  56. </if>
  57. </where>
  58. </select>
  59. <delete id="deleteOperLogByIds" parameterType="java.lang.String">
  60. delete from sys_oper_log where oper_id in
  61. <foreach collection="array" item="operId" open="(" separator="," close=")">
  62. #{operId}
  63. </foreach>
  64. </delete>
  65. <select id="selectOperLogById" parameterType="java.lang.Long" resultMap="OperLogResult">
  66. <include refid="selectOperLogVo"/>
  67. where oper_id = #{operId}
  68. </select>
  69. <update id="cleanOperLog">
  70. truncate table sys_oper_log
  71. </update>
  72. </mapper>