SysOperLogMapper.xml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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.aidex.system.mapper.SysOperLogMapper">
  6. <sql id="sysOperLogColumns">
  7. a.id as "id",
  8. a.title as "title",
  9. a.oper_id as "operId",
  10. a.business_type as "businessType",
  11. a.method as "method",
  12. a.request_method as "requestMethod",
  13. a.operator_type as "operatorType",
  14. a.oper_name as "operName",
  15. a.dept_name as "deptName",
  16. a.oper_url as "operUrl",
  17. a.oper_ip as "operIp",
  18. a.oper_location as "operLocation",
  19. a.oper_param as "operParam",
  20. a.json_result as "jsonResult",
  21. a.log_content as "logContent",
  22. a.form_id as "formId",
  23. a.take_up_time as "takeUpTime",
  24. a.status as "status",
  25. a.error_msg as "errorMsg",
  26. a.oper_time as "operTime"
  27. </sql>
  28. <sql id="sysOperLogJoins">
  29. </sql>
  30. <sql id="sysOperLogOrderBy">
  31. order by a.oper_time desc
  32. </sql>
  33. <select id="get" resultType="SysOperLog">
  34. SELECT
  35. <include refid="sysOperLogColumns"/>
  36. FROM sys_oper_log a
  37. where id = #{id}
  38. </select>
  39. <select id="findList" resultType="SysOperLog">
  40. SELECT
  41. <include refid="sysOperLogColumns"/>
  42. FROM sys_oper_log a
  43. <include refid="sysOperLogJoins"/>
  44. where a.del_flag = #{DEL_FLAG_NORMAL}
  45. <if test="title != null and title != ''">
  46. AND title like concat('%', #{title}, '%')
  47. </if>
  48. <if test="businessType != null and businessType != ''">
  49. AND business_type = #{businessType}
  50. </if>
  51. <if test="businessTypes != null and businessTypes.length > 0">
  52. AND business_type in
  53. <foreach collection="businessTypes" item="businessType" open="(" separator="," close=")">
  54. #{businessType}
  55. </foreach>
  56. </if>
  57. <if test="status != null">
  58. AND status = #{status}
  59. </if>
  60. <if test="operName != null and operName != ''">
  61. AND oper_name like concat('%', #{operName}, '%')
  62. </if>
  63. <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
  64. and date_format(oper_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
  65. </if>
  66. <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
  67. and date_format(oper_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
  68. </if>
  69. <include refid="sysOperLogOrderBy"/>
  70. </select>
  71. <insert id="insert" parameterType="SysOperLog">
  72. insert into sys_oper_log
  73. (id,
  74. title,
  75. business_type,
  76. method,
  77. request_method,
  78. operator_type,
  79. oper_name,
  80. dept_name,
  81. oper_url,
  82. oper_ip,
  83. oper_location,
  84. oper_param,
  85. json_result,
  86. log_content,
  87. form_id,
  88. take_up_time,
  89. status,
  90. error_msg,
  91. oper_time)
  92. values
  93. (#{id},
  94. #{title},
  95. #{businessType},
  96. #{method},
  97. #{requestMethod},
  98. #{operatorType},
  99. #{operName},
  100. #{deptName},
  101. #{operUrl},
  102. #{operIp},
  103. #{operLocation},
  104. #{operParam},
  105. #{jsonResult},
  106. #{logContent},
  107. #{formId},
  108. #{takeUpTime},
  109. #{status},
  110. #{errorMsg},
  111. sysdate())
  112. </insert>
  113. <insert id="addOperlog" parameterType="SysOperLog">
  114. insert into sys_oper_log
  115. (id,
  116. title,
  117. business_type,
  118. method,
  119. request_method,
  120. operator_type,
  121. oper_name,
  122. dept_name,
  123. oper_url,
  124. oper_ip,
  125. oper_location,
  126. oper_param,
  127. json_result,
  128. log_content,
  129. form_id,
  130. take_up_time,
  131. status,
  132. error_msg,
  133. oper_time)
  134. values
  135. (#{id},
  136. #{title},
  137. #{businessType},
  138. #{method},
  139. #{requestMethod},
  140. #{operatorType},
  141. #{operName},
  142. #{deptName},
  143. #{operUrl},
  144. #{operIp},
  145. #{operLocation},
  146. #{operParam},
  147. #{jsonResult},
  148. #{logContent},
  149. #{formId},
  150. #{takeUpTime},
  151. #{status},
  152. #{errorMsg},
  153. sysdate())
  154. </insert>
  155. <update id="deleteOperLogByIds" parameterType="java.util.Map">
  156. UPDATE sys_oper_log SET
  157. del_flag = #{DEL_FLAG_DELETE}
  158. WHERE id in
  159. <foreach collection="operIds" item="ids" open="(" separator="," close=")">
  160. #{ids}
  161. </foreach>
  162. </update>
  163. <update id="cleanOperLog">
  164. truncate table sys_oper_log
  165. </update>
  166. <update id="deleteOperLogBySaveDay" parameterType="java.lang.String">
  167. delete from sys_oper_log where datediff(SYSDATE(),oper_time) >= #{saveDay}
  168. </update>
  169. </mapper>