1
0

ZymlMapper.xml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <!--<mapper namespace="com.onemap.apply.mapper.yzt.ZymlMapper">-->
  6. <mapper namespace="com.siwei.apply.mapper.cadastre.ZymlMapper">
  7. <select id="GetListCondition" parameterType="java.lang.String" resultType="com.siwei.apply.domain.cadastre.ZymlDTO">
  8. select
  9. (WITH RECURSIVE a AS (
  10. SELECT g.bsm, g.pbsm, g.parent
  11. FROM t_yzt_zyml g
  12. WHERE bsm = t.bsm
  13. UNION ALL
  14. SELECT d.bsm, d.pbsm, d.parent
  15. FROM t_yzt_zyml d
  16. JOIN a ON a.bsm = d.pbsm )
  17. SELECT count(1) FROM a where a.parent = '0') as "count",
  18. t.bsm as "bsm",
  19. t.name as "name",
  20. t.type as "type",
  21. t.pbsm as "pbsm",
  22. t.icon as "icon",
  23. t.url as "url",
  24. t.lev as "lev",
  25. t.sort as "sort",
  26. t.state as "state",
  27. t.parent as "parent",
  28. case when t.sde is null then t.server_type else 'Arcgis' end as "server_type",
  29. t.sflssj as "sflssj",
  30. t.sfdbfx as "sfdbfx",
  31. t.sfjl as "sfjl",
  32. t.sfcx as "sfcx",
  33. t.sftj as "sftj",
  34. t.epsg as "epsg",
  35. t.year as "year",
  36. t.sjlx as "sjlx",
  37. t.sde as "sde",
  38. t.gltj as "gltj",
  39. t.sjly as "sjly",
  40. t.legend as "legend",
  41. t.ywlx as "ywlx",
  42. t.server_type as "serverType",
  43. t.fwmc as "fwmc" ,
  44. t.fwgzkj as "fwgzkj",
  45. t.geomfield as "geomfield",
  46. t.fwys as "fwys",
  47. t.qpfa as "qpfa",
  48. t.layergroup as "layergroup",
  49. t.format as "format",
  50. t.maximumlevel as "maximumlevel",
  51. t.minimumlevel as "minimumlevel",
  52. t.create_time as "create_time",
  53. t.create_by as "create_by",
  54. t.sharestate as "sharestate",
  55. t.dataexplain as "dataexplain"
  56. from t_yzt_zyml t
  57. where 1 = 1
  58. <choose>
  59. <when test="bsm != null and bsm != ''">
  60. and t.bsm = #{bsm}
  61. </when>
  62. <otherwise>
  63. <choose>
  64. <when test="pbsm != null and pbsm != ''">
  65. and t.pbsm = #{pbsm}
  66. </when>
  67. <otherwise>
  68. and (T.pbsm is null or T.pbsm ='')
  69. </otherwise>
  70. </choose>
  71. </otherwise>
  72. </choose>
  73. <if test="name != null and name != ''">
  74. and t.name like concat('%',#{name},'%')
  75. </if>
  76. <if test="sharestate != null and sharestate != ''">
  77. and t.sharestate = #{sharestate}
  78. </if>
  79. order by t.lev,t.pbsm,t.sort
  80. </select>
  81. <select id="GetList" parameterType="java.lang.String" resultType="com.siwei.apply.domain.cadastre.ZymlDTO">
  82. select
  83. (WITH RECURSIVE a AS (
  84. SELECT g.bsm, g.pbsm, g.parent
  85. FROM t_yzt_zyml g
  86. WHERE bsm = t.bsm
  87. UNION ALL
  88. SELECT d.bsm, d.pbsm, d.parent
  89. FROM t_yzt_zyml d
  90. JOIN a ON a.bsm = d.pbsm )
  91. SELECT count(1) FROM a where a.parent = '0') as "count",
  92. t.bsm as "bsm",
  93. t.name as "name",
  94. t.type as "type",
  95. t.pbsm as "pbsm",
  96. t.icon as "icon",
  97. t.url as "url",
  98. t.lev as "lev",
  99. t.sort as "sort",
  100. t.state as "state",
  101. t.geomfield as "geomfield",
  102. t.parent as "parent",
  103. case when t.sde is null then t.server_type else 'Arcgis' end as "server_type",
  104. t.sflssj as "sflssj",
  105. t.sfdbfx as "sfdbfx",
  106. t.sfjl as "sfjl",
  107. t.sfcx as "sfcx",
  108. t.sftj as "sftj",
  109. t.epsg as "epsg",
  110. t.year as "year",
  111. t.sjlx as "sjlx",
  112. t.sde as "sde",
  113. t.gltj as "gltj",
  114. t.sjly as "sjly",
  115. t.legend as "legend",
  116. t.ywlx as "ywlx",
  117. t.server_type as "serverType",
  118. t.fwmc as "fwmc" ,
  119. t.fwgzkj as "fwgzkj",
  120. t.fwys as "fwys",
  121. t.qpfa as "qpfa",
  122. t.layergroup as "layergroup",
  123. t.format as "format",
  124. t.maximumlevel as "maximumlevel",
  125. t.minimumlevel as "minimumlevel",
  126. t.create_time as "create_time",
  127. t.create_by as "create_by",
  128. (select distinct(uhbm) from t_yzt_zyml_my my where my.zy_bsm = t.bsm and my.uhbm = #{username}) as "my"
  129. from t_yzt_zyml t
  130. where 1 = 1
  131. <if test="param != null and param != ''">
  132. and t.bsm in (WITH RECURSIVE a AS (
  133. SELECT g.bsm, g.pbsm
  134. FROM t_yzt_zyml g
  135. WHERE bsm = #{param}
  136. UNION ALL
  137. SELECT d.bsm, d.pbsm
  138. FROM t_yzt_zyml d
  139. JOIN a ON a.bsm = d.pbsm )
  140. SELECT bsm FROM a order by a.bsm)
  141. </if>
  142. <if test="resources != null and resources != ''">
  143. and t.parent = '1'
  144. </if>
  145. order by t.sort
  146. </select>
  147. <select id="GetList4XZQH" parameterType="java.lang.String" resultType="com.siwei.apply.domain.cadastre.ZymlDTO">
  148. select
  149. (select count(1) from ( select * from t_yzt_zyml ml left join t_yzt_db_layer dblayer2 on dblayer2.id = ml.sde
  150. where dblayer2.source
  151. like '%'||#{xzqh}||'%' or ml.sjly = #{xzqh} or ml.parent = 1)cou where cou.parent = 0
  152. start with cou.bsm = t.bsm
  153. connect by prior cou.bsm = cou.pbsm ) as "count",
  154. t.bsm as "bsm",
  155. t.name as "name",
  156. case when t.sde is null then t.type else to_char(dblayer.servicetype) end as "type",
  157. t.pbsm as "pbsm",
  158. t.icon as "icon",
  159. case when t.sde is null then t.url else to_char(dblayer.address) end as "url",
  160. t.lev as "lev",
  161. t.sort as "sort",
  162. t.state as "state",
  163. t.parent as "parent",
  164. t.geomfield as "geomfield",
  165. case when t.sde is null then t.server_type else 'Arcgis' end as "server_type",
  166. t.sflssj as "sflssj",
  167. t.sfdbfx as "sfdbfx",
  168. t.sfjl as "sfjl",
  169. t.sfcx as "sfcx",
  170. t.sftj as "sftj",
  171. t.epsg as "epsg",
  172. t.year as "year",
  173. t.sjlx as "sjlx",
  174. t.sde as "sde",
  175. t.gltj as "gltj",
  176. t.sjly as "sjly",
  177. t.legend as "legend",
  178. t.ywlx as "ywlx",
  179. (select distinct(uhbm) from t_yzt_zyml_my my where my.zy_bsm = t.bsm and my.uhbm = #{username}) as "my",
  180. (select fzbsm from T_YZT_ZYML_LSSJ ls where ls.zybsm = t.bsm) as "fzbsm",
  181. to_char(res.datetime ,'yyyy-MM-dd hh24:mi:ss') as "datetime",
  182. (select usertable.nick_name from sys_user usertable where usertable.user_name = res.createperson) as
  183. "createperson"
  184. from t_yzt_zyml t left join t_yzt_db_layer dblayer on dblayer.id = t.sde
  185. left join tb_resourcehooktb res on res.name = replace(dblayer.source, 'SDE.','')
  186. where 1 = 1
  187. <if test="param != null and param != ''">
  188. and t.bsm in (select bsm
  189. from t_yzt_zyml ml
  190. start with ml.bsm = #{param}
  191. connect by prior ml.bsm = ml.pbsm)
  192. </if>
  193. and (dblayer.id in ( select id from T_YZT_DB_LAYER where source
  194. like '%'||#{xzqh}||'%' ) or PARENT = 1 or t.sjly = #{xzqh})
  195. order by t.lev, t.sort
  196. </select>
  197. <select id="GetTree" parameterType="java.lang.String" resultType="com.siwei.apply.domain.cadastre.ZymlTreeDTO">
  198. select
  199. t.bsm as "id",
  200. t.name as "name",
  201. t.pbsm as "pid",
  202. null as "url",
  203. t.state as "state",
  204. -- case when t.parent = 0 then 1 else 0 end as "type"
  205. case when t.parent::integer = 0 then 1 else 0 end as "type"
  206. from t_yzt_zyml t order by t.lev,t.pbsm , t.sort
  207. </select>
  208. <select id="GetMyCollect" parameterType="java.lang.String" resultType="com.siwei.apply.domain.cadastre.ZymlDTO">
  209. select
  210. 0 as "count",
  211. t.bsm as "bsm",
  212. t.name as "name",
  213. t.fwmc as "fwmc",
  214. t.fwgzkj as "fwgzkj",
  215. t.type as "type",
  216. t.format as "format",
  217. t.pbsm as "pbsm",
  218. t.geomfield as "geomfield",
  219. t.icon as "icon",
  220. t.url as "url",
  221. t.lev as "lev",
  222. t.sort as "sort",
  223. t.state as "state",
  224. t.parent as "parent",
  225. t.server_type as "serverType",
  226. t.sflssj as "sflssj",
  227. t.sfdbfx as "sfdbfx",
  228. t.sfjl as "sfjl",
  229. t.sfcx as "sfcx",
  230. t.sftj as "sftj",
  231. t.epsg as "epsg",
  232. t.year as "year",
  233. t.sjlx as "sjlx",
  234. t.sde as "sde",
  235. t.gltj as "gltj",
  236. t.sjly as "sjly",
  237. t.legend as "legend",
  238. t.ywlx as "ywlx",
  239. #{username} as "my",
  240. #{username} as "favorite"
  241. from T_YZT_ZYML t
  242. where t.bsm in ((select distinct(my.zy_bsm) from T_YZT_ZYML_MY my where my.uhbm = #{username})) order by t.bsm
  243. </select>
  244. <select id="GetMyCollect4XZQH" parameterType="java.lang.String" resultType="com.siwei.apply.domain.cadastre.ZymlDTO">
  245. select
  246. 0 as "count",
  247. t.bsm as "bsm",
  248. t.name as "name",
  249. case when t.sde is null then t.type else to_char(dblayer.servicetype) end as "type",
  250. t.pbsm as "pbsm",
  251. t.icon as "icon",
  252. case when t.sde is null then t.url else to_char(dblayer.address) end as "url",
  253. t.lev as "lev",
  254. t.sort as "sort",
  255. t.state as "state",
  256. t.parent as "parent",
  257. t.server_type as "server_type",
  258. t.sflssj as "sflssj",
  259. t.sfdbfx as "sfdbfx",
  260. t.sfjl as "sfjl",
  261. t.geomfield as "geomfield",
  262. t.sfcx as "sfcx",
  263. t.sftj as "sftj",
  264. t.epsg as "epsg",
  265. t.year as "year",
  266. t.sjlx as "sjlx",
  267. t.sde as "sde",
  268. t.gltj as "gltj",
  269. t.sjly as "sjly",
  270. t.legend as "legend",
  271. t.ywlx as "ywlx",
  272. #{username} as "my",
  273. null as "fzbsm",
  274. to_char(res.datetime ,'yyyy-MM-dd hh24:mi:ss') as "datetime",
  275. (select usertable.nick_name from sys_user usertable where usertable.user_name = res.createperson) as "createperson"
  276. from T_YZT_ZYML t left join t_yzt_db_layer dblayer on dblayer.id = t.sde
  277. left join tb_resourcehooktb res on res.name = replace(dblayer.source, 'SDE.','')
  278. where t.bsm in ((select distinct(my.zy_bsm) from T_YZT_ZYML_MY my where my.uhbm = #{username}))
  279. order by t.bsm
  280. </select>
  281. <select id="GetByBsms" parameterType="java.lang.String" resultType="com.siwei.apply.domain.cadastre.ZymlDTO">
  282. select
  283. 0 as "count",
  284. t.bsm as "bsm",
  285. t.name as "name",
  286. t.type as "type",
  287. t.pbsm as "pbsm",
  288. t.icon as "icon",
  289. t.url as "url",
  290. t.lev as "lev",
  291. t.sort as "sort",
  292. t.geomfield as "geomfield",
  293. t.state as "state",
  294. t.parent as "parent",
  295. t.server_type as "server_type",
  296. t.sflssj as "sflssj",
  297. t.sfdbfx as "sfdbfx",
  298. t.sfjl as "sfjl",
  299. t.sfcx as "sfcx",
  300. t.sftj as "sftj",
  301. t.epsg as "epsg",
  302. t.year as "year",
  303. t.sjlx as "sjlx",
  304. t.sde as "sde",
  305. t.gltj as "gltj",
  306. t.sjly as "sjly",
  307. t.legend as "legend",
  308. t.ywlx as "ywlx",
  309. t.create_time as "create_time",
  310. t.create_by as "create_by",
  311. null as "my",
  312. null as "fzbsm"
  313. from T_YZT_ZYML t where t.bsm in
  314. <foreach collection="array" item="bsm" open="(" separator="," close=")">
  315. #{bsm}
  316. </foreach>
  317. order by t.bsm
  318. </select>
  319. <select id="GetByBsm" parameterType="java.lang.String" resultType="com.siwei.apply.domain.cadastre.ZymlDTO">
  320. select
  321. 0 as "count",
  322. t.bsm as "bsm",
  323. t.name as "name",
  324. t.pbsm as "pbs m",
  325. t.icon as "icon",
  326. t.url as "url",
  327. t.lev as "lev",
  328. t.sort as "sort",
  329. t.state as "state",
  330. t.parent as "parent",
  331. t.server_type as "serverType",
  332. t.sflssj as "sflssj",
  333. t.sfdbfx as "sfdbfx",
  334. t.sfjl as "sfjl",
  335. t.sfcx as "sfcx",
  336. t.sftj as "sftj",
  337. t.epsg as "epsg",
  338. t.year as "year",
  339. t.sjlx as "sjlx",
  340. t.sde as "sde",
  341. t.gltj as "gltj",
  342. t.sjly as "sjly",
  343. t.legend as "legend",
  344. t.ywlx as "ywlx",
  345. t.fwmc as "fwmc" ,
  346. t.fwgzkj as "fwgzkj",
  347. t.fwys as "fwys",
  348. t.qpfa as "qpfa",
  349. t.layergroup as "layergroup",
  350. t.format as "format",
  351. t.maximumlevel as "maximumlevel",
  352. t.minimumlevel as "minimumlevel",
  353. t.create_time as "create_time",
  354. t.create_by as "create_by",
  355. t.dataexplain as "dataexplain",
  356. null as "my",
  357. null as "fzbsm"
  358. from T_YZT_ZYML t
  359. where t.bsm = #{bsm}
  360. </select>
  361. <select id="GetAttrs" parameterType="java.lang.String" resultType="com.siwei.apply.domain.cadastre.ResourceAttrsDTO">
  362. select t.sxmc as "sxmc",
  363. t.sxbm as "sxbm",
  364. t.sxlx as "sxlx",
  365. t.xssx as "xssx",
  366. t.sfcx as "sfcx",
  367. t.sftj as "sftj",
  368. t.dw as "dw",
  369. t.zdcx as "zdcx" from T_YZT_ZYSX t where t.zy_bsm = #{bsm}
  370. </select>
  371. <select id="GetCollectCount" parameterType="com.siwei.apply.domain.cadastre.ZymlBsmDTO" resultType="java.lang.Integer">
  372. select count(1) from T_YZT_ZYML_MY t where t.uhbm = #{username} and t.zy_bsm = #{bsm}
  373. </select>
  374. <delete id="DeleteCollect" parameterType="com.siwei.apply.domain.cadastre.ZymlBsmDTO">
  375. delete from T_YZT_ZYML_MY t where t.uhbm = #{username} and t.zy_bsm = #{bsm}
  376. </delete>
  377. <insert id="AddCollect" parameterType="com.siwei.apply.domain.cadastre.ZymlBsmDTO">
  378. insert into T_YZT_ZYML_MY (uhbm,zy_bsm) values(#{username},#{bsm})
  379. </insert>
  380. <select id="GetDbfxList" parameterType="java.lang.String" resultType="com.siwei.apply.domain.cadastre.DbfxResourceDTO">
  381. select t.bsm as "bsm",
  382. case when zy.sde is null then zy.type else to_char(dblayer.servicetype) end as "type",
  383. case when zy.sde is null then zy.url else to_char(dblayer.address) end as "url",
  384. t.name as "name",
  385. t.zybsm "zybsm",
  386. t.lxfz as "lxfz",
  387. t.sort as "sort",
  388. t.tjname as "tjname",
  389. t.xzq as "xzq" ,
  390. zy.server_type as "server_type",
  391. zy.epsg as "epsg",
  392. zy.year as "year",
  393. zy.legend as "legend",
  394. zy.ywlx as "ywlx",
  395. ls.fzbsm as "fzbsm"
  396. from T_YZT_DBFX t
  397. left join t_yzt_zyml zy on zy.bsm = t.zybsm
  398. left join t_yzt_db_layer dblayer on dblayer.id = zy.sde
  399. left join T_YZT_ZYML_LSSJ ls on ls.zybsm = t.zybsm
  400. </select>
  401. <select id="GetLssjList" parameterType="java.lang.String" resultType="com.siwei.apply.domain.cadastre.DbfxLssjDTO">
  402. select
  403. t.fzbsm as "fzbsm",
  404. t.zybsm as "zybsm",
  405. zy.epsg as "epsg",
  406. zy.type as "type",
  407. zy.server_type as "server_type",
  408. zy.year as "year",
  409. zy.url as "url"
  410. from T_YZT_ZYML_LSSJ t
  411. left join t_yzt_zyml zy on zy.bsm = t.zybsm
  412. where t.fzbsm = #{param} order by zy.year desc
  413. </select>
  414. <select id="GetLegend" parameterType="java.lang.String" resultType="com.siwei.apply.domain.cadastre.ZymlLegendDTO">
  415. select t.bsm as "bsm",
  416. t.zybsm as "zybsm",
  417. t.zymc as "zymc",
  418. t.tldm as "tldm",
  419. t.tlmc as "tlmc",
  420. t.tllx as "tllx",
  421. t.tlys as "tlys" from t_yzt_zyml_tl t where t.zybsm = #{zybsm} order by t.tldm
  422. </select>
  423. <select id="getXzqCode" parameterType="java.lang.String" resultType="java.lang.String">
  424. SELECT FD_CODE FROM "TB_DICT_XZQHDM" WHERE FD_NAME = #{deptName}
  425. </select>
  426. <select id="GetLegendAttr" parameterType="java.lang.String" resultType="java.util.Map">
  427. select t.name "name",t.value "value" from bs_dic t where t.type = #{ywlx}
  428. </select>
  429. </mapper>