UserMapper.xml 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  3. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  4. <mapper namespace="com.diagbot.mapper.UserMapper">
  5. <!-- 通用查询映射结果 -->
  6. <resultMap id="BaseResultMap" type="com.diagbot.entity.User">
  7. <id column="id" property="id" />
  8. <result column="is_deleted" property="isDeleted" />
  9. <result column="gmt_create" property="gmtCreate" />
  10. <result column="gmt_modified" property="gmtModified" />
  11. <result column="creator" property="creator" />
  12. <result column="modifier" property="modifier" />
  13. <result column="username" property="username" />
  14. <result column="password" property="password" />
  15. <result column="linkman" property="linkman" />
  16. <result column="phone" property="phone" />
  17. <result column="position" property="position" />
  18. <result column="dept" property="dept" />
  19. <result column="email" property="email" />
  20. <result column="auth_status" property="authStatus" />
  21. <result column="passauth_time" property="passauthTime" />
  22. <result column="type" property="type" />
  23. <result column="remark" property="remark" />
  24. </resultMap>
  25. <resultMap id="UserOrgDTO" type="com.diagbot.dto.UserOrgDTO">
  26. <id column="user_id" property="userId"/>
  27. <result column="username" property="username"/>
  28. <result column="linkman" property="linkman"/>
  29. <result column="email" property="email"/>
  30. <result column="org_id" property="orgId"/>
  31. <result column="org_name" property="orgName"/>
  32. <result column="is_reject" property="isReject"/>
  33. <result column="au_status" property="auStatus"/>
  34. <result column="sub_num" property="subNum"/>
  35. </resultMap>
  36. <select id="findByName" resultMap="BaseResultMap" parameterType="java.lang.String">
  37. select * from sys_user
  38. where username = #{username} and is_deleted = 'N'
  39. </select>
  40. <select id="selectUserListPage" resultMap="BaseResultMap">
  41. select u.*
  42. from sys_user u
  43. LEFT JOIN sys_user_role ur on u.id= ur.user_id
  44. LEFT JOIN sys_role r on ur.role_id=r.id
  45. where u.is_deleted = 'N'
  46. <if test="user.id != null">
  47. and u.id = #{user.id}
  48. </if>
  49. </select>
  50. <select id="indexPage" resultMap="BaseResultMap">
  51. select u.* from sys_user u where u.is_deleted = 'N'
  52. <if test="user.id != null">
  53. and u.id = #{user.id}
  54. </if>
  55. <if test="user.username != null and user.username != '' ">
  56. and u.username like concat('%',#{user.username},'%')
  57. </if>
  58. </select>
  59. <select id="getByIds" resultMap="BaseResultMap">
  60. select u.* from sys_user u where u.is_deleted = 'N'
  61. and u.id in
  62. <foreach collection="list" item="ids" open="(" close=")" separator=",">
  63. #{ids}
  64. </foreach>
  65. </select>
  66. <select id="getUserOrgDTOByIds" resultMap="UserOrgDTO">
  67. select u.id user_id ,u.username username, u.email email, u.linkman linkman , org.id org_id,
  68. org.name org_name, u.auth_status is_reject, u.auth_status au_status,org.sub_num
  69. from sys_user u, sys_user_organization uo, sys_organization org
  70. where u.is_deleted = 'N' and uo.is_deleted = 'N' and org.is_deleted = 'N'
  71. and u.id = uo.user_id and uo.organization_id = org.id
  72. and u.id in
  73. <foreach collection="list" item="ids" open="(" close=")" separator=",">
  74. #{ids}
  75. </foreach>
  76. </select>
  77. <select id="getUserByOrgName" resultMap="BaseResultMap">
  78. select a.* from sys_user a, sys_organization org, sys_user_organization uo
  79. where a.is_deleted = 'N' and org.is_deleted = 'N' and uo.is_deleted = 'N'
  80. and a.id = uo.user_id and uo.organization_id = org.id and org.`name` like concat('%' ,#{orgName}, '%')
  81. </select>
  82. <!-- <select id="selectUserInfoListPage" resultMap="BaseResultMap">
  83. select u.*
  84. LEFT JOIN sys_user_role ur on u.id= ur.user_id
  85. LEFT JOIN
  86. sys_role r on ur.role_id=r.id
  87. where u.is_deleted = 'N' and type = "0"
  88. ORDER BY gmt_create DESC
  89. </select> -->
  90. <!-- <select id="selectUserInfoPage" parameterType="com.diagbot.dto.UserInfoDTO" resultType="com.diagbot.dto.UserInfoDTO">
  91. SELECT
  92. u.id AS userId,
  93. u.gmt_create as userGmtCreate,
  94. u.username as userName,
  95. u.linkman as linKman,
  96. u.email as email,
  97. org.id AS orgId,
  98. org.gmt_create as orgGmtCreate,
  99. org.name as orgName
  100. FROM sys_user u
  101. LEFT JOIN sys_user_organization uorg ON u.id = uorg.user_id
  102. LEFT JOIN sys_organization org ON uorg.organization_id = org.id
  103. WHERE u.is_deleted = 'N' AND u.TYPE = 0 ORDER BY u.gmt_create DESC
  104. </select> -->
  105. <select id="selectUserInfoListPage" resultType="com.diagbot.dto.UserInfoDTO">
  106. SELECT
  107. u.id AS userId,
  108. u.gmt_create AS userGmtCreate,
  109. u.username AS userName,
  110. u.linkman AS linkman,
  111. u.email AS email,
  112. org.id AS orgId,
  113. org.gmt_create AS orgGmtCreate,
  114. org.name AS orgName,
  115. org.type as orgType,
  116. org.principal AS orgPrincipal,
  117. org.address as orgAddress,
  118. org.parent_id as orgParentId,
  119. org.sub_num as orgSub_num,
  120. u.position as position,
  121. aut.is_reject as autIsReject,
  122. u.auth_status as authStatus
  123. FROM sys_user u
  124. LEFT JOIN sys_user_organization uorg ON u.id = uorg.user_id
  125. LEFT JOIN sys_organization org ON uorg.organization_id = org.id
  126. LEFT JOIN sys_user_authentication aut ON u.id = aut.user_id
  127. WHERE u.is_deleted = 'N' AND u.TYPE = 0
  128. <if test="userInfo.orgName != null">
  129. AND org.name LIKE CONCAT('%', #{userInfo.orgName}, '%')
  130. </if>
  131. <if test="userInfo.authStatus != null">
  132. AND u.auth_status = #{userInfo.authStatus}
  133. </if>
  134. ORDER BY u.gmt_create DESC
  135. </select>
  136. <update id="updateUserInfoAll" parameterType="java.util.Map">
  137. UPDATE sys_user u ,sys_user_organization a ,
  138. sys_organization b ,sys_user_authentication c
  139. SET u.remark = "0"
  140. <if test="userMap.email != null">
  141. <if test="userMap.gmtModified !=null">
  142. ,u.gmt_modified=#{userMap.gmtModified}
  143. </if>
  144. <if test="userMap.modifier != null">
  145. ,u.modifier=#{userMap.modifier}
  146. </if>
  147. ,u.email=#{userMap.email}
  148. </if>
  149. <if test="userMap.principal != null || userMap.address != null || userMap.type != null">
  150. <if test="userMap.gmtModified !=null">
  151. ,b.gmt_modified=#{userMap.gmtModified}
  152. </if>
  153. <if test="userMap.modifier != null">
  154. ,b.modifier=#{userMap.modifier}
  155. </if>
  156. <if test="userMap.principal != null">
  157. ,b.principal=#{userMap.principal}
  158. </if>
  159. <if test="userMap.address != null">
  160. ,b.address=#{userMap.address}
  161. </if>
  162. <if test="userMap.type != null">
  163. ,b.type=#{userMap.type}
  164. </if>
  165. </if>
  166. <!-- <if test="position != null || isReject != null || rejectType !=null || rejectComment !=null || status != null"> -->
  167. <if test="userMap.position != null">
  168. <if test="userMap.gmtModified !=null">
  169. ,c.gmt_modified=#{userMap.gmtModified}
  170. </if>
  171. <if test="userMap.modifier != null">
  172. ,c.modifier=#{userMap.modifier}
  173. </if>
  174. ,c.position=#{userMap.position}
  175. </if>
  176. <!-- <if test="isReject != null">
  177. ,c.is_reject=#{isReject}
  178. </if>
  179. <if test="rejectType !=null">
  180. ,c.reject_type=#{rejectType}
  181. </if>
  182. <if test="rejectComment !=null">
  183. ,c.reject_comment=#{rejectComment}
  184. </if>
  185. <if test="status != null">
  186. ,c.status = #{status}
  187. </if> -->
  188. <!-- </if> -->
  189. WHERE
  190. u.is_deleted = "N"
  191. AND u.id = #{userMap.userId}
  192. AND c.user_id= #{userMap.userId}
  193. AND a.user_id = #{userMap.userId}
  194. AND a.organization_id =b.id
  195. </update>
  196. <update id="updateDeleted" parameterType="java.util.Map">
  197. UPDATE sys_user u ,sys_user_organization a ,
  198. sys_organization b,sys_user_authentication c, sys_user_role r
  199. SET u.is_deleted = "Y",a.is_deleted= "Y",b.is_deleted= "Y",c.is_deleted="Y", r.is_deleted="Y"
  200. <if test="map.gmtModified !=null">
  201. ,u.gmt_modified=#{map.gmtModified}
  202. ,a.gmt_modified=#{map.gmtModified}
  203. ,b.gmt_modified=#{map.gmtModified}
  204. ,c.gmt_modified=#{map.gmtModified}
  205. ,r.gmt_modified=#{map.gmtModified}
  206. </if>
  207. <if test="map.modifier != null">
  208. ,u.modifier=#{map.modifier}
  209. ,a.modifier=#{map.modifier}
  210. ,b.modifier=#{map.modifier}
  211. ,c.modifier=#{map.modifier}
  212. ,r.modifier=#{map.modifier}
  213. </if>
  214. WHERE u.id = #{map.userId}
  215. AND c.user_id= #{map.userId}
  216. AND a.user_id = #{map.userId}
  217. AND a.organization_id =b.id
  218. AND r.user_id= #{map.userId}
  219. </update>
  220. <update id="auditUserInfoAll" parameterType="java.util.Map">
  221. UPDATE sys_user_authentication a, sys_user u
  222. <trim prefix="set" suffixOverrides=",">
  223. <if test="auditMap.gmtModified !=null">a.gmt_modified=#{auditMap.gmtModified},</if>
  224. <if test="auditMap.modifier != null">a.modifier=#{auditMap.modifier},</if>
  225. <if test="auditMap.isReject != null">a.is_reject = #{auditMap.isReject} ,</if>
  226. <if test="auditMap.certificationDate != null">a.certification_date = #{auditMap.certificationDate},</if>
  227. <if test="auditMap.rejectType != null">a.reject_type =#{auditMap.rejectType},</if>
  228. <if test="auditMap.rejectComment != null">a.reject_comment= #{auditMap.rejectComment},</if>
  229. <if test="auditMap.status != null">a.STATUS= #{auditMap.status},</if>
  230. <if test="auditMap.authStatus != null">u.auth_status = #{auditMap.authStatus},</if>
  231. <if test="auditMap.certificationDate != null">u.passauth_time = #{auditMap.certificationDate},</if>
  232. <if test="auditMap.gmtModified !=null">u.gmt_modified=#{auditMap.gmtModified},</if>
  233. <if test="auditMap.modifier != null">u.modifier=#{auditMap.modifier}</if>
  234. </trim>
  235. WHERE
  236. a.is_deleted = "N"
  237. AND a.user_id = #{auditMap.userId}
  238. AND a.order_num = #{auditMap.orderNum}
  239. AND u.id = #{auditMap.userId}
  240. </update>
  241. <select id="dependentuserInfoByTime" parameterType="java.util.Map"
  242. resultType="com.diagbot.dto.UserInfoDTO">
  243. SELECT
  244. u.id AS userId,
  245. u.gmt_create AS userGmtCreate,
  246. u.passauth_time AS passauthTime,
  247. u.username AS userName,
  248. u.linkman AS linkman,
  249. u.email AS email,
  250. org.id AS orgId,
  251. org.gmt_create AS orgGmtCreate,
  252. org.name AS orgName,
  253. org.type as orgType,
  254. org.principal AS orgPrincipal,
  255. org.address as orgAddress,
  256. org.parent_id as orgParentId,
  257. org.sub_num as orgSub_num,
  258. u.position as position,
  259. u.auth_status as authStatus
  260. FROM sys_user u
  261. LEFT JOIN sys_user_organization uorg ON u.id = uorg.user_id
  262. LEFT JOIN sys_organization org ON uorg.organization_id = org.id
  263. WHERE
  264. u.is_deleted = 'N'
  265. AND u.TYPE = "0"
  266. <if test="userExport.orgName != null">
  267. AND org.name LIKE CONCAT('%', #{userExport.orgName}, '%')
  268. </if>
  269. <if test="userExport.userName != null">
  270. AND u.username LIKE CONCAT('%', #{userExport.userName}, '%')
  271. </if>
  272. <if test="userExport.authStatus != null">
  273. AND u.auth_status = #{userExport.authStatus}
  274. </if>
  275. <if test="userExport.startTime != null and userExport.endTime != null">
  276. AND u.gmt_create BETWEEN #{userExport.startTime} and #{userExport.endTime}
  277. </if>
  278. ORDER BY u.gmt_create DESC
  279. </select>
  280. <select id="queryUserInformation" resultType="com.diagbot.dto.UserAllDTO">
  281. SELECT
  282. u.id AS userId,
  283. u.gmt_create AS userGmtCreate,
  284. u.username AS userName,
  285. u.linkman AS linkman,
  286. u.email AS email,
  287. org.id AS orgId,
  288. org.name AS orgName,
  289. u.auth_status AS authStatus
  290. FROM sys_user u
  291. LEFT JOIN sys_user_organization uorg ON u.id = uorg.user_id
  292. LEFT JOIN sys_organization org ON uorg.organization_id = org.id
  293. WHERE u.is_deleted = 'N' AND u.TYPE = 0
  294. <if test="userInformation.userName != null">
  295. AND u.username LIKE CONCAT('%', #{userInformation.userName}, '%')
  296. </if>
  297. <if test="userInformation.authStatus != null">
  298. AND u.auth_status = #{userInformation.authStatus}
  299. </if>
  300. <if test="userInformation.startTime != null and userInformation.endTime != null">
  301. AND u.gmt_create BETWEEN #{userInformation.startTime} and #{userInformation.endTime}
  302. </if>
  303. ORDER BY u.gmt_create DESC
  304. </select>
  305. <!-- <select id="queryMechanismInformation(jiude)" resultType="com.diagbot.dto.OrganizationDTO">
  306. SELECT
  307. u.id AS userId,
  308. u.linkman AS linkman,
  309. org.id AS orgId,
  310. org.gmt_create AS orgGmtCreate,
  311. org.name AS orgName,
  312. org.type AS orgType,
  313. org.principal AS orgPrincipal,
  314. org.address AS orgAddress,
  315. org.parent_id AS orgParentId,
  316. org.sub_num AS orgSub_num
  317. FROM sys_user u
  318. LEFT JOIN sys_user_organization uorg ON u.id = uorg.user_id
  319. LEFT JOIN sys_organization org ON uorg.organization_id = org.id
  320. LEFT JOIN sys_user_authentication aut ON u.id = aut.user_id
  321. WHERE u.is_deleted = 'N' AND u.TYPE = 0
  322. <if test="mechanism.orgName != null">
  323. AND org.name LIKE CONCAT('%', #{mechanism.orgName}, '%')
  324. </if>
  325. <if test="mechanism.authStatus != null">
  326. AND u.auth_status = #{mechanism.authStatus}
  327. </if>
  328. <if test="mechanism.startTime != null and mechanism.endTime != null">
  329. AND u.gmt_create BETWEEN #{mechanism.startTime} and #{mechanism.endTime}
  330. </if>
  331. ORDER BY u.gmt_create DESC
  332. </select> -->
  333. <select id="queryMechanismInformation" resultType="com.diagbot.dto.OrganizationDTO">
  334. SELECT
  335. u.id AS userId,
  336. org.id AS orgId,
  337. org.gmt_create AS orgGmtCreate,
  338. org.name AS orgName,
  339. org.principal AS orgPrincipal,
  340. org.type AS orgType,
  341. org.address AS orgAddress,
  342. u.linkman AS linkman,
  343. u.auth_status AS authStatus,
  344. org.parent_id AS orgParentId,
  345. org.sub_num AS orgSubNum
  346. FROM
  347. sys_organization org
  348. LEFT JOIN sys_user_organization uorg ON org.id = uorg.organization_id
  349. LEFT JOIN sys_user u ON uorg.user_id = u.id
  350. WHERE org.is_deleted = 'N'
  351. <if test="mechanism.orgName != null">
  352. AND org.name LIKE CONCAT('%', #{mechanism.orgName}, '%')
  353. </if>
  354. <if test="mechanism.authStatus != null">
  355. AND u.auth_status = #{mechanism.authStatus}
  356. </if>
  357. <if test="mechanism.startTime != null and mechanism.endTime != null">
  358. AND org.gmt_create BETWEEN #{mechanism.startTime} and #{mechanism.endTime}
  359. </if>
  360. ORDER BY org.gmt_create DESC
  361. </select>
  362. <select id="queryVerifiedUserOrganizationProduct" resultType="com.diagbot.dto.UserOrgizationProductDTO">
  363. SELECT
  364. u.id AS userId,
  365. u.gmt_create AS userGmtCreate,
  366. u.username AS userName,
  367. u.linkman AS linkman,
  368. u.email AS email,
  369. org.id AS orgId,
  370. org.gmt_create AS orgGmtCreate,
  371. org.name AS orgName,
  372. org.type AS orgType,
  373. org.principal AS orgPrincipal,
  374. org.address AS orgAddress,
  375. org.parent_id AS orgParentId,
  376. org.sub_num AS orgSubNum,
  377. u.passauth_time AS passauthTime,
  378. u.position AS position,
  379. u.auth_status AS authStatus
  380. FROM sys_user u
  381. LEFT JOIN sys_user_organization uorg ON u.id = uorg.user_id
  382. LEFT JOIN sys_organization org ON uorg.organization_id = org.id
  383. WHERE u.is_deleted = 'N' AND u.TYPE = 0
  384. <if test="userOrg.orgName != null">
  385. AND org.name LIKE CONCAT('%', #{userOrg.orgName}, '%')
  386. </if>
  387. <if test="userOrg.userName != null">
  388. AND u.username LIKE CONCAT('%', #{userOrg.userName}, '%')
  389. </if>
  390. <if test="userOrg.startTime != null and userOrg.endTime != null">
  391. AND u.gmt_create BETWEEN #{userOrg.startTime} and #{userOrg.endTime}
  392. </if>
  393. AND u.auth_status = 1
  394. ORDER BY u.passauth_time DESC
  395. </select>
  396. <select id="queryAuthentication" resultType="com.diagbot.dto.AuthenticationDTO">
  397. SELECT
  398. u.id AS userId,
  399. aut.gmt_create AS autGmtCreate,
  400. u.username AS userName,
  401. u.linkman AS linkman,
  402. u.email AS email,
  403. org.id AS orgId,
  404. org.gmt_create AS orgGmtCreate,
  405. org.name AS orgName,
  406. org.type AS orgType,
  407. org.principal AS orgPrincipal,
  408. org.address AS orgAddress,
  409. org.parent_id AS orgParentId,
  410. org.sub_num AS orgSubNum,
  411. u.position AS position,
  412. u.auth_status AS authStatus,
  413. aut.order_num AS orderNum,
  414. aut.status AS status
  415. FROM sys_user_authentication aut
  416. JOIN sys_user u ON u.id = aut.user_id
  417. JOIN sys_user_organization uorg ON u.id = uorg.user_id
  418. JOIN sys_organization org ON uorg.organization_id = org.id
  419. WHERE u.is_deleted = 'N' AND aut.is_deleted = 'N' AND u.TYPE = 0
  420. <if test="authen.status != null">
  421. AND aut.status = #{authen.status}
  422. </if>
  423. <if test="authen.authStatus != null">
  424. AND u.auth_status= #{authen.authStatus}
  425. </if>
  426. <if test="authen.orgName != null">
  427. AND org.name LIKE CONCAT('%', #{authen.orgName}, '%')
  428. </if>
  429. <if test="authen.userName != null">
  430. AND u.username LIKE CONCAT('%', #{authen.userName}, '%')
  431. </if>
  432. <if test="authen.startTime != null and authen.endTime != null">
  433. AND aut.gmt_create BETWEEN #{authen.startTime} and #{authen.endTime}
  434. </if>
  435. ORDER BY aut.gmt_create DESC
  436. <!-- SELECT u.id AS userId, u.gmt_create AS userGmtCreate, u.username AS
  437. userName, u.linkman AS linKman, u.email AS email, org.id AS orgId, org.gmt_create
  438. AS orgGmtCreate, org.name AS orgName, org.type AS orgType, org.principal
  439. AS orgPrincipal, org.address AS orgAddress, org.parent_id AS orgParentId,
  440. org.sub_num AS orgSub_num, u.position AS autPosition, u.auth_status AS authStatus
  441. FROM sys_user u LEFT JOIN sys_user_organization uorg ON u.id = uorg.user_id
  442. LEFT JOIN sys_organization org ON uorg.organization_id = org.id WHERE u.is_deleted
  443. = 'N' AND u.TYPE = 0 <if test="authen.orgName != null"> AND org.name LIKE
  444. CONCAT('%', #{authen.orgName}, '%') </if> <if test="authen.userName != null">
  445. AND u.username LIKE CONCAT('%', #{authen.userName}, '%') </if> <if test="authen.startTime
  446. != null and authen.endTime != null"> AND u.gmt_create BETWEEN #{authen.startTime}
  447. and #{authen.endTime} </if> AND u.auth_status = 2 ORDER BY u.gmt_create DESC -->
  448. </select>
  449. <update id="updateUserInfo" parameterType="java.util.Map">
  450. UPDATE
  451. sys_user a
  452. <trim prefix="set" suffixOverrides=",">
  453. <if test="amendUserInfo.linkman != null">
  454. a.linkman = #{amendUserInfo.linkman},
  455. </if>
  456. <if test="amendUserInfo.email != null">
  457. a.email = #{amendUserInfo.email},
  458. </if>
  459. <if test="amendUserInfo.position != null">
  460. a.position = #{amendUserInfo.position},
  461. </if>
  462. <if test="amendUserInfo.gmtModified != null">
  463. a.gmt_modified =#{amendUserInfo.gmtModified},
  464. </if>
  465. <if test="amendUserInfo.modifier != null">
  466. a.modifier = #{amendUserInfo.modifier},
  467. </if>
  468. </trim>
  469. WHERE
  470. a.is_deleted = "N"
  471. AND a.id = #{amendUserInfo.userId}
  472. </update>
  473. <update id="updateOrganizations" parameterType="java.util.Map">
  474. UPDATE sys_organization a
  475. <trim prefix="set" suffixOverrides=",">
  476. <if test="amendOrg.address != null">
  477. a.address = #{amendOrg.address},
  478. </if>
  479. <if test="amendOrg.type != null">
  480. a.type = #{amendOrg.type},
  481. </if>
  482. <if test="amendOrg.orgSubNum != null">
  483. a.sub_num = #{amendOrg.orgSubNum},
  484. </if>
  485. <if test="amendOrg.gmtModified != null">
  486. a.gmt_modified =#{amendOrg.gmtModified},
  487. </if>
  488. <if test="amendOrg.modifier != null">
  489. a.modifier =#{amendOrg.modifier}
  490. </if>
  491. </trim>
  492. WHERE
  493. a.is_deleted = "N"
  494. AND a.id = #{amendOrg.orgId}
  495. </update>
  496. <select id="exportOrganizations" parameterType="java.util.Map"
  497. resultType="com.diagbot.dto.UserInfoDTO">
  498. SELECT
  499. u.id AS userId,
  500. org.id AS orgId,
  501. org.gmt_create AS orgGmtCreate,
  502. org.name AS orgName,
  503. org.principal AS orgPrincipal,
  504. org.type AS orgType,
  505. org.address AS orgAddress,
  506. u.linkman AS linkman,
  507. u.auth_status AS authStatus,
  508. org.parent_id AS orgParentId,
  509. org.sub_num AS orgSubNum
  510. FROM
  511. sys_organization org
  512. LEFT JOIN sys_user_organization uorg ON org.id = uorg.organization_id
  513. LEFT JOIN sys_user u ON uorg.user_id = u.id
  514. WHERE org.is_deleted = 'N'
  515. <if test="exportOrg.orgName != null">
  516. AND org.name LIKE CONCAT('%', #{exportOrg.orgName}, '%')
  517. </if>
  518. <if test="exportOrg.startTime != null and exportOrg.endTime != null">
  519. AND org.gmt_create BETWEEN #{exportOrg.startTime} and #{exportOrg.endTime}
  520. </if>
  521. ORDER BY org.gmt_create DESC
  522. </select>
  523. <select id="exportKema" resultType="com.diagbot.dto.AuthenticationDTO">
  524. SELECT
  525. u.id AS userId,
  526. aut.gmt_create AS autGmtCreate,
  527. u.username AS userName,
  528. u.linkman AS linkman,
  529. u.email AS email,
  530. org.id AS orgId,
  531. org.gmt_create AS orgGmtCreate,
  532. org.name AS orgName,
  533. org.type AS orgType,
  534. org.principal AS orgPrincipal,
  535. org.address AS orgAddress,
  536. org.parent_id AS orgParentId,
  537. org.sub_num AS orgSubNum,
  538. u.position AS position,
  539. u.auth_status AS authStatus,
  540. aut.order_num AS orderNum,
  541. aut.status AS status
  542. FROM sys_user_authentication aut
  543. JOIN sys_user u ON u.id = aut.user_id
  544. JOIN sys_user_organization uorg ON u.id = uorg.user_id
  545. JOIN sys_organization org ON uorg.organization_id = org.id
  546. WHERE u.is_deleted = 'N' AND aut.is_deleted = 'N' AND u.TYPE = 0
  547. <if test="exportKema.status != null">
  548. AND aut.status = #{exportKema.status}
  549. </if>
  550. <if test="exportKema.authStatus != null">
  551. AND u.auth_status= #{exportKema.authStatus}
  552. </if>
  553. <if test="exportKema.orgName != null">
  554. AND org.name LIKE CONCAT('%', #{exportKema.orgName}, '%')
  555. </if>
  556. <if test="exportKema.userName != null">
  557. AND u.username LIKE CONCAT('%', #{exportKema.userName}, '%')
  558. </if>
  559. <if test="exportKema.startTime != null and exportKema.endTime != null">
  560. AND aut.gmt_create BETWEEN #{exportKema.startTime} and #{exportKema.endTime}
  561. </if>
  562. ORDER BY aut.gmt_create DESC
  563. </select>
  564. <select id="exportVerified" resultType="com.diagbot.dto.UserInfoDTO">
  565. SELECT
  566. u.id AS userId,
  567. u.gmt_create AS userGmtCreate,
  568. u.username AS userName,
  569. u.linkman AS linkman,
  570. u.email AS email,
  571. org.id AS orgId,
  572. org.gmt_create AS orgGmtCreate,
  573. org.name AS orgName,
  574. org.type AS orgType,
  575. org.principal AS orgPrincipal,
  576. org.address AS orgAddress,
  577. org.parent_id AS orgParentId,
  578. org.sub_num AS orgSubNum,
  579. u.passauth_time AS passauthTime,
  580. u.position AS position,
  581. u.auth_status AS authStatus
  582. FROM sys_user u
  583. LEFT JOIN sys_user_organization uorg ON u.id = uorg.user_id
  584. LEFT JOIN sys_organization org ON uorg.organization_id = org.id
  585. WHERE
  586. u.is_deleted = 'N'
  587. AND u.TYPE = 0
  588. <if test="Verified.orgName != null">
  589. AND org.name LIKE CONCAT('%', #{Verified.orgName}, '%')
  590. </if>
  591. <if test="Verified.userName != null">
  592. AND u.username LIKE CONCAT('%', #{Verified.userName}, '%')
  593. </if>
  594. <if test="Verified.startTime != null and Verified.endTime != null">
  595. AND u.gmt_create BETWEEN #{Verified.startTime} and #{Verified.endTime}
  596. </if>
  597. AND u.auth_status = 1
  598. ORDER BY u.passauth_time DESC
  599. </select>
  600. </mapper>