package com.ruoyi.web.controller.mch;

import com.fasterxml.jackson.annotation.JsonView;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.JsonViewProfile;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.ss.suit.domain.SuitQuery;
import com.ruoyi.ss.suit.domain.SuitVO;
import com.ruoyi.ss.suit.service.SuitAssembler;
import com.ruoyi.ss.suit.service.SuitService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author wjh
 * 2024/7/30
 */
@RestController
@RequestMapping("/mch/suit")
public class MchSuitController extends BaseController {

    @Autowired
    private SuitService suitService;

    @Autowired
    private SuitAssembler suitAssembler;

    @ApiOperation("获取用户的套餐列表")
    @GetMapping("/list")
    @JsonView(JsonViewProfile.AppMch.class)
    public TableDataInfo list(SuitQuery query) {
        startPage();
        query.setUserId(getUserId());
        List<SuitVO> list = suitService.selectSuitList(query);
        suitAssembler.assembleDeviceList(list);
        return getDataTable(list);
    }

}
