|  | @@ -1,19 +1,24 @@
 | 
	
		
			
				|  |  |  package com.yonge.cooleshow.website.controller.open;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.entity.Subject;
 | 
	
		
			
				|  |  | +import com.yonge.cooleshow.biz.dal.queryInfo.SubjectQueryInfo;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.service.SubjectService;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.common.controller.BaseController;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.common.entity.HttpResponseResult;
 | 
	
		
			
				|  |  | +import com.yonge.toolset.base.page.PageInfo;
 | 
	
		
			
				|  |  |  import io.swagger.annotations.Api;
 | 
	
		
			
				|  |  |  import io.swagger.annotations.ApiOperation;
 | 
	
		
			
				|  |  |  import io.swagger.annotations.ApiParam;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | +import org.springframework.security.access.prepost.PreAuthorize;
 | 
	
		
			
				|  |  |  import org.springframework.web.bind.annotation.GetMapping;
 | 
	
		
			
				|  |  |  import org.springframework.web.bind.annotation.PathVariable;
 | 
	
		
			
				|  |  |  import org.springframework.web.bind.annotation.RequestMapping;
 | 
	
		
			
				|  |  |  import org.springframework.web.bind.annotation.RestController;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import java.util.List;
 | 
	
		
			
				|  |  | +import java.util.Map;
 | 
	
		
			
				|  |  | +import java.util.stream.Collectors;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  @RequestMapping("/open/subject")
 | 
	
		
			
				|  |  |  @Api(tags = "声部服务")
 | 
	
	
		
			
				|  | @@ -35,4 +40,24 @@ public class OpenSubjectController extends BaseController {
 | 
	
		
			
				|  |  |          return succeed(subjectSelect);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    @ApiOperation(value = "分页查询声部列表")
 | 
	
		
			
				|  |  | +    @GetMapping("/queryPage")
 | 
	
		
			
				|  |  | +    public HttpResponseResult<PageInfo<Subject>> queryPage(SubjectQueryInfo queryInfo) {
 | 
	
		
			
				|  |  | +        PageInfo<Subject> pageInfo = subjectService.queryPage(queryInfo);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        if(pageInfo.getRows().size() == 0){
 | 
	
		
			
				|  |  | +            return succeed(pageInfo);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        Map<Long, Subject> map = subjectService.findBySubjectByIdList(pageInfo.getRows().stream().map(t -> t.getParentSubjectId()).collect(
 | 
	
		
			
				|  |  | +                                                       Collectors.toList())).stream()
 | 
	
		
			
				|  |  | +                                               .collect(Collectors.toMap(Subject::getId, t -> t));
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        pageInfo.getRows().forEach(row -> {
 | 
	
		
			
				|  |  | +            if(row.getParentSubjectId() != null && row.getParentSubjectId() > 0) {
 | 
	
		
			
				|  |  | +                row.setParentSubjectName(map.get(row.getParentSubjectId()).getName());
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  | +        return succeed(pageInfo);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |  }
 |