SysOperateLogDao.xml 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="cn.ourwill.module.sys.dao.SysOperateLogDao">
  4. <resultMap type="cn.ourwill.module.sys.entity.SysOperateLog" id="baseMap">
  5. <result column="id" property="id"/>
  6. <result column="userId" property="userId"/>
  7. <result column="roleIds" property="roleIds"/>
  8. <result column="cTime" property="cTime"/>
  9. <result column="module" property="module"/>
  10. <result column="action" property="action"/>
  11. <result column="parameters" property="parameters"/>
  12. <result column="ip" property="ip"/>
  13. <result column="uagent" property="uagent"/>
  14. <result column="system" property="system"/>
  15. <result column="username" property="username"/>
  16. <result column="realname" property="realname"/>
  17. <result column="moduleName" property="moduleName"/>
  18. </resultMap>
  19. <sql id="columns">
  20. sol.id ,
  21. sol.userId ,
  22. sol.roleIds ,
  23. sol.cTime ,
  24. sol.module ,
  25. sol.action ,
  26. sol.parameters ,
  27. sol.ip ,
  28. sol.uagent ,
  29. sol.system,
  30. u.name as username,
  31. u.realname,
  32. m.name as moduleName
  33. </sql>
  34. <sql id="joinCols">
  35. left join sys_user u on sol.userId=u.id
  36. left join sys_module m on sol.module=m.id
  37. </sql>
  38. <select id="get" resultMap="baseMap">
  39. SELECT
  40. <include refid="columns"/>
  41. FROM sys_operate_log sol
  42. <include refid="joinCols"/>
  43. WHERE a.id = #{id}
  44. </select>
  45. <select id="findList" resultMap="baseMap">
  46. SELECT
  47. <include refid="columns"/>
  48. FROM sys_operate_log sol
  49. <include refid="joinCols"/>
  50. <where>
  51. <if test="id !=null">
  52. and sol.id = #{id}
  53. </if>
  54. <if test="userId !=null">
  55. and sol.userId = #{userId}
  56. </if>
  57. <if test="roleIds !=null">
  58. and sol.roleIds = #{roleIds}
  59. </if>
  60. <if test="cTime !=null">
  61. and sol.cTime = #{cTime}
  62. </if>
  63. <if test="module !=null">
  64. and sol.module = #{module}
  65. </if>
  66. <if test="action !=null">
  67. and sol.action = #{action}
  68. </if>
  69. <if test="parameters !=null">
  70. and sol.parameters = #{parameters}
  71. </if>
  72. <if test="ip !=null">
  73. and sol.ip = #{ip}
  74. </if>
  75. <if test="uagent !=null">
  76. and sol.uagent = #{uagent}
  77. </if>
  78. <if test="system !=null">
  79. and sol.system = #{system}
  80. </if>
  81. <if test="username !=null">
  82. and u.name = #{username}
  83. </if>
  84. </where>
  85. ORDER BY sol.cTime DESC
  86. </select>
  87. <select id="findAllList" resultMap="baseMap">
  88. SELECT
  89. <include refid="columns"/>
  90. FROM sys_operate_log sol
  91. <include refid="joinCols"/>
  92. <where>
  93. <if test="id !=null">
  94. and sol.id = #{id}
  95. </if>
  96. <if test="userId !=null">
  97. and sol.userId = #{userId}
  98. </if>
  99. <if test="roleIds !=null">
  100. and sol.roleIds = #{roleIds}
  101. </if>
  102. <if test="cTime !=null">
  103. and sol.cTime = #{cTime}
  104. </if>
  105. <if test="module !=null">
  106. and sol.module = #{module}
  107. </if>
  108. <if test="action !=null">
  109. and sol.action = #{action}
  110. </if>
  111. <if test="parameters !=null">
  112. and sol.parameters = #{parameters}
  113. </if>
  114. <if test="ip !=null">
  115. and sol.ip = #{ip}
  116. </if>
  117. <if test="uagent !=null">
  118. and sol.uagent = #{uagent}
  119. </if>
  120. <if test="system !=null">
  121. and sol.system = #{system}
  122. </if>
  123. <if test="username !=null">
  124. and u.name = #{username}
  125. </if>
  126. </where>
  127. ORDER BY sol.cTime DESC
  128. </select>
  129. <insert id="insert" keyColumn="id" keyProperty="id" useGeneratedKeys="true"
  130. parameterType="cn.ourwill.module.sys.entity.SysOperateLog">
  131. INSERT INTO sys_operate_log
  132. <trim prefix="(" suffix=")" suffixOverrides=",">
  133. <if test=" id != null">
  134. id,
  135. </if>
  136. <if test=" userId != null">
  137. userId,
  138. </if>
  139. <if test=" roleIds != null">
  140. roleIds,
  141. </if>
  142. <if test=" cTime != null">
  143. cTime,
  144. </if>
  145. <if test=" module != null">
  146. module,
  147. </if>
  148. <if test=" action != null">
  149. action,
  150. </if>
  151. <if test=" parameters != null">
  152. parameters,
  153. </if>
  154. <if test=" ip != null">
  155. ip,
  156. </if>
  157. <if test=" uagent != null">
  158. uagent,
  159. </if>
  160. <if test=" system != null">
  161. system
  162. </if>
  163. </trim>
  164. <trim prefix="values (" suffix=")" suffixOverrides=",">
  165. <if test=" id != null">
  166. #{id}, </if>
  167. <if test=" userId != null">
  168. #{userId}, </if>
  169. <if test=" roleIds != null">
  170. #{roleIds}, </if>
  171. <if test=" cTime != null">
  172. #{cTime}, </if>
  173. <if test=" module != null">
  174. #{module}, </if>
  175. <if test=" action != null">
  176. #{action}, </if>
  177. <if test=" parameters != null">
  178. #{parameters}, </if>
  179. <if test=" ip != null">
  180. #{ip}, </if>
  181. <if test=" uagent != null">
  182. #{uagent}, </if>
  183. <if test=" system != null">
  184. #{system} </if>
  185. </trim>
  186. </insert>
  187. <update id="update" parameterType="cn.ourwill.module.sys.entity.SysOperateLog">
  188. UPDATE sys_operate_log <set>
  189. <if test="id != null">
  190. id= #{id} ,
  191. </if>
  192. <if test="userId != null">
  193. userId= #{userId} ,
  194. </if>
  195. <if test="roleIds != null">
  196. roleIds= #{roleIds} ,
  197. </if>
  198. <if test="cTime != null">
  199. cTime= #{cTime} ,
  200. </if>
  201. <if test="module != null">
  202. module= #{module} ,
  203. </if>
  204. <if test="action != null">
  205. action= #{action} ,
  206. </if>
  207. <if test="parameters != null">
  208. parameters= #{parameters} ,
  209. </if>
  210. <if test="ip != null">
  211. ip= #{ip} ,
  212. </if>
  213. <if test="uagent != null">
  214. uagent= #{uagent} ,
  215. </if>
  216. <if test="system != null">
  217. system= #{system}
  218. </if>
  219. </set>
  220. WHERE id = #{id}
  221. </update>
  222. <delete id="deleteById" parameterType="java.lang.Long">
  223. DELETE FROM sys_operate_log WHERE id = #{id}
  224. </delete>
  225. <delete id="deleteByIds" parameterType="java.util.List">
  226. DELETE FROM sys_operate_log WHERE id IN
  227. <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
  228. #{item}
  229. </foreach>
  230. </delete>
  231. </mapper>