OrganizationInfoMapper.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  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.ubitech.ttc.dao.OrganizationInfoMapper">
  4. <!-- 开启二级缓存 -->
  5. <!--<cache type="org.mybatis.caches.ehcache.LoggingEhcache"/>-->
  6. <select id="getInterviewListByUserid"
  7. resultType="cn.ubitech.ttc.model.datatools.interview.InterviewListModel">
  8. SELECT
  9. a.*
  10. FROM (SELECT
  11. DISTINCT
  12. oi.id,
  13. oi.name,
  14. oi.orgtype,
  15. c.id as connid,
  16. c.creator as userid,
  17. c.createtime,
  18. c.pagecode,
  19. c.node,
  20. oi.district as address,
  21. c.templettype
  22. FROM connectioninfo c,
  23. conn_org_lk col,
  24. organization_info oi,
  25. sys_page sp
  26. WHERE c.id = col.connid
  27. AND col.orgid = oi.id
  28. AND c.templettype = sp.id
  29. AND c.isresourcelibrarydata = 0
  30. AND c.by1 = 0
  31. AND c.node = #{node}
  32. AND sp.funid = #{funid}
  33. AND c.creator = #{userid}
  34. AND c.templettype IN
  35. <foreach collection="funlist" item="id" index="index"
  36. open="(" close=")" separator=",">
  37. #{id}
  38. </foreach>
  39. ORDER BY c.createtime DESC) a
  40. WHERE a.name LIKE #{keyword}
  41. GROUP BY a.name order by a.createtime desc
  42. </select>
  43. <select id="getInterviewListByUid"
  44. resultType="cn.ubitech.ttc.model.datatools.interview.InterviewListModel">
  45. SELECT
  46. a.*
  47. FROM (SELECT
  48. DISTINCT
  49. oi.id,
  50. oi.name,
  51. oi.orgtype,
  52. c.id as connid,
  53. c.creator as userid,
  54. c.createtime,
  55. c.pagecode,
  56. c.node,
  57. oi.district as address,
  58. c.templettype
  59. FROM connectioninfo c,
  60. conn_org_lk col,
  61. organization_info oi,
  62. sys_page sp
  63. WHERE c.id = col.connid
  64. AND col.orgid = oi.id
  65. AND c.templettype = sp.id
  66. AND c.isresourcelibrarydata = 0
  67. AND c.by1 = 0
  68. AND c.node = #{node}
  69. AND sp.funid = #{funid}
  70. AND c.creator = #{userid}
  71. AND c.templettype IN
  72. <foreach collection="funlist" item="id" index="index"
  73. open="(" close=")" separator=",">
  74. #{id}
  75. </foreach>
  76. ORDER BY c.createtime DESC) a
  77. GROUP BY a.name order by a.createtime desc
  78. </select>
  79. <select id="getInterviewListByUseridCount" resultType="java.lang.Integer">
  80. SELECT COUNT(*) AS total FROM (
  81. SELECT
  82. a.*
  83. FROM (SELECT
  84. DISTINCT
  85. oi.id,
  86. oi.name,
  87. c.creator as userid,
  88. c.createtime,
  89. c.pagecode,
  90. c.node,
  91. oi.district as address,
  92. c.templettype
  93. FROM connectioninfo c,
  94. conn_org_lk col,
  95. organization_info oi,
  96. sys_page sp
  97. WHERE c.id = col.connid
  98. AND col.orgid = oi.id
  99. AND c.templettype = sp.id
  100. AND c.by1 = 0
  101. AND c.isresourcelibrarydata = 0
  102. AND c.node = #{node}
  103. AND sp.funid = #{funid}
  104. AND c.creator = #{userid}
  105. AND c.templettype IN
  106. <foreach collection="funlist" item="id" index="index"
  107. open="(" close=")" separator=",">
  108. #{id}
  109. </foreach>
  110. ORDER BY c.createtime DESC) a
  111. WHERE a.name LIKE #{keyword} GROUP BY a.name) b
  112. </select>
  113. <select id="getInterviewList" resultType="cn.ubitech.ttc.model.datatools.interview.InterviewListModel">
  114. SELECT
  115. a.*
  116. FROM (SELECT
  117. DISTINCT
  118. oi.id,
  119. oi.name,
  120. c.creator AS userid,
  121. c.createtime,
  122. oi.district AS address
  123. FROM (SELECT
  124. ci.*
  125. FROM connectioninfo ci,
  126. coninfo_classification cc,
  127. conninfoclassrelation ccr
  128. WHERE ci.id = ccr.infoId
  129. AND cc.id = ccr.claid
  130. AND cc.id = #{claid}) c,
  131. conn_org_lk col,
  132. organization_info oi
  133. WHERE c.id = col.connid
  134. AND col.orgid = oi.id
  135. ORDER BY c.createtime DESC) a
  136. WHERE a.name LIKE #{keyword}
  137. GROUP BY a.name
  138. ORDER BY a.createtime DESC
  139. </select>
  140. <select id="getInterviewListCount" resultType="java.lang.Integer">
  141. SELECT COUNT(*) AS total
  142. FROM (
  143. SELECT
  144. a.*
  145. FROM (SELECT
  146. DISTINCT
  147. oi.id,
  148. oi.name,
  149. c.creator AS userid,
  150. c.createtime,
  151. oi.district AS address
  152. FROM (SELECT
  153. ci.*
  154. FROM connectioninfo ci,
  155. coninfo_classification cc,
  156. conninfoclassrelation ccr
  157. WHERE ci.id = ccr.infoId
  158. AND cc.id = ccr.claid
  159. AND cc.id = #{claid}) c,
  160. conn_org_lk col,
  161. organization_info oi
  162. WHERE c.id = col.connid
  163. AND col.orgid = oi.id
  164. ORDER BY c.createtime DESC) a
  165. WHERE a.name LIKE #{keyword}
  166. GROUP BY a.name ) b
  167. </select>
  168. <select id="getInterviewListTwo" resultType="cn.ubitech.ttc.model.datatools.interview.InterviewListModel">
  169. SELECT
  170. a.*
  171. FROM (SELECT
  172. DISTINCT
  173. oi.id,
  174. oi.name,
  175. c.id as connid,
  176. c.creator as userid,
  177. c.createtime,
  178. c.pagecode,
  179. c.node,
  180. c.templettype,
  181. oi.district as address,
  182. oi.orgtype
  183. FROM connectioninfo c,
  184. conn_org_lk col,
  185. organization_info oi,
  186. sys_page sp
  187. WHERE c.id = col.connid
  188. AND col.orgid = oi.id
  189. AND c.by1 =0
  190. AND c.templettype = sp.id
  191. AND c.isresourcelibrarydata = 0
  192. AND sp.funid = #{funid}
  193. AND c.templettype IN
  194. <foreach collection="funlist" item="id" index="index"
  195. open="(" close=")" separator=",">
  196. #{id}
  197. </foreach>
  198. AND c.node IN
  199. <foreach collection="nodeList" item="id" index="index"
  200. open="(" close=")" separator=",">
  201. #{id}
  202. </foreach>
  203. ORDER BY c.createtime DESC) a
  204. WHERE a.name LIKE #{keyword}
  205. GROUP BY a.name order by a.createtime desc
  206. </select>
  207. <select id="getInterviewListCountTwo" resultType="java.lang.Integer">
  208. SELECT COUNT(*) AS total
  209. FROM (
  210. SELECT a.*
  211. FROM (SELECT
  212. DISTINCT
  213. oi.id,
  214. oi.name,
  215. c.creator as userid,
  216. c.createtime,
  217. c.pagecode,
  218. c.node,
  219. c.templettype,
  220. oi.orgtype,
  221. oi.district as address
  222. FROM connectioninfo c,
  223. conn_org_lk col,
  224. organization_info oi,
  225. sys_page sp
  226. WHERE c.id = col.connid
  227. AND col.orgid = oi.id
  228. AND c.by1 =0
  229. AND c.templettype = sp.id
  230. AND c.isresourcelibrarydata = 0
  231. AND sp.funid = #{funid}
  232. AND c.templettype IN
  233. <foreach collection="funlist" item="id" index="index"
  234. open="(" close=")" separator=",">
  235. #{id}
  236. </foreach>
  237. AND c.node IN
  238. <foreach collection="nodeList" item="id" index="index"
  239. open="(" close=")" separator=",">
  240. #{id}
  241. </foreach>
  242. ORDER BY c.createtime DESC) a
  243. WHERE a.name LIKE #{keyword}
  244. GROUP BY a.name) b
  245. </select>
  246. <select id="getViceOrgByOrgname" resultType="cn.ubitech.ttc.entity.OrganizationInfo">
  247. select * from organization_info where id in(
  248. select otherorg from union_org_lk u
  249. inner join organization_info o on u.unionorg = o.id
  250. where o.name = #{orgname}
  251. )
  252. </select>
  253. <select id="getOrgListByNode" resultType="cn.ubitech.ttc.entity.OrganizationInfo">
  254. select * from organization_info where id in (
  255. select companyid from company_node_lk where companyid in(
  256. select id from organization_info where name = #{orgname}) AND comefrom = #{node})
  257. </select>
  258. <select id="getOrgListByCodeAndNameAndNode" resultType="cn.ubitech.ttc.entity.OrganizationInfo">
  259. select * from organization_info where id in (
  260. select companyid from company_node_lk where companyid in(
  261. select id from organization_info where name = #{orgname} and orgcode = #{orgcode}) AND comefrom = #{node})
  262. </select>
  263. <select id="getOrgListByCodeAndNameAndNode1" resultType="cn.ubitech.ttc.entity.OrganizationInfo">
  264. select * from organization_info where id in (
  265. select companyid from company_node_lk where companyid in(
  266. select id from organization_info where name = #{orgname} or orgcode = #{orgcode}) AND comefrom = #{node})
  267. </select>
  268. <select id="getInspectMunicipalOrgList" resultType="cn.ubitech.ttc.entity.OrganizationInfo">
  269. select distinct
  270. o.name,
  271. o.logo,
  272. o.categoryname
  273. from
  274. inspection_municipal i
  275. left join organization_info o
  276. on
  277. i.orgid = o.id
  278. and i.name like #{orgname}
  279. order by
  280. i.${sortColumn} ${sortType};
  281. </select>
  282. </mapper>