增加多租户功能(应用隔离)

This commit is contained in:
zlt
2019-08-09 00:46:18 +08:00
parent d7e914c6ce
commit d0d7deaf7a
44 changed files with 546 additions and 330 deletions
@@ -1,6 +1,5 @@
package com.central;
import com.central.common.annotation.EnableLoginArgResolver;
import com.central.common.ribbon.annotation.EnableFeignInterceptor;
import com.central.search.annotation.EnableSearchClient;
import org.springframework.boot.SpringApplication;
@@ -11,7 +10,6 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
/**
* @author 作者 owen E-mail: 624191343@qq.com
*/
@EnableLoginArgResolver
@EnableDiscoveryClient
@EnableSearchClient
@EnableTransactionManagement
@@ -0,0 +1,12 @@
package com.central.user.config;
import com.central.common.config.DefaultWebMvcConfig;
import org.springframework.context.annotation.Configuration;
/**
* @author zlt
* @date 2019/8/5
*/
@Configuration
public class WebMvcConfig extends DefaultWebMvcConfig {
}
@@ -28,8 +28,7 @@ public interface SysUserRoleMapper extends SuperMapper<SysRoleUser> {
* @param userId
* @return
*/
@Select("select r.* from sys_role_user ru inner join sys_role r on r.id = ru.role_id where ru.user_id = #{userId}")
List<SysRole> findRolesByUserId(Long userId);
List<SysRole> findRolesByUserId(@Param("userId") Long userId);
/**
* 根据用户ids 获取
@@ -26,3 +26,10 @@ zlt:
second: 300
- key: user
second: 1800
#多租户配置
tenant:
enable: true
ignoreTables:
- sys_user
- sys_role_user
- sys_role_menu
@@ -43,6 +43,7 @@
<if test="type != null">
and t.type = #{type}
</if>
and t.hidden = 0
ORDER BY sort ASC
</select>
</mapper>
@@ -13,4 +13,9 @@
</if>
</where>
</delete>
<select id="findRolesByUserId" resultType="com.central.common.model.SysRole">
select r.* from sys_role r
inner join sys_role_user ru on r.id = ru.role_id and ru.user_id = #{userId}
</select>
</mapper>