OperLogMapper.xml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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.project.monitor.operlog.mapper.OperLogMapper">
  6. <resultMap type="OperLog" id="OperLogResult">
  7. <id property="operId" column="oper_id" />
  8. <result property="title" column="title" />
  9. <result property="action" column="action" />
  10. <result property="method" column="method" />
  11. <result property="channel" column="channel" />
  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. <insert id="insertOperlog" parameterType="OperLog">
  23. insert into sys_oper_log(title, action, method, channel, oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param, status, error_msg, oper_time)
  24. values (#{title}, #{action}, #{method}, #{channel}, #{operName}, #{deptName}, #{operUrl}, #{operIp}, #{operLocation}, #{operParam}, #{status}, #{errorMsg}, sysdate())
  25. </insert>
  26. <select id="selectOperLogList" parameterType="OperLog" resultMap="OperLogResult">
  27. select * from sys_oper_log
  28. <where>
  29. <if test="title != null and title != ''">
  30. AND title like concat('%', #{title}, '%')
  31. </if>
  32. <if test="action != null and action != ''">
  33. AND action = #{action}
  34. </if>
  35. <if test="operName != null and operName != ''">
  36. AND oper_name like concat('%', #{operName}, '%')
  37. </if>
  38. <if test="params != null and params.beginTime != ''"><!-- 开始时间检索 -->
  39. and date_format(oper_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
  40. </if>
  41. <if test="params != null and params.endTime != ''"><!-- 结束时间检索 -->
  42. and date_format(oper_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
  43. </if>
  44. </where>
  45. </select>
  46. <delete id="deleteOperLogByIds" parameterType="String">
  47. delete from sys_oper_log where oper_id in
  48. <foreach collection="array" item="operId" open="(" separator="," close=")">
  49. #{operId}
  50. </foreach>
  51. </delete>
  52. <select id="selectOperLogById" parameterType="Long" resultMap="OperLogResult">
  53. select *
  54. from sys_oper_log
  55. where oper_id = #{operId}
  56. </select>
  57. </mapper>