UserMapper.xml 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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="jnpf.permission.mapper.UserMapper">
  4. <select id="getListId" resultType="java.lang.String">
  5. SELECT F_Id from base_user WHERE F_Enabled_Mark = 1
  6. </select>
  7. <select id="query" resultType="java.lang.String">
  8. SELECT F_Id FROM
  9. (SELECT DISTINCT u.F_Id,u.F_Sort_Code,u.F_Creator_Time
  10. FROM base_user_relation ul1,base_user u
  11. WHERE u.F_Id = ul1.F_User_Id
  12. AND u.f_account != 'admin'
  13. <if test="enabledMark != null">
  14. AND u.f_enabled_mark = #{enabledMark}
  15. </if>
  16. <if test="gender != null and gender != ''">
  17. AND u.f_gender = #{gender}
  18. </if>
  19. <if test="account != null and account != ''">
  20. and (u.F_Account like #{account} or u.F_Real_Name like #{account} or u.F_Mobile_Phone like
  21. #{account})
  22. </if>
  23. <if test="orgIdList != null and orgIdList.size > 0">
  24. AND (ul1.F_Object_Id IN
  25. <trim suffixOverrides=" OR ul1.F_Object_Id IN()">
  26. <foreach collection="orgIdList" item="orgIds" index="index" open="(" close=")">
  27. <if test="index != 0">
  28. <choose>
  29. <when test="index % 1000 == 999">) OR ul1.F_Object_Id IN (</when>
  30. <otherwise>,</otherwise>
  31. </choose>
  32. </if>
  33. #{orgIds}
  34. </foreach>
  35. </trim>
  36. )
  37. </if>
  38. ORDER BY u.F_Sort_Code ASC,u.F_Creator_Time DESC) uu
  39. </select>
  40. <select id="count" resultType="java.lang.Long">
  41. SELECT count(F_Id) FROM
  42. (SELECT DISTINCT u.F_Id,u.F_Sort_Code,u.F_Creator_Time
  43. FROM base_user_relation ul1,base_user u
  44. WHERE u.F_Id = ul1.F_User_Id
  45. AND u.F_Account != 'admin'
  46. <if test="enabledMark != null">
  47. AND u.f_enabled_mark = #{enabledMark}
  48. </if>
  49. <if test="gender != null and gender != ''">
  50. AND u.f_gender = #{gender}
  51. </if>
  52. <if test="account != null and account != ''">
  53. and (u.F_Account like #{account} or u.F_Real_Name like #{account} or u.F_Mobile_Phone like
  54. #{account})
  55. </if>
  56. <if test="orgIdList != null and orgIdList.size > 0">
  57. AND (ul1.F_Object_Id IN
  58. <trim suffixOverrides=" OR ul1.F_Object_Id IN()">
  59. <foreach collection="orgIdList" item="orgIds" index="index" open="(" close=")">
  60. <if test="index != 0">
  61. <choose>
  62. <when test="index % 1000 == 999">) OR ul1.F_Object_Id IN (</when>
  63. <otherwise>,</otherwise>
  64. </choose>
  65. </if>
  66. #{orgIds}
  67. </foreach>
  68. </trim>
  69. )
  70. </if>) uu
  71. </select>
  72. </mapper>