RsResourceDefaultQueryEndPoint.java 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package com.yihu.ehr.resource.controller;
  2. import com.yihu.ehr.constants.ApiVersion;
  3. import com.yihu.ehr.constants.ServiceApi;
  4. import com.yihu.ehr.resource.model.RsResourceDefaultQuery;
  5. import com.yihu.ehr.resource.service.RsResourceDefaultQueryService;
  6. import io.swagger.annotations.Api;
  7. import io.swagger.annotations.ApiOperation;
  8. import io.swagger.annotations.ApiParam;
  9. import org.springframework.beans.factory.annotation.Autowired;
  10. import org.springframework.web.bind.annotation.RequestMapping;
  11. import org.springframework.web.bind.annotation.RequestMethod;
  12. import org.springframework.web.bind.annotation.RequestParam;
  13. import org.springframework.web.bind.annotation.RestController;
  14. /**
  15. * Created by Sxy on 2017/08.
  16. */
  17. @RestController
  18. @RequestMapping(value= ApiVersion.Version1_0)
  19. @Api(value = "RsResourceDefaultQueryEndPoint", description = "资源默认查询条件", tags = {"资源服务-资源默认查询条件"})
  20. public class RsResourceDefaultQueryEndPoint {
  21. @Autowired
  22. private RsResourceDefaultQueryService resourcesDefaultQueryService;
  23. @RequestMapping(value = ServiceApi.Resources.QueryByResourceId, method = RequestMethod.GET)
  24. @ApiOperation("根据资源id获取默认查询条件值")
  25. public String getByResourceId(
  26. @ApiParam(name = "resourceId", value = "资源id")
  27. @RequestParam(value = "resourceId") String resourceId){
  28. RsResourceDefaultQuery resourcesQuery = resourcesDefaultQueryService.findByResourcesId(resourceId);
  29. if(resourcesQuery == null){
  30. return "{}";
  31. }
  32. return resourcesQuery.getQuery();
  33. }
  34. }