package com.hc.web.controller.browser.app;

import com.hc.business.service.MsgsService;
import com.hc.core.utils.result.Result;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;


/**
 * (Msgs)表控制层
 *
 * @author makejava
 * @since 2024-02-29 18:52:03
 */

@RestController
@RequestMapping("/new/api/app/msgs")
public class AppMsgsController {

    /**
     * 服务对象
     */
    private final MsgsService msgsService;

    public AppMsgsController(MsgsService msgsService) {
        this.msgsService = msgsService;
    }

    @GetMapping("/{id}")
    @ApiOperation(value = "依据主键获取 Msgs", response = Result.class)
    public Result selectDetail(@PathVariable("id") Integer id) {
        return Result.success(this.msgsService.queryById(id));
    }

    @GetMapping("/list")
    @ApiOperation(value = "获取 Msgs列表(分页)", response = Result.class)
    public Result listMsgs(@RequestParam(defaultValue = "0") Integer page,
                           @RequestParam(defaultValue = "0") Integer size) {
        return Result.success(msgsService.queryAllByLimit(page, size));
    }


}
