BisInspLogDao.xml 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  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.com.goldenwater.dcproj.dao.BisInspLogDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspLog" id="bisInspLogResultMap">
  5. <result property="logId" column="LOG_ID"/>
  6. <result property="userId" column="USER_ID"/>
  7. <result property="intm" column="INTM"/>
  8. <result property="content" column="CONTENT"/>
  9. <result property="path" column="PATH"/>
  10. <result property="source" column="SRC"/>
  11. <result property="ipAddr" column="IP_ADDR"/>
  12. <result property="appModel" column="APP_MODEL"/>
  13. <result property="username" column="PERS_NAME"/>
  14. <result property="requestBody" column="REQUEST_BODY"/>
  15. <result property="responseBody" column="RESPONSE_BODY"/>
  16. <result property="method" column="METHOD"/>
  17. <result property="params" column="PARAMS"/>
  18. <result property="header" column="HEADER"/>
  19. <result property="orgId" column="ORG_ID"/>
  20. </resultMap>
  21. <sql id="table_columns">
  22. LOG_ID,
  23. USER_ID,
  24. INTM,
  25. CONTENT,
  26. PATH,
  27. SRC,
  28. IP_ADDR,
  29. APP_MODEL,REQUEST_BODY,RESPONSE_BODY,METHOD,PARAMS,HEADER,ORG_ID
  30. </sql>
  31. <sql id="table_columns2">
  32. A.LOG_ID,
  33. A.USER_ID,
  34. A.INTM,
  35. A.CONTENT,
  36. A.PATH,
  37. A.SRC,
  38. A.IP_ADDR,
  39. A.APP_MODEL,A.REQUEST_BODY,A.METHOD,A.PARAMS,A.HEADER,A.ORG_ID,
  40. B.PERS_NAME
  41. </sql>
  42. <sql id="entity_properties">
  43. #{logId},
  44. #{userId},
  45. #{intm},
  46. #{content},
  47. #{path},
  48. #{source},
  49. #{ipAddr},
  50. #{appModel},#{requestBody},#{responseBody},#{method},#{params},#{header},#{orgId}
  51. </sql>
  52. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  53. <sql id="page_where">
  54. <trim prefix="where" prefixOverrides="and | or ">
  55. <if test="userId != null and userId != ''">and USER_ID = #{userId}</if>
  56. <if test="intm != null">and INTM = #{intm}</if>
  57. <if test="content != null and content != ''">and CONTENT = #{content}</if>
  58. <if test="path != null and path != ''">and PATH = #{path}</if>
  59. <if test="source != null and source != ''">and SRC = #{source}</if>
  60. <if test="ipAddr != null and ipAddr != ''">and IP_ADDR = #{ipAddr}</if>
  61. <if test="appModel != null and appModel != ''">and APP_MODEL = #{appModel}</if>
  62. <if test="method != null and method != ''">and METHOD = #{method}</if>
  63. <if test="orgId != null and orgId != ''">and ORG_ID = #{orgId}</if>
  64. </trim>
  65. </sql>
  66. <sql id="page_where2">
  67. <trim prefix="where" prefixOverrides="and | or ">
  68. <if test="userId != null and userId != ''">and A.USER_ID = #{userId}</if>
  69. <if test="sttm != null">and A.INTM &gt;= #{sttm}</if>
  70. <if test="entm != null">and A.INTM &lt;= #{entm}</if>
  71. <if test="username != null and username != ''">and B.pers_name like concat('%' , #{username} , '%')</if>
  72. <if test="content != null and content != ''">and A.CONTENT like concat('%' , #{content} , '%')</if>
  73. <if test="path != null and path != ''">and A.PATH = #{path}</if>
  74. <if test="source != null and source != ''">and A.SRC = #{source}</if>
  75. <if test="ipAddr != null and ipAddr != ''">and A.IP_ADDR = #{ipAddr}</if>
  76. <if test="appModel != null and appModel != ''">and A.APP_MODEL = #{appModel}</if>
  77. <if test="method != null and method != ''">and A.METHOD = #{method}</if>
  78. <if test="orgId != null and orgId != ''">and ORG_ID = #{orgId}</if>
  79. </trim>
  80. </sql>
  81. <select id="get" resultMap="bisInspLogResultMap" parameterType="String">
  82. select
  83. <include refid="table_columns"/>
  84. from BIS_INSP_LOG where LOG_ID = #{id}
  85. </select>
  86. <select id="getBy" resultMap="bisInspLogResultMap">
  87. select
  88. <include refid="table_columns"/>
  89. from BIS_INSP_LOG
  90. <include refid="page_where"/>
  91. order by intm desc,log_id
  92. </select>
  93. <select id="findAll" resultMap="bisInspLogResultMap">
  94. select
  95. <include refid="table_columns"/>
  96. from BIS_INSP_LOG order by intm desc,log_id
  97. </select>
  98. <select id="findList" resultMap="bisInspLogResultMap">
  99. select
  100. <include refid="table_columns2"/>
  101. from BIS_INSP_LOG A
  102. LEFT JOIN BIS_INSP_ALL_RLATION_PERS B ON A.user_id = B.guid
  103. <include refid="page_where2"/>
  104. order by A.intm desc,A.log_id
  105. </select>
  106. <select id="selectCount" resultType="int">
  107. select count(ID) from BIS_INSP_LOG
  108. <include refid="page_where"/>
  109. </select>
  110. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspLog">
  111. insert into BIS_INSP_LOG(
  112. <include refid="table_columns"/>
  113. )
  114. values (
  115. <include refid="entity_properties"/>
  116. )
  117. </insert>
  118. <insert id="insertDelLog" parameterType="cn.com.goldenwater.dcproj.model.BisInspLog" >
  119. insert into BIS_INSP_DEL_LOG(
  120. <include refid="table_columns"/>
  121. )
  122. values (
  123. <include refid="entity_properties"/>
  124. )
  125. </insert>
  126. <delete id="delete" parameterType="java.lang.String">
  127. delete from BIS_INSP_LOG where LOG_ID = #{id}
  128. </delete>
  129. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspLog">
  130. delete from BIS_INSP_LOG
  131. <include refid="page_where"/>
  132. </delete>
  133. <update id="deleteInFlag" parameterType="java.lang.String">
  134. update BIS_INSP_LOG set flag_valid = 0 where LOG_ID = #{id}
  135. </update>
  136. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspLog">
  137. update BIS_INSP_LOG
  138. <trim prefix="set" suffixOverrides=",">
  139. <if test="userId != null and userId != ''">USER_ID = #{userId},</if>
  140. <if test="intm != null">INTM = #{intm},</if>
  141. <if test="content != null and content != ''">CONTENT = #{content},</if>
  142. <if test="path != null and path != ''">PATH = #{path},</if>
  143. <if test="source != null and source != ''">SRC = #{source},</if>
  144. <if test="ipAddr != null and ipAddr != ''">IP_ADDR = #{ipAddr},</if>
  145. <if test="appModel != null and appModel != ''">APP_MODEL = #{appModel},</if>
  146. <if test="method != null and method != ''">METHOD = #{method},</if>
  147. <if test="requestBody != null and requestBody != ''">REQUEST_BODY = #{requestBody},</if>
  148. <if test="responseBody != null and responseBody != ''">RESPONSE_BODY = #{responseBody},</if>
  149. <if test="params != null and params != ''">PARAMS = #{params},</if>
  150. <if test="header != null and header != ''">HEADER = #{header},</if>
  151. </trim>
  152. <where>LOG_ID = #{id}</where>
  153. </update>
  154. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspLog">
  155. update BIS_INSP_LOG
  156. <trim prefix="set" suffixOverrides=",">
  157. <if test="userId != null and userId != ''">USER_ID = #{userId},</if>
  158. <if test="intm != null">INTM = #{intm},</if>
  159. <if test="content != null and content != ''">CONTENT = #{content},</if>
  160. <if test="path != null and path != ''">PATH = #{path},</if>
  161. <if test="source != null and source != ''">SRC = #{source},</if>
  162. <if test="ipAddr != null and ipAddr != ''">IP_ADDR = #{ipAddr},</if>
  163. <if test="appModel != null and appModel != ''">APP_MODEL = #{appModel},</if>
  164. <if test="method != null and method != ''">METHOD = #{method},</if>
  165. <if test="requestBody != null and requestBody != ''">REQUEST_BODY = #{requestBody},</if>
  166. <if test="responseBody != null and responseBody != ''">RESPONSE_BODY = #{responseBody},</if>
  167. <if test="params != null and params != ''">PARAMS = #{params},</if>
  168. <if test="header != null and header != ''">HEADER = #{header},</if>
  169. </trim>
  170. <include refid="page_where"/>
  171. </update>
  172. <!-- 其他自定义SQL -->
  173. <select id="findLogList" resultMap="bisInspLogResultMap">
  174. select
  175. <include refid="table_columns"/>
  176. from BIS_INSP_LOG
  177. <include refid="page_where"/>
  178. order by intm,log_id
  179. </select>
  180. </mapper>