forked from github/cool-admin-java
feat: 新增代理白名单模块 - AgentWhitelist实体/Controller/Service/Admin分页
This commit is contained in:
+31
@@ -0,0 +1,31 @@
|
||||
package com.cool.modules.agent.controller.admin;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.cool.core.annotation.CoolRestController;
|
||||
import com.cool.core.base.BaseController;
|
||||
import com.cool.modules.agent.entity.AgentInfoEntity;
|
||||
import com.cool.modules.agent.entity.AgentWhitelistEntity;
|
||||
import com.cool.modules.agent.service.AgentInfoService;
|
||||
import com.cool.modules.agent.service.AgentWhitelistService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@Tag(name = "白名单管理", description = "代理白名单管理")
|
||||
@CoolRestController(api = {"delete", "page"})
|
||||
public class AdminAgentWhitelistController extends BaseController<AgentWhitelistService, AgentWhitelistEntity> {
|
||||
|
||||
private final AgentInfoService agentInfoService;
|
||||
|
||||
@Override
|
||||
protected void init(HttpServletRequest request, JSONObject requestParams) {
|
||||
setPageOption(createOp().transformValue(o -> {
|
||||
AgentWhitelistEntity entity = (AgentWhitelistEntity) o;
|
||||
AgentInfoEntity agent = (AgentInfoEntity) agentInfoService.info(entity.getAgentInfoId());
|
||||
if (agent != null) {
|
||||
entity.setAgentName(agent.getName());
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.cool.modules.agent.entity;
|
||||
|
||||
import com.cool.core.base.TenantEntity;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import com.cool.core.annotation.ColumnDefine;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Table(value = "agent_whitelist", comment = "代理白名单表")
|
||||
public class AgentWhitelistEntity extends TenantEntity<AgentWhitelistEntity> {
|
||||
|
||||
@ColumnDefine(comment = "代理信息ID", notNull = true)
|
||||
private Long agentInfoId;
|
||||
|
||||
@ColumnDefine(comment = "IP地址", notNull = true)
|
||||
private String ipAddress;
|
||||
|
||||
@com.mybatisflex.annotation.Column(ignore = true)
|
||||
private String agentName;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.cool.modules.agent.mapper;
|
||||
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.cool.modules.agent.entity.AgentWhitelistEntity;
|
||||
|
||||
public interface AgentWhitelistMapper extends BaseMapper<AgentWhitelistEntity> {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.cool.modules.agent.service;
|
||||
|
||||
import com.cool.core.base.BaseService;
|
||||
import com.cool.modules.agent.entity.AgentWhitelistEntity;
|
||||
|
||||
public interface AgentWhitelistService extends BaseService<AgentWhitelistEntity> {
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.cool.modules.agent.service.impl;
|
||||
|
||||
import com.cool.core.base.BaseServiceImpl;
|
||||
import com.cool.modules.agent.entity.AgentWhitelistEntity;
|
||||
import com.cool.modules.agent.mapper.AgentWhitelistMapper;
|
||||
import com.cool.modules.agent.service.AgentWhitelistService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class AgentWhitelistServiceImpl extends BaseServiceImpl<AgentWhitelistMapper, AgentWhitelistEntity> implements
|
||||
AgentWhitelistService {
|
||||
}
|
||||
Reference in New Issue
Block a user