Public String showPortalPage Model (Model) {
//1. The way to call MySQLRemoteService provides query page to display the data
ResultEntity
- ResultEntity=mySQLRemoteService. GetPortalTypeProjectDataRemote ();//hint here data
//is empty
//2. Check the query results
The String result=resultEntity. GetResult ();
If (ResultEntity. SUCCESS. Equals (result)) {
//3. Obtain the query data
List
//4. Deposit model
Model. The addAttribute (CrowdConstant ATTR_NAME_PORTAL_DATA, a list).
}
Return "portal";
}
Expose interfaces//
@ FeignClient (" atguigu - the crowd - mysql ")
Public interface MySQLRemoteService {
@ RequestMapping ("/get/portal/type/project/data/remote ")
Public ResultEntity
- GetPortalTypeProjectDataRemote ();
}
//database part
@ RequestMapping ("/get/portal/type/project/data/remote ")
Public ResultEntity
- GetPortalTypeProjectDataRemote () {
Try {
List
Return ResultEntity. SuccessWithData (portalTypeVOList);
} the catch (Exception e) {
e.printStackTrace();
Return ResultEntity. Failed (um participant etMessage ());
}
}