mallplus多租户商城实现的具体逻辑

1.我们有一个中台系统,可以实现商户入驻,插入商户数据和生成一个管理员账号 不可删除,此账号可以添加员工 角色  和添加商品等所有权限,此商户的所有数据 都会有一个字段去隔离,比如商品和品牌等等,

也可以设置哪些表的数据是全部商户共有的比如权限菜单表,如

public static final List<String> IGNORE_TENANT_TABLES = Lists.newArrayList("sys_admin_log", "sys_web_log", "sys_permission_category", "columns", "tables", "information_schema.columns",
        "information_schema.tables",  "sys_store", "sys_permission","pms_product_attribute","pms_product_category_attribute_relation","pms_product_attribute_value",
        "pms_product_category","pms_product_category_attribute_relation");

2.小程序断可以在header里面写死一个参数 storeId=1 或者其他值,后期会对商户做一个映射 ,不然谁都可以切换到别的商户去,数据不安全,

3.然后后台会有一个过滤器处理商户id

com.zscat.mallplus.component.JwtAuthenticationTokenFilter

4.我们会用mybatis-plus的多租户插件 将storeId参数注入到需要处理的表中

com.zscat.mallplus.config.MybatisPlusConfig 类

5.商户可以自己开发小程序前端 (只要能适配到我们的接口)或者使用官方生成的前端

 1商户自己开发的前端demo https://gitee.com/catshen/mobile-mall

发布了34 篇原创文章 · 获赞 28 · 访问量 10万+

猜你喜欢

转载自blog.csdn.net/a1439226817/article/details/99677350