OperLogMapper.xml 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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="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="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="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">
  37. AND business_type = #{businessType}
  38. </if>
  39. <if test="operName != null and operName != ''">
  40. AND oper_name like concat('%', #{operName}, '%')
  41. </if>
  42. <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
  43. and date_format(oper_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
  44. </if>
  45. <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
  46. and date_format(oper_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
  47. </if>
  48. </where>
  49. </select>
  50. <delete id="deleteOperLogByIds" parameterType="String">
  51. delete from sys_oper_log where oper_id in
  52. <foreach collection="array" item="operId" open="(" separator="," close=")">
  53. #{operId}
  54. </foreach>
  55. </delete>
  56. <select id="selectOperLogById" parameterType="Long" resultMap="OperLogResult">
  57. <include refid="selectOperLogVo"/>
  58. where oper_id = #{operId}
  59. </select>
  60. </mapper>