xiaoyong931011
2022-08-12 77a12468215a8a8a5b3a22544bdcc239efddf287
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
79
80
81
82
package cc.mrbird.febs.mall.controller;
 
import cc.mrbird.febs.common.annotation.ControllerEndpoint;
import cc.mrbird.febs.common.controller.BaseController;
import cc.mrbird.febs.common.entity.FebsResponse;
import cc.mrbird.febs.common.entity.QueryRequest;
import cc.mrbird.febs.mall.dto.AdminLeaderUpdateDto;
import cc.mrbird.febs.mall.entity.MallGoodsCategory;
import cc.mrbird.febs.mall.entity.MallLeaderStock;
import cc.mrbird.febs.mall.entity.MallMember;
import cc.mrbird.febs.mall.entity.MallTeamLeader;
import cc.mrbird.febs.mall.service.IAdminMallTeamLeaderService;
import cc.mrbird.febs.mall.vo.AdminSelectListLeaderVo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
 
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.Map;
 
@Slf4j
@Validated
@RestController
@RequiredArgsConstructor
@RequestMapping(value = "/admin/leader")
public class AdminMallTeamLeaderController extends BaseController {
 
 
    private final IAdminMallTeamLeaderService iAdminMallTeamLeaderService;
 
    /**
     * 团长信息--列表
     */
    @GetMapping("leaderList")
    public FebsResponse getLeaderList(MallTeamLeader mallTeamLeader, QueryRequest request) {
        Map<String, Object> data = getDataTable(iAdminMallTeamLeaderService.getLeaderListInPage(mallTeamLeader, request));
        return new FebsResponse().success().data(data);
    }
 
    /**
     * 团长信息--审核
     */
    @PostMapping("leaderUpdate")
    @ControllerEndpoint(operation = "团长信息--审核", exceptionMessage = "审核失败")
    public FebsResponse leaderUpdate(@Valid AdminLeaderUpdateDto adminLeaderUpdateDto) {
        return iAdminMallTeamLeaderService.leaderUpdate(adminLeaderUpdateDto);
    }
 
    /**
     * 团长信息--下拉列表
     */
    @GetMapping("selectList")
    public List<AdminSelectListLeaderVo> selectList(MallTeamLeader mallTeamLeader) {
        return iAdminMallTeamLeaderService.selectList(mallTeamLeader);
    }
 
    /**
     * 团长信息--取消团长
     */
    @GetMapping("leaderCancel/{id}")
    @ControllerEndpoint(operation = "团长信息--取消团长", exceptionMessage = "取消团长失败")
    public FebsResponse leaderCancel(@NotNull(message = "{required}") @PathVariable Long id) {
        return iAdminMallTeamLeaderService.leaderCancel(id);
    }
 
    /**
     * 团长信息-商品库存编辑
     */
    @GetMapping("/leaderGoodsUpdate")
    public FebsResponse leaderGoodsUpdate(QueryRequest request, MallLeaderStock mallLeaderStock, Integer parentId) {
        if (parentId == null) {
            ViewMallTeamLeaderController.idLeaderGoodsUpdate = 0;
        }
        mallLeaderStock.setTeamLeaderId(ViewMallTeamLeaderController.idLeaderGoodsUpdate);
        Map<String, Object> dataTable = getDataTable(iAdminMallTeamLeaderService.leaderGoodsUpdate(request, mallLeaderStock));
        return new FebsResponse().success().data(dataTable);
    }
 
}