SysLogDao.xml 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  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.SysLogDao">
  4. <resultMap type="cn.ourwill.module.sys.entity.SysLog" id="baseMap">
  5. <result column="id" property="id"/>
  6. <result column="username" property="username"/>
  7. <result column="userid" property="userid"/>
  8. <result column="rolename" property="rolename"/>
  9. <result column="date" property="date"/>
  10. <result column="action" property="action"/>
  11. <result column="modular" property="modular"/>
  12. <result column="data" property="data"/>
  13. <result column="ip" property="ip"/>
  14. <result column="version" property="version"/>
  15. <result column="login_time" property="loginTime"/>
  16. </resultMap>
  17. <sql id="columns">
  18. id ,
  19. username ,
  20. userid ,
  21. rolename ,
  22. date ,
  23. action ,
  24. modular ,
  25. data ,
  26. ip ,
  27. version ,
  28. login_time
  29. </sql>
  30. <sql id="joinCols">
  31. </sql>
  32. <select id="get" resultMap="baseMap">
  33. SELECT
  34. <include refid="columns"/>
  35. FROM sys_log a
  36. <include refid="joinCols"/>
  37. WHERE a.id = #{id}
  38. </select>
  39. <select id="findList" resultMap="baseMap">
  40. SELECT
  41. <include refid="columns"/>
  42. FROM sys_log a
  43. <include refid="joinCols"/>
  44. <where>
  45. <if test="id !=null">
  46. and id = #{id}
  47. </if>
  48. <if test="username !=null">
  49. and username = #{username}
  50. </if>
  51. <if test="userid !=null">
  52. and userid = #{userid}
  53. </if>
  54. <if test="rolename !=null">
  55. and rolename = #{rolename}
  56. </if>
  57. <if test="date !=null">
  58. and date = #{date}
  59. </if>
  60. <if test="action !=null">
  61. and action = #{action}
  62. </if>
  63. <if test="modular !=null">
  64. and modular = #{modular}
  65. </if>
  66. <if test="data !=null">
  67. and data = #{data}
  68. </if>
  69. <if test="ip !=null">
  70. and ip = #{ip}
  71. </if>
  72. <if test="version !=null">
  73. and version = #{version}
  74. </if>
  75. <if test="loginTime !=null">
  76. and login_time = #{loginTime}
  77. </if>
  78. </where>
  79. <choose>
  80. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  81. ORDER BY ${page.orderBy}
  82. </when>
  83. <otherwise>
  84. </otherwise>
  85. </choose>
  86. </select>
  87. <select id="findAllList" resultMap="baseMap">
  88. SELECT
  89. <include refid="columns"/>
  90. FROM sys_loga
  91. <include refid="joinCols"/>
  92. <where>
  93. <if test="id !=null">
  94. and id = #{id}
  95. </if>
  96. <if test="username !=null">
  97. and username = #{username}
  98. </if>
  99. <if test="userid !=null">
  100. and userid = #{userid}
  101. </if>
  102. <if test="rolename !=null">
  103. and rolename = #{rolename}
  104. </if>
  105. <if test="date !=null">
  106. and date = #{date}
  107. </if>
  108. <if test="action !=null">
  109. and action = #{action}
  110. </if>
  111. <if test="modular !=null">
  112. and modular = #{modular}
  113. </if>
  114. <if test="data !=null">
  115. and data = #{data}
  116. </if>
  117. <if test="ip !=null">
  118. and ip = #{ip}
  119. </if>
  120. <if test="version !=null">
  121. and version = #{version}
  122. </if>
  123. <if test="loginTime !=null">
  124. and login_time = #{loginTime}
  125. </if>
  126. </where>
  127. <choose>
  128. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  129. ORDER BY ${page.orderBy}
  130. </when>
  131. <otherwise>
  132. </otherwise>
  133. </choose>
  134. </select>
  135. <insert id="insert" keyColumn="id" keyProperty="id" useGeneratedKeys="true"
  136. parameterType="cn.ourwill.module.sys.entity.SysLog">
  137. INSERT INTO sys_log
  138. <trim prefix="(" suffix=")" suffixOverrides=",">
  139. <if test=" id != null">
  140. id,
  141. </if>
  142. <if test=" username != null">
  143. username,
  144. </if>
  145. <if test=" userid != null">
  146. userid,
  147. </if>
  148. <if test=" rolename != null">
  149. rolename,
  150. </if>
  151. <if test=" date != null">
  152. date,
  153. </if>
  154. <if test=" action != null">
  155. action,
  156. </if>
  157. <if test=" modular != null">
  158. modular,
  159. </if>
  160. <if test=" data != null">
  161. data,
  162. </if>
  163. <if test=" ip != null">
  164. ip,
  165. </if>
  166. <if test=" version != null">
  167. version,
  168. </if>
  169. <if test=" loginTime != null">
  170. login_time
  171. </if>
  172. </trim>
  173. <trim prefix="values (" suffix=")" suffixOverrides=",">
  174. <if test=" id != null">
  175. #{id}, </if>
  176. <if test=" username != null">
  177. #{username}, </if>
  178. <if test=" userid != null">
  179. #{userid}, </if>
  180. <if test=" rolename != null">
  181. #{rolename}, </if>
  182. <if test=" date != null">
  183. #{date}, </if>
  184. <if test=" action != null">
  185. #{action}, </if>
  186. <if test=" modular != null">
  187. #{modular}, </if>
  188. <if test=" data != null">
  189. #{data}, </if>
  190. <if test=" ip != null">
  191. #{ip}, </if>
  192. <if test=" version != null">
  193. #{version}, </if>
  194. <if test=" loginTime != null">
  195. #{loginTime} </if>
  196. </trim>
  197. </insert>
  198. <update id="update" parameterType="cn.ourwill.module.sys.entity.SysLog">
  199. UPDATE sys_log <set>
  200. <if test="id != null">
  201. id= #{id} ,
  202. </if>
  203. <if test="username != null">
  204. username= #{username} ,
  205. </if>
  206. <if test="userid != null">
  207. userid= #{userid} ,
  208. </if>
  209. <if test="rolename != null">
  210. rolename= #{rolename} ,
  211. </if>
  212. <if test="date != null">
  213. date= #{date} ,
  214. </if>
  215. <if test="action != null">
  216. action= #{action} ,
  217. </if>
  218. <if test="modular != null">
  219. modular= #{modular} ,
  220. </if>
  221. <if test="data != null">
  222. data= #{data} ,
  223. </if>
  224. <if test="ip != null">
  225. ip= #{ip} ,
  226. </if>
  227. <if test="version != null">
  228. version= #{version} ,
  229. </if>
  230. <if test="loginTime != null">
  231. login_time= #{loginTime}
  232. </if>
  233. </set>
  234. WHERE id = #{id}
  235. </update>
  236. <delete id="deleteById" parameterType="java.lang.Long">
  237. DELETE FROM sys_log WHERE id = #{id}
  238. </delete>
  239. <delete id="deleteByIds" parameterType="java.util.List">
  240. DELETE FROM sys_log WHERE id IN
  241. <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
  242. #{item}
  243. </foreach>
  244. </delete>
  245. </mapper>