SysLog.xml 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  3. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  4. <!-- namespace必须指向DAO接口 -->
  5. <mapper namespace="com.jpsoft.employment.modules.sys.dao.SysLogDAO">
  6. <resultMap id="SysLogMap" type="com.jpsoft.employment.modules.sys.entity.SysLog">
  7. <id property="id" column="id_"/>
  8. <result property="remoteIp" column="remote_ip"/>
  9. <result property="url" column="url_"/>
  10. <result property="data" column="data_"/>
  11. <result property="userId" column="user_id"/>
  12. <result property="createTime" column="create_time"/>
  13. <result property="remark" column="remark_"/>
  14. <result property="elapse" column="elapse_"/>
  15. <result property="pointcut" column="pointcut_"/>
  16. </resultMap>
  17. <insert id="insert" parameterType="com.jpsoft.employment.modules.sys.entity.SysLog">
  18. <selectKey resultType="long" keyColumn="id_" keyProperty="id">
  19. SELECT LAST_INSERT_ID() AS id_
  20. </selectKey>
  21. <![CDATA[
  22. insert into sys_log
  23. (remote_ip,url_,data_,user_id,create_time,remark_,elapse_,pointcut_)
  24. values
  25. (
  26. #{remoteIp,jdbcType=VARCHAR}
  27. ,#{url,jdbcType=VARCHAR}
  28. ,#{data,jdbcType=VARCHAR}
  29. ,#{userId,jdbcType=VARCHAR}
  30. ,#{createTime,jdbcType= TIMESTAMP }
  31. ,#{remark,jdbcType=VARCHAR}
  32. ,#{elapse,jdbcType=NUMERIC}
  33. ,#{pointcut,jdbcType=VARCHAR}
  34. )
  35. ]]>
  36. </insert>
  37. <delete id="delete" parameterType="string">
  38. delete from sys_log where id_=#{id,jdbcType=VARCHAR}
  39. </delete>
  40. <update id="update" parameterType="com.jpsoft.employment.modules.sys.entity.SysLog">
  41. update sys_log
  42. <set>
  43. <if test="remoteIp!=null">
  44. remote_ip=#{remoteIp,jdbcType=VARCHAR},
  45. </if>
  46. <if test="url!=null">
  47. url_=#{url,jdbcType=VARCHAR},
  48. </if>
  49. <if test="data!=null">
  50. data_=#{data,jdbcType=VARCHAR},
  51. </if>
  52. <if test="userId!=null">
  53. user_id=#{userId,jdbcType=VARCHAR},
  54. </if>
  55. <if test="createTime!=null">
  56. create_time=#{createTime,jdbcType= TIMESTAMP },
  57. </if>
  58. </set>
  59. where id_=#{id}
  60. </update>
  61. <select id="get" parameterType="string" resultMap="SysLogMap">
  62. select * from sys_log where id_=#{0}
  63. </select>
  64. <select id="exist" parameterType="string" resultType="int">
  65. select count(*) from sys_log where id_=#{0}
  66. </select>
  67. <select id="list" resultMap="SysLogMap">
  68. select * from sys_log
  69. </select>
  70. <select id="search" parameterType="hashmap" resultMap="SysLogMap">
  71. <![CDATA[
  72. select * from sys_log
  73. ]]>
  74. <where>
  75. <if test="searchParams.userId != null">
  76. and user_id = #{searchParams.userId}
  77. </if>
  78. <if test="searchParams.remoteIP != null">
  79. and remote_ip like #{searchParams.remoteIP}
  80. </if>
  81. <if test="searchParams.url != null">
  82. and url_ like #{searchParams.url}
  83. </if>
  84. <if test="searchParams.pointcut != null">
  85. and pointcut_ like #{searchParams.pointcut}
  86. </if>
  87. <if test="searchParams.startTime != null">
  88. and create_time >= #{searchParams.startTime}
  89. </if>
  90. <if test="searchParams.endTime != null">
  91. <![CDATA[
  92. and create_time <= #{searchParams.endTime}
  93. ]]>
  94. </if>
  95. <if test="searchParams.elapseMin != null">
  96. and elapse_ >= #{searchParams.elapseMin}
  97. </if>
  98. <if test="searchParams.elapseMax != null">
  99. <![CDATA[
  100. and elapse_ <= #{searchParams.elapseMax}
  101. ]]>
  102. </if>
  103. <if test="searchParams.remark != null">
  104. and remark_ like #{searchParams.remark}
  105. </if>
  106. </where>
  107. <foreach item="sort" collection="sortList" open="order by" separator=",">
  108. ${sort.name} ${sort.order}
  109. </foreach>
  110. </select>
  111. </mapper>