92e223c8a58bfa66cb77d277e81dbeef6f160297.svn-base 11 KB

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