|
@@ -0,0 +1,63 @@
|
|
|
+package io.renren.modules.qyh.api;
|
|
|
+
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
+import io.renren.common.utils.PageUtils;
|
|
|
+import io.renren.common.utils.R;
|
|
|
+import io.renren.modules.qyh.entity.NewsEntity;
|
|
|
+import io.renren.modules.qyh.service.NewsService;
|
|
|
+import io.renren.modules.sys.controller.AbstractController;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 青雲慧-青创赛
|
|
|
+ *
|
|
|
+ * @author pengc
|
|
|
+ * @email sunlightcs@gmail.com
|
|
|
+ * @date 2025-09-22 18:00:53
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("api/news")
|
|
|
+@Api(tags = "青雲慧-青创赛管理")
|
|
|
+public class ApiNewsController extends AbstractController {
|
|
|
+ @Autowired
|
|
|
+ private NewsService newsService;
|
|
|
+
|
|
|
+ @GetMapping("/page")
|
|
|
+ @ApiOperation("分页")
|
|
|
+ @RequiresPermissions("qyh:news:list")
|
|
|
+ public R page(@RequestParam Map<String, Object> params) {
|
|
|
+ PageUtils page = newsService.queryPage(params);
|
|
|
+ return R.ok().put("page", page);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/list")
|
|
|
+ @ApiOperation("列表")
|
|
|
+ public R list() {
|
|
|
+ return R.ok().put("list", newsService.list());
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/info/{id}")
|
|
|
+ @ApiOperation("信息")
|
|
|
+ @RequiresPermissions("qyh:news:info")
|
|
|
+ public R info(@PathVariable("id") Long id) {
|
|
|
+ NewsEntity news = newsService.getById(id);
|
|
|
+ if (ObjectUtil.isNotNull(news)){
|
|
|
+ news.setHits(news.getHits() + 1);
|
|
|
+ }
|
|
|
+ return R.ok().put("news", news);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/getByIdList")
|
|
|
+ @ApiOperation("根据id列表查询青创赛列表(不建议调用)")
|
|
|
+ public R getByIdList(@RequestBody List<Long> ids) {
|
|
|
+ return R.ok().put("list", newsService.getByIdList(ids));
|
|
|
+ }
|
|
|
+
|
|
|
+}
|