mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-09 02:46:50 +08:00
白名单调整
This commit is contained in:
@@ -18,6 +18,13 @@ public class WhiteUserApi extends ApiBaseController {
|
||||
|
||||
@Resource
|
||||
IWhiteUserService service;
|
||||
|
||||
|
||||
@GetMapping("/codes")
|
||||
public JsonResponse<List<String>> list(String env){
|
||||
List<String> list = service.getCodes(null);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 白名单列表
|
||||
|
||||
@@ -16,7 +16,9 @@ import javax.persistence.Table;
|
||||
public class WhiteUser extends IdEntity {
|
||||
|
||||
|
||||
@Column(name = "code",length = 30)
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Column(name = "code",length = 30)
|
||||
private String code;
|
||||
|
||||
@Column(name = "name",length = 30)
|
||||
@@ -26,6 +28,6 @@ public class WhiteUser extends IdEntity {
|
||||
* 环境
|
||||
* */
|
||||
@Column(name="environment")
|
||||
private Integer environment;
|
||||
private String environment;
|
||||
|
||||
}
|
||||
|
||||
@@ -12,6 +12,13 @@ public interface IWhiteUserService {
|
||||
* 查看现有白名单
|
||||
* */
|
||||
List<WhiteUser> list(WhiteUser whiteUser);
|
||||
|
||||
/**
|
||||
* 提取代码列表
|
||||
* @param env
|
||||
* @return
|
||||
*/
|
||||
List<String> getCodes(String env);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -8,6 +8,8 @@ import com.xboe.core.orm.QueryBuilder;
|
||||
import com.xboe.system.whiteuser.dao.WhiteUserDao;
|
||||
import com.xboe.system.whiteuser.entity.WhiteUser;
|
||||
import com.xboe.system.whiteuser.service.IWhiteUserService;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -60,4 +62,18 @@ public class WhiteUserServiceImpl implements IWhiteUserService {
|
||||
WhiteUser whiteUser = whiteUserDao.get(id);
|
||||
return whiteUser;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getCodes(String env) {
|
||||
if(StringUtils.isBlank(env)) {
|
||||
@SuppressWarnings("unchecked")
|
||||
List<String> codes = (List<String>) whiteUserDao.findListField("code");
|
||||
return codes;
|
||||
}else {
|
||||
@SuppressWarnings("unchecked")
|
||||
List<String> codes = (List<String>) whiteUserDao.findListField("code",FieldFilters.eq("environment", env));
|
||||
return codes;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user