AdvertController.java 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. package com.yihu.wlyy.web.common.advert;
  2. import io.swagger.annotations.Api;
  3. import org.springframework.beans.factory.annotation.Autowired;
  4. import org.springframework.http.MediaType;
  5. import org.springframework.stereotype.Controller;
  6. import org.springframework.web.bind.annotation.RequestMapping;
  7. import org.springframework.web.bind.annotation.RequestMethod;
  8. import org.springframework.web.bind.annotation.ResponseBody;
  9. import com.yihu.wlyy.service.common.advert.AdvertService;
  10. import com.yihu.wlyy.web.BaseController;
  11. @Controller
  12. @RequestMapping(value = "common", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, method = RequestMethod.GET)
  13. @Api(description = "广告")
  14. public class AdvertController extends BaseController {
  15. @Autowired
  16. private AdvertService advertService;
  17. @RequestMapping(value = "advert")
  18. @ResponseBody
  19. public String list(int type) {
  20. try {
  21. return write(200, "查询成功", "list" , advertService.findByType(type));
  22. } catch (Exception e) {
  23. error(e);
  24. return error(-1, "查询失败");
  25. }
  26. }
  27. }