BisInspLogDao.xml 8.5 KB

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