SysLogDao.xml 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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="com.kmall.admin.fromcomm.dao.SysLogDao">
  4. <select id="queryObject" resultType="com.kmall.manager.entity.SysLogEntity">
  5. select * from sys_log where id = #{value}
  6. </select>
  7. <select id="queryList" resultType="com.kmall.manager.entity.SysLogEntity">
  8. select * from sys_log
  9. <where>
  10. <if test="key != null and key.trim() != ''">
  11. and `username` like concat('%',#{key},'%') or `operation` like concat('%',#{key},'%')
  12. </if>
  13. <if test="operation != null and operation.trim() != ''">
  14. `operation` like concat('%',#{operation},'%')
  15. </if>
  16. </where>
  17. order by create_date desc
  18. <if test="offset != null and limit != null">
  19. limit #{offset}, #{limit}
  20. </if>
  21. </select>
  22. <select id="queryTotal" resultType="int">
  23. select count(*) from sys_log
  24. <where>
  25. <if test="key != null and key.trim() != ''">
  26. `username` like concat('%',#{key},'%') or `operation` like concat('%',#{key},'%')
  27. </if>
  28. <if test="operation != null and operation.trim() != ''">
  29. and `operation` like concat('%',#{operation},'%')
  30. </if>
  31. </where>
  32. </select>
  33. <insert id="save" parameterType="com.kmall.manager.entity.SysLogEntity" useGeneratedKeys="true" keyProperty="id">
  34. insert into sys_log
  35. (
  36. `username`,
  37. `operation`,
  38. `method`,
  39. `params`,
  40. `ip`,
  41. `create_date`
  42. )
  43. values
  44. (
  45. #{username},
  46. #{operation},
  47. #{method},
  48. #{params},
  49. #{ip},
  50. #{createDate}
  51. )
  52. </insert>
  53. <update id="update" parameterType="com.kmall.manager.entity.SysLogEntity">
  54. update sys_log
  55. <set>
  56. <if test="username != null">`username` = #{username}, </if>
  57. <if test="operation != null">`operation` = #{operation}, </if>
  58. <if test="method != null">`method` = #{method}, </if>
  59. <if test="params != null">`params` = #{params}, </if>
  60. <if test="ip != null">`ip` = #{ip} </if>
  61. </set>
  62. where id = #{id}
  63. </update>
  64. <delete id="delete">
  65. delete from sys_log where id = #{value}
  66. </delete>
  67. <delete id="deleteBatch">
  68. delete from sys_log where id in
  69. <foreach item="id" collection="array" open="(" separator="," close=")">
  70. #{id}
  71. </foreach>
  72. </delete>
  73. </mapper>