xuhy
2026-05-08 d6c0f2ed698d6cdf86a0a3a8893b4d9717f3b7b1
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
77
78
package com.xiaopeng.operation.controller;
 
import com.xiaopeng.api.model.operation.XpActicityUser;
import com.xiaopeng.common.core.domain.R;
import com.xiaopeng.operation.service.IXpActicityUserService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
import java.util.List;
 
/**
 * <p>
 * 活动发放用户 前端控制器
 * </p>
 *
 * @author mitao
 * @since 2026-04-20
 */
@Api(tags = "活动发放用户管理")
@RequiredArgsConstructor(onConstructor_ = @Lazy)
@RestController
@RequestMapping("/v1/api/acticity-user")
public class XpActicityUserController {
 
    @Resource
    private IXpActicityUserService service;
 
    @GetMapping("/{id}")
    @ApiOperation(value = "活动发放用户详情", tags = {"管理后台-活动发放用户管理"})
    public R<XpActicityUser> queryById(@PathVariable Integer id) {
        XpActicityUser user = service.getById(id);
        return R.ok(user);
    }
 
    @GetMapping("/listByActicityId/{actitcityId}")
    @ApiOperation(value = "根据活动ID获取用户配置", tags = {"管理后台-活动发放用户管理"})
    public R<List<XpActicityUser>> listByActicityId(@PathVariable Integer actitcityId) {
        LambdaQueryWrapper<XpActicityUser> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(XpActicityUser::getActitcityId, actitcityId);
        List<XpActicityUser> list = service.list(queryWrapper);
        return R.ok(list);
    }
 
    @PostMapping("/add")
    @ApiOperation(value = "批量新增活动发放用户", tags = {"管理后台-活动发放用户管理"})
    public R<List<XpActicityUser>> add(@RequestBody List<XpActicityUser> xpActicityUsers) {
        service.saveBatch(xpActicityUsers);
        return R.ok(xpActicityUsers);
    }
 
    @PostMapping("/update")
    @ApiOperation(value = "修改活动发放用户", tags = {"管理后台-活动发放用户管理"})
    public R<?> updateById(@RequestBody XpActicityUser xpActicityUser) {
        service.updateById(xpActicityUser);
        return R.ok();
    }
 
    @DeleteMapping("/{id}")
    @ApiOperation(value = "删除活动发放用户", tags = {"管理后台-活动发放用户管理"})
    public R<?> deleteById(@PathVariable Integer id) {
        service.removeById(id);
        return R.ok();
    }
    
    @DeleteMapping("/deleteByActicityId/{actitcityId}")
    @ApiOperation(value = "根据活动ID删除用户配置", tags = {"管理后台-活动发放用户管理"})
    public R<?> deleteByActicityId(@PathVariable Integer actitcityId) {
        LambdaQueryWrapper<XpActicityUser> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(XpActicityUser::getActitcityId, actitcityId);
        service.remove(queryWrapper);
        return R.ok();
    }
}