SdeversionMapper.xml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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.tofly.base.mapper.SdeversionMapper">
  4. <resultMap id="sdeversionMap" type="com.tofly.base.entity.Sdeversion">
  5. <id property="id" column="ID"/>
  6. <result property="userId" column="USER_ID"/>
  7. <result property="departmentId" column="DEPARTMENT_ID"/>
  8. <result property="sdeVersion" column="SDE_VERSION"/>
  9. <result property="auditor" column="AUDITOR"/>
  10. <association property="auditorName" column="AUDITOR" select="getauditorName" ></association>
  11. </resultMap>
  12. <select id="getauditorName" resultType="java.lang.Object" databaseId="oracle">
  13. select decode(#{auditor},0,'不是审核员',1,'是审核员') as auditorName from dual
  14. </select>
  15. <select id="getauditorName" resultType="java.lang.Object" databaseId="mysql">
  16. select (case #{auditor} when 0 then '不是审核员'
  17. when 1 then '是审核员' else '' end ) as auditorName
  18. </select>
  19. <resultMap id="userSdeversionMap" type="com.tofly.base.entity.UserSdeversion">
  20. <id property="id" column="ID"/>
  21. <result property="username" column="USERNAME"/>
  22. <result property="salt" column="SALT"/>
  23. <result property="phone" column="PHONE"/>
  24. <result property="avatar" column="AVATAR"/>
  25. <result property="departmentId" column="DEPARTMENT_ID"/>
  26. <result property="departmentName" column="departmentName"/>
  27. <result property="createTime" column="CREATE_TIME"/>
  28. <result property="updateTime" column="UPDATE_TIME"/>
  29. <result property="lockFlag" column="LOCK_FLAG"/>
  30. <result property="statusFlag" column="STATUS_FLAG"/>
  31. <result property="wxOpenid" column="WX_OPENID"/>
  32. <result property="qqOpenid" column="QQ_OPENID"/>
  33. <result property="email" column="EMAIL"/>
  34. <result property="realName" column="REAL_NAME"/>
  35. <result property="loginTime" column="LOGIN_TIME"/>
  36. <result property="lastIp" column="LAST_IP"/>
  37. <result property="pwderrtimes" column="PWDERRTIMES"/>
  38. <result property="worknumber" column="WORKNUMBER"/>
  39. <result property="findpwdkey" column="FINDPWDKEY"/>
  40. <result property="aliasname" column="ALIASNAME"/>
  41. <result property="birthday" column="BIRTHDAY"/>
  42. <result property="belong" column="BELONG"/>
  43. <result property="createUser" column="CREATE_USER"/>
  44. <result column="USER_LEVEL" property="userLevel"/>
  45. <result column="sfbd" property="sfbd"/>
  46. <association property="roleName" column="ID" javaType="java.lang.String" select="getRoleName"></association>
  47. <association property="sdeversion" javaType="java.util.Map">
  48. <result property="versionId" column="VERSIONID"/>
  49. <result property="sdeVersion" column="SDE_VERSION"/>
  50. <result property="auditor" column="AUDITOR"/>
  51. <association property="auditorName" javaType="java.lang.String" column="AUDITOR" select="getauditorName" ></association>
  52. </association>
  53. </resultMap>
  54. <select id="getRoleName" resultType="string" databaseId="oracle">
  55. select to_char((select wmsys.wm_concat(o.role_name)
  56. from TF_SMPN_ROLE_X o, TF_SMPN_USERROLE_X n
  57. where n.role_id = o.id
  58. and l.id = n.user_id)) as role_name
  59. from TF_SMPN_USER_X l
  60. where l.id=#{id}
  61. </select>
  62. <select id="getRoleName" resultType="string" databaseId="mysql">
  63. select (select group_concat(o.role_name)
  64. from TF_SMPN_ROLE_X o, TF_SMPN_USERROLE_X n
  65. where n.role_id = o.id
  66. and l.id = n.user_id GROUP BY l.id) as role_name
  67. from TF_SMPN_USER_X l
  68. where l.id=#{id}
  69. </select>
  70. <select id="getUserSdeversionMap" resultMap="userSdeversionMap">
  71. select l.id,
  72. username,
  73. phone,
  74. avatar,
  75. l.department_id,
  76. (select name from TF_SMPN_DEPARTMENT_X where id=l.department_id) as departmentName,
  77. create_time,
  78. lock_flag,
  79. status_flag,
  80. wx_openid,
  81. qq_openid,
  82. email,
  83. real_name,
  84. login_time,
  85. last_ip,
  86. pwderrtimes,
  87. worknumber,
  88. findpwdkey,
  89. aliasname,
  90. birthday,
  91. belong,
  92. create_user,
  93. user_level,
  94. (select decode(count(1),0,'不存在','存在') from TF_SMPN_SDEVERSION_X where user_ID=l.id) as sfcz,
  95. tss.ID as VERSIONID,
  96. tss.SDE_VERSION,
  97. tss.AUDITOR
  98. from TF_SMPN_USER_X l left join TF_SMPN_SDEVERSION_X tss on l.id=tss.user_id
  99. where 1=1
  100. <if test="user.realName != null and user.realName.trim() != ''">
  101. and (real_Name like '%'||#{user.realName}||'%' or username like '%'||#{user.realName}||'%')
  102. </if>
  103. <if test="user.departmentId != null">
  104. and l.department_id = #{user.departmentId}
  105. </if>
  106. <if test='user.sfcz != null and user.sfcz == "0" '>
  107. and not exists (select 1 from TF_SMPN_SDEVERSION_X where user_id=l.id)
  108. </if>
  109. <if test='user.sfcz != null and user.sfcz == "1" '>
  110. and exists (select 1 from TF_SMPN_SDEVERSION_X where user_id=l.id)
  111. </if>
  112. <if test="user.menuId != null">
  113. and exists (select 1
  114. from TF_SMPN_USERROLE_X ur, TF_SMPN_ROLEMENU_X rm
  115. where ur.role_id = rm.role_id
  116. and ur.user_id = l.id
  117. and rm.menu_id = #{user.menuId})
  118. </if>
  119. </select>
  120. </mapper>