|  | @@ -0,0 +1,103 @@
 | 
	
		
			
				|  |  | +package com.ym.mec.web.controller;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +import io.swagger.annotations.Api;
 | 
	
		
			
				|  |  | +import io.swagger.annotations.ApiOperation;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +import java.util.ArrayList;
 | 
	
		
			
				|  |  | +import java.util.List;
 | 
	
		
			
				|  |  | +import java.util.stream.Collectors;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +import org.springframework.beans.BeanUtils;
 | 
	
		
			
				|  |  | +import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | +import org.springframework.http.MediaType;
 | 
	
		
			
				|  |  | +import org.springframework.security.access.prepost.PreAuthorize;
 | 
	
		
			
				|  |  | +import org.springframework.web.bind.annotation.GetMapping;
 | 
	
		
			
				|  |  | +import org.springframework.web.bind.annotation.PostMapping;
 | 
	
		
			
				|  |  | +import org.springframework.web.bind.annotation.RequestBody;
 | 
	
		
			
				|  |  | +import org.springframework.web.bind.annotation.RequestMapping;
 | 
	
		
			
				|  |  | +import org.springframework.web.bind.annotation.RestController;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.dto.MusicGroupPlanMakingDto;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.entity.MusicGroupPlanMaking;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.entity.Subject;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.service.MusicGroupPlanMakingService;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.service.SubjectService;
 | 
	
		
			
				|  |  | +import com.ym.mec.common.controller.BaseController;
 | 
	
		
			
				|  |  | +import com.ym.mec.common.entity.HttpResponseResult;
 | 
	
		
			
				|  |  | +import com.yonge.log.model.AuditLogAnnotation;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +@RequestMapping("musicGroupPlanMaking")
 | 
	
		
			
				|  |  | +@Api(tags = "乐团编制服务")
 | 
	
		
			
				|  |  | +@RestController
 | 
	
		
			
				|  |  | +public class MusicGroupPlanMakingController extends BaseController {
 | 
	
		
			
				|  |  | +	
 | 
	
		
			
				|  |  | +	@Autowired
 | 
	
		
			
				|  |  | +	private MusicGroupPlanMakingService musicGroupPlanMakingService;
 | 
	
		
			
				|  |  | +	
 | 
	
		
			
				|  |  | +	@Autowired
 | 
	
		
			
				|  |  | +	private SubjectService subjectService;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	@ApiOperation(value = "查询所有乐团编制")
 | 
	
		
			
				|  |  | +	@GetMapping(value = "/queryAll", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
 | 
	
		
			
				|  |  | +	@PreAuthorize("@pcs.hasPermissions('musicGroupPlanMaking/queryAll')")
 | 
	
		
			
				|  |  | +	public HttpResponseResult<List<MusicGroupPlanMakingDto>> queryAll() throws Exception {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +		List<MusicGroupPlanMakingDto> result = new ArrayList<MusicGroupPlanMakingDto>();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +		List<MusicGroupPlanMaking> list = musicGroupPlanMakingService.findAll(null);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +		for (MusicGroupPlanMaking pm : list) {
 | 
	
		
			
				|  |  | +			MusicGroupPlanMakingDto dto = new MusicGroupPlanMakingDto();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +			BeanUtils.copyProperties(pm, dto);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +			List<Subject> subjectList = subjectService.findBySubjectByIdList(pm.getSubjectIdList());
 | 
	
		
			
				|  |  | +			if (subjectList != null) {
 | 
	
		
			
				|  |  | +				dto.setSubjectMap(subjectList.stream().collect(Collectors.toMap(Subject::getId, Subject::getName)));
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +			result.add(dto);
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +		return succeed(result);
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	@ApiOperation(value = "查询乐团编制")
 | 
	
		
			
				|  |  | +	@GetMapping(value = "/query", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
 | 
	
		
			
				|  |  | +	@PreAuthorize("@pcs.hasPermissions('musicGroupPlanMaking/query')")
 | 
	
		
			
				|  |  | +	public HttpResponseResult<MusicGroupPlanMakingDto> query(Integer id) throws Exception {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +		MusicGroupPlanMaking pm = musicGroupPlanMakingService.get(id);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +		if (pm != null) {
 | 
	
		
			
				|  |  | +			MusicGroupPlanMakingDto dto = new MusicGroupPlanMakingDto();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +			BeanUtils.copyProperties(pm, dto);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +			List<Subject> subjectList = subjectService.findBySubjectByIdList(pm.getSubjectIdList());
 | 
	
		
			
				|  |  | +			if (subjectList != null) {
 | 
	
		
			
				|  |  | +				dto.setSubjectMap(subjectList.stream().collect(Collectors.toMap(Subject::getId, Subject::getName)));
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +			return succeed(dto);
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +		return succeed();
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	@ApiOperation(value = "查询所有乐团编制")
 | 
	
		
			
				|  |  | +	@PostMapping(value = "/add", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
 | 
	
		
			
				|  |  | +	@AuditLogAnnotation(operateName = "乐团基本信息修改",interfaceURL = "musicGroupPlanMaking/add")
 | 
	
		
			
				|  |  | +	@PreAuthorize("@pcs.hasPermissions('musicGroupPlanMaking/add')")
 | 
	
		
			
				|  |  | +	public Object add(@RequestBody MusicGroupPlanMaking musicGroupPlanMaking) throws Exception {
 | 
	
		
			
				|  |  | +		musicGroupPlanMakingService.insert(musicGroupPlanMaking);
 | 
	
		
			
				|  |  | +		return succeed();
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	@ApiOperation(value = "查询所有乐团编制")
 | 
	
		
			
				|  |  | +	@PostMapping(value = "/update", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
 | 
	
		
			
				|  |  | +	@AuditLogAnnotation(operateName = "乐团基本信息修改",interfaceURL = "musicGroupPlanMaking/update")
 | 
	
		
			
				|  |  | +	@PreAuthorize("@pcs.hasPermissions('musicGroupPlanMaking/update')")
 | 
	
		
			
				|  |  | +	public Object update(@RequestBody MusicGroupPlanMaking musicGroupPlanMaking) throws Exception {
 | 
	
		
			
				|  |  | +		musicGroupPlanMakingService.update(musicGroupPlanMaking);
 | 
	
		
			
				|  |  | +		return succeed();
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +	
 | 
	
		
			
				|  |  | +}
 |