package com.hxhq.business.controller;

import java.util.Arrays;
import java.util.List;

import com.alibaba.fastjson2.JSONObject;
import com.hxhq.common.core.web.controller.BaseController;
import com.hxhq.common.core.web.domain.AjaxResult;
import com.hxhq.common.core.web.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.hxhq.business.domain.Test;
import com.hxhq.business.service.ITestService;


/**
 * 测试Controller
 *
 * @author hxhq
 * @date 2025-12-15
 */
@RestController
@RequestMapping("/business/test")
public class TestController extends BaseController
{
    @Autowired
    private ITestService testService;

    /**
     * 查询测试列表
     */
    @GetMapping("/list")
    public TableDataInfo list(Test test)
    {
        startPage();
        List<Test> list = testService.queryList(test);
        return getDataTable(list);
    }

    /**
     * 获取测试详细信息
     */
    @GetMapping(value = "/info")
    public AjaxResult getInfo(Long id)
    {
        return AjaxResult.success(testService.getById(id));
    }

    /**
     * 新增测试信息
     */
    @PostMapping("/save")
    public AjaxResult save(@RequestBody Test test)
    {
        return toAjax(testService.saveOrUpdate(test));
    }

    /**
     * 删除测试信息
     */
    @PostMapping("/delete")
    public AjaxResult delete(@RequestBody Long[] ids)
    {
        return toAjax(testService.removeByIds(Arrays.asList(ids)));
    }


    /**
     * 查询落笔留痕
     */
    @PostMapping("/testLblh")
    public AjaxResult testLblh(@RequestBody JSONObject json)
    {
        logger.info("落笔留痕请求："+JSONObject.toJSONString(json));
        return AjaxResult.success();
    }

    /**
     * 查询落笔留痕
     */
    @PostMapping("/testLblhHistory")
    public AjaxResult testLblhHistory(@RequestBody JSONObject json)
    {
        logger.info("落笔留痕历史请求："+JSONObject.toJSONString(json));
        return AjaxResult.success();
    }
}
