package com.stylefeng.guns.modular.api; import com.stylefeng.guns.modular.system.service.IAdvertisementService; import com.stylefeng.guns.modular.system.util.ResultUtil; import com.stylefeng.guns.modular.system.warpper.AdvertisementWarpper; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; import java.util.List; /** * 广告控制器 */ @Api @RestController @RequestMapping("/base/advertisement") public class AdvertisementController { @Autowired private IAdvertisementService advertisementService; @ResponseBody @PostMapping("/queryByType") @ApiOperation(value = "获取广告列表", tags = {"用户端-首页"}, notes = "") @ApiImplicitParams({ @ApiImplicitParam(value = "数据类型(1:弹窗广告,2:底部广告)", name = "type", required = true, dataType = "int"), @ApiImplicitParam(value = "当前定位城市code(510100)", name = "code", required = true, dataType = "string") }) public ResultUtil> queryAdvertisement(String code, Integer type){ try { List advertisementWarpper = advertisementService.queryAdvertisement(code, type); return ResultUtil.success(advertisementWarpper); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } }