CfUsersCQuery.xml 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  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="com.ghsc.partybuild.mapper.CfUsersCQuery">
  4. <select id="selectUserAll" resultType="java.util.HashMap">
  5. select * from cf_users where UserName like Concat('%',#{username},'%')
  6. </select>
  7. <select id="selectUserAllByUserID" resultType="java.util.HashMap">
  8. select * from cf_users where USERID = #{userID}
  9. </select>
  10. <select id="GetRoleByUserId" resultType="java.util.HashMap">
  11. SELECT ROLENAME,CF_ROLES.ROLEID FROM CF_USERROLES,CF_ROLES WHERE CF_USERROLES.USERID = #{userId} and CF_USERROLES.ROLEID = CF_ROLES.ROLEID
  12. </select>
  13. <select id="getMenuByUid" resultType="java.util.HashMap">
  14. select DISTINCT M.APPLICATIONID,
  15. M.MENUID,
  16. M.MENUNAME,
  17. M.MENUNO,
  18. M.PARENTMENUID,
  19. M.MNUSYSTEM,
  20. M.MENUPROGRAM,
  21. M.MENUPIC,
  22. M.MENUORDER,M.ISBLANK from cf_userroles ur
  23. inner join CF_USERS u on u.USERID = ur.UserId
  24. inner join cf_roles r on ur.RoleId=r.RoleId
  25. inner join cf_menu_role mr on ur.RoleId=mr.RoleID
  26. inner join cf_menu m on mr.MenuId=m.MenuId and m.ApplicationId=r.ApplicationId
  27. where r.ApplicationId=#{appid} and u.USERID=#{userid} and m.IsVisible=1
  28. order by m.MenuOrder
  29. </select>
  30. <select id="getMenuByRoles" resultType="java.util.HashMap">
  31. select DISTINCT M.APPLICATIONID,
  32. M.MENUID,
  33. M.MENUNAME,
  34. M.MENUNO,
  35. M.PARENTMENUID,
  36. M.MNUSYSTEM,
  37. M.MENUPROGRAM,
  38. M.MENUPIC,
  39. M.MENUORDER,M.ISBLANK from cf_menu_role mr
  40. inner join cf_menu m on mr.MenuId=m.MenuId
  41. where m.IsVisible=1
  42. <if test="roleId != null and roleId!=''">
  43. and mr.RoleID=#{roleId}
  44. </if>
  45. <if test="menuDwids != null and menuDwids.size()>0">
  46. and (
  47. m.MENUDESC is null or m.MENUDESC not in
  48. <foreach collection="menuDwids" item="id" index="index" open="(" close=")" separator=",">
  49. #{id}
  50. </foreach>
  51. )
  52. </if>
  53. order by m.MenuOrder
  54. </select>
  55. <!--<select id="GetUserByRoleName" resultType="com.ghsc.partybuild.model.CfUsersinfo">
  56. select u.id,u.dguserid,u.name,u.mobile,u.telephonenumber,u.birthday,u.dpid,u.dpname,u.dpcode,
  57. u.parentdpid,u.dpfullname,u.jobtypeid,u.desjobtype,u.employeeclassid,u.desemployeeclass,u.sexid,
  58. u.orderno,u.userrole,u.userligion,u.istmpuser
  59. from cf_usersinfo u
  60. inner join cf_userroles ur on u.Id=ur.UserId
  61. inner join cf_roles cr ON ur.RoleId = cr.RoleId
  62. where cr.RoleName= #{roleName}
  63. </select>-->
  64. <!--<select id="selectUserList" resultType="java.util.HashMap">
  65. select u.userId,u.userName,ui.dguserid as RYBM,ui.isEnable
  66. from cf_users u
  67. inner join cf_usersinfo ui on u.UserId = ui.Id
  68. where 1=1
  69. <if test="username !=null and username !=''">
  70. and u.username like '%'||#{username}||'%'
  71. </if>
  72. group by
  73. u.UserId,u.UserPwd,u.userName,ui.dguserid,ui.isEnable
  74. </select>-->
  75. <select id="selectEnableUserList" resultType="com.ghsc.partybuild.model.CfUsers">
  76. select u.userid,u.applicationid,u.username,u.isanonymous,u.lastactivitydate,u.userpwd
  77. from cf_users u
  78. where u.UserName = #{UserLoginId}
  79. </select>
  80. <select id="getUserList" resultType="com.ghsc.partybuild.model.CfUsersinfo">
  81. select us.RYBM as "id",us.XM as "name" from VM_RYJBXX us
  82. inner join CF_USERS cfus on us.RYBM = cfus.USERID
  83. where 1=1
  84. <if test="dpid != null and dpid != ''">
  85. and us.SZDZBDM like concat('%',#{dpid},'%')
  86. </if>
  87. <if test="username !=null and username !=''">
  88. and us.XM like concat('%',#{username},'%')
  89. </if>
  90. </select>
  91. <select id="getUserByParams" resultType="com.ghsc.partybuild.model.CfUsersinfo">
  92. select distinct info.USERID DGUSERID,info.USERID ID,r.XM NAME,zz.DZZDM dpid,zz.DZZMC dpname
  93. from CF_USERS info
  94. inner join VM_RYJBXX r on info.USERID=r.rybm
  95. inner join ZZ_ZZQKXX zz on r.SZDZBDM=zz.DZZDM
  96. where 1=1
  97. <if test="dpid != null and dpid != ''">
  98. and r.szdzbdm like concat('%',#{dpid},'%')
  99. </if>
  100. <if test="dzzmc !=null and dzzmc !=''">
  101. and zz.DZZMC =#{dzzmc}
  102. </if>
  103. <if test="username !=null and username !=''">
  104. and r.XM=#{username}
  105. </if>
  106. </select>
  107. <select id="getPowerByMenu" resultType="java.lang.Integer">
  108. select count(1) from CF_MENU_ROLE mr
  109. inner join CF_USERROLES ru on mr.ROLEID = ru.ROLEID
  110. inner join CF_USERS u on ru.USERID = u.USERID
  111. inner join CF_MENU m on mr.MENUID=m.MENUID
  112. where 1=1
  113. <if test="menuIds != null">
  114. <foreach collection="menuIds" index="index" item="item" open="and mr.MENUID in (" separator="," close=")">
  115. #{ item }
  116. </foreach>
  117. </if>
  118. <if test="userName !=null and userName !=''">
  119. and u.USERNAME = #{ userName }
  120. </if>
  121. <if test="roleId !=null and roleId !=''">
  122. and ru.ROLEID = #{ roleId }
  123. </if>
  124. <if test="menuDwids != null and menuDwids.size()>0">
  125. and (
  126. m.MENUDESC is null or m.MENUDESC not in
  127. <foreach collection="menuDwids" item="id" index="index" open="(" close=")" separator=",">
  128. #{id}
  129. </foreach>
  130. )
  131. </if>
  132. </select>
  133. <select id="GetPartyUserInfo" resultType="java.util.HashMap">
  134. select ry.XM as "name",ry.RYBM,xx.DZZDM,xx.DZZMC,SUBSTR(xx.DZZDM,1,LENGTH(xx.DZZDM)-3) PARENTCODE,zfb.ZZLB,
  135. (case zfb.ZZLB when '500' then 1 else 0 end ) as ISDXZ,
  136. ufb.SFSLDRY as ISLEADER
  137. from vm_ryjbxx_all ry
  138. inner join ZZ_ZZQKXX xx on ry.SZDZBDM=xx.DZZDM
  139. left join ZZ_ZZQKXXFB zfb on xx.DZZDM = zfb.DZZDM
  140. left join RS_RYJBXXFB ufb on ry.RYBM = ufb.RYBM
  141. where ry.RYBM= #{ id }
  142. </select>
  143. <select id="GetPartyUserInfoMore" resultType="java.util.HashMap">
  144. select t.RYZT,z.HZMC,t1.JRZGZZRQ from VM_RYJBXX t
  145. inner join ZZZD_RYZT z on t.RYZT=z.BM
  146. left join ZZ_DJXX t1 on t1.RYBM=t.RYBM
  147. where t.RYBM= #{ userId }
  148. </select>
  149. <select id="GetPartyGroup" resultType="java.util.HashMap">
  150. select xx.DZZDM,xx.DZZMC,SUBSTR(xx.DZZDM,1,LENGTH(xx.DZZDM)-3) PARENTCODE from ZZ_ZZQKXX xx
  151. where xx.DZZDM= #{ groupId }
  152. </select>
  153. <!--用户党小组信息-->
  154. <select id="GetUserDxzInfo" resultType="java.util.HashMap">
  155. select us.RYBM,p.DZZDM as SZDXZDM,p.DZZMC as SZDXZMC from ZZ_RYJBXX us
  156. inner join ZZ_DXZCY dxz on us.rybm = dxz.rybm
  157. inner join ZZ_ZZQKXX p on dxz.dzzdm=p.dzzdm
  158. where us.RYBM= #{ userId }
  159. </select>
  160. <select id="getCfUserByMobile" resultType="com.ghsc.partybuild.model.CfUsers">
  161. select u.* from CF_USERS u
  162. where u.USERNAME= #{ mobile }
  163. </select>
  164. <select id="getCfUserByUsername" resultType="com.ghsc.partybuild.model.CfUsers">
  165. select u.* from CF_USERS u
  166. inner join VM_RYJBXX i on u.USERID = i.RYBM
  167. where i.XM= #{ name }
  168. </select>
  169. <select id="selectUserMobileList" resultType="com.ghsc.partybuild.vo.UserVo">
  170. select distinct ry.rybm as "userCode",u.USERNAME as "mobile",ry.SZDZBDM as "dzzdm"
  171. from VM_RYJBXX ry
  172. left join CF_USERS u on u.USERID=ry.RYBM
  173. where 1=1
  174. <if test="dzzdm != null and dzzdm != ''">
  175. and ry.SZDZBDM like concat('%',#{dzzdm},'%')
  176. </if>
  177. </select>
  178. <select id="selectUserByMobileList" resultType="com.ghsc.partybuild.vo.UserVo">
  179. select distinct ry.rybm as "userCode",u.USERNAME as "mobile",ry.SZDZBDM as "dzzdm"
  180. from VM_RYJBXX ry
  181. inner join CF_USERS u on u.USERID=ry.RYBM
  182. where 1=1
  183. <if test="mobileList != null and mobileList.size()>0">
  184. and u.USERNAME in
  185. <foreach collection="mobileList" item="mobile" index="index" open="(" close=")" separator=",">
  186. #{mobile}
  187. </foreach>
  188. </if>
  189. </select>
  190. <update id="batchUpdateUserMobile" parameterType="java.util.ArrayList">
  191. <foreach collection="userList" item="user" index="index" open="" close="" separator=";">
  192. insert into cf_users (USERID, APPLICATIONID, USERNAME, ISANONYMOUS, LASTACTIVITYDATE, USERPWD, FORCELOGINOUT)
  193. select ry.rybm,'f0c4fa7f9f3c4fb6bd56aac608b7ad3f',#{user.mobile,jdbcType=VARCHAR},1,null,'D6FB6D8741F9AF9E7BC1C39E79D73944',null
  194. from VM_RYJBXX ry
  195. left join cf_users u on ry.rybm=u.userid
  196. where ry.rybm=#{user.userCode,jdbcType=VARCHAR} and u.userid is null;
  197. UPDATE cf_users T
  198. <set>
  199. T.USERNAME = #{user.mobile,jdbcType=VARCHAR}
  200. </set>
  201. WHERE
  202. T.USERID = #{user.userCode,jdbcType=VARCHAR}
  203. </foreach>
  204. </update>
  205. <select id="getUserOnline" resultType="java.util.Map">
  206. select u.USERID,u.LASTACTIVITYDATE,u.ISANONYMOUS,v.XM,u.USERNAME,z.DZZMC from CF_USERS u
  207. inner join VM_RYJBXX v on u.USERID = v.RYBM
  208. inner join ZZ_ZZQKXX z on v.SZDZBDM = z.DZZDM
  209. where u.USERNAME is not null
  210. and u.LASTACTIVITYDATE > #{ beforeTime }
  211. <if test="userName != null and userName != ''">
  212. and v.XM like concat('%',#{userName},'%')
  213. </if>
  214. order by u.LASTACTIVITYDATE desc
  215. </select>
  216. <update id="UpdatePartyusercount" statementType="CALLABLE">
  217. {
  218. call UpdatePartyusercount()
  219. }
  220. </update>
  221. <update id="updateUserage" statementType="CALLABLE">
  222. {
  223. call UpdateUserage()
  224. }
  225. </update>
  226. <update id="UpdatePartyusercountOfMonth" statementType="CALLABLE">
  227. {
  228. call UpdatePartyusercountOfMonth()
  229. }
  230. </update>
  231. </mapper>