美文网首页
出现相同的映射路径

出现相同的映射路径

作者: 墨色尘埃 | 来源:发表于2018-02-04 16:54 被阅读3次

    比如在AControl中映射路径为"/v1/enterpriseInfo",在BControl中映射路径也为"/v1/enterpriseInfo",那么再有一个相同的Get/Post的方法时就会报错。

    路径相同报错
    public com.jsptpd.gayg.common.model.ResponseObj<com.jsptpd.gayg.common.util.PageUtil> com.jsptpd.gayg.modules
         * .operative.restcontrol.OrderControl.list(java.util.Map) to {[/v1/orderInfo],methods=[GET]}: There is already
         * 'orderchantControl' bean method
    
    @RestController
    @RequestMapping("/v1/enterpriseInfo")
    public class AControl {
        @Autowired
        private EnterpriseBaseMapper enterpriseBaseMapper;
    
        /**
         * 获取列表
         */
        @RequestMapping(value = "", method = RequestMethod.GET)
        public ResponseObj<PageUtil> list(@RequestParam Map<String, String> formData) {
    
            formData = CommonUtil.convertFormData(formData);
            Integer integer = enterpriseBaseMapper.countByRole(formData);
            List<EnterpriseBase> enterpriseBases = enterpriseBaseMapper.selectByOrg(formData);
    
            PageUtil pageInfo = new PageUtil(integer, formData);
            pageInfo.setResultList(enterpriseBases);
    
            return new ResponseObj<PageUtil>(pageInfo, RetCode.SUCCESS);
        }
    }
    
    @RestController
    @RequestMapping("/v1/enterpriseInfo")
    public class BControl {
        @Autowired
        private EnterpriseBaseMapper enterpriseBaseMapper;
    
        /**
         * 获取列表
         */
        @RequestMapping(value = "", method = RequestMethod.GET)
        public ResponseObj<PageUtil> list(@RequestParam Map<String, String> formData) {
    
            formData = CommonUtil.convertFormData(formData);
            Integer integer = enterpriseBaseMapper.countByRole(formData);
            List<EnterpriseBase> enterpriseBases = enterpriseBaseMapper.selectByOrg(formData);
    
            PageUtil pageInfo = new PageUtil(integer, formData);
            pageInfo.setResultList(enterpriseBases);
    
            return new ResponseObj<PageUtil>(pageInfo, RetCode.SUCCESS);
        }
    }
    

    相关文章

      网友评论

          本文标题:出现相同的映射路径

          本文链接:https://www.haomeiwen.com/subject/hagmzxtx.html