SysUsersInfoMapper.xml 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  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.SysUsersInfoMapper">
  4. <!-- 开启二级缓存 -->
  5. <cache type="org.mybatis.caches.ehcache.EhcacheCache">
  6. <property name="timeToIdleSeconds" value="120"/>
  7. <property name="timeToLiveSeconds" value="180"/>
  8. <property name="maxEntriesLocalHeap" value="1000"/>
  9. <property name="maxEntriesLocalDisk" value="10000000"/>
  10. <property name="memoryStoreEvictionPolicy" value="LRU"/>
  11. </cache>
  12. <select id="getreviewAuthlist" resultType="cn.ubitech.ttc.entity.SysUsersInfo" useCache="false">
  13. SELECT
  14. *
  15. FROM
  16. sys_users_info
  17. WHERE
  18. (id IN (
  19. SELECT
  20. s.id
  21. FROM
  22. sys_users_info s,
  23. sys_users_review_auth u
  24. WHERE
  25. s.usercomefrom = u.nodeid
  26. AND u.userid IN
  27. <foreach collection="usernodeList" item="id" index="index"
  28. open="(" close=")" separator=",">
  29. #{id}
  30. </foreach>
  31. AND s.applytype IN
  32. <foreach collection="personTypeList" item="id" index="index"
  33. open="(" close=")" separator=",">
  34. #{id}
  35. </foreach>
  36. )
  37. OR id IN (
  38. SELECT
  39. i.id
  40. FROM
  41. sys_users_info i,
  42. organization_info o,
  43. company_node_lk n
  44. WHERE
  45. i.orgid = o.id
  46. AND o.id = n.companyid
  47. AND i.applytype IN
  48. <foreach collection="companyTypeList" item="id" index="index"
  49. open="(" close=")" separator=",">
  50. #{id}
  51. </foreach>
  52. AND n.comefrom IN (
  53. SELECT
  54. u.nodeid
  55. FROM
  56. sys_users_review_auth u
  57. WHERE
  58. u.userid IN
  59. <foreach collection="usernodeList" item="id" index="index"
  60. open="(" close=")" separator=",">
  61. #{id}
  62. </foreach>
  63. )
  64. )
  65. OR id IN (
  66. SELECT
  67. i.id
  68. FROM
  69. sys_users_info i,
  70. node nod
  71. WHERE
  72. i.orgid = nod.orgid
  73. AND i.applytype IN
  74. <foreach collection="companyTypeList" item="id" index="index"
  75. open="(" close=")" separator=",">
  76. #{id}
  77. </foreach>
  78. AND nod.id IN (
  79. SELECT
  80. u.nodeid
  81. FROM
  82. sys_users_review_auth u
  83. WHERE
  84. u.userid IN
  85. <foreach collection="usernodeList" item="id" index="index"
  86. open="(" close=")" separator=",">
  87. #{id}
  88. </foreach>
  89. )
  90. )
  91. OR id IN (
  92. SELECT
  93. f.id
  94. FROM
  95. sys_users_info f,
  96. sys_users_review_auth u
  97. WHERE
  98. f.usercomefrom = u.nodeid
  99. AND f.applytype IN
  100. <foreach collection="companyTypeList" item="id" index="index"
  101. open="(" close=")" separator=",">
  102. #{id}
  103. </foreach>
  104. AND f.orgid IS NULL
  105. AND u.userid IN
  106. <foreach collection="usernodeList" item="id" index="index"
  107. open="(" close=")" separator=",">
  108. #{id}
  109. </foreach>
  110. ))
  111. <if test='idtype != 0'>
  112. AND idtype=#{idtype}
  113. </if>
  114. <if test='authenstatus != 0'>
  115. AND authenstatus=#{authenstatus}
  116. </if>
  117. <if test="key != null and key != ''">
  118. AND (username like '%${key}%' or applyname like '%${key}%')
  119. </if>
  120. ORDER BY createtime DESC
  121. </select>
  122. <select id="getreviewAuthlist1" resultType="cn.ubitech.ttc.entity.SysUsersInfo" useCache="false">
  123. SELECT
  124. *
  125. FROM
  126. sys_users_info
  127. where usercomefrom in
  128. (select nodeid
  129. FROM sys_users_review_auth
  130. WHERE userid = #{userid})
  131. ORDER BY createtime DESC
  132. </select>
  133. <select id="getreviewAuthcount" resultType="java.lang.Integer" useCache="false">
  134. SELECT
  135. count(id)
  136. FROM
  137. sys_users_info
  138. WHERE
  139. (id IN (
  140. SELECT
  141. s.id
  142. FROM
  143. sys_users_info s,
  144. sys_users_review_auth u
  145. WHERE
  146. s.usercomefrom = u.nodeid
  147. AND u.userid IN
  148. <foreach collection="usernodeList" item="id" index="index"
  149. open="(" close=")" separator=",">
  150. #{id}
  151. </foreach>
  152. AND s.applytype IN
  153. <foreach collection="personTypeList" item="id" index="index"
  154. open="(" close=")" separator=",">
  155. #{id}
  156. </foreach>
  157. )
  158. OR id IN (
  159. SELECT
  160. i.id
  161. FROM
  162. sys_users_info i,
  163. organization_info o,
  164. company_node_lk n
  165. WHERE
  166. i.orgid = o.id
  167. AND o.id = n.companyid
  168. AND i.applytype IN
  169. <foreach collection="companyTypeList" item="id" index="index"
  170. open="(" close=")" separator=",">
  171. #{id}
  172. </foreach>
  173. AND n.comefrom IN (
  174. SELECT
  175. u.nodeid
  176. FROM
  177. sys_users_review_auth u
  178. WHERE
  179. u.userid IN
  180. <foreach collection="usernodeList" item="id" index="index"
  181. open="(" close=")" separator=",">
  182. #{id}
  183. </foreach>
  184. )
  185. )
  186. OR id IN (
  187. SELECT
  188. i.id
  189. FROM
  190. sys_users_info i,
  191. node nod
  192. WHERE
  193. i.orgid = nod.orgid
  194. AND i.applytype IN
  195. <foreach collection="companyTypeList" item="id" index="index"
  196. open="(" close=")" separator=",">
  197. #{id}
  198. </foreach>
  199. AND nod.id IN (
  200. SELECT
  201. u.nodeid
  202. FROM
  203. sys_users_review_auth u
  204. WHERE
  205. u.userid IN
  206. <foreach collection="usernodeList" item="id" index="index"
  207. open="(" close=")" separator=",">
  208. #{id}
  209. </foreach>
  210. )
  211. )
  212. OR id IN (
  213. SELECT
  214. f.id
  215. FROM
  216. sys_users_info f,
  217. sys_users_review_auth u
  218. WHERE
  219. f.usercomefrom = u.nodeid
  220. AND f.applytype IN
  221. <foreach collection="companyTypeList" item="id" index="index"
  222. open="(" close=")" separator=",">
  223. #{id}
  224. </foreach>
  225. AND f.orgid IS NULL
  226. AND u.userid IN
  227. <foreach collection="usernodeList" item="id" index="index"
  228. open="(" close=")" separator=",">
  229. #{id}
  230. </foreach>
  231. ))
  232. <if test='idtype != 0'>
  233. AND idtype=#{idtype}
  234. </if>
  235. <if test='authenstatus != 0'>
  236. AND authenstatus=#{authenstatus}
  237. </if>
  238. <if test="key != null and key != ''">
  239. AND (username like '%${key}%' or applyname like '%${key}%')
  240. </if>
  241. </select>
  242. <select id="getUserInOrg" resultType="cn.ubitech.ttc.entity.SysUsersInfo">
  243. select sui.*
  244. from sys_users_info sui
  245. where sui.userid = #{userid}
  246. and sui.orgid = #{oid}
  247. and sui.authenstatus = #{status}
  248. </select>
  249. <select id="getUserInNode" resultType="cn.ubitech.ttc.entity.SysUsersInfo">
  250. select sui.* from sys_users_info sui where sui.userid = #{userid} and sui.authenstatus = #{status}
  251. </select>
  252. </mapper>