liusuyi
2025-10-30 9f911c1461ba33c1a561046eb1ac8e1c56fc9b9d
实体对象基类增加是否使用数据范围
9 files modified
65 ■■■■■ changed files
ard-common/src/main/java/com/ard/common/core/domain/BaseEntity.java 11 ●●●●● patch | view | raw | blame | history
ard-framework/src/main/java/com/ard/framework/aspectj/DataScopeAspect.java 11 ●●●●● patch | view | raw | blame | history
ard-work/src/main/java/com/ard/work/component/netty/TyTcpClientManager.java 2 ●●●●● patch | view | raw | blame | history
ard-work/src/main/java/com/ard/work/domain/entity/ArdServerInfo.java 1 ●●●●● patch | view | raw | blame | history
ard-work/src/main/java/com/ard/work/mapper/ArdServerInfoMapper.java 7 ●●●●● patch | view | raw | blame | history
ard-work/src/main/java/com/ard/work/service/IArdServerInfoService.java 8 ●●●●● patch | view | raw | blame | history
ard-work/src/main/java/com/ard/work/service/impl/ArdServerInfoServiceImpl.java 11 ●●●●● patch | view | raw | blame | history
ard-work/src/main/java/com/ard/work/service/impl/TyServiceImpl.java 2 ●●●●● patch | view | raw | blame | history
ard-work/src/main/resources/mapper/ArdServerInfoMapper.xml 12 ●●●●● patch | view | raw | blame | history
ard-common/src/main/java/com/ard/common/core/domain/BaseEntity.java
@@ -38,6 +38,9 @@
    /** 备注 */
    private String remark;
    /** 是否使用数据范围 */
    private Boolean useDataScope;
    /** 请求参数 */
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private Map<String, Object> params;
@@ -102,6 +105,14 @@
        this.remark = remark;
    }
    public Boolean getUseDataScope() {
        return useDataScope;
    }
    public void setUseDataScope(Boolean useDataScope) {
        this.useDataScope = useDataScope;
    }
    public Map<String, Object> getParams()
    {
        if (params == null)
ard-framework/src/main/java/com/ard/framework/aspectj/DataScopeAspect.java
@@ -64,7 +64,16 @@
    }
    protected void handleDataScope(final JoinPoint joinPoint, DataScope controllerDataScope)
    {
    {  /**
     * 自定义权限是否生效 baseEntity中  useStatus为false不使用数据权限
     */
        Object params = joinPoint.getArgs()[0];
        if (StringUtils.isNotNull(params) && params instanceof BaseEntity) {
            BaseEntity baseEntity = (BaseEntity) params;
            if (!baseEntity.getUseDataScope()) {
                return;
            }
        }
        // 获取当前的用户
        LoginUser loginUser = SecurityUtils.getLoginUser();
        if (StringUtils.isNotNull(loginUser))
ard-work/src/main/java/com/ard/work/component/netty/TyTcpClientManager.java
@@ -124,7 +124,7 @@
    @PostConstruct
    public void initConnectServers() {
        try {
            var serverList = ardServerService.getServerLsNoPermission(new ArdServerInfo()); // ← 从数据库查询所有服务器配置
            var serverList = ardServerService.selectArdServerInfoList(new ArdServerInfo() {{ setUseDataScope(false); }}); // ← 从数据库查询所有服务器配置
            if (serverList == null || serverList.isEmpty()) {
                log.warn("未在数据库中找到边缘服务器配置,跳过连接初始化");
                return;
ard-work/src/main/java/com/ard/work/domain/entity/ArdServerInfo.java
@@ -3,6 +3,7 @@
import java.util.List;
import com.ard.common.core.domain.BaseEntity;
import lombok.Builder;
import lombok.Data;
/**
ard-work/src/main/java/com/ard/work/mapper/ArdServerInfoMapper.java
@@ -28,13 +28,6 @@
     */
    public List<ArdServerInfo> selectArdServerInfoList(ArdServerInfo ardServerInfo);
    /**
     * 查询服务器管理列表
     *
     * @param ardServerInfo 服务器管理
     * @return 服务器管理集合
     */
    public List<ArdServerInfo> getServerLsNoPermission(ArdServerInfo ardServerInfo);
    /**
     * 新增服务器管理
ard-work/src/main/java/com/ard/work/service/IArdServerInfoService.java
@@ -29,14 +29,6 @@
    public List<ArdServerInfo> selectArdServerInfoList(ArdServerInfo ardServerInfo);
    /**
     * 查询服务器管理列表 - 无权限校验
     *
     * @param ardServerInfo 服务器管理
     * @return 服务器管理集合
     */
    public List<ArdServerInfo> getServerLsNoPermission(ArdServerInfo ardServerInfo);
    /**
     * 新增服务器管理
     * 
     * @param ardServerInfo 服务器管理
ard-work/src/main/java/com/ard/work/service/impl/ArdServerInfoServiceImpl.java
@@ -59,17 +59,6 @@
    }
    /**
     * 查询服务器管理列表 - 无权限
     *
     * @param ardServerInfo 服务器管理
     * @return 服务器管理
     */
    @Override
    public List<ArdServerInfo> getServerLsNoPermission(ArdServerInfo ardServerInfo) {
        return ardServerInfoMapper.getServerLsNoPermission(ardServerInfo);
    }
    /**
     * 新增服务器管理
     *
     * @param ardServerInfo 服务器管理
ard-work/src/main/java/com/ard/work/service/impl/TyServiceImpl.java
@@ -94,7 +94,7 @@
     */
    @Override
    public List<BoxInfoReceiver> getBoxList() {
        List<ArdServerInfo> ardServerInfos = ardServerService.getServerLsNoPermission(new ArdServerInfo());
        List<ArdServerInfo> ardServerInfos = ardServerService.selectArdServerInfoList(new ArdServerInfo() {{ setUseDataScope(false); }});
        return getBoxList(ardServerInfos);
    }
ard-work/src/main/resources/mapper/ArdServerInfoMapper.xml
@@ -71,18 +71,6 @@
            ${params.dataScope}
        </where>
    </select>
    <select id="getServerLsNoPermission" parameterType="ArdServerInfo" resultMap="ArdServerInfoResult">
        <include refid="selectArdServerInfoVoNo"/>
        <where>
            <if test="id != null and id != ''"> and id = #{id}</if>
            <if test="serverName != null and serverName != ''"> and server_name like concat('%', #{serverName}, '%')</if>
            <if test="accessKeyId != null and accessKeyId != ''"> and access_key_id = #{accessKeyId}</if>
            <if test="accessKeySecret != null and accessKeySecret != ''"> and access_key_secret = #{accessKeySecret}</if>
            <if test="serverStatus != null and serverStatus != ''"> and server_status = #{serverStatus}</if>
            <if test="deptId != null and deptId != 0">and dept_id = #{deptId}</if>
        </where>
    </select>
    
    <select id="selectArdServerInfoById" parameterType="String" resultMap="ArdServerInfoResult">
        <include refid="selectArdServerInfoVo"/>