diff --git a/dl-module-base/pom.xml b/dl-module-base/pom.xml index 8d5385a2..a6cbdc43 100644 --- a/dl-module-base/pom.xml +++ b/dl-module-base/pom.xml @@ -25,11 +25,18 @@ yudao-module-infra-api ${revision} + cn.iocoder.boot yudao-spring-boot-starter-biz-tenant 2.1.0-jdk8-snapshot + + + cn.iocoder.boot + yudao-spring-boot-starter-biz-data-permission + 2.1.0-jdk8-snapshot + cn.iocoder.boot diff --git a/dl-module-company/src/main/java/cn/iocoder/yudao/config/CompanyDataPermissionConfiguration.java b/dl-module-company/src/main/java/cn/iocoder/yudao/config/CompanyDataPermissionConfiguration.java new file mode 100644 index 00000000..82ee3cc3 --- /dev/null +++ b/dl-module-company/src/main/java/cn/iocoder/yudao/config/CompanyDataPermissionConfiguration.java @@ -0,0 +1,28 @@ +package cn.iocoder.yudao.config; + +import cn.iocoder.yudao.framework.datapermission.core.rule.dept.DeptDataPermissionRuleCustomizer; +import cn.iocoder.yudao.module.staff.entity.CompanyStaff; +import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO; +import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * 数据权限 Configuration + * + * @author vinjor-m + */ +@Configuration(proxyBeanMethods = false) +public class CompanyDataPermissionConfiguration { + + @Bean + public DeptDataPermissionRuleCustomizer companyDataPermissionRuleCustomizer() { + return rule -> { + // 应用部门的数据权限都有哪些表,默认dept_id + rule.addDeptColumn(CompanyStaff.class); + // 应用用户的数据权限都有哪些表和对应字段,默认creator +// rule.addUserColumn(CompanyStaff.class, "id"); + }; + } + +} diff --git a/dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/service/impl/CompanyStaffServiceImpl.java b/dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/service/impl/CompanyStaffServiceImpl.java index 96bb7aca..3770dedd 100644 --- a/dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/service/impl/CompanyStaffServiceImpl.java +++ b/dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/service/impl/CompanyStaffServiceImpl.java @@ -6,6 +6,8 @@ import cn.hutool.core.util.RandomUtil; import cn.iocoder.yudao.common.BaseConstants; import cn.iocoder.yudao.common.CommonErrorCodeConstants; import cn.iocoder.yudao.framework.common.util.io.FileUtils; +import cn.iocoder.yudao.framework.datapermission.core.rule.DataPermissionRule; +import cn.iocoder.yudao.framework.datapermission.core.rule.dept.DeptDataPermissionRule; import cn.iocoder.yudao.framework.security.core.LoginUser; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.module.company.entity.Company; @@ -66,6 +68,8 @@ public class CompanyStaffServiceImpl extends ServiceImpl