refactor: 精简代码
This commit is contained in:
@@ -11,8 +11,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author : xiaohai
|
* @author : xiaohai
|
||||||
@@ -46,14 +46,7 @@ public class LinksController {
|
|||||||
|
|
||||||
@GetMapping("/links")
|
@GetMapping("/links")
|
||||||
public Response allForOpen() {
|
public Response allForOpen() {
|
||||||
List<PartnerSite> sites = new ArrayList<>();
|
List<PartnerSite> sites = partnerSiteService.findAll().stream().peek(partnerSite -> partnerSite.setOpen(null)).collect(Collectors.toList());
|
||||||
for (PartnerSite p : partnerSiteService.findAll()) {
|
|
||||||
if (p.getOpen()) {
|
|
||||||
//隐藏open字段
|
|
||||||
p.setOpen(null);
|
|
||||||
sites.add(p);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Response.success(sites);
|
return Response.success(sites);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user