BisInspFjwtenfDao.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  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.BisInspFjwtenfDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspFjwtenf" id="bisInspFjwtenfResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="objId" column="OBJ_ID"/>
  7. <result property="nm" column="NM"/>
  8. <result property="adCode" column="AD_CODE"/>
  9. <result property="adName" column="AD_NAME"/>
  10. <result property="state" column="STATE"/>
  11. <result property="keyState" column="KEY_STATE"/>
  12. <result property="persId" column="PERS_ID"/>
  13. <result property="intm" column="INTM"/>
  14. <result property="uptm" column="UPTM"/>
  15. <result property="note" column="NOTE"/>
  16. <result property="dataStat" column="DATA_STAT"/>
  17. </resultMap>
  18. <sql id="table_columns">
  19. ID,
  20. OBJ_ID,
  21. NM,
  22. AD_CODE,
  23. AD_NAME,
  24. STATE,
  25. KEY_STATE,
  26. PERS_ID,
  27. INTM,
  28. UPTM,
  29. NOTE,
  30. DATA_STAT
  31. </sql>
  32. <sql id="entity_properties">
  33. #{id},
  34. #{objId},
  35. #{nm},
  36. #{adCode},
  37. #{adName},
  38. #{state},
  39. #{keyState},
  40. #{persId},
  41. #{intm},
  42. #{uptm},
  43. #{note},
  44. #{dataStat}
  45. </sql>
  46. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  47. <sql id="page_where">
  48. <trim prefix="where" prefixOverrides="and | or ">
  49. <if test="objId != null and objId != ''">
  50. and OBJ_ID = #{objId}
  51. </if>
  52. <if test="nm != null and nm != ''">
  53. and NM = #{nm}
  54. </if>
  55. <if test="adCode != null and adCode != ''">
  56. and AD_CODE = #{adCode}
  57. </if>
  58. <if test="adName != null and adName != ''">
  59. and AD_NAME = #{adName}
  60. </if>
  61. <if test="state != null and state != ''">
  62. and STATE = #{state}
  63. </if>
  64. <if test="keyState != null and keyState != ''">
  65. and KEY_STATE = #{keyState}
  66. </if>
  67. <if test="persId != null and persId != ''">
  68. and PERS_ID = #{persId}
  69. </if>
  70. <if test="intm != null">
  71. and INTM = #{intm}
  72. </if>
  73. <if test="uptm != null">
  74. and UPTM = #{uptm}
  75. </if>
  76. <if test="note != null and note != ''">
  77. and NOTE = #{note}
  78. </if>
  79. <if test="dataStat != null and dataStat != ''">
  80. and DATA_STAT = #{dataStat}
  81. </if>
  82. and DATA_STAT='0'
  83. </trim>
  84. </sql>
  85. <select id="get" resultMap="bisInspFjwtenfResultMap" parameterType="String">
  86. select
  87. <include refid="table_columns"/>
  88. from BIS_INSP_FJWTENF where ID = #{id}
  89. </select>
  90. <select id="getBy" resultMap="bisInspFjwtenfResultMap">
  91. select
  92. <include refid="table_columns"/>
  93. from BIS_INSP_FJWTENF
  94. <include refid="page_where"/>
  95. </select>
  96. <select id="findAll" resultMap="bisInspFjwtenfResultMap">
  97. select
  98. <include refid="table_columns"/>
  99. from BIS_INSP_FJWTENF
  100. </select>
  101. <select id="findList" resultMap="bisInspFjwtenfResultMap">
  102. SELECT * FROM (
  103. select
  104. <include refid="table_columns"/>
  105. from BIS_INSP_FJWTENF
  106. <include refid="page_where"/>
  107. )
  108. <where>
  109. <if test="groupId != null and groupId != ''">
  110. and OBJ_ID IN (SELECT OBJ_ID FROM BIS_INSP_ALL_OBJ WHERE ID LIKE CONCAT(#{groupId}, '%'))
  111. </if>
  112. </where>
  113. </select>
  114. <select id="selectCount" resultType="int">
  115. select count(ID) from BIS_INSP_FJWTENF
  116. <include refid="page_where"/>
  117. </select>
  118. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspFjwtenf">
  119. insert into BIS_INSP_FJWTENF(
  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. update BIS_INSP_FJWTENF set DATA_STAT='9' where ID = #{id}
  128. </delete>
  129. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspFjwtenf">
  130. update BIS_INSP_FJWTENF set DATA_STAT='9'
  131. <include refid="page_where"/>
  132. </delete>
  133. <update id="deleteInFlag" parameterType="java.lang.String">
  134. update BIS_INSP_FJWTENF set DATA_STAT = '9' where ID = #{id}
  135. </update>
  136. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspFjwtenf">
  137. update BIS_INSP_FJWTENF
  138. <trim prefix="set" suffixOverrides=",">
  139. <if test="objId != null and objId != ''">OBJ_ID
  140. = #{objId},
  141. </if>
  142. <if test="nm != null and nm != ''">NM
  143. = #{nm},
  144. </if>
  145. <if test="adCode != null and adCode != ''">AD_CODE
  146. = #{adCode},
  147. </if>
  148. <if test="adName != null and adName != ''">AD_NAME
  149. = #{adName},
  150. </if>
  151. <if test="state != null and state != ''">STATE
  152. = #{state},
  153. </if>
  154. <if test="keyState != null and keyState != ''">KEY_STATE
  155. = #{keyState},
  156. </if>
  157. <if test="persId != null and persId != ''">PERS_ID
  158. = #{persId},
  159. </if>
  160. <if test="intm != null">INTM
  161. = #{intm},
  162. </if>
  163. <if test="uptm != null">UPTM
  164. = #{uptm},
  165. </if>
  166. <if test="note != null and note != ''">NOTE
  167. = #{note},
  168. </if>
  169. <if test="dataStat != null and dataStat != ''">DATA_STAT
  170. = #{dataStat},
  171. </if>
  172. </trim>
  173. <where>ID = #{id}</where>
  174. </update>
  175. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspFjwtenf">
  176. update BIS_INSP_FJWTENF
  177. <trim prefix="set" suffixOverrides=",">
  178. <if test="objId != null and objId != ''">OBJ_ID
  179. = #{objId},
  180. </if>
  181. <if test="nm != null and nm != ''">NM
  182. = #{nm},
  183. </if>
  184. <if test="adCode != null and adCode != ''">AD_CODE
  185. = #{adCode},
  186. </if>
  187. <if test="adName != null and adName != ''">AD_NAME
  188. = #{adName},
  189. </if>
  190. <if test="state != null and state != ''">STATE
  191. = #{state},
  192. </if>
  193. <if test="keyState != null and keyState != ''">KEY_STATE
  194. = #{keyState},
  195. </if>
  196. <if test="persId != null and persId != ''">PERS_ID
  197. = #{persId},
  198. </if>
  199. <if test="intm != null">INTM
  200. = #{intm},
  201. </if>
  202. <if test="uptm != null">UPTM
  203. = #{uptm},
  204. </if>
  205. <if test="note != null and note != ''">NOTE
  206. = #{note},
  207. </if>
  208. <if test="dataStat != null and dataStat != ''">DATA_STAT
  209. = #{dataStat},
  210. </if>
  211. </trim>
  212. <include refid="page_where"/>
  213. </update>
  214. <!-- 其他自定义SQL -->
  215. <select id="findPageList" resultType="cn.com.goldenwater.dcproj.dto.BisInspFjwtenfDto">
  216. SELECT * FROM (
  217. select
  218. A.CODE, A.ID AS nodeId, A.NM, A.PTYPE, A.OBJ_ID, IA.PNM AS groupName,
  219. B.ID AS rgstrId, AW.AD_FULL_NAME,
  220. (CASE WHEN B.STATE IS NULL THEN '0' ELSE B.STATE END) STATE,
  221. B.ID,
  222. B.AD_CODE,
  223. B.AD_NAME,
  224. B.KEY_STATE,
  225. B.PERS_ID,
  226. B.INTM,
  227. B.UPTM,
  228. B.NOTE,
  229. B.DATA_STAT
  230. FROM BIS_INSP_ALL_OBJ A
  231. JOIN BIS_INSP_FJWTENF B ON A.OBJ_ID=B.OBJ_ID
  232. LEFT JOIN BIS_INSP_ALL IA ON A.ID = IA.ID
  233. LEFT JOIN ATT_AD_BASE AW ON B.AD_CODE = AW.AD_CODE
  234. <where>
  235. <if test="adCodes ==null or adCodes ==''">
  236. <choose>
  237. <when test='isAll =="1"'>
  238. </when>
  239. <otherwise>
  240. and
  241. A.Id in (
  242. select distinct id from (
  243. SELECT P.id FROM BIS_INSP_ALL P START WITH P.PID IN (SELECT id FROM BIS_INSP_ALL_RLATION A
  244. WHERE A.PERSID = #{presId} and TYPE = #{pType} and length(id) in (3,6,9))
  245. CONNECT BY P.PID = PRIOR P.ID
  246. union all
  247. SELECT P.id FROM BIS_INSP_ALL P where p.id in (SELECT id FROM BIS_INSP_ALL_RLATION A
  248. WHERE A.PERSID =#{presId} and TYPE = #{pType} and length(id)=12 )
  249. )
  250. )
  251. </otherwise>
  252. </choose>
  253. </if>
  254. <if test="adCodes !=null and adCodes !=''">
  255. and
  256. <foreach item="item" index="index" collection="adCodes.split(',')" open="(" separator="or" close=")">
  257. b.ad_code like concat('${item}','%')
  258. </foreach>
  259. </if>
  260. <if test="tabType =='2'.toString()">
  261. AND IA.ENTM &lt; TO_DATE(#{nowTime},'yyyy-MM-dd')+1
  262. </if>
  263. <if test="tabType =='1'.toString()">
  264. AND IA.ENTM &gt;= TO_DATE(#{nowTime},'yyyy-MM-dd')
  265. </if>
  266. </where>
  267. ) A
  268. <where>
  269. <if test="id !=null and id !=''">and a.nodeId like '${id}%'</if>
  270. <if test="plnaId !=null and plnaId !=''">and a.nodeId like '${plnaId}%'</if>
  271. <if test="state !=null and state !=''">and STATE in (${state})</if>
  272. <if test="rsName !=null and rsName !=''">and a.nm like '%${rsName}%'</if>
  273. <if test="code !=null and code !=''">and a.code = #{code}</if>
  274. <if test="adName != null and adName != ''">and a.AD_NAME like '%${adName}%'</if>
  275. <if test="sttm != null and sttm != ''">and a.INTM &gt;= TO_DATE(#{sttm},'YYYY-MM-DD')</if>
  276. <if test="entm != null and entm != ''">and a.INTM &lt; To_DATE(#{entm},'yyyy-MM-dd') + 1</if>
  277. <if test="groupId != null and groupId != ''">and a.nodeId = #{groupId}</if>
  278. </where>
  279. order by nodeId asc
  280. <if test="orderBy != null and orderBy != ''">
  281. ,nlssort(nm,'NLS_SORT=SCHINESE_PINYIN_M')
  282. </if>
  283. </select>
  284. </mapper>