ZymlMapper.xml 15 KB

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