package com.muyu.breakdown.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.muyu.breakdown.domain.Messages;
import com.muyu.breakdown.service.BreakDownService;
import com.muyu.breakdown.service.StationMessageService;
import com.muyu.common.core.domain.Result;
import com.muyu.common.core.web.controller.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @ Tool：IntelliJ IDEA
 * @ Author：CHX
 * @ Date：2024-09-18-12:01
 * @ Version：1.0
 * @ Description：站内信控制层
 * @author Lenovo
 */
@RestController
@RequestMapping("/stationMessage")
public class StationMessageController extends BaseController {
   @Autowired
    private StationMessageService stationMessageService;


    /**
     * 根据当前用户id获取站内信列表
     * @param receiverId 当前用户id
     * @return 站内信列表
     */
   @GetMapping("/getMessageList")
   public Result<List<Messages>> list(@RequestParam("receiverId") String receiverId){
       List<Messages> list = stationMessageService.list(new LambdaQueryWrapper<>() {{
           eq(Messages::getReceiverId, receiverId);
       }});
       return Result.success(list);
   }

}
