初始化数据权限模块

This commit is contained in:
YunaiV 2021-12-07 21:28:16 +08:00
parent 814c2db65c
commit c99115abe7
7 changed files with 11 additions and 7 deletions

View File

@ -24,7 +24,7 @@ public interface SysDeptMapper extends BaseMapperX<SysDeptDO> {
} }
default Integer selectCountByParentId(Long parentId) { default Integer selectCountByParentId(Long parentId) {
return selectCount(new QueryWrapper<SysDeptDO>().eq("parent_id", parentId)); return selectCount("parent_id", parentId);
} }
default boolean selectExistsByUpdateTimeAfter(Date maxUpdateTime) { default boolean selectExistsByUpdateTimeAfter(Date maxUpdateTime) {

View File

@ -19,7 +19,7 @@ public interface SysMenuMapper extends BaseMapperX<SysMenuDO> {
} }
default Integer selectCountByParentId(Long parentId) { default Integer selectCountByParentId(Long parentId) {
return selectCount(new QueryWrapper<SysMenuDO>().eq("parent_id", parentId)); return selectCount("parent_id", parentId);
} }
default List<SysMenuDO> selectList(SysMenuListReqVO reqVO) { default List<SysMenuDO> selectList(SysMenuListReqVO reqVO) {

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.framework.datascope.core.interceptor; package cn.iocoder.yudao.framework.datapermission.core.interceptor;
import com.baomidou.mybatisplus.core.plugins.InterceptorIgnoreHelper; import com.baomidou.mybatisplus.core.plugins.InterceptorIgnoreHelper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;

View File

@ -0,0 +1 @@
package cn.iocoder.yudao.framework.datapermission.core;

View File

@ -1,4 +1,4 @@
/** /**
* 基于 JSqlParser 解析 SQL增加数据权限的 WHERE 条件 * 基于 JSqlParser 解析 SQL增加数据权限的 WHERE 条件
*/ */
package cn.iocoder.yudao.framework.datascope; package cn.iocoder.yudao.framework.datapermission;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.framework.datascope.core.interceptor; package cn.iocoder.yudao.framework.datapermission.core.interceptor;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
@ -9,7 +9,7 @@ public class DataPermissionInterceptorTest {
private final DataPermissionInterceptor interceptor = new DataPermissionInterceptor(); private final DataPermissionInterceptor interceptor = new DataPermissionInterceptor();
@Test @Test
void selectSingle() { public void selectSingle() {
// 单表 // 单表
assertSql("select * from entity where id = ?", assertSql("select * from entity where id = ?",
"SELECT * FROM entity WHERE id = ? AND tenant_id = 1"); "SELECT * FROM entity WHERE id = ? AND tenant_id = 1");
@ -29,4 +29,8 @@ public class DataPermissionInterceptorTest {
assertThat(interceptor.parserSingle(sql, null)).isEqualTo(targetSql); assertThat(interceptor.parserSingle(sql, null)).isEqualTo(targetSql);
} }
public static void main(String[] args) {
System.out.println("123");
}
} }