package com.xy.controller;

import com.xy.annotate.RestMappingController;
import com.xy.dto.DeviceSimDto;
import com.xy.service.DeviceSimServiceImpl;
import com.xy.utils.MercAuthUtils;
import com.xy.utils.PageBean;
import com.xy.utils.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@AllArgsConstructor
@Api(tags = "小程序-设备流量卡")
@RestMappingController("merc-mini/device-sim")
public class DeviceSimController {

    private DeviceSimServiceImpl deviceSimService;

    @PostMapping("page")
    @ApiOperation("分页查询")
    public R<PageBean<DeviceSimDto.PageVo>> page(@RequestBody DeviceSimDto.Page page) {
        return deviceSimService.page(page.setMercId(MercAuthUtils.getMercId()));
    }

    @PostMapping("pageCount")
    @ApiOperation("分页数量查询")
    public R<DeviceSimDto.PageCountVo> pageCount(@RequestBody @Validated DeviceSimDto.PageCount pageCount) {
        return deviceSimService.pageCount(pageCount.setMercId(MercAuthUtils.getMercId()));
    }
}
