|
@@ -15,6 +15,7 @@
|
|
|
<result column="update_time_" property="updateTime"/>
|
|
|
<result column="del_flag_" property="delFlag"/>
|
|
|
<result column="organ_id_" property="organId"/>
|
|
|
+ <result column="tenant_id_" property="tenantId"/>
|
|
|
</resultMap>
|
|
|
|
|
|
<!-- 根据主键查询一条记录 -->
|
|
@@ -24,14 +25,14 @@
|
|
|
|
|
|
<!-- 全查询 -->
|
|
|
<select id="findAll" resultMap="SysRole">
|
|
|
- SELECT * FROM sys_role WHERE del_flag_ = 0 ORDER BY upate_time_ DESC
|
|
|
+ SELECT * FROM sys_role WHERE del_flag_ = 0 and tenant_id_ = #{tenantId} ORDER BY upate_time_ DESC
|
|
|
</select>
|
|
|
|
|
|
<!-- 向数据库增加一条记录 -->
|
|
|
<insert id="insert" parameterType="com.ym.mec.auth.api.entity.SysRole" useGeneratedKeys="true" keyColumn="id"
|
|
|
keyProperty="id">
|
|
|
- INSERT INTO sys_role (id_,role_name_,role_code_,role_desc_,create_time_,update_time_,organ_id_)
|
|
|
- VALUES(#{id},#{roleName},#{roleCode},#{roleDesc},now(),now(),#{organId})
|
|
|
+ INSERT INTO sys_role (id_,role_name_,role_code_,role_desc_,create_time_,update_time_,organ_id_,tenant_id_)
|
|
|
+ VALUES(#{id},#{roleName},#{roleCode},#{roleDesc},now(),now(),#{organId},#{tenantId})
|
|
|
</insert>
|
|
|
|
|
|
<!-- 根据主键查询一条记录 -->
|
|
@@ -57,7 +58,7 @@
|
|
|
organ_id_ = #{organId},
|
|
|
</if>
|
|
|
</set>
|
|
|
- WHERE id_ = #{id}
|
|
|
+ WHERE id_ = #{id} and tenant_id_ = #{tenantId}
|
|
|
</update>
|
|
|
|
|
|
<!-- 根据主键删除一条记录 -->
|
|
@@ -67,13 +68,13 @@
|
|
|
|
|
|
<!-- 分页查询 -->
|
|
|
<select id="queryPage" resultMap="SysRole" parameterType="map">
|
|
|
- SELECT * FROM sys_role WHERE del_flag_ = 0 ORDER BY update_time_ DESC
|
|
|
+ SELECT * FROM sys_role WHERE del_flag_ = 0 and tenant_id_ = #{tenantId} ORDER BY update_time_ DESC
|
|
|
<include refid="global.limit"/>
|
|
|
</select>
|
|
|
|
|
|
<!-- 查询当前表的总记录数 -->
|
|
|
<select id="queryCount" resultType="int">
|
|
|
- SELECT COUNT(*) FROM sys_role WHERE del_flag_ = 0
|
|
|
+ SELECT COUNT(*) FROM sys_role WHERE del_flag_ = 0 and tenant_id_ = #{tenantId}
|
|
|
</select>
|
|
|
|
|
|
<select id="findRoleByUserId" resultMap="SysRole">
|
|
@@ -81,9 +82,9 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="findRoleByCode" resultMap="SysRole">
|
|
|
- SELECT sr.* FROM sys_role WHERE role_code_ = #{code} AND sr.del_flag_ = 0
|
|
|
+ SELECT sr.* FROM sys_role WHERE role_code_ = #{code} AND sr.del_flag_ = 0 and tenant_id_ = #{tenantId}
|
|
|
</select>
|
|
|
<select id="findByRoleName" resultMap="SysRole">
|
|
|
- SELECT * FROM sys_role WHERE role_name_ = #{roleName} AND del_flag_ = 0 LIMIT 1
|
|
|
+ SELECT * FROM sys_role WHERE role_name_ = #{roleName} AND del_flag_ = 0 and tenant_id_ = #{tenantId} LIMIT 1
|
|
|
</select>
|
|
|
</mapper>
|