c596b4fd7419ff1ea04bd4a09e65bf682a721e6e.svn-base 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  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
  146. A.ID AS nodeId,
  147. A.PTYPE,
  148. A.OBJ_ID,
  149. IA.PNM AS groupName,
  150. B.ID AS rgstrId,
  151. AW.AD_FULL_NAME,
  152. (CASE WHEN B.STATE IS NULL THEN '0' ELSE B.STATE END) AS STATE,
  153. B.ID,
  154. C.ID AS CODE,
  155. C.NAME AS NM,
  156. C.NAME,
  157. C.LOC,
  158. C.INVESTMENT,
  159. C.PLANNED_DURATION,
  160. C.AD_CODE,
  161. C.AD_NAME,
  162. B.INTM,
  163. B.UPTM,
  164. B.NOTE,
  165. B.DATA_STAT
  166. FROM BIS_INSP_ALL_OBJ A
  167. JOIN BIS_INSP_ANZE_RGSTR B ON A.OBJ_ID = B.OBJ_ID
  168. JOIN ATT_PROJECT_INSURANCE C ON A.CODE = C.ID
  169. LEFT JOIN BIS_INSP_ALL IA ON A.ID = IA.ID
  170. LEFT JOIN ATT_AD_BASE AW ON B.AD_CODE = AW.AD_CODE
  171. <where>
  172. <if test="adCodes ==null or adCodes ==''">
  173. <choose>
  174. <when test='isAll =="1"'>
  175. </when>
  176. <otherwise>
  177. AND A.Id in (
  178. select distinct id from (
  179. SELECT P.id FROM BIS_INSP_ALL P START WITH P.PID IN (SELECT id FROM BIS_INSP_ALL_RLATION A
  180. WHERE A.PERSID = #{presId} and TYPE = #{pType} and length(id) in (3,6,9))
  181. CONNECT BY P.PID = PRIOR P.ID
  182. union all
  183. SELECT P.id FROM BIS_INSP_ALL P where p.id in (SELECT id FROM BIS_INSP_ALL_RLATION A
  184. WHERE A.PERSID =#{presId} and TYPE = #{pType} and length(id)=12 )
  185. )
  186. )
  187. </otherwise>
  188. </choose>
  189. </if>
  190. <if test="adCodes !=null and adCodes !=''">
  191. and
  192. <foreach item="item" index="index" collection="adCodes.split(',')" open="(" separator="or" close=")">
  193. b.ad_code like concat('${item}','%')
  194. </foreach>
  195. </if>
  196. <if test="tabType =='2'.toString()">
  197. AND IA.ENTM &lt; TO_DATE(#{nowTime},'yyyy-MM-dd')+1
  198. </if>
  199. <if test="tabType =='1'.toString()">
  200. AND IA.ENTM &gt;= TO_DATE(#{nowTime},'yyyy-MM-dd')
  201. </if>
  202. </where>
  203. ) A
  204. <where>
  205. <if test="id !=null and id !=''">and a.nodeId like '${id}%'</if>
  206. <if test="plnaId !=null and plnaId !=''">and a.nodeId like '${plnaId}%'</if>
  207. <if test="state !=null and state !=''">and STATE in (${state})</if>
  208. <if test="nm !=null and nm !=''">and a.nm like '%${nm}%'</if>
  209. <if test="rsName !=null and rsName !=''">and a.nm like '%${rsName}%'</if>
  210. <if test="code !=null and code !=''">and a.code = #{code}</if>
  211. <if test="type !=null and type !=''">and a.OBJ_TYPE = #{type}</if>
  212. <if test="adName != null and adName != ''">and a.AD_NAME like '%${adName}%'</if>
  213. <if test="sttm != null and sttm != ''">and a.INTM &gt;= TO_DATE(#{sttm},'YYYY-MM-DD')</if>
  214. <if test="entm != null and entm != ''">and a.INTM &lt; To_DATE(#{entm},'yyyy-MM-dd') + 1</if>
  215. <if test="groupId != null and groupId != ''">and a.nodeId = #{groupId}</if>
  216. </where>
  217. order by nodeId asc
  218. <if test="orderBy != null and orderBy != ''">
  219. ,nlssort(nm,'NLS_SORT=SCHINESE_PINYIN_M')
  220. </if>
  221. </select>
  222. <select id="findAnzeList" resultType="cn.com.goldenwater.dcproj.dto.BisInspRgstrDto">
  223. SELECT * FROM (
  224. select A.CODE,A.ID nodeId,
  225. A.NM,
  226. #{pType} PTYPE,
  227. A.OBJ_ID,B.ID ID,b.id as rgstrId,
  228. (case when b.State is null then '0' else b.state end) STATE,
  229. B.OBJ_TYPE,B.ENGR_TYPE,B.INTM, b.AD_NAME as ad_name,
  230. ia.pnm groupName
  231. from BIS_INSP_ALL_OBJ A
  232. LEFT JOIN BIS_INSP_ANZE_RGSTR B ON A.OBJ_ID=B.OBJ_ID
  233. LEFT JOIN BIS_INSP_ALL ia on A.ID = ia.id
  234. where A.ptype= #{pType}
  235. <if test="tabType =='2'.toString()">
  236. and ia.entm &lt;to_date(#{nowTime},'yyyy-MM-dd')+1
  237. </if>
  238. <if test="tabType =='1'.toString()">
  239. and ia.entm &gt;=to_date(#{nowTime},'yyyy-MM-dd')
  240. </if>
  241. <if test="adCodes ==null or adCodes ==''">
  242. and
  243. REGEXP_LIKE(
  244. A.Id,'^('||
  245. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{presId}
  246. <include refid="choseSql"/>
  247. )>0 then
  248. (SELECT LISTAGG(id, '|') WITHIN GROUP(ORDER BY PERSID) as
  249. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{presId}
  250. <include refid="choseSql"/>
  251. )
  252. else (select 'non' from dual) end)
  253. ||')')
  254. </if>
  255. ) A WHERE a.PTYPE=#{pType}
  256. <if test="efpType != null and efpType != ''">
  257. and a.type = #{efpType}
  258. </if>
  259. <if test="plnaId !=null and plnaId !=''">
  260. and a.nodeId like '${plnaId}%'
  261. </if>
  262. <if test="state !=null and state !=''">
  263. and STATE in (${state})
  264. </if>
  265. <if test="rsName !=null and rsName !=''">
  266. and a.nm like '%${rsName}%'
  267. </if>
  268. <if test="code !=null and code !=''">
  269. and a.code = #{code}
  270. </if>
  271. <if test="adName != null and adName != ''">and a.adName like '%${adName}%'</if>
  272. <if test="sttm != null and sttm != ''">and a.Intm&gt;= TO_DATE(#{sttm},'YYYY-MM-DD')</if>
  273. <if test="entm != null and entm != ''">and a.Intm &lt; To_DATE(#{entm},'yyyy-MM-dd') + 1</if>
  274. <if test="groupId != null and groupId != ''">and a.nodeId = #{groupId}</if>
  275. order by nodeId asc
  276. <if test="orderBy != null and orderBy != ''">
  277. ,nlssort(nm,'NLS_SORT=SCHINESE_PINYIN_M')
  278. </if>
  279. </select>
  280. <sql id="choseSql">
  281. <choose>
  282. <when test="province != null and province != ''">
  283. and AD_CODE LIKE '${province}%'
  284. </when>
  285. <otherwise>
  286. and AD_CODE is null
  287. </otherwise>
  288. </choose>
  289. </sql>
  290. <select id="getBaseById" resultType="cn.com.goldenwater.dcproj.model.AttProjectInsurance">
  291. SELECT A.*
  292. FROM ATT_PROJECT_INSURANCE A
  293. JOIN BIS_INSP_ALL_OBJ B ON A.ID = B.CODE
  294. JOIN BIS_INSP_ANZE_RGSTR C ON B.OBJ_ID = C.OBJ_ID
  295. where C.ID = #{id}
  296. </select>
  297. </mapper>