业务层实现:
1.IndexImgService接口:
public interface IndexImgService {
public ResultVO listIndexImgs();
}
2.IndexImgServiceImpl实现类:
@Service
public class IndexImgServiceImpl implements IndexImgService {
@Autowired
private IndexImgMapper indexImgMapper;
public ResultVO listIndexImgs() {
List<IndexImg> indexImgs = indexImgMapper.listIndexImgs();
if (indexImgs.size()==0){
return new ResultVO(ResStatus.NO,"fail",null);
}else {
return new ResultVO(ResStatus.OK,"success",indexImgs);
}
}
}
3.控制层实现
IndexController:
IndexController:
@RestController
@CrossOrigin
@RequestMapping("/index")
@Api(value = "提供首页数据显示所需的接口",tags = "首页管理")
public class IndexController {
@Autowired
private IndexImgService indexImgService;
@GetMapping("/indeximg")
@ApiOperation("首页轮播图接口")
public ResultVO listIndexImgs(){
return indexImgService.listIndexImgs();
}
}
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/128117.html