AdmProjectController.java 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. package com.persagy.proxy.adm.controller;
  2. import com.alibaba.fastjson.JSONArray;
  3. import com.persagy.proxy.adm.constant.AdmCommonConstant;
  4. import com.persagy.proxy.adm.model.AdmProject;
  5. import com.persagy.proxy.adm.request.AdmQueryCriteria;
  6. import com.persagy.proxy.adm.request.AdmResponse;
  7. import com.persagy.proxy.adm.service.IAdmProjectService;
  8. import com.persagy.proxy.common.entity.DmpResult;
  9. import com.persagy.proxy.common.entity.InstanceUrlParam;
  10. import org.springframework.beans.factory.annotation.Autowired;
  11. import org.springframework.beans.factory.annotation.Value;
  12. import org.springframework.web.bind.annotation.PostMapping;
  13. import org.springframework.web.bind.annotation.RequestBody;
  14. import org.springframework.web.bind.annotation.RequestMapping;
  15. import org.springframework.web.bind.annotation.RestController;
  16. import javax.ws.rs.QueryParam;
  17. /**
  18. * ADM 项目 API
  19. * @author Charlie Yu
  20. * @date 2021-08-16
  21. */
  22. @RestController
  23. @RequestMapping("/object/project")
  24. public class AdmProjectController {
  25. @Autowired
  26. private IAdmProjectService service;
  27. @Value("${middleware.group.code}")
  28. private String groupCode;
  29. /**
  30. * 查询项目信息
  31. * @param projectId
  32. * @param request
  33. * @return
  34. * @throws Exception
  35. */
  36. @PostMapping("/query")
  37. public AdmResponse query(@QueryParam("projectId") String projectId,
  38. @RequestBody AdmQueryCriteria request) throws Exception {
  39. // 组装上下文条件
  40. InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
  41. request.setName("project");
  42. return service.doQuery(context, request, AdmProject.class);
  43. }
  44. /**
  45. * 查询项目信息-全部或指定id
  46. * @param request
  47. * @return
  48. * @throws Exception
  49. */
  50. @PostMapping("/query/obj")
  51. public AdmResponse queryObj(@RequestBody AdmQueryCriteria request) throws Exception {
  52. return query(null, request);
  53. }
  54. }