BisInspSixmeRgstrDao.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  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.BisInspSixmeRgstrDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspSixmeRgstr" id="bisInspSixmeRgstrResultMap">
  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="bisInspSixmeRgstrResultMap" parameterType="String" >
  75. select <include refid="table_columns" /> from BIS_INSP_SIXME_RGSTR where ID = #{id}
  76. </select>
  77. <select id="getBy" resultMap="bisInspSixmeRgstrResultMap">
  78. select <include refid="table_columns" /> from BIS_INSP_SIXME_RGSTR <include refid="page_where" />
  79. </select>
  80. <select id="findAll" resultMap="bisInspSixmeRgstrResultMap">
  81. select <include refid="table_columns" /> from BIS_INSP_SIXME_RGSTR
  82. </select>
  83. <select id="findList" resultMap="bisInspSixmeRgstrResultMap">
  84. select <include refid="table_columns" /> from BIS_INSP_SIXME_RGSTR <include refid="page_where" />
  85. </select>
  86. <select id="selectCount" resultType="int" >
  87. select count(ID) from BIS_INSP_SIXME_RGSTR <include refid="page_where" />
  88. </select>
  89. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspSixmeRgstr">
  90. insert into BIS_INSP_SIXME_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_SIXME_RGSTR set DATA_STAT='9' where ID = #{id}
  95. </delete>
  96. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspSixmeRgstr">
  97. update BIS_INSP_SIXME_RGSTR set DATA_STAT='9' <include refid="page_where" />
  98. </delete>
  99. <update id="deleteInFlag" parameterType="java.lang.String">
  100. update BIS_INSP_SIXME_RGSTR set DATA_STAT = '9' where ID = #{id}
  101. </update>
  102. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspSixmeRgstr">
  103. update BIS_INSP_SIXME_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.BisInspSixmeRgstr">
  123. update BIS_INSP_SIXME_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.BisInspSixmeRgstrDto">
  144. SELECT * FROM (
  145. select A.CODE,
  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.NAME AS NM,
  155. C.TYPE,
  156. C.MANAGEMENT_UNIT,
  157. C.CONTACT_PERSON,
  158. C.INVESTMENT,
  159. C.CONSTRUCTORS,
  160. C.START_DATE,
  161. C.STATUS,
  162. C.LOC,
  163. C.AD_CODE,
  164. C.AD_NAME,
  165. B.INTM,
  166. B.UPTM,
  167. B.NOTE,
  168. B.DATA_STAT
  169. FROM BIS_INSP_ALL_OBJ A
  170. JOIN BIS_INSP_SIXME_RGSTR B ON A.OBJ_ID = B.OBJ_ID
  171. JOIN ATT_PROJECT_INSURANCE C ON A.CODE = C.ID
  172. LEFT JOIN BIS_INSP_ALL IA ON A.ID = IA.ID
  173. LEFT JOIN ATT_AD_BASE AW ON B.AD_CODE = AW.AD_CODE
  174. <where>
  175. <if test="adCodes ==null or adCodes ==''">
  176. <choose>
  177. <when test='isAll =="1"'>
  178. </when>
  179. <otherwise>
  180. AND A.Id in (
  181. select distinct id from (
  182. SELECT P.id FROM BIS_INSP_ALL P START WITH P.PID IN (SELECT id FROM BIS_INSP_ALL_RLATION A
  183. WHERE A.PERSID = #{presId} and TYPE = #{pType} and length(id) in (3,6,9))
  184. CONNECT BY P.PID = PRIOR P.ID
  185. union all
  186. SELECT P.id FROM BIS_INSP_ALL P where p.id in (SELECT id FROM BIS_INSP_ALL_RLATION A
  187. WHERE A.PERSID =#{presId} and TYPE = #{pType} and length(id)=12 )
  188. )
  189. )
  190. </otherwise>
  191. </choose>
  192. </if>
  193. <if test="adCodes !=null and adCodes !=''">
  194. and
  195. <foreach item="item" index="index" collection="adCodes.split(',')" open="(" separator="or" close=")">
  196. b.ad_code like concat('${item}','%')
  197. </foreach>
  198. </if>
  199. <if test="tabType =='2'.toString()">
  200. AND IA.ENTM &lt; TO_DATE(#{nowTime},'yyyy-MM-dd')+1
  201. </if>
  202. <if test="tabType =='1'.toString()">
  203. AND IA.ENTM &gt;= TO_DATE(#{nowTime},'yyyy-MM-dd')
  204. </if>
  205. </where>
  206. ) A
  207. <where>
  208. <if test="id !=null and id !=''">and a.nodeId like '${id}%'</if>
  209. <if test="plnaId !=null and plnaId !=''">and a.nodeId like '${plnaId}%'</if>
  210. <if test="state !=null and state !=''">and STATE in (${state})</if>
  211. <if test="nm !=null and nm !=''">and a.nm like '%${nm}%'</if>
  212. <if test="rsName !=null and rsName !=''">and a.nm like '%${rsName}%'</if>
  213. <if test="code !=null and code !=''">and a.code = #{code}</if>
  214. <if test="type !=null and type !=''">and a.OBJ_TYPE = #{type}</if>
  215. <if test="adName != null and adName != ''">and a.AD_NAME like '%${adName}%'</if>
  216. <if test="sttm != null and sttm != ''">and a.INTM &gt;= TO_DATE(#{sttm},'YYYY-MM-DD')</if>
  217. <if test="entm != null and entm != ''">and a.INTM &lt; To_DATE(#{entm},'yyyy-MM-dd') + 1</if>
  218. <if test="groupId != null and groupId != ''">and a.nodeId = #{groupId}</if>
  219. </where>
  220. order by nodeId asc
  221. <if test="orderBy != null and orderBy != ''">
  222. ,nlssort(nm,'NLS_SORT=SCHINESE_PINYIN_M')
  223. </if>
  224. </select>
  225. <select id="findSixmeList" resultType="cn.com.goldenwater.dcproj.dto.BisInspRgstrDto">
  226. SELECT * FROM (
  227. select A.CODE,A.ID nodeId,
  228. A.NM,
  229. #{pType} PTYPE,
  230. A.OBJ_ID,B.ID ID,b.id as rgstrId,
  231. (case when b.State is null then '0' else b.state end) STATE,
  232. B.INTM, b.AD_NAME as ad_name,
  233. ia.pnm groupName
  234. from BIS_INSP_ALL_OBJ A
  235. LEFT JOIN BIS_INSP_SIXME_RGSTR B ON A.OBJ_ID=B.OBJ_ID
  236. LEFT JOIN BIS_INSP_ALL ia on A.ID = ia.id
  237. where A.ptype= #{pType}
  238. <if test="tabType =='2'.toString()">
  239. and ia.entm &lt;to_date(#{nowTime},'yyyy-MM-dd')+1
  240. </if>
  241. <if test="tabType =='1'.toString()">
  242. and ia.entm &gt;=to_date(#{nowTime},'yyyy-MM-dd')
  243. </if>
  244. <if test="adCodes ==null or adCodes ==''">
  245. and
  246. REGEXP_LIKE(
  247. A.Id,'^('||
  248. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{presId}
  249. <include refid="choseSql"/>
  250. )>0 then
  251. (SELECT LISTAGG(id, '|') WITHIN GROUP(ORDER BY PERSID) as
  252. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{presId}
  253. <include refid="choseSql"/>
  254. )
  255. else (select 'non' from dual) end)
  256. ||')')
  257. </if>
  258. ) A WHERE a.PTYPE=#{pType}
  259. <if test="efpType != null and efpType != ''">
  260. and a.type = #{efpType}
  261. </if>
  262. <if test="plnaId !=null and plnaId !=''">
  263. and a.nodeId like '${plnaId}%'
  264. </if>
  265. <if test="state !=null and state !=''">
  266. and STATE in (${state})
  267. </if>
  268. <if test="rsName !=null and rsName !=''">
  269. and a.nm like '%${rsName}%'
  270. </if>
  271. <if test="code !=null and code !=''">
  272. and a.code = #{code}
  273. </if>
  274. <if test="adName != null and adName != ''">and a.adName 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. order by nodeId asc
  279. <if test="orderBy != null and orderBy != ''">
  280. ,nlssort(nm,'NLS_SORT=SCHINESE_PINYIN_M')
  281. </if>
  282. </select>
  283. <sql id="choseSql">
  284. <choose>
  285. <when test="province != null and province != ''">
  286. and AD_CODE LIKE '${province}%'
  287. </when>
  288. <otherwise>
  289. and AD_CODE is null
  290. </otherwise>
  291. </choose>
  292. </sql>
  293. <select id="getBaseById" resultType="cn.com.goldenwater.dcproj.model.AttProjectInsurance">
  294. SELECT A.*
  295. FROM ATT_PROJECT_INSURANCE A
  296. JOIN BIS_INSP_ALL_OBJ B ON A.ID = B.CODE
  297. JOIN BIS_INSP_SIXME_RGSTR C ON B.OBJ_ID = C.OBJ_ID
  298. where C.ID = #{id}
  299. </select>
  300. </mapper>