auditLogMapper.xml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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.yqh.p2p.dal.dao.AuditLogDao">
  4. <resultMap id="BaseResultMap" type="com.yqh.p2p.dal.model.AuditLog">
  5. <id column="id_" property="id" jdbcType="BIGINT" />
  6. <result column="username_" property="username" jdbcType="VARCHAR" />
  7. <result column="operate_name_" property="operateName" jdbcType="VARCHAR" />
  8. <result column="interface_url_" property="interfaceUrl"
  9. jdbcType="VARCHAR" />
  10. <result column="operate_time_" property="operateTime" jdbcType="TIMESTAMP" />
  11. <result column="input_params_" property="inputParams" jdbcType="LONGVARCHAR" />
  12. <result column="user_ip_" property="userIp" jdbcType="VARCHAR" />
  13. </resultMap>
  14. <sql id="Base_Column_List">
  15. id_, username_, operate_name_,
  16. interface_url_,input_params_,
  17. operate_time_, user_ip_
  18. </sql>
  19. <sql id="queryCondition">
  20. <where>
  21. <if test="operateName != null">
  22. and operate_name_ = #{operateName}
  23. </if>
  24. <if test="username != null">
  25. and username_ = #{username}
  26. </if>
  27. <if test="inputParams != null">
  28. and input_params_ like '%' #{inputParams} '%'
  29. </if>
  30. <if test="startDate != null">
  31. and operate_time_ &gt;= #{startDate}
  32. </if>
  33. <if test="endDate != null">
  34. and operate_time_ &lt;= #{endDate}
  35. </if>
  36. </where>
  37. </sql>
  38. <select id="get" resultMap="BaseResultMap" parameterType="java.lang.Long">
  39. select
  40. <include refid="Base_Column_List" />
  41. from p2p_audit_log
  42. where id_ = #{id,jdbcType=BIGINT}
  43. </select>
  44. <delete id="delete" parameterType="java.lang.Long">
  45. delete from
  46. p2p_audit_log
  47. where
  48. id_ = #{id,jdbcType=BIGINT}
  49. </delete>
  50. <insert id="insert" parameterType="com.yqh.p2p.dal.model.AuditLog">
  51. insert into p2p_audit_log
  52. (id_, username_, operate_name_,
  53. interface_url_,
  54. input_params_,operate_time_,
  55. user_ip_)
  56. values
  57. (#{id,jdbcType=BIGINT},
  58. #{username,jdbcType=VARCHAR},
  59. #{operateName,jdbcType=VARCHAR},
  60. #{interfaceUrl,jdbcType=VARCHAR},
  61. #{inputParams,jdbcType=LONGVARCHAR},
  62. #{operateTime,jdbcType=TIMESTAMP},
  63. #{userIp,jdbcType=VARCHAR})
  64. </insert>
  65. <update id="update" parameterType="com.yqh.p2p.dal.model.AuditLog">
  66. update p2p_audit_log
  67. <set>
  68. <if test="username != null">
  69. username_ = #{username,jdbcType=VARCHAR},
  70. </if>
  71. <if test="operateName != null">
  72. operate_name_ = #{operateName,jdbcType=VARCHAR},
  73. </if>
  74. <if test="interfaceUrl != null">
  75. interface_url_ = #{interfaceUrl,jdbcType=VARCHAR},
  76. </if>
  77. <if test="operateTime != null">
  78. operate_time_ = #{operateTime,jdbcType=TIMESTAMP},
  79. </if>
  80. <if test="userIp != null">
  81. user_ip_ = #{userIp,jdbcType=VARCHAR},
  82. </if>
  83. <if test="inputParams != null">
  84. input_params_ = #{inputParams,jdbcType=LONGVARCHAR},
  85. </if>
  86. </set>
  87. where id_ = #{id,jdbcType=BIGINT}
  88. </update>
  89. <select id="queryCount" parameterType="map" resultType="int">
  90. select count(*) from p2p_audit_log
  91. <include refid="queryCondition" />
  92. </select>
  93. <select id="queryPage" parameterType="map" resultMap="BaseResultMap">
  94. select * from p2p_audit_log
  95. <include refid="queryCondition" />
  96. order by operate_time_ desc
  97. <include refid="global.limit" />
  98. </select>
  99. </mapper>