hanfucheng 2 月之前
父節點
當前提交
ae52483aac

+ 2 - 0
src/main/java/com/sooka/sponest/data/digitalresource/service/impl/CenterdataTFarmGridServiceImpl.java

@@ -46,7 +46,9 @@ public class CenterdataTFarmGridServiceImpl extends BaseServiceImpl implements I
     }
 
     @Override
+    @DataScopeMutiDept(deptAlias = "d")
     public List<Map<String, Object>> selectCenterdataTFarmGridListTree(CenterdataTFarmGrid centerdataTFarmGrid) {
+        centerdataTFarmGrid.setDeptId(SecurityUtils.getLoginUser().getSysUser().getDeptId());
         return centerdataTFarmGridMapper.selectCenterdataTFarmGridListTree(centerdataTFarmGrid);
     }
 

+ 4 - 1
src/main/resources/mapper/digitalresource/CenterdataTFarmGridMapper.xml

@@ -75,6 +75,9 @@
 
     <select id="selectCenterdataTFarmGridListTree" parameterType="CenterdataTFarmGrid" resultType="map">
         select * from centerdata_t_farm_grid_view where `type` in ( '0', #{type} )
+        <if test="deptId != null">
+            AND ( id = #{deptId} OR find_in_set( #{deptId}, ancestors ) OR 1 = 2 )
+        </if>
         <if test="params.list != null and params.list.size > 0">
             and id in
             <foreach item="id" collection="params.list" open="(" separator="," close=")">
@@ -216,4 +219,4 @@
             <if test="gridLandId != null  and gridLandId != ''">and grid_land_id = #{gridLandId}</if>
         </where>
     </select>
-</mapper>
+</mapper>