xiangpei
61 分钟以前 4318746ee88ad53e00341df1a0395058bebc40fa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package cn.lili.controller.lmk;
import cn.lili.base.Result;
import cn.lili.group.Add;
import cn.lili.group.Update;
import cn.lili.modules.lmk.domain.form.ActivityForm;
import cn.lili.modules.lmk.domain.form.NewsForm;
import cn.lili.modules.lmk.domain.query.ActivityQuery;
import cn.lili.modules.lmk.domain.query.NewsQuery;
import cn.lili.modules.lmk.service.NewsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
 
import javax.validation.constraints.NotEmpty;
import java.util.List;
 
 
/**
 * lmk-shop-java
 * 用户端新闻
 *
 * @author : zxl
 * @date : 2025-06-23 18:39
 **/
@Validated
@RequiredArgsConstructor
@Api(value = "新闻", tags = "新闻")
@RestController
@RequestMapping("/buyer/lmk/news")
public class NewsController {
    private final NewsService newsService;
 
    @PostMapping
    @ApiOperation(value = "添加", notes = "添加")
    public Result add(@RequestBody @Validated(Add.class) NewsForm form) {
        return newsService.add(form);
    }
 
    @PutMapping
    @ApiOperation(value = "修改", notes = "修改")
    public Result update(@RequestBody @Validated(Update.class) NewsForm form) {
        return newsService.update(form);
    }
 
    @DeleteMapping("/{id}")
    @ApiOperation(value = "ID删除", notes = "ID删除")
    public Result removeById(@PathVariable("id") String id) {
        return newsService.removeById(id);
    }
 
    @DeleteMapping("/batch")
    @ApiOperation(value = "批量删除", notes = "批量删除")
    public Result remove(@RequestBody @NotEmpty(message = "请选择数据") List<String> ids) {
        return newsService.remove(ids);
    }
 
    @GetMapping("/page")
    @ApiOperation(value = "分页", notes = "分页")
    public Result page(NewsQuery query) {
        return newsService.page(query);
    }
 
    @GetMapping("/{id}")
    @ApiOperation(value = "详情", notes = "详情")
    public Result detail(@PathVariable("id") String id) {
        return newsService.detail(id);
    }
 
    @PutMapping("/publish/{id}")
    public Result publish(@PathVariable("id") String id){
        return newsService.publish(id);
    }
 
}