Commit 4844a190 authored by licc's avatar licc

修改获取广告接口

parent f27d4dc8
...@@ -61,5 +61,5 @@ public interface BannerMapper extends BaseMapper<Banner> { ...@@ -61,5 +61,5 @@ public interface BannerMapper extends BaseMapper<Banner> {
*/ */
int editStatus(@Param("id") Integer id, @Param("status") Integer status); int editStatus(@Param("id") Integer id, @Param("status") Integer status);
List<Banner> getTopBanners(); List<Banner> getTopBanners(@Param("type") Integer type);
} }
...@@ -107,7 +107,7 @@ ...@@ -107,7 +107,7 @@
<include refid="cols_all"/> <include refid="cols_all"/>
from from
<include refid="table"/> <include refid="table"/>
where status=1 and type=1 where status=1 and type=#{type}
</select> </select>
<update id="editStatus"> <update id="editStatus">
......
...@@ -56,6 +56,6 @@ public interface BannerService { ...@@ -56,6 +56,6 @@ public interface BannerService {
*/ */
R<Boolean> editStatus(Integer id, Integer status); 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 ...@@ -139,7 +139,11 @@ public class BannerServiceImpl extends ServiceImpl<BannerMapper, Banner> impleme
} }
@Override @Override
public R<List<Banner>> getTopBanners() { public R<List<Banner>> getTopBanners(Integer type) {
return R.ok(bannerMapper.getTopBanners()); 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 { ...@@ -78,11 +78,15 @@ public class BannerController {
} }
@ApiOperation(value = "获取顶部广告", notes = "获取顶部广告", httpMethod = "GET") @ApiOperation(value = "获取顶部/底部广告", notes = "获取顶部/底部广告", httpMethod = "GET")
@GetMapping("/getTopBanners") @ApiImplicitParam(name = "type", value = "广告类型:1:顶部 2:底部", dataType = "int", required = true)
public R<List<Banner>> getTopBanners() { @GetMapping("/getBanners")
log.info("BannerController[]getTopBanners[]input.param"); public R<List<Banner>> getBanners(Integer type) {
return bannerService.getTopBanners(); 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