package com.xhkjedu.sapi.controller.system;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xhkjedu.vo.PageResult;
import com.xhkjedu.sapi.model.system.TMsg;
import com.xhkjedu.sapi.service.system.MsgService;
import com.xhkjedu.utils.PageUtil;
import com.xhkjedu.vo.ResultVo;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
* @author ywx
* @classname TMsgController
* @description
* @date 2020/10/15 15:23
**/
@RestController
@RequestMapping("/msg")
public class MsgController {
    @Resource
    private MsgService msgService;

    @PostMapping("/list")
    public ResultVo list(@RequestBody TMsg msg) {
        PageHelper.startPage(msg.getPage(), msg.getPageSize());
        List<TMsg> list = msgService.listAll(msg);
        PageResult pageResult = PageUtil.getPageResult(new PageInfo(list));
        return new ResultVo(0,"获取短信列表成功",pageResult);
    }
}
