♻️ Refactoring code. 数据权限 DataScope.java 增加链式操作方便使用

This commit is contained in:
lbw committed 2022-05-13 10:51:22 +08:00
1 parent 73c6fa415d
commit c5f291943e
7 files changed
+36 -14

No files matched your search

@@ -56,4 +56,31 @@ public class DataScope extends HashMap {
*/
private DataScopeFuncEnum func = DataScopeFuncEnum.ALL;
/**
* of 获取实例
*/
public static DataScope of() {
return new DataScope();
}
public DataScope scopeName(String scopeName) {
this.scopeName = scopeName;
return this;
}
public DataScope deptIds(List<Long> deptIds) {
this.deptIds = deptIds;
return this;
}
public DataScope only(boolean isOnly) {
this.isOnly = isOnly;
return this;
}
public DataScope func(DataScopeFuncEnum func) {
this.func = func;
return this;
}
}
@@ -27,7 +27,7 @@ public class SelectCountByScope extends AbstractMethod {
this.sqlComment());
SqlSource sqlSource = languageDriver.createSqlSource(configuration, sql, modelClass);
return this.addSelectMappedStatementForOther(mapperClass, sqlSource, Integer.class);
return this.addSelectMappedStatementForOther(mapperClass, sqlSource, Long.class);
}
}