调取接口时报404错误(ID:16)

业务代码中调用简单的查询接口:
Controller层:

@Controller
@RequestMapping("/agentReturnDetail")
public class AgentReturnDetailController  extends BasicController {
    @Autowired
    AgentReturnDetailService agentReturnDetailService;

    @RequestMapping(value = "/list",method = RequestMethod.GET)
    @ApiOperation(value = "供应商退货详情")
    @FastMappingInfo(needLogin = true)
    public ActionResult list(@RequestParam String returnId) throws Exception {
        if (null==returnId){
            return actionResult(ErrorCode.IllegalArument);
        }
        FunctionResult result=agentReturnDetailService.list(returnId);
        return actionResult(result.getCode(),result.getValue());
    }
}

Service层:

 public FunctionResult list(String returnId){
        FunctionResult result = new FunctionResult();
        List doList = agentReturnDetailDOMapper.getListByReturnId(returnId);
        List voList = new ArrayList<>();
        for (AgentReturnDetailDO entity : doList) {
            AgentReturnDetailShowVO model = new AgentReturnDetailShowVO();
            BeanUtils.copyProperties(entity, model);
            voList.add(model);
        }
        result.setCode(ErrorCode.Success);
        result.setValue(doList);
        return result;
    }

查询内容很简单,数据也能正常进断点,查询到数据,但是接口一直报404错误,如图:


调取接口时报404错误(ID:16)_第1张图片
16-1.png

请教同事,大佬一秒确认Response Body问题.
发现使用的注解是@Controller,需要再使用注解@ResponseBody,
或者直接使用@RestController注解,效果上等于这两者之和.

修改后问题解决。


调取接口时报404错误(ID:16)_第2张图片
16-2.png

你可能感兴趣的:(调取接口时报404错误(ID:16))