MallController.java 2.22 KB
package vion.controller.monitor;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import vion.dto.monitor.MallDTO;
import vion.model.monitor.MAccount;
import vion.service.monitor.IMallService;
import vion.vo.monitor.MallVO;

import java.util.List;

/**
 * mall 信息
 */
@RestController
@RequestMapping("/api/mall")
@RequiredArgsConstructor
public class MallController {

    private final IMallService mallService;

    @GetMapping("/account")
    @SaCheckPermission(value = "mall:account:list", orRole = "admin")
    public Page<MAccount> listAccount(MAccount dto) {
        return mallService.listAccount(dto);
    }

    @GetMapping
    @SaCheckPermission(value = "mall:list", orRole = "admin")
    public Page<MallVO> list(MallDTO dto) {
        return mallService.list(dto);
    }

    @GetMapping("/{id}")
    @SaCheckPermission(value = "mall:get", orRole = "admin")
    public MallVO get(@PathVariable Long id) {
        return mallService.get(id);
    }

    @GetMapping("/attention")
    @SaCheckPermission(value = "mall:attention:list", orRole = "admin")
    public Page<MallVO> listAttention(MallDTO dto) {
        return mallService.listAttention(dto);
    }

    @GetMapping("/errorAttention")
    @SaCheckPermission(value = "mall:attention:listError", orRole = "admin")
    public Page<MallVO> listErrorAttention(MallDTO dto) {
        return mallService.listErrorAttention(dto);
    }

    @PostMapping("/attention")
    @SaCheckPermission(value = "mall:attention:edit", orRole = "admin")
    public String attention(@RequestBody List<MallDTO> dtoList) {
        return mallService.attention(dtoList);
    }

    @PostMapping("/attention/account/{accountUid}")
    @SaCheckPermission(value = "mall:attention:account", orRole = "admin")
    public String attentionByAccount(@PathVariable String accountUid) {
        return mallService.attentionByAccount(accountUid);
    }

    @PostMapping("/attention/{id}")
    @SaCheckPermission(value = "mall:attention:cancel", orRole = "admin")
    public String cancelAttention(@PathVariable Long id) {
        return mallService.cancelAttention(id);
    }
}