package com.kxs.product.biz.controller.kxsapp;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.kxs.common.core.util.R;
import com.kxs.common.security.annotation.Inner;
import com.kxs.product.api.model.KxsMachineCirculationLog;
import com.kxs.product.biz.service.KxsMachineCirculationLogService;
import lombok.RequiredArgsConstructor;
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;

/**
 * 机器循环记录控制器
 *
 * @author 没秃顶的码农
 * @date 2024-01-08
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("machineCirculationLog")
public class MachineCirculationLogController {

    private final KxsMachineCirculationLogService kxsMachineCirculationLogService;

    /**
     * 查询机具循环记录
     *
     * @param machineId 机具ID
     * @return 机具循环记录
     */
    @Inner
    @GetMapping("/loadCirculationLogByMachineId")
    public R loadCirculationLogBySn(@RequestParam("machineId") Integer machineId) {

        return R.ok(kxsMachineCirculationLogService.getOne(Wrappers.<KxsMachineCirculationLog>lambdaQuery().eq(KxsMachineCirculationLog::getMachineId, machineId)));
    }


}
