|
@@ -0,0 +1,98 @@
|
|
|
+package com.ym.mec.web.controller.degree;
|
|
|
+
|
|
|
+import com.microsvc.toolkit.common.response.paging.PageInfo;
|
|
|
+import com.microsvc.toolkit.common.response.paging.QueryInfo;
|
|
|
+import com.microsvc.toolkit.common.response.template.R;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.ym.mec.common.controller.BaseController;
|
|
|
+import com.ym.mec.common.entity.HttpResponseResult;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.PathVariable;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+
|
|
|
+import com.ym.mec.biz.service.DegreeNewsService;
|
|
|
+import com.ym.mec.biz.dal.wrapper.DegreeNewsWrapper;
|
|
|
+import com.ym.mec.biz.dal.entity.DegreeNews;
|
|
|
+
|
|
|
+@Slf4j
|
|
|
+@Validated
|
|
|
+@RestController
|
|
|
+@RequestMapping("/degreeNews")
|
|
|
+@Api(tags = "考级资讯表")
|
|
|
+public class DegreeNewsController extends BaseController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private DegreeNewsService degreeNewsService;
|
|
|
+
|
|
|
+ @ApiOperation(value = "详情", notes = "考级资讯表-根据详情ID查询单条, 传入id")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('degreeNews/detail')")
|
|
|
+ @GetMapping("/detail/{id}")
|
|
|
+ public HttpResponseResult<DegreeNews> detail(@PathVariable("id") Long id) {
|
|
|
+
|
|
|
+ DegreeNews wrapper = degreeNewsService.detail(id);
|
|
|
+
|
|
|
+ return succeed(wrapper);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "查询分页", notes = "考级资讯表- 传入 DegreeNewsWrapper.DegreeNewsQuery")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('degreeNews/page')")
|
|
|
+ @PostMapping("/page")
|
|
|
+ public HttpResponseResult<PageInfo<DegreeNews>> page(@RequestBody DegreeNewsWrapper.DegreeNewsQuery query) {
|
|
|
+
|
|
|
+ IPage<DegreeNews> pages = degreeNewsService.selectPage(QueryInfo.getPage(query), query);
|
|
|
+
|
|
|
+ return succeed(QueryInfo.pageInfo(pages));
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "新增", notes = "考级资讯表- 传入 DegreeNewsWrapper.DegreeNews")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('degreeNews/save')")
|
|
|
+ @PostMapping("/save")
|
|
|
+ public HttpResponseResult<JSONObject> add(@Validated @RequestBody DegreeNews degreeNews) {
|
|
|
+
|
|
|
+ // 新增数据
|
|
|
+ degreeNewsService.save(degreeNews);
|
|
|
+
|
|
|
+ return succeed();
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "修改", notes = "考级资讯表- 传入 DegreeNewsWrapper.DegreeNews")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('degreeNews/update')")
|
|
|
+ @PostMapping("/update")
|
|
|
+ public HttpResponseResult<JSONObject> update(@Validated @RequestBody DegreeNews degreeNews) {
|
|
|
+
|
|
|
+ // 更新数据
|
|
|
+ degreeNewsService.updateById(degreeNews);
|
|
|
+
|
|
|
+ return succeed();
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "启用、停用")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('degreeNews/enable')")
|
|
|
+ @PostMapping("/enable")
|
|
|
+ public HttpResponseResult<JSONObject> enable(Long newsId) {
|
|
|
+ DegreeNews degreeNews = degreeNewsService.getById(newsId);
|
|
|
+ degreeNews.setStatus(!degreeNews.getStatus());
|
|
|
+ degreeNewsService.updateById(degreeNews);
|
|
|
+ return succeed();
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "删除", notes = "考级资讯表- 传入id")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('degreeNews/remove')")
|
|
|
+ @PostMapping("/remove")
|
|
|
+ public HttpResponseResult<Boolean> remove(@RequestParam Long id) {
|
|
|
+
|
|
|
+ return succeed(degreeNewsService.removeById(id));
|
|
|
+ }
|
|
|
+}
|