SysUserLinkSysMapper.xml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ydtech.modules.admin.dao.SysUserLinkSysMapper">
  6. <resultMap id="BaseResultMap" type="com.ydtech.modules.admin.model.po.SysUserLinkSys">
  7. <id property="id" column="id" jdbcType="BIGINT"/>
  8. <result property="sysId" column="sys_id" jdbcType="BIGINT"/>
  9. <result property="userId" column="user_id" jdbcType="VARCHAR"/>
  10. <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
  11. <result property="createUser" column="create_user" jdbcType="VARCHAR"/>
  12. <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
  13. <result property="updateUser" column="update_user" jdbcType="VARCHAR"/>
  14. </resultMap>
  15. <sql id="Base_Column_List">
  16. id,sys_id,user_id,
  17. create_time,create_user,update_time,
  18. update_user
  19. </sql>
  20. <select id="queryPage" resultType="com.ydtech.modules.admin.model.po.SysUserLinkSys">
  21. select
  22. link.id as id,
  23. link.sys_id as sysId,
  24. link.user_id as userId,
  25. link.create_time as createTime,
  26. s.system_name as systemName,
  27. s.system_code as systemCode,
  28. s.system_status as systemStatus,
  29. su.name as userName,
  30. su.id as userId
  31. from sys_user_link_sys link
  32. left join sys_sys s on s.id=link.sys_id
  33. left join sys_user su on su.id =link.user_id
  34. <where>
  35. 1=1
  36. <if test="vo.systemName != null and vo.systemName != ''">
  37. AND s.system_name like CONCAT('%', #{vo.systemName}, '%')
  38. </if>
  39. <if test="vo.systemCode != null and vo.systemCode != ''">
  40. AND s.system_code = #{vo.systemCode}
  41. </if>
  42. <if test="vo.userName != null and vo.userName != ''">
  43. AND su.name like CONCAT('%', #{vo.userName}, '%')
  44. </if>
  45. <if test="vo.userId != null and vo.userId != ''">
  46. AND su.id = #{vo.userId}
  47. </if>
  48. </where>
  49. </select>
  50. <select id="queryUserPage" resultType="com.ydtech.modules.admin.model.SysUser">
  51. select *
  52. from sys_user su
  53. <where>
  54. su.status=1 and su.id !='admin'
  55. <if test="vo.deptId != null and vo.deptId != ''">
  56. AND su.dept_id like CONCAT('', #{vo.deptId}, '%')
  57. </if>
  58. <if test="vo.name != null and vo.name != ''">
  59. AND su.name like CONCAT('%', #{vo.name}, '%')
  60. </if>
  61. <if test="vo.userId != null and vo.userId != ''">
  62. AND su.id = #{vo.userId}
  63. </if>
  64. </where>
  65. </select>
  66. <select id="checkSys" resultType="com.ydtech.modules.admin.model.po.SysUserLinkSys">
  67. select
  68. link.id as id,
  69. link.sys_id as sysId,
  70. link.user_id as userId,
  71. s.system_name as systemName,
  72. su.name as userName
  73. from sys_user_link_sys link
  74. left join sys_sys s on s.id=link.sys_id
  75. left join sys_user su on su.id =link.user_id
  76. <where>
  77. s.system_status = '1'
  78. <if test="userId != null and userId != ''">
  79. AND link.id = #{userId}
  80. </if>
  81. <if test="sysId != null and sysId != ''">
  82. AND link.sys_id = #{sysId}
  83. </if>
  84. </where>
  85. </select>
  86. <select id="setByUserIds" resultType="java.lang.String">
  87. SELECT
  88. a.user_id
  89. FROM
  90. sys_user_link_sys a
  91. LEFT JOIN sys_sys s ON s.id = a.sys_id
  92. <where>
  93. s.system_status ='1'
  94. <if test="userIds != null and userIds != '' and userIds.size() > 0">
  95. and a.user_id in
  96. <foreach collection="userIds" item="item" open="(" separator="," close=")">
  97. #{item}
  98. </foreach>
  99. </if>
  100. <if test="sysId != null and sysId !=''">
  101. and a.sys_id =#{sysId}
  102. </if>
  103. </where>
  104. </select>
  105. </mapper>