UserInfoMapper.xml 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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.diagbot.mapper.UserInfoMapper">
  4. <select id="selectUserInfoPage" parameterType="com.diagbot.entity.UserInfo" resultType="com.diagbot.entity.UserInfo">
  5. SELECT
  6. u.id AS userId,
  7. u.gmt_create as userGmtCreate,
  8. u.username as userName,
  9. u.linkman as linKman,
  10. u.email as email,
  11. org.id AS orgId,
  12. org.gmt_create as orgGmtCreate,
  13. org.name as orgName
  14. FROM sys_user u
  15. LEFT JOIN sys_user_organization uorg ON u.id = uorg.user_id
  16. LEFT JOIN sys_organization org ON uorg.organization_id = org.id
  17. WHERE u.is_deleted = 'N' AND u.TYPE = "0" ORDER BY u.gmt_create DESC
  18. </select>
  19. <select id="selectUserInfoListPage" resultType="com.diagbot.entity.UserInfo">
  20. SELECT
  21. u.id AS userId,
  22. u.gmt_create AS userGmtCreate,
  23. u.username AS userName,
  24. u.linkman AS linKman,
  25. u.email AS email,
  26. org.id AS orgId,
  27. org.gmt_create AS orgGmtCreate,
  28. org.name AS orgName,
  29. org.type as orgType,
  30. org.principal AS orgPrincipal,
  31. org.address as orgAddress,
  32. org.parent_id as orgParent_id,
  33. org.sub_num as orgSub_num,
  34. aut.position as autPosition,
  35. aut.is_reject as autIsReject,
  36. aut.status as autStatus
  37. FROM sys_user u
  38. LEFT JOIN sys_user_organization uorg ON u.id = uorg.user_id
  39. LEFT JOIN sys_organization org ON uorg.organization_id = org.id
  40. LEFT JOIN sys_user_authentication aut ON u.id = aut.user_id
  41. WHERE u.is_deleted = 'N' AND u.TYPE = "0"
  42. <if test="userInfo.orgName != null">
  43. AND org.name LIKE CONCAT('%', #{userInfo.orgName}, '%')
  44. </if>
  45. <if test="userInfo.autStatus != null">
  46. AND aut.status = #{userInfo.autStatus}
  47. </if>
  48. ORDER BY u.gmt_create DESC
  49. </select>
  50. <update id="updateUserInfoAll" parameterType="java.util.Map" >
  51. UPDATE sys_user u ,sys_user_organization a ,
  52. sys_organization b ,sys_user_authentication c
  53. SET
  54. <if test="isDeleted !=null">
  55. u.is_deleted = #{isDeleted},a.is_deleted= #{isDeleted},b.is_deleted= #{isDeleted},c.is_deleted= #{isDeleted},
  56. </if>
  57. <if test="email != null">
  58. u.gmt_modified=#{gmtModified},u.modifier=#{modifier},
  59. u.email=#{email},
  60. </if>
  61. <if test="principal != null || address != null || type != null">
  62. b.gmt_modified=#{gmtModified},b.modifier=#{modifier},
  63. b.principal=#{principal},b.address=#{address},b.type=#{type}
  64. </if>
  65. <if test="position != null ||">
  66. c.gmt_modified=#{gmtModified},c.modifier=#{modifier},
  67. c.position=#{position},c.is_reject=#{isReject},c.reject_type=#{rejectType},
  68. c.reject_comment=#{rejectComment},c.status = #{status}
  69. </if>
  70. WHERE u.id = #{userId}
  71. AND c.user_id= #{userId}
  72. AND a.user_id = #{userId}
  73. AND a.organization_id =b.id
  74. </update>
  75. </mapper>