‘liusuyi’
2023-07-24 e339298a0b94505a0dd283f7f0d9c0cf0aa51987
增加用户任务数据过滤
已修改4个文件
27 ■■■■ 文件已修改
ard-work/src/main/resources/mapper/app/ArdAppTaskMapper.xml 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ard-work/src/main/resources/mapper/device/ArdCamerasMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ard-work/src/main/resources/mapper/app/ArdAppTaskMapper.xml
@@ -52,8 +52,8 @@
               c.name,
               c.text,
               c.voice,
               c.dept_id,
               c.user_id,
               d.dept_id,
               u.user_id,
               c.create_by,
               c.create_time,
               c.update_by,
@@ -69,14 +69,9 @@
            <if test="name != null  and name != ''">and name like '%'||#{name}||'%'</if>
            <if test="text != null  and text != ''">and text = #{text}</if>
            <if test="voice != null  and voice != ''">and voice = #{voice}</if>
            <if test="deptId != null and deptId != 0 ">
            and (c.dept_id = #{deptId} OR c.dept_id IN ( SELECT t.dept_id FROM sys_dept t
                WHERE cast(#{deptId} as varchar) = any(string_to_array(ancestors,',')) ))
            </if>
            <if test="userId != null  and userId != ''">and user_id = #{userId}</if>
            <!-- 数据范围过滤 -->
            ${params.dataScope}
        </where>
        <!-- 数据范围过滤 -->
        ${params.dataScope}
    </select>
    <select id="selectArdAppTaskById" parameterType="String" resultMap="ArdAppTaskSubResult">
ard-work/src/main/resources/mapper/device/ArdCamerasMapper.xml
@@ -81,10 +81,6 @@
            <if test="longitude != null ">and c.longitude = #{longitude}</if>
            <if test="latitude != null ">and c.latitude = #{latitude}</if>
            <if test="altitude != null ">and c.altitude = #{altitude}</if>
            <if test="userId != null  and userId != ''">and c.user_id = #{userId}</if>
            <if test="deptId != null ">and (c.dept_id = #{deptId} OR c.dept_id IN ( SELECT t.dept_id FROM sys_dept t
                WHERE cast(#{deptId} as varchar) = any(string_to_array(ancestors,',')) ))
            </if>
            <if test="camHeading != null ">and c.cam_heading = #{camHeading}</if>
            <if test="camPitch != null ">and c.cam_pitch = #{camPitch}</if>
            <if test="camRoll != null ">and c.cam_roll = #{camRoll}</if>
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java
@@ -146,6 +146,14 @@
    {
        return userId != null && userId.equals("1");
    }
    public boolean isApp()
    {
        return isApp(this.userId);
    }
    public boolean isApp(String userId)
    {
        return userId != null && this.getRoles().stream().anyMatch(sysRole -> sysRole.getRoleKey().contains("appLeader"));
    }
    public Long getDeptId()
    {
ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java
@@ -70,7 +70,7 @@
        {
            SysUser currentUser = loginUser.getUser();
            // 如果是超级管理员,则不过滤数据
            if (StringUtils.isNotNull(currentUser) && !currentUser.isAdmin())
            if (StringUtils.isNotNull(currentUser) && !currentUser.isAdmin()&& !currentUser.isApp())
            {
                String permission = StringUtils.defaultIfEmpty(controllerDataScope.permission(), PermissionContextHolder.getContext());
                dataScopeFilter(joinPoint, currentUser, controllerDataScope.deptAlias(),