Commit 4844a190 authored by licc's avatar licc

修改获取广告接口

parent f27d4dc8
......@@ -61,5 +61,5 @@ public interface BannerMapper extends BaseMapper<Banner> {
*/
int editStatus(@Param("id") Integer id, @Param("status") Integer status);
List<Banner> getTopBanners();
List<Banner> getTopBanners(@Param("type") Integer type);
}
......@@ -107,7 +107,7 @@
<include refid="cols_all"/>
from
<include refid="table"/>
where status=1 and type=1
where status=1 and type=#{type}
</select>
<update id="editStatus">
......
......@@ -56,6 +56,6 @@ public interface BannerService {
*/
R<Boolean> editStatus(Integer id, Integer status);
R<List<Banner>> getTopBanners();
R<List<Banner>> getTopBanners(Integer type);
}
......@@ -139,7 +139,11 @@ public class BannerServiceImpl extends ServiceImpl<BannerMapper, Banner> impleme
}
@Override
public R<List<Banner>> getTopBanners() {
return R.ok(bannerMapper.getTopBanners());
public R<List<Banner>> getTopBanners(Integer type) {
log.info("BannerServiceImpl[]getTopBanners[]input.param.type:" + type);
if (null == type) {
return R.error("参数不能为空!");
}
return R.ok(bannerMapper.getTopBanners(type));
}
}
......@@ -78,11 +78,15 @@ public class BannerController {
}
@ApiOperation(value = "获取顶部广告", notes = "获取顶部广告", httpMethod = "GET")
@GetMapping("/getTopBanners")
public R<List<Banner>> getTopBanners() {
log.info("BannerController[]getTopBanners[]input.param");
return bannerService.getTopBanners();
@ApiOperation(value = "获取顶部/底部广告", notes = "获取顶部/底部广告", httpMethod = "GET")
@ApiImplicitParam(name = "type", value = "广告类型:1:顶部 2:底部", dataType = "int", required = true)
@GetMapping("/getBanners")
public R<List<Banner>> getBanners(Integer type) {
log.info("BannerController[]getBanners[]input.param.type:" + type);
if (null == type) {
return R.error("入参不能为空!");
}
return bannerService.getTopBanners(type);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment