package com.muyu.warn.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.muyu.common.core.domain.Result;
import com.muyu.warn.domain.CarMessage;
import com.muyu.warn.service.CarMessageService;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ClassName CarMessageController
 * @Description 描述
 * @Author YiBo.Liu
 * @Date 2024/9/22 22:28
 */
@RestController
@RequestMapping("/carMessage")
public class CarMessageController {
    @Autowired
    private CarMessageService carMessageService;

    /**
     * 根据报文模板id查询报文
     * @param templateId
     * @return
     */
    @GetMapping("/selectByTemplateId")
    private Result<List<CarMessage>> selectByTemplateId(@RequestParam("templateId") Integer templateId) {
      return Result.success(carMessageService.list
              (new LambdaQueryWrapper<CarMessage>().eq(CarMessage::getTemplateId, templateId)));
    }

}
