package com.persagy.proxy.adm.controller; import com.alibaba.fastjson.JSONArray; import com.persagy.proxy.adm.constant.AdmCommonConstant; import com.persagy.proxy.adm.model.AdmProject; import com.persagy.proxy.adm.request.AdmQueryCriteria; import com.persagy.proxy.adm.request.AdmResponse; import com.persagy.proxy.adm.service.IAdmProjectService; import com.persagy.proxy.common.entity.DmpResult; import com.persagy.proxy.common.entity.InstanceUrlParam; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; 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 javax.ws.rs.QueryParam; /** * ADM 项目 API * @author Charlie Yu * @date 2021-08-16 */ @RestController @RequestMapping("/object/project") public class AdmProjectController { @Autowired private IAdmProjectService service; @Value("${middleware.group.code}") private String groupCode; /** * 查询项目信息 * @param projectId * @param request * @return * @throws Exception */ @PostMapping("/query") public AdmResponse query(@QueryParam("projectId") String projectId, @RequestBody AdmQueryCriteria request) throws Exception { // 组装上下文条件 InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID); request.setName("project"); return service.doQuery(context, request, AdmProject.class); } /** * 查询项目信息-全部或指定id * @param request * @return * @throws Exception */ @PostMapping("/query/obj") public AdmResponse queryObj(@RequestBody AdmQueryCriteria request) throws Exception { return query(null, request); } }